cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved]Problem overriding the action definitions

jey
Champ in-the-making
Champ in-the-making
Hi,

I read here (http://forums.alfresco.com/viewtopic.php?t=5690)  that we can override the definition of actions.

I tried it an it works fine.
I have override the action "create_space" without any problem.

But now I want to override the action "manage_deleted_items".
I want to add an evaluator to give access only to administrator.
but this time it doesn't work …

I have even try to modify the image and the label to ensure the result, and I have the following issue : OVERRIDING "manage_deleted_items" ACTION DOESN'T HAVE ANY EFFECT … but there is no issue with the create space action  😞

here is the code of my web-client-config-custom.xml file:

<alfresco-config>

   <config>
      <actions>
         <action id="create_space">
            <permissions>
               <permission allow="true">CreateChildren</permission>
            </permissions>
            <evaluator>***.***.***.web.action.evaluator.ShortcutNodeEvaluator</evaluator>
            <label-id>create_space</label-id>
            <image>/images/icons/create_space.gif</image>
            <action>dialog:createSpace</action>
         </action>
        
         <action id="manage_deleted_items">
            <evaluator>***.***.***.web.action.evaluator.ShortcutNodeEvaluator</evaluator>
            <label-id>email_space_users</label-id>
            <image>/images/icons/email_users.gif</image>
            <action>dialog:manageDeletedItems</action>
         </action>
      </actions>
   </config>
   
</alfresco-config>

Any idea ???
6 REPLIES 6

gavinc
Champ in-the-making
Champ in-the-making
This action got moved to the user console page in a previous release and the action definition has been left in the web-client-config-actions.xml file by the looks of it.

The action is now defined in /jsp/users/user-console.jsp as shown below:


<a:actionLink id="manage-deleted-items" value="#{msg.manage_deleted_items}" action="dialog:manageDeletedItems" image="/images/icons/trashcan.gif" />

You can wrap this inside a boolean evaluator to get the effect you want. You can do this as follows:


<a:booleanEvaluator value="#{NavigationBean.currentUser.admin == true}">
<a:actionLink id="manage-deleted-items" value="#{msg.manage_deleted_items}" action="dialog:manageDeletedItems" image="/images/icons/trashcan.gif" />
</a:booleanEvaluator>

jey
Champ in-the-making
Champ in-the-making
Thank you gavin for your reply …

I have allready build a new jsp (copy/past of user-console.jsp) and put it jsp/extension/

And I used the boolean evaluator 😉

But to use my custom jsp I have to overide 2 navigation rules in  face-config.xml.

This works fine …
But i am not sure of the compliance with future version …
So I was trying to find a "BETTER" way … (with action definition).

If you think it is fine like this 🙂

Thanks and have a nice day!

gavinc
Champ in-the-making
Champ in-the-making
Ideally, the action should really be using the one defined in web-client-config-actions.xml as it was before, then you only need to override the action definition, feel free to raise this as an issue in JIRA.

However, the way you have done it is OK if you also override the faces navigation rules. I'm presuming at the moment you've changed our faces-config-navigation.xml file?

To override faces navigation rules you need to re-define them in a faces-config.xml file placed in the META-INF folder of a JAR file, see http://wiki.alfresco.com/wiki/Packaging_And_Deploying_Extensions#JSF_configuration_files for details. If you follow this it will be upgrade proof.

jey
Champ in-the-making
Champ in-the-making
First of all, thank you gavin for all those informations.

Indeed I did not override faces-config-navigation.xml because i didn't to override alfresco's file but i have define new navigation rules for my custom jsp in a face-config.xml included in a .jar file containing all my customizations!

I got a last question related to this topic 🙂 :

As I said before it is very easy to override action such as Create space, Advanced Space Wizard, …. and to add them an evaluator.
But how can I had an evaluator to the item "Add Content" ??? (I did not found the definitions of this action anywhere…)

I want to disable this in some space thanks to an evaluator. (Those space must contains only spaces and not files)…

Thanks,
Jérémie

kevinr
Star Contributor
Star Contributor
As I said before it is very easy to override action such as Create space, Advanced Space Wizard, …. and to add them an evaluator.
But how can I had an evaluator to the item "Add Content" ??? (I did not found the definitions of this action anywhere…)

I want to disable this in some space thanks to an evaluator. (Those space must contains only spaces and not files)…

Unfortunately at present that requires modifying browse.jsp - it is a bug really since virtually all actions are now externally configurable and overridable but that action is not! I have created a bug for it so hopefully it can be fixed for 2.1:
http://issues.alfresco.com/browse/AWC-1253

Thanks,

Kevin

jey
Champ in-the-making
Champ in-the-making
Thank you kevin …

I take good notes of it and I will expect the 2.1 version 😉 !