changeset 6401:f369d69e3488

Datacage: Rewrote the loading of the official lines based on the latest changes. Untested!
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 22 Jun 2013 00:03:18 +0200
parents 25230bc3137c
children da1d1df9ab23
files artifacts/doc/conf/meta-data.xml
diffstat 1 files changed, 22 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Fri Jun 21 23:35:01 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Sat Jun 22 00:03:18 2013 +0200
@@ -2318,60 +2318,28 @@
     </dc:macro>
 
     <dc:macro name="officiallines_user">
-      <dc:comment comment=".wst -------------------------------">
-      <!-- =============== THIS IS BROKEN! ============== -->
-      <officiallines>
-        <dc:for-each>
-          <dc:context>
-            <dc:statement>
-              SELECT m.id       AS a_id,
-                     m.state    AS a_state,
-                     m.gid      AS a_gid,
-                     m.creation AS a_creation,
-                     ardg.v     AS gaugy,
-                     arv.v      AS wqsingle
-              FROM   master_artifacts m,
-              artifact_data ardg,
-              artifact_data arv
-              WHERE  m.collection_id = ${collection_id}
-              AND m.gid = CAST(${artifact-id} AS uuid)
-              AND ardg.artifact_id = m.id
-              AND ardg.k = 'ld_gaugename'
-              AND arv.artifact_id = m.id
-              AND arv.k = 'wq_single'
-              AND EXISTS (
-              SELECT id
-              FROM artifact_data ad
-              WHERE ad.artifact_id = m.id
-              AND k = 'river'
-              AND v = ${river})
-            </dc:statement>
-            <dc:for-each>
-              <dc:context connection="system">
-                <dc:statement>
-                  SELECT ol.wst_id         AS wstid,
-                         ol.wst_column_pos AS wstcolpos,
-                         ol.name           AS olname,
-                         ol.value          AS oval
-                  FROM official_q_values ol
-                  WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2))
-                  AND ol.gauge_name = ${gaugy}
-                </dc:statement>
-                <dc:for-each>
-                  <dc:element name="${olname}">
-                    <dc:attribute name="name" value="${olname}"/>
-                    <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
-                    <dc:attribute name="factory" value="staticwkms"/>
-                    <dc:attribute name="target_out" value="${out}"/>
-                    <dc:attribute name="out" value="${out}"/>
-                  </dc:element>
-                </dc:for-each>
-              </dc:context>
-            </dc:for-each>
-          </dc:context>
-        </dc:for-each>
-      </officiallines>
-    </dc:comment>
+      <dc:if test="dc:contains($parameters, 'official-lines')">
+        <dc:container-context container="official-lines">
+          <dc:properties>
+            <dc:property name="name" alias="olname"/>
+            <dc:property name="wst" alias="wstid"/>
+            <dc:property name="columnPos" alias="wstcolpos"/>
+          </dc:properties>
+          <dc:if test="dc:has-result()">
+            <officiallines>
+              <dc:for-each>
+                <dc:element name="${olname}">
+                  <dc:attribute name="name" value="${olname}"/>
+                  <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
+                  <dc:attribute name="factory" value="staticwkms"/>
+                  <dc:attribute name="target_out" value="${out}"/>
+                  <dc:attribute name="out" value="${out}"/>
+                </dc:element>
+              </dc:for-each>
+            </officiallines>
+          </dc:if>
+        </dc:container-context>
+      </dc:if>
     </dc:macro>
 
     <!-- Common stuff -->

http://dive4elements.wald.intevation.org