11-21-2016 04:03 AM
Hi,
I want to hide version download link for consumers. Please let me know what needs to be done in order to hide the link.
11-21-2016 05:29 AM
Could you provide a more detailed description of what you're trying to achieve? There are lots of places/pages in which a download appears? You refer to "version" download - so I would assume that you want to hide a button or buttons on the document details page in the "Version History" section - is this correct?
11-21-2016 05:35 AM
HI Dave,
Yes, I want to hide the download link available in the version history
section. I have to hide the link for users with consumer role. I am trying
to override the document-versions.js file's function
"*getDocumentVersionMarkup:
function DocumentVersions_getDocumentVersionMarkup(doc)*." I am calling the
membership webscript to check the role of the user "*var json =
remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships/" +
encodeURIComponent(user.name <http://user.name>));*" and hide the link if
the user role is SiteConsumer.
Is this correct ??
Thanks
Hiten Rastogi
Sr. Software Engineer
Mobile: +91 9899586608
Email: hiten.rastogi@eisenvault.com <vipul.swarup@eisenvault.com>
11-21-2016 06:12 AM
Yes, I would say that this looks to be the correct approach. Is it not working?
11-21-2016 06:49 AM
I can see an error ""Uncaught ReferenceError: remote is not defined ."
Can you please let me know where I am going wrong ?
Thanks
Hiten Rastogi
Sr. Software Engineer
Mobile: +91 9899586608
Email: hiten.rastogi@eisenvault.com <vipul.swarup@eisenvault.com>
11-21-2016 07:02 AM
Ah... this is because "remote" is a variable that is available in the JavaScript controller of the WebScript - not on the client. You should aim to use this capability in the JavaScript controller to determine whether or not the user is a Site Consumer and then pass that information on to a customized version of the Alfresco.DocumentVersions widget.
You should follow the principals outlined in this blog post for how to do it: https://community.alfresco.com/community/ecm/blog/2012/05/22/customizing-share-javascript-widget-ins...
11-22-2016 12:35 AM
Hi Dave,
I am getting an error while customizing docuement-versions.js
file's getDocumentVersionMarkup: function
DocumentVersions_getDocumentVersionMarkup(doc) method. In this I am getting
response object as null but I can see in the developer console that my
membership webscript is returning the desired result. can you please help
me out.
Here is my custom code - http://pastebin.com/ABQ8BubJ
Thanks
Hiten Rastogi
Sr. Software Engineer
Mobile: +91 9899586608
Email: hiten.rastogi@eisenvault.com <vipul.swarup@eisenvault.com>
11-22-2016 08:08 AM
On first inspection it looks like the problem you have is that you're treating an asynchronous request as being synchronous... so you make the call to Alfresco.util.Ajax.jsonGet and then immediately continue the processing and try to reference the variable "json" before the XHR request has completed and set it - this is why it's being reported as null. The XHR request does successfully complete, but not until after you've tried to reference "json".
As I suggested in my previous answer, your best best here is to determine whether or not the user is a SiteConsumer in the JavaScript controller of the WebScript and not on the client-side - otherwise it's just going to make your client side code that much more complicated. The calls using "remote" in the JavaScript controller are handled synchronously.
12-01-2016 12:44 AM
Hi Dave,
12-01-2016 03:14 AM
The basic principal is exactly the same, except that instead of extending the documentlist.get.js controller you're extending the document-versions.get.js controller and instead of extending the Alfresco.DocumentList widget you're extending the Alfresco.DocumentVersions widget and instead of overriding the onFilterChanged function you're overriding the getDocumentVersionMarkup function.
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.