Mercurial > dive4elements > gnv-client
changeset 413:0ce07c6e132c
Refactored xsl sheet for ui's dynamic part: Removed local-name() method, put 'group' items into a table to be well aligned and set the size of multi select boxes to max 5 items or less.
gnv/trunk@621 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 25 Jan 2010 14:53:38 +0000 |
parents | 49898531c0b6 |
children | 59c6c7b62e43 |
files | gnv/ChangeLog gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl gnv/src/main/webapp/WEB-INF/jsp/index.jsp gnv/src/main/webapp/styles/default.css |
diffstat | 4 files changed, 98 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Fri Jan 22 17:54:55 2010 +0000 +++ b/gnv/ChangeLog Mon Jan 25 14:53:38 2010 +0000 @@ -1,3 +1,16 @@ +2010-01-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/styles/default.css: Added a class for dynamic tables + - enabled input fields - to adjust font size of input fields. + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Removed + local-name() method, inserted a table for 'group' items (like input fields + of dates) and resized the height of multi select boxes - max 5 items or + less. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Removed a typo which made the html + output invalid. + 2010-01-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Add width,
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Fri Jan 22 17:54:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Mon Jan 25 14:53:38 2010 +0000 @@ -3,44 +3,77 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/2002/xforms" xmlns:xform="http://www.w3.org/2002/xforms" - xmlns:art="http://www.intevation.de/2009/artifacts"> - <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/> - - <xsl:template match="*[local-name() = 'select']"> - <xsl:variable name="selectName" select="@ref"/> - <legend><xsl:value-of select="*[local-name() = 'label']"/></legend> - <select name="{$selectName}" multiple="multiple" size="6"> <xsl:apply-templates/></select> - <br/> - </xsl:template> - <xsl:template match="*[local-name() = 'select1']"> + xmlns:art="http://www.intevation.de/2009/artifacts" + exclude-result-prefixes="xform art"> + + <xsl:output + method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no" /> + + <!-- single select --> + <xsl:template match="xform:select1"> <xsl:variable name="selectName" select="@ref"/> - <legend><xsl:value-of select="*[local-name() = 'label']"/></legend> - <select name="{$selectName}"> <xsl:apply-templates/></select> - <br/> - </xsl:template> - <xsl:template match="*[local-name() = 'item']"> - <xsl:variable name="optionValue" select="*[local-name() = 'value']"/> + <legend><xsl:value-of select="xform:label"/></legend> + <select name="{$selectName}"> + <xsl:apply-templates /> + </select> + </xsl:template> + + + <!-- multi select --> + <xsl:template match="xform:select"> + <xsl:variable name="selectName" select="@ref"/> + <xsl:variable name="items" select="count(//xform:item)"/> + + <legend><xsl:value-of select="xform:label"/></legend> <xsl:choose> - <xsl:when test="@selected = 'true'"> - <option value="{$optionValue}" selected="selected"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option> - </xsl:when> - <xsl:otherwise> - <option value="{$optionValue}"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option> - </xsl:otherwise> + <xsl:when test="$items < 5"> + <select name="{$selectName}" multiple="multiple" size="{$items}"> + <xsl:apply-templates/> + </select> + </xsl:when> + <xsl:otherwise> + <select name="{$selectName}" multiple="multiple" size="5"> + <xsl:apply-templates /> + </select> + </xsl:otherwise> </xsl:choose> </xsl:template> - - <xsl:template match="*[local-name() = 'group']"> - <xsl:variable name="selectName" select="@ref"/> - <legend><xsl:value-of select="*[local-name() = 'label']"/></legend> - <xsl:apply-templates/> - </xsl:template> - - <xsl:template match="*[local-name() = 'input']"> - <xsl:variable name="inputValue" select="*[local-name() = 'value']"/> + + + <!-- options for select --> + <xsl:template match="xform:item"> + <xsl:variable name="optionValue" select="xform:value"/> + <xsl:choose> + <xsl:when test="@selected = 'true'"> + <option value="{$optionValue}" selected="selected"> + <xsl:value-of select="xform:label"/> + </option> + </xsl:when> + <xsl:otherwise> + <option value="{$optionValue}"> + <xsl:value-of select="xform:label"/> + </option> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="xform:group"> + <legend> + <xsl:value-of select="xform:label"/> + </legend> + <table class="dynamic"> + <xsl:apply-templates/> + </table> + </xsl:template> + + + <xsl:template match="xform:input"> + <xsl:variable name="inputValue" select="xform:value"/> <xsl:variable name="inputName" select="@ref"/> + <xsl:variable name="label" select="xform:label"/> - <!-- TODO: Remove this when we have the GIS interface. (slt) --> + <!-- TODO: Remove this when we have the GIS interface. (slt) --> <xsl:choose> <xsl:when test="$inputName = 'mesh_linestring'"> <a href="javascript:copy_demo_wkt_line();"><xsl:text>Beispiel WKT-Linestring einfügen:</xsl:text></a><br/> @@ -50,15 +83,22 @@ </xsl:when> </xsl:choose> - <xsl:choose> - <xsl:when test="*[local-name() = 'label']!= ''"> - <xsl:value-of select="*[local-name() = 'label']"/>: - </xsl:when> - </xsl:choose> + <tr> + <xsl:choose> + <xsl:when test="$label != ''"> + <td><xsl:value-of select="$label"/>:</td> + </xsl:when> + </xsl:choose> - <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" /><br/> + <td> + <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" /><br/> + </td> + </tr> </xsl:template> - - <xsl:template match="*[local-name() = 'label']"> + + + <xsl:template match="xform:label"> + <!-- do nothing here --> </xsl:template> + </xsl:stylesheet>
--- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Jan 22 17:54:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Mon Jan 25 14:53:38 2010 +0000 @@ -29,7 +29,7 @@ <%-- render the dynamic part to feed the state and advance to the next state --%> <%if (ui != null){%> <div id="timeseriesfilter"> - <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>") method="post"> + <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>" method="post"> <fieldset> <%=ui != null ? ui.toString().replaceAll(" ", "") : "" %>