cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] Change an action following conditions

lamba
Champ on-the-rise
Champ on-the-rise
Hello everybody,

I have created 2 new actions in Share (v3.2r2) for documents and they work well.

However I would like to change the action if the document has certain aspect.
I tried the steps in this post http://forums.alfresco.com/en/viewtopic.php?f=48&t=22737&p=74582&hilit=actionSet#p74582.

So, I added the following code in doclist.get.js within the loop
 
for each (asset in assets)
{
   …
}

// Asset status
      if (asset.hasAspect("custom:new"))
      {
         itemStatus.push("newed");
      }

in the documentlist.get.config.xml file, I added the other custom action as following:

<actionSet id="newed">
         <action type="action-link" id="onActionNew2" permission="" label="actions.document.new2" />
</actionSet>

But no change on my Document Library in spite of the change of the aspect.

If anybody knows how to make it, tells me.

thank you for you help .
4 REPLIES 4

lamba
Champ on-the-rise
Champ on-the-rise
I also tried to modify files:
- action-sets.lib.js by adding the condition

    else if (itemStatus.indexOf("newed") != -1)
   {
      actionSet = "newed";
   }

- And filters.lib.js by adding the filter

    FilterQueryDefaults = "-ASPECT: \ " {http: // www.new.com / model / t / 1.0} custom:new \ "";



But that did not work  :!:

Somebody to help me please.  :cry:



Thank you in advance.

lamba
Champ on-the-rise
Champ on-the-rise
Any help please !

mikeh
Star Contributor
Star Contributor
Setting the actionSet to "newed" should make that set of actions appear for those documents with the aspect. However, adding that line to filters.lib.js tells the search query to not return any nodes that have the aspect (the minus sign in front means "not").

Thanks,
Mike

lamba
Champ on-the-rise
Champ on-the-rise
Solved Smiley Happy

In fact it is as Mike described in the post: http://forums.alfresco.com/en/viewtopic.php?f=48&t=22737&p=74582&hilit=actionSet#p74582

The steps are:
1. Modify the file "doclist.get.js " by adding the logic of display of the actions, in the section:
for each (asset in assets)
   {
      …
   }

2. Modify the file "doclist.get.json.ftl " by adding new permissions in the section " userAccess ". For exp:
"my-action": ${item.enableMyAction?string}
These permissions allow show/mask each of the actions according to a condition.

3. Modify the file "documentlist.get.config.xml " by associating every permission with its corresponding action. For exp:
<action type="action-link" id="onActionMyAction" permission="my-action" label="actions.document.my-action" />


Thank you all Smiley Happy

Good day.