changeset 2912:329db21372ba

FixA: Extent of overview is determined by min/max km of sectors. flys-client/trunk@4733 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 20 Jun 2012 17:30:42 +0000 (2012-06-20)
parents 37dce0f2f63b
children 6d96443ed6e6
files flys-client/ChangeLog flys-client/src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl
diffstat 2 files changed, 52 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Jun 20 08:52:00 2012 +0000
+++ b/flys-client/ChangeLog	Wed Jun 20 17:30:42 2012 +0000
@@ -1,3 +1,8 @@
+2012-06-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl:
+	  Extent of overview is determined by min/max km of sectors.
+
 2012-06-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/ThemeListingServiceImpl.java,
--- a/flys-client/src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl	Wed Jun 20 08:52:00 2012 +0000
+++ b/flys-client/src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl	Wed Jun 20 17:30:42 2012 +0000
@@ -9,10 +9,48 @@
   <xsl:param name="render-checkboxes" select="true()"/>
   <xsl:param name="callback"/>
 
+  <xsl:template match="@*" mode="min">
+    <xsl:if test="position() = 1">
+      <xsl:value-of select="number(.)"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="@*" mode="max">
+    <xsl:if test="position() = last()">
+      <xsl:value-of select="number(.)"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:variable name="events-min">
+    <xsl:choose>
+      <xsl:when test="count(/fixings/events/event/sector) &gt; 0">
+        <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from">
+          <xsl:sort data-type="number" select="."/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="number(/fixings/river/@from)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="events-max">
+    <xsl:choose>
+      <xsl:when test="count(/fixings/events/event/sector) &gt; 0">
+        <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to">
+          <xsl:sort data-type="number" select="."/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="number(/fixings/river/@to)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:template name="percent">
     <xsl:param name="sector"/>
-    <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/>
-    <xsl:variable name="rto" select="number(/fixings/river/@to)"/>
+    <xsl:variable name="rfrom" select="number($events-min)"/>
+    <xsl:variable name="rto" select="number($events-max)"/>
     <xsl:variable name="rlength" select="$rto - $rfrom"/>
 
     <xsl:variable name="sfrom" select="number($sector/@from)"/>
@@ -28,7 +66,7 @@
     <xsl:variable name="glength">
       <xsl:choose>
         <xsl:when test="$num-preds &lt; 1">
-          <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/>
+          <xsl:variable name="rfrom" select="number($events-min)"/>
           <xsl:value-of select="number($sector/@from) - $rfrom"/>
         </xsl:when>
         <xsl:otherwise>
@@ -43,8 +81,8 @@
         <div>
           <xsl:attribute name="style">
             <xsl:text>width:</xsl:text>
-              <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/>
-              <xsl:variable name="rto" select="number(/fixings/river/@to)"/>
+              <xsl:variable name="rfrom" select="number($events-min)"/>
+              <xsl:variable name="rto" select="number($events-max)"/>
               <xsl:variable name="rlength" select="$rto - $rfrom"/>
               <xsl:value-of select="100.0 * ($glength div $rlength)"/>
             <xsl:text>%;float:left</xsl:text>
@@ -119,6 +157,10 @@
         <col width="*"/>
         <col width="90px"/>
       </colgroup>
+      <tr>
+        <th>km <xsl:value-of select="$events-min"/> - <xsl:value-of select="$events-max"/></th>
+        <th>Ereignis</th>
+      </tr>
       <xsl:apply-templates/>
     </table>
   </xsl:template>

http://dive4elements.wald.intevation.org