comparison artifacts/doc/conf/meta-data.xml @ 6183:3f8f212253a0

Simplify and fix range filtering for server data. We did not use the user id in the user range and the ld_* values are provided as parameters for the datacage no need of that artifact database access. This also fixes Location awareness for DGMs
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 04 Jun 2013 16:04:08 +0200
parents 06cb01e8aef3
children 467df391317d
comparison
equal deleted inserted replaced
6182:95257f28bb3f 6183:3f8f212253a0
3 <datacage> 3 <datacage>
4 4
5 <dc:comment> 5 <dc:comment>
6 User specific part 6 User specific part
7 ------------------ 7 ------------------
8 This is a hack because we currently have no way to supress empty
9 folders (either in the client or in the datacage).
8 </dc:comment> 10 </dc:comment>
9 <dc:if test="dc:contains($parameters, 'user-id') and not(dc:contains($artifact-outs, 'floodmap-hws'))"> 11 <dc:if test="dc:contains($parameters, 'user-id') and
12 not(dc:contains($artifact-outs, 'floodmap-hws')) and
13 not($current-state-id = 'state.winfo.uesk.dgm')">
10 <dc:call-macro name="load-user"/> 14 <dc:call-macro name="load-user"/>
11 </dc:if> 15 </dc:if>
12 16
13 <dc:call-macro name="load-system"/> 17 <dc:call-macro name="load-system"/>
14 18
30 <dc:call-macro name="generate-user-content"/> 34 <dc:call-macro name="generate-user-content"/>
31 </old_calculations> 35 </old_calculations>
32 </dc:macro> 36 </dc:macro>
33 37
34 <dc:macro name="generate-system-content"> 38 <dc:macro name="generate-system-content">
35 <dc:call-macro name="user-range"> 39 <dc:call-macro name="artifact-range">
36 <dc:call-macro name="km-filtered-wsts"> 40 <dc:call-macro name="km-filtered-wsts">
37 <dc:choose> 41 <dc:choose>
38 <dc:when test="dc:contains($parameters, 'recommended')"> 42 <dc:when test="dc:contains($parameters, 'recommended')">
39 <dc:comment> 43 <dc:comment>
40 Recommendations (client shall load immediately). 44 Recommendations (client shall load immediately).
270 </dc:call-macro> 274 </dc:call-macro>
271 </dc:call-macro> 275 </dc:call-macro>
272 </dc:macro> 276 </dc:macro>
273 277
274 <dc:macro name="generate-user-content"> 278 <dc:macro name="generate-user-content">
275 <dc:call-macro name="user-range"> 279 <dc:call-macro name="artifact-range">
276 <dc:call-macro name="all-user-artifacts"> 280 <dc:call-macro name="all-user-artifacts">
277 <dc:call-macro name="km-filtered-user-artifacts"> 281 <dc:call-macro name="km-filtered-user-artifacts">
278 <dc:choose> 282 <dc:choose>
279 <dc:when test="dc:contains($parameters, 'recommended')"> 283 <dc:when test="dc:contains($parameters, 'recommended')">
280 <dc:comment> 284 <dc:comment>
1440 r.a AS dem_lower, 1444 r.a AS dem_lower,
1441 r.b AS dem_upper, 1445 r.b AS dem_upper,
1442 d.name AS name, 1446 d.name AS name,
1443 t.start_time AS start_time, 1447 t.start_time AS start_time,
1444 t.stop_time AS stop_time, 1448 t.stop_time AS stop_time,
1445 'Projektion: ' || d.projection || '$' || 1449 'Projektion: ' || d.projection || '&lt;BR&gt;' ||
1446 'Rasterweite: ' || d.resolution || 'm$' || 1450 'Rasterweite: ' || d.resolution || 'm&lt;BR&gt;' ||
1447 'Format: ' || d.format || '$' || 1451 'Format: ' || d.format || '&lt;BR&gt;' ||
1448 'Zeitraum: ' 1452 'Zeitraum: '
1449 AS info 1453 AS info
1450 FROM dem d 1454 FROM dem d
1451 JOIN ranges r ON d.range_id = r.id 1455 JOIN ranges r ON d.range_id = r.id
1452 LEFT JOIN time_intervals t ON d.time_interval_id = t.id 1456 LEFT JOIN time_intervals t ON d.time_interval_id = t.id
1453 WHERE d.river_id = ${river_id} 1457 WHERE d.river_id = ${river_id}
1454 </dc:statement> 1458 AND NOT((${tokm} &lt; r.a) or (${fromkm} &gt; r.b))
1455 <dc:for-each> 1459 </dc:statement>
1460 <dc:for-each>
1456 <dem factory="demfactory" target_out="{$out}" 1461 <dem factory="demfactory" target_out="{$out}"
1457 ids="{$dem_id}" 1462 ids="{$dem_id}"
1458 name="{$name}" 1463 name="{$name}"
1459 info="{dc:replace($info, '$', '&lt;BR&gt;')}{dc:date-format('yyyy', $start_time)} - {dc:date-format('yyyy', $stop_time)}"/> 1464 info="{$info}{dc:date-format('yyyy', $start_time)} - {dc:date-format('yyyy', $stop_time)}"/>
1460 </dc:for-each> 1465 </dc:for-each>
1461 </dc:context> 1466 </dc:context>
1462 </dems> 1467 </dems>
1463 </dc:macro> 1468 </dc:macro>
1464 1469
2395 <dc:filter expr="not($deffrom &gt; $tokm or $defto &lt; $fromkm)"> 2400 <dc:filter expr="not($deffrom &gt; $tokm or $defto &lt; $fromkm)">
2396 <dc:macro-body/> 2401 <dc:macro-body/>
2397 </dc:filter> 2402 </dc:filter>
2398 </dc:macro> 2403 </dc:macro>
2399 2404
2400 <dc:macro name="user-range"> 2405 <dc:macro name="artifact-range">
2401 <dc:choose> 2406 <dc:variable name="fromkm" type="number" expr="dc:fromValue(dc:get('ld_mode'), dc:get('ld_locations'), dc:get('ld_from'))"/>
2402 <dc:when test="dc:contains($parameters, 'user-id')"> 2407 <dc:variable name="tokm" type="number" expr="dc:toValue(dc:get('ld_mode'), dc:get('ld_locations'), dc:get('ld_to'))"/>
2403 <dc:context connection="user"> 2408 <dc:macro-body/>
2404 <dc:statement>
2405 SELECT COALESCE(ld_mode, '') AS ldm,
2406 COALESCE(ld_locations, '') AS ldl,
2407 COALESCE(ld_from, '') AS ldf,
2408 COALESCE(ld_to, '') AS ldt
2409 FROM master_artifacts_range
2410 WHERE gid = CAST(${artifact-id} AS uuid)
2411 </dc:statement>
2412 <dc:for-each>
2413 <dc:variable name="fromkm" type="number" expr="dc:fromValue($ldm, $ldl, $ldf)"/>
2414 <dc:variable name="tokm" type="number" expr="dc:toValue($ldm, $ldl, $ldt)"/>
2415 <dc:macro-body/>
2416 </dc:for-each>
2417 </dc:context>
2418 </dc:when>
2419 <dc:otherwise>
2420 <dc:variable name="fromkm" type="number" expr="dc:fromValue('', '', '')"/>
2421 <dc:variable name="tokm" type="number" expr="dc:toValue('', '', '')"/>
2422 <dc:macro-body/>
2423 </dc:otherwise>
2424 </dc:choose>
2425 </dc:macro> 2409 </dc:macro>
2426 2410
2427 </datacage> 2411 </datacage>
2428 </dc:template> 2412 </dc:template>

http://dive4elements.wald.intevation.org