cancel
Showing results for 
Search instead for 
Did you mean: 

what does dialog:close do and how can i intervene?

netos
Champ in-the-making
Champ in-the-making
hi,

i am currently changing the logic of how associations are handled so that a user can go from modifying a content's properties to modifying the association's properties with a single click.

i did that by adding an action link instead of the path to the association, and gave the path as the link to show. the parameters to the action link were exactly like in the action details_doc in web-client-config-action.

all works great but the problem is that when i press close after modifying the association's properties, i go back to the space i was in and not to the properties of the content that owns the association.(where i came from).
if i don't modify the properties the first click on close does nothing and the second one takes you back to the space as before.

i tried to figure out the logic behind dialog:close and couldn't find anything.

any help would be appreciated.

thx, netanel.
14 REPLIES 14

gavinc
Champ in-the-making
Champ in-the-making
All the logic for dialog:close is in org.alfresco.web.app.AlfrescoNavigationHandler.

Basically when JSF sees the 'dialog:close' outcome it will navigate to the last page in the view stack for the dialog. Did you open your association property edit page with a dialog:xxxx action? If not, dialog:close won't know where to go back to, or will go back to the last page that launched a dialog, this may explain why you go back to the space.

Another possiblity is that the dialog:close outcome has been overridden. If it looks something like "dialog:close:browse", then all dialogs are closed and JSF looks up and follows the navigation rule for the "browse" action.

Hope that helps!

netos
Champ in-the-making
Champ in-the-making
thx, it helped me to understand, but it is not what you assumed.

as i said, my action link acts exactly like the details_doc action, which action is dialog:showDocDetails.

so i am launching a dialog action, but still the dialog:close does not take me back to where i wanted. dialog:close is not overridden, it is the action of the commandButton in document-details.jsp.

so my actions are actually showDocDetails –> showDocDetails –> close.
before that i navigate to a space, and it is not a dialog action, but it still goes back there and not to the first doc details.

can i see this view stack somehow so i can be sure? any other ideas?

thx again.

gavinc
Champ in-the-making
Champ in-the-making
Ok I see now!

Yes you can see what's going on by turning on debugging for the AlfrescoNavigationHandler i.e. add this to your log4j.properties file:

log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug

What version of Alfresco are you using? If you're not using the latest HEAD code from SVN you will probably notice that the document details page in the  view stack only gets added once, even though you have effectively launched it twice. As a result when you click Close the dialog framework goes back to the space view and not the first docs details.

One of the problems is that document details is still a "Simple Dialog" (see  http://wiki.alfresco.com/wiki/Dialog_Framework#Simple_Dialogs). So one possibility is to copy/paste the document details JSP and create a separate JSP and navigation rule for it. The dialog framework will then treat them as different dialogs.

In the latest HEAD code or nightly builds the document details page should now be a proper configured dialog which gives you more scope for overriding it.

netos
Champ in-the-making
Champ in-the-making
great that explains everything!!

i am not using the HEAD code, but alfresco 2.1, so you actually gave me a good solution with the copied jsp, but i was wondering about the better solution of configuring the doc details as a proper dialog, how complicated is that? where do i start?

thx.

gavinc
Champ in-the-making
Champ in-the-making
It's generally not complicated to create/convert a proper dialog, you just define the configuration, see web-client-config-dialogs.xml for examples, define and implement a managed bean and strip out all the chrome from an existing JSP, just leaving the 'body' of the dialog.

However, in the case of the document details page, it was fairly central to a lot of functionality so it's not so easy to extract it out. To be honest I wasn't the one that converted it so I don't know all the details, I'd suggest getting the latest HEAD code and trace back the changes. As a starting point the document details dialog is defined in org.alfresco.web.bean.content.DocumentDetailsDialog

netos
Champ in-the-making
Champ in-the-making
i didn't catch your drift about the chrome and body, but you have been a great help anyways, i will have a look at the HEAD code and see what i can come up with.

thanks a lot gavin!!

gavinc
Champ in-the-making
Champ in-the-making
A "simple" dialog JSP has the tags for the whole page i.e. the whole page structure, header, shelf etc. etc. A "proper" dialog JSP only needs the UI that provides the functionality for the dialog.

So I was meaning removing all the "structure" code from the old JSP page to just leave the bit that actually represents what the dialog does.

netos
Champ in-the-making
Champ in-the-making
thanks gavin i got it now.
sounds untrivial, i haven't had a chance to look at the HEAD code yet.

i did try the copied jsp solution, and suprisingly it does not work.
i debuged AlfrescoNavigationHandler, and what i saw is that because it uses the NavigationHandler dispatchContext, even though the view stack is correctly handled, and i suspect it is the case even before i duplicated the jsp, it goes back to the docDetails of the node in the dispatchContext, and that node is the association and not it's "father". so it shows me the same screen twice.

i will try to see if i can make it a "rule" and manipulate the dispatchContext on that dialog.

please do help if you can think of something else.

thx.

gavinc
Champ in-the-making
Champ in-the-making
You're correct, you need to reset the context back to that of the content, this is not just the dispatch context but the context for the DocumentDetailsBean as well, you will also need to do whatever "BrowseBean.setupContentAction()" does as that "sets the scene" ready for the document details page.

If you've got a copy of the JSP now you can adjust the 'action' for the Close button to call a method on a managed bean. You can then set the context back to the correct state before the dialog closes. For example your close button will be:

<h:commandButton id="close-btn" value="#{msg.close}" action="#{YourBean.yourMethod}" styleClass="wizardButton" />

and in your managed bean you can do:

public String yourMethod()
{
   // reset context

   return "dialog:close";
}

Hope this helps!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.