Mercurial > dive4elements > gnv-client
changeset 401:002a4d38c16d
Added a link to jump back to the fis selection.
gnv/trunk@568 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 18 Jan 2010 16:21:54 +0000 |
parents | a8b1875dcd93 |
children | b88e881e8e94 |
files | gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java gnv/src/main/java/de/intevation/gnv/action/SelectFisAction.java gnv/src/main/webapp/WEB-INF/config/struts-config.xml gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl |
diffstat | 6 files changed, 103 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Mon Jan 18 13:42:44 2010 +0000 +++ b/gnv/ChangeLog Mon Jan 18 16:21:54 2010 +0000 @@ -1,3 +1,19 @@ +2010-01-18 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added a new controller + which causes a return to the point, where the user can choose a fis. + + * src/main/java/de/intevation/gnv/action/SelectFisAction.java: Controller to + reset the SessionModel and to jump back to fis selection. + + * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: Made + the link to return to the fis select box available in XSL. + + * src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Check the + 'fis' attribute is contained in select1 nodes and create a link in this + case. + 2010-01-18 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java:
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Mon Jan 18 13:42:44 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Mon Jan 18 16:21:54 2010 +0000 @@ -111,6 +111,10 @@ mapping.findForward("back").getPath()); transformer.addParameter("back-url", url); + String fisUrl = response.encodeURL( + mapping.findForward("selectfis").getPath()); + transformer.addParameter("selectfis", fisUrl); + Node dynamicUINode = new XMLUtils().getNodeXPath(currentUI,"art:dynamic"); if (dynamicUINode != null){ String ui = transformer @@ -170,6 +174,11 @@ String url = response.encodeURL( mapping.findForward("back").getPath()); transformer.addParameter("back-url", url); + + String fisUrl = response.encodeURL( + mapping.findForward("selectfis").getPath()); + transformer.addParameter("selectfis", fisUrl); + Node dynamicUINode = new XMLUtils().getNodeXPath(currentUI,"art:dynamic"); if (dynamicUINode != null){ String ui = transformer
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Jan 18 13:42:44 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Jan 18 16:21:54 2010 +0000 @@ -75,7 +75,11 @@ ArtifactDescription artifactdescription = adc .getCurrentStepDescription(af, artifact,true); + String fisUrl = response.encodeURL( + mapping.findForward("selectfis").getPath()); + XSLTransformer transformer = new XSLTransformer(); + transformer.addParameter("selectfis", fisUrl); Node dynamicUINode = new XMLUtils().getNodeXPath( artifactdescription.getCurrentUI(), "art:dynamic"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectFisAction.java Mon Jan 18 16:21:54 2010 +0000 @@ -0,0 +1,53 @@ +package de.intevation.gnv.action; + +import de.intevation.gnv.action.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + + +/** + * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + */ +public class SelectFisAction extends ArtifactDatabaseActionBase { + + private static Logger logger = Logger.getLogger(SelectFisAction.class); + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response + ) { + logger.info("Goto fis selection."); + + try { + + SessionModelFactory fac = SessionModelFactory.getInstance(); + SessionModel sm = fac.getSessionModel(request); + + sm.resetModel(); + + return new FetchArtifactFactoriesAction().execute( + mapping, form, request, response); + } + catch (Exception e) { + logger.error(e, e); + + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + e.getMessage()); + + return super.getExceptionForward(mapping); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Jan 18 13:42:44 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Jan 18 16:21:54 2010 +0000 @@ -32,6 +32,9 @@ <forward name="success" path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="selectfis" + path="/gnv/selectFis.do"/> </action> <action path="/back" type="de.intevation.gnv.action.PreviousArtifactStepAction" @@ -41,7 +44,15 @@ name="success" path="/WEB-INF/jsp/mainlayout.jsp"/> </action> - <action path="/next" + <action path="/selectFis" + type="de.intevation.gnv.action.SelectFisAction" + scope="request" + validate="false"> + <forward + name="success" + path="/WEB-INF/jsp/mainlayout.jsp"/> + </action> + <action path="/next" type="de.intevation.gnv.action.NextArtifactStepAction" scope="request" validate="false"> @@ -51,8 +62,11 @@ <forward name="back" path="/gnv/back.do"/> + <forward + name="selectfis" + path="/gnv/selectFis.do"/> </action> - <action path="/out" + <action path="/out" type="de.intevation.gnv.action.DoOutputAction" scope="request" validate="false">
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl Mon Jan 18 13:42:44 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl Mon Jan 18 16:21:54 2010 +0000 @@ -8,6 +8,7 @@ <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no" /> <xsl:param name="back-url"/> + <xsl:param name="selectfis"/> <!-- start parsing document --> <xsl:template match="*"> @@ -35,11 +36,15 @@ <!-- match select boxes --> <xsl:template match="xform:select1"> <xsl:variable name="state" select="@art:state" /> + <xsl:variable name="fis" select="@art:fis" /> <tr> <td class="historyback"> <xsl:if test="$state != ''"> <a href="{$back-url}?target={$state}">[X]</a> </xsl:if> + <xsl:if test="$fis"> + <a href="{$selectfis}">[X]</a> + </xsl:if> </td> <th class="parameter"><xsl:value-of select="xform:label" /></th> <td><xsl:apply-templates select="xform:choices" /></td>