Mercurial > dive4elements > gnv-client
changeset 682:d3062dc8626a
Application is now sensitive to changes of the preferred browser language in the current session (issue30).
gnv/trunk@853 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 29 Mar 2010 08:46:21 +0000 |
parents | 15ac78a91d1b |
children | d49e8695786c |
files | gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java gnv/src/main/webapp/WEB-INF/config/struts-config.xml |
diffstat | 4 files changed, 27 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/ChangeLog Mon Mar 29 08:46:21 2010 +0000 @@ -1,3 +1,23 @@ +2010-03-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue30 + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Use the + correct locale for i18n supported by HttpServletRequest object. The + application language is switched after the next server round-trip if the + user changes the preferred browser language. + Hint: Struts' Action class has a method getLocale(HttpServletRequest) + which should return the currently selected locale. This method seems to be + buggy - returns session's initial locale. + + * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java: + Inherit from DescribeUIAction. The rendering stuff is now done by + DescribeUIAction. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forward + used for stepping back to a previous state in SelectArtifactFactory + action. + 2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/gnv/**/*.java:
--- a/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Mon Mar 29 08:46:21 2010 +0000 @@ -19,6 +19,7 @@ import org.apache.log4j.Logger; +import org.apache.struts.Globals; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; @@ -62,7 +63,8 @@ request); ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory - .getInstance().getArtifactDatabaseClient(getLocale(request)); + .getInstance().getArtifactDatabaseClient(request.getLocale()); + request.getSession().setAttribute(Globals.LOCALE_KEY, request.getLocale()); ArtifactDescription artifactDescription = adc.getCurrentStepDescription(
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Mar 29 08:46:21 2010 +0000 @@ -28,7 +28,7 @@ * @author Tim Englich <tim.englich@intevation.de> * */ -public class SelectArtifactFactoryAction extends ArtifactDatabaseActionBase { +public class SelectArtifactFactoryAction extends DescribeUIAction { /** * the logger, used to log exceptions and additonaly information */ @@ -72,41 +72,6 @@ ArtifactObject artifact = adc.createNewArtifact(af); sm.setCurrentArtifact(artifact); - 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" - ); - - if (dynamicUINode != null){ - String ui = transformer.transform( - dynamicUINode, - "UTF-8", - request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); - - request.setAttribute("ui", ui); - } - - Node staticUINode = new XMLUtils().getNodeXPath( - artifactdescription.getCurrentUI(), "art:static" - ); - - if (staticUINode != null) { - String staticUI = transformer.transform( - staticUINode, - "UTF-8", - request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); - request.setAttribute("staticui", staticUI); - } - - // return succsess return super.execute(mapping, form, request, response); } catch (Exception e) { log.error(e, e);
--- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Mar 29 08:46:21 2010 +0000 @@ -76,6 +76,9 @@ <forward name="success" path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="back" + path="/gnv/back.do"/> <forward name="selectfis" path="/gnv/selectFis.do"/>