cancel
Showing results for 
Search instead for 
Did you mean: 

Custom browse.jsp and navigation override

sebp
Champ in-the-making
Champ in-the-making
I wrote a custom browse.jsp to be displayed for folders with a certain aspect only. Therefore I have overriden the navigation rules to browse to my
/jsp/pemappe/posteingang-browse.jsp page as follows:


<config evaluator="aspect-name" condition="pemappe:posteingangsordner">
      <navigation>
           <override from-view-id="/jsp/browse/browse.jsp" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-view-id="/jsp/pemappe/posteingang-browse.jsp" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-view-id="/jsp/*" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-view-id="/jsp/wizard/*" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-outcome="browse" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-outcome="finish" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-outcome="cancel" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-outcome="success" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
           <override from-outcome="browse" to-view-id="/jsp/pemappe/posteingang-browse.jsp" />
       </navigation>
</config>

It mostly works. But it doesn't if I am in that folder and click on "Add Content" and finish the wizard or if I checkout a document. After these wizards the standard browse.jsp is displayed. What other navigation rules do I need (I'm using Alfresco Community 3.2r2)?
9 REPLIES 9

david_labbe
Champ in-the-making
Champ in-the-making
Hi there,

I am facing a similar issue and have been looking into a solution for a little while.

It seems that for the conditions in the wizards, there is a "base condition handler" in the source code where the redirection is hard coded:

if you have checked out the community 3.3 branch from the svn, check out the BaseConditionHandler.java file located in:
HEAD\root\projects\web-client\source\java\org\alfresco\web\bean\rules\handlers

on line 37:

   protected static final String CONDITION_PAGES_LOCATION = "/jsp/rules/";


That's a bit of a pain as it is hard coded into the core web-client. You would need to modify it to /jsp/pemappe/rules/ in your case, recompile the whole lot and copy the alfresco-web-client-3.3.jar file into your alfresco webapp (in alfresco/WEB-INF/lib).

I am not sure this is the best way of doing it as it involves messing around the core code, but that is the only way I found so far.

As I am going through the customization of the Explorer, I am finding out a few "hard coded" path and styles making it a little bit difficult to adapt. Again, being a total newb with Alfresco, I might be going about it the wrong way…

Anyway, I hope this help, and I would be very interested in finding out if this is the only way to cope with the redirection in the wizards and if other people have suggestions and tips about the general customization of the styles (those hard coded as opposed to those in the obvious css files)…

Kind regards

David

david_labbe
Champ in-the-making
Champ in-the-making
by the way, you will be hit by the same problem with the action wizards…

in BaseConditionHandler.java file located in:
HEAD\root\projects\web-client\source\java\org\alfresco\web\bean\actions\handlers

line 33


   protected static final String ACTION_PAGES_LOCATION = "/jsp/actions/";

change it to /jsp/pemappe/actions/ and recompile… then copy the alfresco-web-client-3.3.jar file into your alfresco webapp (in alfresco/WEB-INF/lib).

PS: I have just seen you are working with the community 3.2 version but I am sure it is the same.

Hope this helps

Regards

David

david_labbe
Champ in-the-making
Champ in-the-making
just a thought for the Alfresco developers. It might be totally impossible, and I might be talking nonsense (I have zero experience in java and know very little of Alfresco), but would it be better, for the sake of customization if there was some sort of default directory where pretty much any customization would go (in a similar folder structure than the actual code) and the code would have "built-in" checks to see first if the file or path exist in the custom directory, if not use the default one… I have had quite a lot of experience with php and Joomla, and this is a technique used to customize the templates…

just a thought…

Kind regards

David

david_labbe
Champ in-the-making
Champ in-the-making
Not much activity on this thread? Can anyone tell me if I am doing this right?

Thanks

david

david_labbe
Champ in-the-making
Champ in-the-making
Well I guess since nobody is commenting, it must be the only way to do so! Hmmm! 😞

Cheers

David

sebp
Champ in-the-making
Champ in-the-making
Hi David,
thanks for all your replies. I gave up trying to find a solution. I still have the navigation problem and our current workaround is that if the users do not see the custom browse.jsp then they should reload the page by clicking on the folder name in the breadcrumb. Not nice, but it works. I don't want to change the source code since all these changes must be checked and revised if a new Alfresco version comes out (and I already have lots of changes and fixes to check).
Since nobody else is answering this thread we are the only ones having this problem  Smiley Indifferent

david_labbe
Champ in-the-making
Champ in-the-making
Hi Sebp,

I guess we must be. With regards to the modifications to the source code, I agree with you, although on this one, this really is the only possibility and they are very simple changes. As I have already modified a few litltle things in the code (eliminating the scary footer saying unsupported and blablabla and a few other things), I don't mind the changes involved here. I guess if I start getting too many changes to the codes, I will wonder whether I am doing the right thing.

Good luck to you.

Cheers

David

kgeis
Champ on-the-rise
Champ on-the-rise
You're not the only ones having this problem.  It's apparently just never been given priority.  There's ALFCOM-372 posted three years ago and ALF-2856 posted two years ago.

sebp, I'm going with your workaround but I'm hoping to resolve the issue before our second release a few months from now.

shmoula
Champ in-the-making
Champ in-the-making
Hi guys,
  I have following navigation rules:

<config evaluator="aspect-name" condition="txt:folder">
         <navigation>
        <override from-view-id="/jsp/browse/browse.jsp" to-view-id="/jsp/txt/browse.jsp" />
        <override from-outcome="browse" to-view-id="/jsp/teletext/browse.jsp" />
        <override from-outcome="dialog:close" to-view-id="/jsp/teletext/browse.jsp" />
     </navigation>
   </config>
  
   <config evaluator="aspect-name" condition="txt:folder">
         <navigation>
        <override from-view-id="/jsp/dialog/container.jsp" to-view-id="/jsp/txt/browse.jsp" />
        <override from-outcome="browse" to-view-id="/jsp/teletext/browse.jsp" />
        <override from-outcome="dialog:close" to-view-id="/jsp/teletext/browse.jsp" />
     </navigation>
   </config>

Also my own dialog:

public class ModifyTxtFolder extends BaseDialogBean {
. . .
@Override
public String cancel(){
    String outcome = super.cancel();

    navigator.setupDispatchContext(navigator.getCurrentNode());
    FacesContext fc = FacesContext.getCurrentInstance();
    fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome);

    return outcome;
}
. . .
}

My log after cancel button is pressed (and view is returned back to default browse.jsp):

18:33:34,558 User:admin DEBUG [web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=dialog:close)
18:33:34,558 User:admin DEBUG [web.app.AlfrescoNavigationHandler] Current view id: /jsp/dialog/container.jsp
18:33:34,559 User:admin DEBUG [web.app.AlfrescoNavigationHandler] Closing dialog
18:33:34,559 User:admin DEBUG [web.app.AlfrescoNavigationHandler] Popped item from the top of the view stack: /jsp/browse/browse.jsp
18:33:34,560 User:admin DEBUG [web.app.AlfrescoNavigationHandler] view stack: []
18:33:34,560 User:admin DEBUG [web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{DialogManager.cancel}, outcome=dialog:close)
18:33:34,560 User:admin DEBUG [web.app.AlfrescoNavigationHandler] Current view id: /jsp/browse/browse.jsp
18:33:34,560 User:admin DEBUG [web.app.AlfrescoNavigationHandler] Attempting to close a dialog with an empty view stack, returning 'browse' outcome
18:33:34,560 User:admin DEBUG [web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
18:33:34,560 User:admin DEBUG [web.app.AlfrescoNavigationHandler] view stack: []

I've got problems with this in another project two years ago and as I can see it still doesn't work. Am I doing anything wrong, or that problem is still there?

(crosspost: https://forums.alfresco.com/en/viewtopic.php?f=9&t=1217&p=120172#p120172 and https://forums.alfresco.com/en/viewtopic.php?f=10&t=2392&p=120173#p120173)