cancel
Showing results for 
Search instead for 
Did you mean: 

XML Extensions with conditions

Guian_
Confirmed Champ
Confirmed Champ

Hi guys!

I would like to apply an XML Extension only for a particular path.

Let's say I want to remote the notification tab in the administration panel for each folders inside : /default-domain/worspaces/myWorkspace/aSpecialFolder/

So I'm using this Extension :

<extension target="org.nuxeo.ecm.platform.actions.ActionService" point="actions">
        <action id="TAB_MANAGE_SUBSCRIPTIONS" enabled="false"/>
</extension>

But it removes the subscription tab for any folder in my nuxeo instance. How can I use it only on a particular path ? ( a "path start with" condition would be perfect )

EDIT :
/> as guillaume suggested, I've tried to add a filter node in my action so I can enable it according to the current document path like this :

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="actions">
  <action id="TAB_MANAGE_SUBSCRIPTIONS" >
      <filter id="TAB_MANAGE_SUBSCRIPTIONS">
        <rule grant="true">
          <condition>#{!currentDocument.getPathAsString().startsWith("/default-domain/worspaces/myWorkspace/aSpecialFolder/")}</condition>
        </rule>
      </filter>
  </action>
</extension>

But it doesn't seem to work, I'll keep testing but just in case, can you see where I did wrong ?

1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

Please read about action and filters on User Actions (Links, Buttons, Icons, Tabs). Check the Managing Filters to Control an Action Visibility section.

View answer in original post

4 REPLIES 4

Florent_Guillau
World-Class Innovator
World-Class Innovator

Please read about action and filters on User Actions (Links, Buttons, Icons, Tabs). Check the Managing Filters to Control an Action Visibility section.

Ok seems it, I'll add a filter with an EL Expression condition... thanx

I've updated my question with my last try to apply filter on my action

Guian_
Confirmed Champ
Confirmed Champ

Ok it works now with :

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="actions">
  <action id="TAB_MANAGE_SUBSCRIPTIONS" >
      <filter id="TAB_MANAGE_SUBSCRIPTIONS">
        <rule grant="false">
          <condition>#{currentDocument.getPathAsString().startsWith("/default-domain/worspaces/myWorkspace/aSpecialFolder/")}</condition>
        </rule>
      </filter>
  </action>
</extension>

I guess there was no sens to enable it only outside of a folder since its enabled by default so I Disabled it inside of the target folder and it works fine !

thanks for your help!