diff gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl @ 582:b8ea9383d285

Implemented a One-Step-Back-History. gnv/trunk@723 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Mar 2010 10:53:30 +0000
parents f21ad239c748
children 21ad44ccdb84
line wrap: on
line diff
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl	Tue Mar 02 09:02:31 2010 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl	Tue Mar 02 10:53:30 2010 +0000
@@ -12,6 +12,7 @@
     <xsl:param name="back-url"/>
     <xsl:param name="selectfis"/>
     <xsl:param name="edit">bearbeiten</xsl:param>
+    <xsl:param name="total"><xsl:value-of select="count(*)"/></xsl:param>
 
     <!-- start parsing document -->
     <xsl:template match="*">
@@ -23,37 +24,48 @@
     
     <!-- match multi select boxes -->
     <xsl:template match="xform:select">
-        <xsl:variable name="state" select="@art:state" />
         <tr>
             <th class="parameter"><xsl:value-of select="xform:label" /></th>
             <td><xsl:apply-templates select="xform:choices" /></td>
             <td class="historyback">
-                <xsl:if test="$state != ''">
-                    <a href="{$back-url}?target={$state}">
-                        <img title="{$edit}" alt="{$edit}" src="images/back_button.png"/>
-                    </a>
-                </xsl:if>
+                <xsl:call-template name="InsertEdit">
+                    <xsl:with-param name="state" select="@art:state" />
+                    <xsl:with-param name="index" select="position()" />
+                    <xsl:with-param name="fis" select="@art:fis" />
+                </xsl:call-template>
             </td>
         </tr>
     </xsl:template>
 
 
+    <xsl:template name="InsertEdit">
+        <xsl:param name="state" />
+        <xsl:param name="index" />
+        <xsl:param name="fis" />
+        <xsl:if test="$state != ''">
+            <xsl:if test="$index = $total">
+                <a href="{$back-url}?target={$state}">
+                    <img title="{$edit}" alt="{$edit}" src="images/back_button.png"/>
+                </a>
+            </xsl:if>
+        </xsl:if>
+        <xsl:if test="$fis">
+            <a href="{$selectfis}"><img title="{$edit}" alt="{$edit}" src="images/back_button.png"/></a>
+        </xsl:if>
+    </xsl:template>
+
+
     <!-- match select boxes -->
     <xsl:template match="xform:select1">
-        <xsl:variable name="state" select="@art:state" />
-        <xsl:variable name="fis" select="@art:fis" />
         <tr>
             <th class="parameter"><xsl:value-of select="xform:label" /></th>
             <td><xsl:apply-templates select="xform:choices" /></td>
             <td class="historyback">
-                <xsl:if test="$state != ''">
-                    <a href="{$back-url}?target={$state}">
-                        <img title="{$edit}" alt="{$edit}" src="images/back_button.png"/>
-                    </a>
-                </xsl:if>
-                <xsl:if test="$fis">
-                    <a href="{$selectfis}"><img title="{$edit}" alt="{$edit}" src="images/back_button.png"/></a>
-                </xsl:if>
+                <xsl:call-template name="InsertEdit">
+                    <xsl:with-param name="state" select="@art:state" />
+                    <xsl:with-param name="index" select="position()" />
+                    <xsl:with-param name="fis" select="@art:fis" />
+                </xsl:call-template>
             </td>
         </tr>
     </xsl:template>
@@ -75,16 +87,17 @@
 
     <!-- match group items -->
     <xsl:template match="xform:group">
-        <xsl:variable name="state" select="@art:state" />
         <tr>
             <th class="parameter"><xsl:value-of select="xform:label" /></th>
             <td>
                 <table><xsl:apply-templates select="xform:input" /></table>
             </td>
             <td class="historyback">
-                <xsl:if test="$state != ''">
-                    <a href="{$back-url}?target={$state}"><img title="{$edit}" alt="{$edit}" src="images/back_button.png"/></a>
-                </xsl:if>
+                <xsl:call-template name="InsertEdit">
+                    <xsl:with-param name="state" select="@art:state" />
+                    <xsl:with-param name="index" select="position()" />
+                    <xsl:with-param name="fis" select="@art:fis" />
+                </xsl:call-template>
             </td>
         </tr>
     </xsl:template>

http://dive4elements.wald.intevation.org