cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Links from node-header in document-details

d_franz
Champ on-the-rise
Champ on-the-rise
I want to reduce the links I can see on the Document-Details View. I have already created a Module to reduce the ActionGroups on the right side.
Now my problem is to hide the fields “favorite” “like” and “comment” from the node-header.
[img]http://www.freeimagehosting.net/t/cee7b.jpg[/img]

I have already changed the Metadata-Template:
<config evaluator="string-compare" condition="DocumentLibrary"  replace="true">
         <!– Default (fallback) –>
         <template id="default">
            <line index="10" id="date">{date}{size}</line>
            <line index="20" id="description" view="detailed">{description}</line>
            <line index="30" id="tags" view="detailed">{tags}</line>
            <!–line index="40" id="categories" view="detailed" evaluator="evaluator.doclib.metadata.hasCategories">{categories}</line–>
            <!–line index="50" id="social" view="detailed">{social}</line–>
         </template>
      </metadata-templates>
    </config>

But this only takes effect on the library browser.

It would be realy great if somebody could help me.
14 REPLIES 14

afaust
Legendary Innovator
Legendary Innovator
Hello,

Those links can be configured / removed using Spring Surf extension modules via sub-component evaluations and properties on the node-header component.

Regards
Axel

d_franz
Champ on-the-rise
Champ on-the-rise
What file I have to edit for this? Can you give me a short code sample?

Thank you in advance!

d_franz
Champ on-the-rise
Champ on-the-rise
I can't find anything about sub-components of the document-details view. Is there a tutorial for a module available?

d_franz
Champ on-the-rise
Champ on-the-rise
Now I have looked many days for a solution for this simple looking problem. But the only solution I found was to directly edit the node-header.get.html.ftl file. But with this solution I only get rid of the fields "showQuickShare" and "showComments"

Disabling the fields "showLikes" and "showFavourite" mostly disables the howl details view.

Does anyone know a solution to disable this fields?

My changed "Modified & Social" section of node-header.get.html.ftl looks as follows:
                  <!– Modified & Social –>
                  <div>
                     <#assign modifyUser = node.properties["cm:modifier"]>
                     <#assign modifyDate = node.properties["cm:modified"]>
                     <#assign modifierLink = userProfileLink(modifyUser.userName, modifyUser.displayName, 'class="theme-color-1"') >
                     ${msg("label.modified-by-user-on-date", modifierLink, "<span id='${id}-modifyDate'>${modifyDate.iso8601}</span>")}
                     <#if showFavourite == "true">
                     <span id="${id}-favourite" class="item item-separator"></span>
                     </#if>
                     <#if showLikes == "true">
                     <span id="${id}-like" class="item item-separator"></span>
                     </#if>
                     <#if showComments == "false">
                     <span class="item item-separator item-social">
                        <a href="#" name="@commentNode" rel="${nodeRef?js_string}" class="theme-color-1 comment ${id}" title="${msg("comment.${itemType}.tip")}" tabindex="0">${msg("comment.${itemType}.label")}</a><#if commentCount??><span class="comment-count">${commentCount}</span></#if>
                     </span>
                     </#if>
                     <#if showQuickShare == "false">
                     <span id="${id}-quickshare" class="item item-separator"></span>
                     </#if>
                  </div>

d_franz
Champ on-the-rise
Champ on-the-rise
Now I have recognized that the modification of the JS file only works for the 64bit version of Alfresco 4.2 on the 32Bit Version it doesn't works.

So again I tried it with a Model:
                <!–Remove Node-Header   Details–>            
            <component>
               <scope>template</scope>
               <region-id>node-header</region-id>
               <source-id>document-details</source-id>
               <sub-components>
                 <sub-component id="default">
                   <evaluations>
                     <evaluation id="rm-nodeHeader">
                        <url>/components/node-details/node-header</url>
                        <properties>
                          <nodeRef>{nodeRef}</nodeRef>
                          <rootPage>documentlibrary</rootPage>
                          <rootLabelId>path.fileplan</rootLabelId>
                          <showFavourite>false</showFavourite>
                          <showLikes>false</showLikes>
                          <showComments>false</showComments>
                                  <showQuickShare>false</showQuickShare>
                        </properties>
                     </evaluation>
                   </evaluations>
                 </sub-component>
               </sub-components>
            </component>

But with this Model it is the same Problem as before it does not work with "<showLikes>false</showLikes>" "<showFavourite>false</showFavourite>".

How can I disable this functions?

ddraper
World-Class Innovator
World-Class Innovator
In answer to this question:
I can't find anything about sub-components of the document-details view. Is there a tutorial for a module available?

There is some information on Sub-Components at these pages:
http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2FSurf_v4_com...
http://blogs.alfresco.com/wp/ddraper/2011/07/22/how-to-add-content-to-an-alfresco-share-page/
http://blogs.alfresco.com/wp/ddraper/2011/07/27/how-to-hide-content-on-an-existing-alfresco-share-pa...
http://blogs.alfresco.com/wp/ddraper/2011/07/29/sub-component-evaluations/

Also, there should be no difference between the 32-bit and 64-bit versions of Alfresco 4.2 - I'm not sure what would have given you this idea?

If you're working on 4.2 then the best way to disable features in the node-header is to extend the node-header.get.js WebScript controller and override the default options for the widget. There are some blog posts describing how this is now possible for 4.2 here:
http://blogs.alfresco.com/wp/ddraper/2012/05/22/customizing-share-javascript-widget-instantiation-pa...
http://blogs.alfresco.com/wp/ddraper/2012/05/24/customizing-share-javascript-widget-instantiation-pa...

Regards,
Dave

d_franz
Champ on-the-rise
Champ on-the-rise
I already tried to modyfie the node-header.get.js.

For my 64Bit Machine this changes work but on my 32Bit machine nothing hapens.

That is my changes node-header.get.js:
<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">

function main()
{
   AlfrescoUtil.param("nodeRef");
   AlfrescoUtil.param("site", null);
   AlfrescoUtil.param("rootPage", "documentlibrary");
   AlfrescoUtil.param("rootLabelId", "path.documents");
   AlfrescoUtil.param("showFavourite", "true");
   AlfrescoUtil.param("showLikes", "true");
   AlfrescoUtil.param("showComments", "false");
   AlfrescoUtil.param("showQuickShare", "true");
   AlfrescoUtil.param("showDownload", "true");
   AlfrescoUtil.param("showPath", "true");
   var nodeDetails = AlfrescoUtil.getNodeDetails(model.nodeRef, model.site);
   if (nodeDetails)
   {
      model.item = nodeDetails.item;
      model.node = nodeDetails.item.node;
      model.isContainer = nodeDetails.item.node.isContainer;
      model.paths = AlfrescoUtil.getPaths(nodeDetails, model.rootPage, model.rootLabelId);
      model.showQuickShare = (!model.isContainer && model.showQuickShare && config.scoped["Social"]["quickshare"].getChildValue("url") != null).toString();
      model.showComments = ((nodeDetails.item.node.permissions.user["CreateChildren"] || false) && model.showComments).toString();
      model.showDownload = (!model.isContainer && model.showDownload).toString();
      var count = nodeDetails.item.node.properties["fm:commentCount"];
      model.commentCount = (count != undefined ? count : null);

      // Widget instantiation metadata…
      var likes = {};
      if (model.item.likes != null)
      {
         likes.isLiked = model.item.likes.isLiked || false;
         likes.totalLikes = model.item.likes.totalLikes || 0;
      }

      var nodeHeader = {
         id : "NodeHeader",
         name : "Alfresco.component.NodeHeader",
         options : {
            nodeRef : model.nodeRef,
            siteId : model.site,
            rootPage : model.rootPage,
            rootLabelId : model.rootLabelId,
            showDownload : Boolean(model.showDownload),
            showPath : Boolean(model.showPath),
            displayName : (model.item.displayName != null) ? model.item.displayName : model.item.fileName,
            isFavourite : Boolean(model.item.isFavourite || false),
            isContainer : Boolean(model.isContainer),
            sharedId: model.item.node.properties["qshare:sharedId"] || null,
            sharedBy: model.item.node.properties["qshare:sharedBy"] || null
         }
      };
      model.widgets = [nodeHeader];
   }
}

main();

ddraper
World-Class Innovator
World-Class Innovator
I think you've somewhat missed the point of what it's now possible to do with the refactored Share WebScripts…

You don't need to completely override the node-header.get.js file anymore… you can allow the default version to run but then create an extension that manipulates the parts of the model that specify "showLikes", etc. The advantage of doing it this way is that it's considerably less code, and secondly it protects against updates to that file (if the default controller changes then you won't need to merge those changes into your overridden file).

The code in the customization file would look something like this:
for (var i=0; i<model.widgets.length; i++)
{
  if (model.widgets[i].id == "NodeHeader")
  {
    model.widgets[i].options.showLikes = false;
  }
}

Again, I'm genuinely surprised that you're encountering a difference between a 32-bit and 64-bit versions as there is no difference between the WebScript code on either of them. It's possible that maybe the installer builds have a fault in them but I'd expect that to be presented in a more serious way than this subtle problem.

Regards,
Dave

mitpatoliya
Star Collaborator
Star Collaborator
Hi David,

I have tried your last solution to hide "likes" action but it did not change anything.
I have taken exact reference from your comments on following bug

https://issues.alfresco.com/jira/browse/ALF-16740

I do not know what could be the issue no error related to this module
I am using 4.2 community version on 32 bit windows
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.