cancel
Showing results for 
Search instead for 
Did you mean: 

how to override this?

alpha
Champ in-the-making
Champ in-the-making
Hi guys,

I have applied an aspect to a space to make it be displayed a custom JSP rather than browse.jsp, and it works fine.
But when i launch an action defined by a rule (simple workflow action like approve or reject), browse.jsp is displayed.
How can i do to override the outcome? any idea?

here is the code :
<config evaluator="aspect-name" condition="my:myaspect">
     <navigation>
         <override from-view-id="/jsp/browse/browse.jsp" to-view-id="/jsp/extension/custom.jsp" />
         <override from-outcome="browse" to-view-id="/jsp/extension/custom.jsp" />
      </navigation>
   </config>

and here is the log when i launch the approve action (from a simple workflow rule):
10:57:06,564 DEBUG [web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
10:57:06,564 DEBUG [web.app.AlfrescoNavigationHandler] Current view id: /jsp/extension/custom.jsp
10:57:06,564 DEBUG [web.app.AlfrescoNavigationHandler] No dispatch context found
10:57:06,564 DEBUG [web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
10:57:06,564 DEBUG [web.app.AlfrescoNavigationHandler] view stack: []

thanks.
5 REPLIES 5

jey
Champ in-the-making
Champ in-the-making
You should also override this declaration:


<navigation-rule>
      <from-view-id>/jsp/wizard/*</from-view-id>
      <navigation-case>
         <from-outcome>cancel</from-outcome>
         <to-view-id>/jsp/browse/browse.jsp</to-view-id>
      </navigation-case>
      <navigation-case>
         <from-outcome>finish</from-outcome>
         <to-view-id>/jsp/browse/browse.jsp</to-view-id>
      </navigation-case>
   </navigation-rule>

And maybe some more.

In fact most of the actions are redirected to browse.jsp : wizard, admin, ..

SO you need to override all of them if you want your custom jsp to be used whatever the action performed is.

You can have a look at the file: Alfresco\tomcat\webapps\alfresco\WEB-INF\faces-config-navigation.xml to see all what you have to override!

alpha
Champ in-the-making
Champ in-the-making
thanks jey,

actually i m not trying to override all navigation that deals with browse.jsp in Alfresco. I just want to override the navigation rules for the space that has a certain aspect.
By the way, i've managed to override the outcome for the simpleworkflow action by changing the tag <action> from "browse" to "custom" in the web-client-config-custom.xml

<action id="approve_doc">
            …
     <action-listener>#{DocumentDetailsBean.approve}</action-listener>
     <action>custom</action>
            …
</action>
and setting the faces-config.xml like this :
<navigation-rule>
      <from-view-id>/jsp/*</from-view-id>
            …
      <navigation-case>
         <from-outcome>custom</from-outcome>
         <to-view-id>/jsp/extension/custom.jsp</to-view-id>
      </navigation-case>
   <navigation-rule>

But with this, if i trigger the approve action anywhere in alfresco, the outcome will be "custom" and the displayed jsp custom.jsp, even if i am not in a space that has my aspect.
  :cry:

jey
Champ in-the-making
Champ in-the-making
Why don't you try to override those navigations rules inside your config with evaluator on the aspect-name=my:myaspect ?

Ths will maybe be better than overriding in faces-config.xml

I am telling this but I have never tried such a thing … Smiley Very Happy

gavinc
Champ in-the-making
Champ in-the-making
Depending on the scenario there a couple of things you can try.

If you need to handle naviation away from your custom page you can add some JSF navigation rules for your page only as follows:

<navigation-rule>
  <from-view-id>/jsp/extension/custom.jsp</from-view-id>
  <navigation-case>
    <from-outcome>approve</from-outcome>
    <to-view-id>/jsp/extension/custom.jsp</to-view-id>
  </navigation-case>
</navigation-rule>

Or you could define an approve action that only applies to the objects that have your aspect applied. You'll need to define the action and then override the action group that includes it for your aspect as shown below:


<config evaluator="aspect-name" condition="my:myaspect">
  <actions>
    <action id="custom_approve_doc">
      <evaluator>org.alfresco.web.action.evaluator.ApproveDocEvaluator</evaluator>
      <label>#{actionContext["app:approveStep"]}</label>
      <image>/images/icons/approve.gif</image>
      <action-listener>#{DocumentDetailsBean.approve}</action-listener>
      <action>custom</action>
      <params>
        <param name="id">#{actionContext.id}</param>
      </params>
    </action>

    <action-group id="document_browse_menu">
      <action idref="preview_doc" />
      <action idref="update_doc" />
      <action idref="cancelcheckout_doc" />
      <action idref="custom_approve_doc" />
      <action idref="reject_doc" />
      <action idref="cut_node" />
      <action idref="copy_node" />
    </action-group>

You obviously need to change this for all places that the action is used i.e. in every action group.

Hope this helps.

alpha
Champ in-the-making
Champ in-the-making
thanks Gavin
Sounds pretty good ideas, i will try them.

Jey, i have tried your tip, actually it doesn't work very well.
When i approve, the document appears in the current space (and it is supposed to be moved to the destination). No error is displayed, when i check the destination folder the document is there, and when i go back to the folder where it was moved from, it's no more there.
Actually i have to get into a another space and come back to my space to see that my document has been moved.

maybe it's a problem with refreshing the current node…i don't really now.:?

Thanks for all