diff gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl @ 1002:b1eea43ba133

Second attempt to apply redirect link patch. gnv/trunk@1206 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 13 Jun 2010 16:28:37 +0000
parents 27029f0ec7e1
children a0d16ccb82ba
line wrap: on
line diff
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Fri Jun 11 12:11:52 2010 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Sun Jun 13 16:28:37 2010 +0000
@@ -11,21 +11,70 @@
 
     <xsl:param name="example-linestring"/>
     <xsl:param name="example-polygon"/>
+    <xsl:param name="uuid"/>
+    <xsl:param name="next-url">/gnv/next.do</xsl:param>
+    <xsl:param name="further">false</xsl:param>
+    <xsl:param name="exception"/>
+    <xsl:param name="gnviewer-select-button-src">./images/auswaehlen.png</xsl:param>
+
+    <xsl:template match="art:ui">
+        <xsl:if test="$further = 'true'">
+            <div id="timeseriesfilter"> 
+                <form id="fisSelectionForm" 
+                      onsubmit="displayOverlay()" 
+                      action="{$next-url}" 
+                      method="post">
+                <fieldset>
+                    <xsl:if test="$exception != ''">
+                        <div class="inputException"><xsl:value-of select="$exception"/></div>
+                    </xsl:if>
+                    <input type="hidden" name="artifact-uuid" value="{$uuid}"/>
+                    <xsl:apply-templates select="art:dynamic"/>
+                    <xsl:variable name="item-count" select="count(art:dynamic//xform:select1//xform:item)"/>
+                    <xsl:if test="$item-count = 0 or $item-count &gt; 5">
+                        <br/> 
+                        <input style="margin-top: 5px;" type="image" src="{$gnviewer-select-button-src}"/>
+                    </xsl:if>
+                </fieldset>
+                </form>
+            </div>
+        </xsl:if>
+    </xsl:template>
 
     <!-- single select -->
-    <xsl:template match="xform:select1">
+    <xsl:template match="xform:select1" >
         <xsl:variable name="selectName" select="@ref"/>
+        <xsl:variable name="items" select="count(.//xform:item)"/>
         <legend><xsl:value-of select="xform:label"/></legend>
-        <select name="{$selectName}">
-            <xsl:apply-templates />
-        </select>
+        <xsl:choose>
+            <xsl:when test="$items &lt; 6">
+                <xsl:apply-templates mode="direct-link"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <select name="{$selectName}">
+                    <xsl:apply-templates />
+                </select>
+            </xsl:otherwise>
+        </xsl:choose>
     </xsl:template>
 
+    <xsl:template match="text()" mode="direct-link"/>
+
+    <!-- options for select: direct-link -->
+    <xsl:template match="xform:item" mode="direct-link">
+        <xsl:variable name="optionValue" select="xform:value"/>
+        <xsl:variable name="selectName" select="ancestor::xform:select1/@ref"/>
+        <a class="linkButton"
+            onclick="displayOverlay()"
+            href="{$next-url}?{$selectName}={$optionValue}"><xsl:value-of select="xform:label"/></a>
+        <br/>
+        <br/>
+    </xsl:template>
 
     <!-- multi select -->
     <xsl:template match="xform:select">
         <xsl:variable name="selectName" select="@ref"/>
-        <xsl:variable name="items" select="count(//xform:item)"/>
+        <xsl:variable name="items" select="count(.//xform:item)"/>
         <legend>
             <xsl:value-of select="xform:label"/>
         </legend>

http://dive4elements.wald.intevation.org