cancel
Showing results for 
Search instead for 
Did you mean: 

Download Action button in Version History

karimbuenaseda
Champ on-the-rise
Champ on-the-rise
Hi All,

Just like to ask if its possible to disable the download action button in Alfresco 4.2 under the Version History of a certain document. I've been looking at the file "document-versions.get.html.ftl" but the download action is nowhere to be found in that file. Question is am I editing the right file? or there is an updated file within Alfresco Share to be edited in place of the "document-versions.get.html.ftl" so that I can disable the download action button.

Appreciate the Help.
6 REPLIES 6

zladuric
Champ on-the-rise
Champ on-the-rise
I think those download actions were attached via client-side code? Did you look at the JavaScript files for document-versions?

karimbuenaseda
Champ on-the-rise
Champ on-the-rise
Hi there,

Yes, but from what I can understand there is no line in the code below that points out to the Document download in version history or maybe I'm looking it the wrong way?.

document-versions.get.js

<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">

function main()
{
   AlfrescoUtil.param('nodeRef');
   AlfrescoUtil.param('site', null);
   AlfrescoUtil.param('container', 'documentLibrary');
   var documentDetails = AlfrescoUtil.getNodeDetails(model.nodeRef, model.site);
   if (documentDetails)
   {
      var userPermissions = documentDetails.item.node.permissions.user;
      model.allowNewVersionUpload = userPermissions["Write"] || false;
      model.isWorkingCopy = (documentDetails.item && documentDetails.item.workingCopy && documentDetails.item.workingCopy.isWorkingCopy) ? true : false;
   }
  
   // Widget instantiation metadata…
   var documentVersions = {
      id : "DocumentVersions",
      name : "Alfresco.DocumentVersions",
      options : {
         nodeRef : model.nodeRef,
         siteId : model.site,
         containerId : model.container,
         workingCopyVersion : model.workingCopyVersion,
         allowNewVersionUpload : model.allowNewVersionUpload
      }
   };
  
   model.widgets = [documentVersions];
}

main();

Hi,

This is the server-side javascript.
What you're looking for is the client-side javascript  document-versions.js

You'll see (depending on your version I guess) that in the function "getDocumentVersionMarkup" you have
html += '      <a href="' + downloadURL + '" class="download" title="' + this.msg("label.download") + '"> </a>';


This is it. Good luck.

Hi there, so from what I can understand?, should I just comment out this line of code right?

scouil
Star Contributor
Star Contributor
Yes and no.
Just doing it would work. but won't persist through any redeploy or upgrade.

The easy way out would be to override that file in web-extensions. Copy/paste the original file and comment that line out.
The best way would be to write a proper surf extension. It's a bit longer to get started with it but is really nice how modular it is and how cleaner your code is.

Oh I see, will test commenting out the lines first and will move onto learning extending surf as I'm a newbie when it comes to alfresco development. Thanks anyways..