cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable download button in Version history and remove hyperlink in sources with F12?

alantan
Champ in-the-making
Champ in-the-making

Hello,

I am new with alfresco, I want the consumer can only read not download. I've disabled most of the download buttons but I need to disable the Download button (only appear when there is multi versions) and the href link with F12 (No matter if there is multi versions) in Version History for Consumer as well. I didn't find any threads about this, how can I achieve this? Could you please help? Thanks.

<div class="version-panel-right">
<span class="actions"> <a href="http://192.168.76.29/share/proxy/alfresco/api/node/content/versionStore/version2Store/edf39dd7-63bc-..." target="_blank" class="download" title="下载">&nbsp;</a>
</span>

7 REPLIES 7

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

What you mean by disable using F12?

Do you want to change in code and then disable?

Dear sanjaybandhniya,

Please refer to below picture, I want to disable the download button(circled in red color) in version history for consumer.

image

And for this version history, I found that the user can get the actual URL from Browser's developer tools by click F12. Please refer to below picture, copy that URL and login with consumer also be able to download the file.

Pls help. Thanks a lot.image

You need to override getDocumentVersionMarkup method \components\document-details\document-versions.js file to disable download.

Hi sanjaybandhniya,

Actually I have tried this method before I posted this post. I tried to change the downloadURL and html value in document-versions.js as below. But the result is it still shows the URL same as previous

<a href="http://192.168.76.29/share/proxy/alfresco/api/node/content/versionStore/version2Store/edf39dd7-63bc-..." target="_blank" class="download" title="下载">.

Looks like I didn't do the correct way. Could you please explain more details on how to override getDocumentVersionMarkup method? Thanks a lot.

getDocumentVersionMarkup: function DocumentVersions_getDocumentVersionMarkup(doc)
      {
       //  var downloadURL = Alfresco.constants.PROXY_URI + 'api/node/content/' + doc.nodeRef.replace(":/", "") + '/' + encodeURIComponent(doc.name) + '?a=true',html = '';
         var downloadURL = 'xxx',html = 'yyy';
         html += '<div class="version-panel-left">'
         html += '   <span class="document-version">' + $html(doc.label) + '</span>';
         html += '</div>';
         html += '<div class="version-panel-right">';
         html += '   <h3 class="thin dark" style="width:' + (Dom.getViewportWidth() * 0.25) + 'px;">' + $html(doc.name) +  '</h3>';
         html += '   <span class="actions">';
         if (this.options.allowNewVersionUpload)
         {
            html += '   <a href="#" name=".onRevertVersionClick" rel="' + doc.label + '" class="' + this.id + ' revert" title="' + this.msg("label.revert") + '">&nbsp;</a>';
         }

I haven't tried.

Workaround solution is create same file at same path with your change. This is not properr way to override.

May be you will get better solution from other member.

Hi Sanjay,

I got advice that I need change the document-versions.min.js instead of document-versions.js. After I set the html value to null, the download button can be disabled, but the upload button is still there. Do you know how can I hide the upload button as well?

Regards

Alan

image

That icon/functionality you can disable/remove from document-versions.get.html.ftl file.