cancel
Showing results for 
Search instead for 
Did you mean: 

Share action evaluator from JavaScript

jamilnour
Star Contributor
Star Contributor
Hello,

I have a request when I need my custom documentlibrary action to be hidden depends on a client browser plugin installation (let say if Adobe Reader installed show the action)

Is is possible to call a js function as an evaluator of an action (inside the share-config-custom.xml file) so it will not be shown in some scenarios?

I know how to use java beans as evaluator but what about client JS

Best regards
Jamil
2 REPLIES 2

angelborroy
Community Manager Community Manager
Community Manager
As far as I know there is no ootb mechanism to include JS client evaluators on actions.

You should extend Alfresco.DocumentActions. and Alfresco.DocumentListViewRenderer YUI objects in order to apply your own visibility conditions.

For instance, in <CODE>document-action.js</CODE> you can exclude from actions list rendering any action by id in <CODE>onReady</CODE> event:

<javascript>
for (var i = 0, ii = actions.length; i < ii; i++)
{
    // Show action object in log
    console.log(actions);

    // If "any condition" add to rendering list
    if (actions.id != "document-download")
        actionHTML += this.renderAction(actions, record);
}
</javascript>
Hyland Developer Evangelist

The exclude method works very well and as expected and described

Thank you

Best regards
Jamil