I would like to customize the share UI header, for example remove some of buttons such as People and Shared files. I found that this can be done by modifying the share-header.lib.js file located in the tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/share/imports folder. On modifying this file, I can see the changes. But as has been advised in these links: https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/correctbest-way-customize-shares-ui-07182011 http://ecmarchitect.com/archives/2010/09/07/1212
The right way would be to create the same folder structure under the tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension directory and put the modified file there. I created the folder hierarchy and copied the share-header.lib.js file in this folder with the changes but now the changes are not seen on the website. Am I missing something ? Can anyone advise on the right method to do this ?
Thanks !
The general guideline that tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension overrides tomcat/webapps/share/WEB-INF/classes/alfresco is correct but there is one big caveat: it only works for webscripts.
In your case there are two files involved in the generation of the header:
The former belongs indeed to a webscript (you'll find a share-header.get.desc.xml in the same directory). This file can be overridden by placing a file in a similar directory structure under WEB-INF/classes/alfresco/web-extension as you've correctly found in your research.
The latter however is not part of a webscript. Rather it is imported through an import directive. Importing is a completely different mechanism and the WEB-INF/classes/alfresco/web-extension trick doesn't work here.
The first lines of share-header.get.js clarify this:
<import resource="classpath:/alfresco/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
model.jsonModel = {
rootNodeId: "share-header",
...
The imported resource is loaded from the classpath literally, without any web-extension overlay. To import your customised version of share-header.lib.js, the first line should have been:
<import resource="classpath:/alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
So in summary my recommendation is to customise both header/share-header.get.js (just the first line) and imports/share-header.lib.js (as you've already done).
Remember that when you create a new customisation file it is safer to restart Alfresco. On the other hand when you edit an existing customisation file it is sufficient to visit /share/service/index on your local installation and click on Refresh Web Scripts and Clean Dependency Caches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With