-
-
Notifications
You must be signed in to change notification settings - Fork 490
Add your own customized user interface
The cleanest way to add a new UI is with an external maven project.
The source code will have the same structure as in the catalog. The views have to be placed inside a catalog/views folder on src/main/resources
Example: https://github.com/cobweb-eu/core-geonetwork/commit/f2724be0787565d3203afcbc20b92dfeb70e8e55
Even with an external project, you have to make geoNetwork know there is a new view that can be used.
You can either modify some config files as described below, or make your pom.xml copy all your resources to the web-ui/src/main/resources folder.
You have to add your folders to this file so wro4j knows they are there:
<require pathOnDisk="web-ui/src/main/resources" >
<jsSource webappPath="myStyle/js" pathOnDisk="${project.basedir}/../myStyle/src/main/resources" />
<jsSource webappPath="myStyle/components" pathOnDisk="${project.basedir}/../myStyle/src/main/resources" />
<jsSource webappPath="catalog/js" pathOnDisk="${project.basedir}/../web-ui/src/main/resources" />
<jsSource webappPath="catalog/views" pathOnDisk="${project.basedir}/../web-ui/src/main/resources" />
<jsSource webappPath="catalog/components" pathOnDisk="${project.basedir}/../web-ui/src/main/resources" />
<cssSource webappPath="catalog/views" pathOnDisk="${project.basedir}/../web-ui/src/main/resources" />
<cssSource webappPath="catalog/style" pathOnDisk="${project.basedir}/../web-ui/src/main/resources" />
<cssSource webappPath="myStyle/style" pathOnDisk="${project.basedir}/../myStyle/src/main/resources" />
</require>
You need to check the following sections:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archiveClasses>true</archiveClasses>
<!-- Filter resources according to current profile properties
(see src/main/filters) and copy them to the webapp -->
<webResources>
<resource>
<directory>${project.basedir}/../schemas</directory>
<includes>
[...]
<resource>
<directory>${project.basedir}/../web-ui/src/main/resources</directory>
</resource>
<resource>
<directory>${project.basedir}/../myStyle/src/main/resources</directory>
</resource>
And, optionally, maybe you have some Java source files you want to add by adding your new maven project as a maven dependency.
There is some inconsistency on how the jetty plugin and tomcat load resources. So, you have to add two more lines on the web-ui-wro-sources.xml to make mvn jetty:run work. But this breaks the building of the war, so remember to remove them before the final build:
<jsSource webappPath="catalog/views/myStyle" pathOnDisk="${project.basedir}/../myStyle/src/main/resources" />
<cssSource webappPath="catalog/views/myStyle" pathOnDisk="${project.basedir}/../myStyle/src/main/resources" />
On the jetty plugin description, to be able to do mvn jetty:run
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
[...]
<resourcesAsCSV>
${project.basedir}/src/main/webapp,
${rootProjectDir}/web-ui/src/main/resources/,
${rootProjectDir}/myStyle/src/main/resources/,
[...]
To activate this new UI by default, make sure there is a row on the settings table with the identifier system/ui/defaultView. For example: "system/ui/defaultView";0;"n";10100;"myNewUI"
If you have some comments, start a discussion, raise an issue or use one of our other communication channels to talk to us.