Reputation: 167
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 !
Upvotes: 3
Views: 3219
Reputation: 383
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
.
Upvotes: 4
Reputation: 1298
Actually, your approach isn't the best one.
As in Alfresco documentation you should configure your share-config-custom.xml
in tomcat/shared/classes/web-extension
folder. You should find a sample file there.
Look for the original one share-config.xml
in share webapp folder: and search for the <header>
tag. It will look something similar to this:
<app-items>
<!-- defaults: icon="{id}.png" label="header.{id}.label" description="header.{id}.description" -->
<item type="link" id="my-dashboard">{userdashboardpage}</item>
<item type="js" id="sites">Alfresco.module.Sites</item>
<item type="link" id="people">/people-finder</item>
<item type="link" id="repository" condition="conditionRepositoryRootNode">/repository</item>
<item type="container" id="more">
<container-group id="my">
<item type="link" id="my-tasks">/my-tasks</item>
<item type="link" id="my-workflows">/my-workflows</item>
<item type="link" id="my-content">/user/user-content</item>
<item type="link" id="my-sites">/user/user-sites</item>
<item type="link" id="my-profile">{userprofilepage}</item>
</container-group>
<container-group id="tools" permission="admin">
<item type="link" id="application">/console/admin-console/application</item>
<item type="link" id="groups">/console/admin-console/groups</item>
<item type="link" id="replication-jobs" condition="!conditionEditionTeam">/console/admin-console/replication-jobs</item>
<item type="link" id="repository">/console/admin-console/repository</item>
<item type="link" id="trashcan">/console/admin-console/trashcan</item>
<item type="link" id="users">/console/admin-console/users</item>
<item type="link" id="more">/console/admin-console/</item>
</container-group>
</item>
</app-items>
Copy the entire section in your share-config-custom.xml
file. make your changes and restart Alfresco. You should be good to go.
Upvotes: 2