Alfresco shares customizing UI header

I would like to customize the UI header for sharing, like removing some of the buttons like 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 / exports folder. When I change this file, I see the changes. But as said 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 correct way would be to create the same folder structure in tomcat / webapps / share / WEB-INF / classes / alfresco / web-extension directory and put the modified file there. I created a folder hierarchy and copied the share-header.lib.js file in this folder with the changes, but now the changes are not showing up on the website. Am I missing something? Can anyone advise on the correct method for this?

Thank!

+3


source to share


2 answers


The general rule of thumb 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 web scripts.

In your case, two files are involved in generating the header:

  • WEB-INF / classes / open air / site-webscripts / org / open air / share / header / share-header.get.js
  • WEB-INF / classes / open air / site-webscripts / org / open air / share / import / share-header.lib.js

The first relates to the web window (you will find it share-header.get.desc.xml

in the same directory). This file can be overridden by placing the file in a similar directory structure WEB-INF/classes/alfresco/web-extension

as you correctly found in your research.

The latter, however, is not part of the web page. Rather, it is imported using an import directive. Importing is a completely different mechanism and the trick WEB-INF/classes/alfresco/web-extension

doesn't work here.

The first lines share-header.get.js

make this clear:



<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 overlapping web-extension

. To import the customized version of share-header.lib.js, the first line had to be:

<import resource="classpath:/alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js">

      

So my recommendation is to tweak both header/share-header.get.js

(first line only) and imports/share-header.lib.js

(as you already did).

Remember, when creating a new configuration file, it is best to restart Alfresco. On the other hand, when editing an existing configuration file, just visit / share / service / index in the local installation and press Refresh Web Scripts

and Clean Dependency Caches

.

+4


source


Actually, your approach is not the best. As per Alfresco documentation, you have to set up your folder share-config-custom.xml

in tomcat/shared/classes/web-extension

. You should find a sample file there. Find the source folder share-config.xml

in the Webapp: shared folder and find the tag <header>

. It will look something like 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 to a file share-config-custom.xml

. make changes and restart Alfresco. You should be good to go.

+2


source







All Articles