cancel
Showing results for 
Search instead for 
Did you mean: 

Hide/Add buttons for content of specific space...

joaotpd
Champ on-the-rise
Champ on-the-rise
Hi all!!

I'm tired to look… Smiley Tongue Someone please tell me how can I hide or show buttons in the "more actions menu" of content but only for content of a specific space. Is this possible?? … I've manage to add buttons  for a specific type of content… but now i need to do it for a space… please help!!!… I'm sure the answer is simple… but i can manage to solve it… :s
Thanks!! Smiley Happy

João Duarte
5 REPLIES 5

joaotpd
Champ on-the-rise
Champ on-the-rise
HI! … I still don't have it!!! … Anyone??? …
Thanks!! …

João Duarte

zaizi
Champ in-the-making
Champ in-the-making
For JSF Client: When you define an action in web-client-custom.xml you can specify an evaluator class; e.g AddBlogDetailsEvaluator


         <action id="addBlogDetails">     
            <permissions>
               <permission allow="true">Write</permission>
            </permissions>
            <evaluator>org.alfresco.module.blogIntegration.ui.AddBlogDetailsEvaluator</evaluator>
            <label>Add Blog Details</label>
            <image>/images/icons/edit_icon.gif</image>
          <action-listener>#{org_alfresco_module_blogIntegration_BlogDetailsActionListener.executeScript}</action-listener>
          <params>
              <param name="id">#{actionContext.id}</param>
               <param name="action">add</param>
            </params>
         </action>

which returns either true or false based on your specific code. This determines if the action is shown. The following evaluator returns true only when a space has a specific aspect.


public class AddBlogDetailsEvaluator extends BaseActionEvaluator implements BlogIntegrationModel
{
    /**
     * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
     */
    public boolean evaluate(Node node)
    {
        boolean result = false;
        if (node.hasAspect(ASPECT_BLOG_DETAILS) == false)
        {
            result = true;
        }
        return result;
    }
}

You need to write your own evaluator for your specific use case.

joaotpd
Champ on-the-rise
Champ on-the-rise
Hi zaizi!! Smiley Happy
Thanks a lot for your answer!!… but if i want to add an action to "browse create menu" can't i just do it simply like this:


<config>
   <actions>
      <action id="myAction">
         <label>Arquivar</label>
         <image>/images/icons/myAction.gif</image>
         <script>/Company Home/Data Dictionary/Scripts/myScript.js</script>
         <params>
            <param name="noderef">#{actionContext.nodeRef}</param>
         </params>
      </action>
   </actions>
</config>

<config evaluator="node-type" condition="SPACE NAME HERE">
   <actions>
      <action-group id="browse_create_menu">
         <action idref="myAction" />
      </action-group>
   </actions>
</config>

My problem is just how do i get the space name??… Is this possible??…
Suppose that i have a space called "My Space" in Company Home…
Thanks again… Smiley Wink

joaotpd
Champ on-the-rise
Champ on-the-rise
Anyone??? …
Thanks again!! …

togomez
Champ on-the-rise
Champ on-the-rise
You can Use the evaluator , and the java api ,  to figure out if the node is in the desired space.

For instance, you can get the path to the node through nodeService and then check if it's in the desired space.

Path path = nodeService.getPath(node.getNodeRef());

Does anyone know a better method?