cancel
Showing results for 
Search instead for 
Did you mean: 

Change behavior of filename link from document-details

mbortonus
Champ in-the-making
Champ in-the-making
Hi,

I am having difficulties locating the appropriate file to extend in order to change the behavior of the filename link in Share's document library view.  By default, the filename link will launch "document-details" but I would like to perform a document "view in browser" instead.  Is this possible?

Thanks to anyone in advance that may have a solution and sorry for the newbie question.
2 REPLIES 2

lementree
Champ on-the-rise
Champ on-the-rise
Yes it is possible

You can get this by making changes in <Alfresco>\tomcat\webapps\share\components\documentlibrary\documentlist.js file

replace  Alfresco.DocumentList.generateFileFolderLinkMarkup with the following piece of code

 Alfresco.DocumentList.generateFileFolderLinkMarkup = function DL_generateFileFolderLinkMarkup(scope, record)
   {
      var jsNode = record.jsNode,
         recordSiteName = $isValueSet(record.location.site) ? record.location.site.name : null,
         html;

      // Test for: handling a link and the link's target does not live within this site
      if (jsNode.isLink && recordSiteName !== scope.options.siteId)
      {
         if (jsNode.isContainer)
         {
            // Create a URL to either the Repository or Site document library where the link target lives
            html = $siteURL((recordSiteName === null ? "repository" : "documentlibrary") + "?path=" + encodeURIComponent($combine(record.location.path, record.location.file)),
            {
               site: recordSiteName
            });
         }
         else
         {
            // Create a URL to the document details page for the link target
         html = scope.getActionUrls(record, recordSiteName).viewUrl;
         }
      }
      else
      {
         if (jsNode.isContainer)
         {
            // Create path-change filter markup
            html = '#" class="filter-change" rel="' + Alfresco.DocumentList.generatePathMarkup(record.location);
         }
         else
         {
           // Create a URL to the document details page for the link target
            html = scope.getActionUrls(record).viewUrl;
         }
      }

      return '<a href="' + html + '">';
   };

Smiley Happy

mbortonus
Champ in-the-making
Champ in-the-making
That worked great!  Thanks so much!
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.