AnsweredAssumed Answered

Add context menu item only if aspect present

Question asked by nicolasraoul on Jan 23, 2012
Latest reply on Jan 23, 2012 by nicolasraoul
In Alfresco Share's document library, each document has a context menu with items like "Upload New Version".
I want to modify this context menu and add a "Warp" action.
But this action should only be visible if the document has the "Warpable" aspect.

What is the usual way to do this?
I plan to do something like the following, is it possible?

tomcat/webapps/share/WEB-INF/classes/alfresco/share-documentlibrary-config.xml :
         <action id="warp" type="javascript" label="actions.document.warp">
            <param name="function">onActionWarp</param>
            <evaluator negate="true">evaluator.doclib.action.hasAspect("warpable")</evaluator>
         </action>

custom-slingshot-nicolas-raoul-context.xml :
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans> 
   <bean id="evaluator.doclib.action.warpable" class="org.alfresco.web.evaluator.HasAspectEvaluator">
      <property name="aspects">
         <list>
            <value>nr:warpable</value>
         </list>
      </property>
   </bean>
</beans>

Am I missing something?

Outcomes