changeset 4917:c499201a30a3 dc-km-filter

[branch dc-km-filter] meta-data.xml: Use global vars and art. data for wst-km-filter.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 30 Jan 2013 15:54:07 +0100
parents 2cec81e697e8
children b7a3cd7aa2fb
files flys-artifacts/doc/conf/meta-data.xml
diffstat 1 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/meta-data.xml	Wed Jan 30 15:52:50 2013 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml	Wed Jan 30 15:54:07 2013 +0100
@@ -11,14 +11,37 @@
                  wst_ranges.b            AS defto
           FROM wst_columns, wst_ranges
           WHERE wst_columns.wst_id = ${prot_id} AND wst_ranges.wst_column_id = wst_columns.id
-          AND ( CAST(${startkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
-           OR CAST(${endkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
-           OR wst_ranges.a BETWEEN CAST(${startkm} AS DOUBLE PRECISION) AND CAST(${endkm} AS DOUBLE PRECISION)
+          AND ( CAST(${fromkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
+           OR CAST(${tokm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
+           OR wst_ranges.a BETWEEN CAST(${fromkm} AS DOUBLE PRECISION) AND CAST(${tokm} AS DOUBLE PRECISION)
           )
           ORDER by wst_columns.position
       </dc:statement>
   </dc:macro>
   <dc:macro name="load-system">
+    <dc:variable name="fromkm" expr="dc:fromValue('', '', '')"/>
+    <dc:variable name="tokm" expr="dc:toValue('', '', '')"/>
+
+    <dc:if test="dc:contains($parameters, 'user-id')">
+     <dc:context connection="user">
+      <dc:statement>
+         SELECT COALESCE(ld_mode, '')      AS ldm,
+                COALESCE(ld_locations, '') AS ldl,
+                COALESCE(ld_from, '')      AS ldf,
+                COALESCE(ld_to, '')        AS ldt
+         FROM master_artifacts_range
+         WHERE gid = CAST(${artifact-id} as uuid)
+       </dc:statement>
+       <dc:elements>
+         <dc:variable name="fromkm" expr="dc:fromValue($ldm, $ldl, $ldf)"/>
+         <dc:variable name="tokm" expr="dc:toValue($ldm, $ldl, $ldt)"/>
+         <debug>
+                <dc:attribute name="name" value="[${artifact-id} , ${fromkm} : ${tokm}"/>
+         </debug>
+       </dc:elements>
+    </dc:context>
+    </dc:if>
+
     <dc:context connection="system">
       <dc:statement>
         SELECT id AS river_id, name as river_name FROM rivers

http://dive4elements.wald.intevation.org