changeset 577:60caaa265e2b

Render a matrix for measurement selection (measurement-parameter). gnv/trunk@714 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Feb 2010 13:54:47 +0000
parents b21fc7502750
children fe825061b83e
files gnv/ChangeLog gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl gnv/src/main/webapp/styles/default.css
diffstat 3 files changed, 69 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Thu Feb 25 08:18:41 2010 +0000
+++ b/gnv/ChangeLog	Fri Feb 26 13:54:47 2010 +0000
@@ -1,3 +1,11 @@
+2010-02-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render a matrix
+	  for measurement selection.
+
+	* src/main/webapp/styles/default.css: Added new css class to adjust the
+	  matrix' column headers.
+
 2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue178
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Thu Feb 25 08:18:41 2010 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Fri Feb 26 13:54:47 2010 +0000
@@ -73,14 +73,69 @@
 
 
     <xsl:template match="xform:group">
+        <xsl:variable name="selectcount" select="count(xform:select)"/>
+
         <legend>
             <xsl:value-of select="xform:label"/>
         </legend>
-        <table class="dynamic">
-            <xsl:apply-templates/>
+
+        <xsl:choose>
+            <xsl:when test="$selectcount &lt; '2'">
+                <table class="dynamic">
+                    <xsl:apply-templates/>
+                </table>
+            </xsl:when>
+            <xsl:otherwise>
+                <table class="static">
+                    <tr>
+                        <td><!-- nothing here --></td>
+                        <xsl:for-each select="xform:select[1]/xform:item">
+                            <td class="matrixHeader"><xsl:value-of select="position()"/>.</td>
+                        </xsl:for-each>
+                    </tr>
+                    <xsl:apply-templates mode="matrix" />
+                </table>
+                <xsl:apply-templates select="xform:select[1]" mode="matrixLegend"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <!-- template for rendering parameter matrix -->
+    <xsl:template match="xform:select" mode="matrix">
+        <tr>
+            <td><xsl:value-of select="@label" /></td>
+            <xsl:apply-templates mode="matrix" />
+        </tr>
+    </xsl:template>
+
+    <!-- template for rendering parameter matrix -->
+    <xsl:template match="xform:select" mode="matrixLegend">
+        <table>
+            <xsl:for-each select="xform:item">
+                <tr>
+                    <td><xsl:value-of select="position()" />.:</td>
+                    <td><xsl:value-of select="@parameter" /></td>
+                </tr>
+            </xsl:for-each>
         </table>
     </xsl:template>
 
+    <!-- template for rendering parameter matrix -->
+    <xsl:template match="xform:item" mode="matrix">
+        <xsl:variable name="value" select="xform:value/text()"/>
+        <xsl:variable name="name" select="@ref"/>
+        <td>
+            <xsl:choose>
+            <xsl:when test="@disabled = 'true'">
+                <input type="checkbox" name="{$name}" value="{$value}" disabled="true"></input>
+            </xsl:when>
+            <xsl:otherwise>
+                <input type="checkbox" name="{$name}" value="{$value}"></input>
+            </xsl:otherwise>
+            </xsl:choose>
+        </td>
+    </xsl:template>
+
 
     <xsl:template match="xform:input">
         <xsl:variable name="inputValue" select="xform:value"/>
--- a/gnv/src/main/webapp/styles/default.css	Thu Feb 25 08:18:41 2010 +0000
+++ b/gnv/src/main/webapp/styles/default.css	Fri Feb 26 13:54:47 2010 +0000
@@ -131,6 +131,10 @@
     width:          100px;
 }
 
+.matrixHeader {
+    padding-left: 5px;
+}
+
 .value {
     font-size: 1.2em;
 }

http://dive4elements.wald.intevation.org