Copied MPRG over for DPR to get column alignment and ignore empty tables.
Showing
1 changed file
with
20 additions
and
14 deletions
1 | -<div> | 1 | +<ui:call ui:template="{= ?template }" arg:report="{= ?report }"> |
2 | + <ui:if ui:condition="{= spr:rowCount(?rs) > 0 }"> | ||
3 | + <div> | ||
2 | <hr /> | 4 | <hr /> |
3 | <ui:setContext ui:queryGraph="<http://www.reportinghub.no/ep/spin/dpr-tables>"> | 5 | <ui:setContext ui:queryGraph="<http://www.reportinghub.no/ep/spin/dpr-tables>"> |
4 | <h2>{= ui:label(?template) }</h2> | 6 | <h2>{= ui:label(?template) }</h2> |
5 | </ui:setContext> | 7 | </ui:setContext> |
6 | - <table class="ddrTable"> | 8 | + <table class="ddrTable" letrs:hrs="{# |
7 | - <ui:setContext ui:queryGraph="<http://www.reportinghub.no/ep/spin/dpr-tables>"> | 9 | + SELECT ?header ?left |
8 | - <tr class="ddrTR"> | ||
9 | - <ui:forEach ui:resultSet="{# | ||
10 | - SELECT ?header | ||
11 | WHERE { | 10 | WHERE { |
11 | + GRAPH <http://www.reportinghub.no/ep/spin/dpr-tables> { | ||
12 | ?template rhspin:tableHeaders ?list . | 12 | ?template rhspin:tableHeaders ?list . |
13 | - ?list <http://jena.hpl.hp.com/ARQ/list#member> ?header . | 13 | + ?list <http://jena.hpl.hp.com/ARQ/list#member> ?str . |
14 | + BIND (fn:starts-with(?str, '*') AS ?left) . | ||
15 | + BIND (IF(?left, fn:substring(?str, 2), ?str) AS ?header) . | ||
16 | + } | ||
14 | } | 17 | } |
15 | }"> | 18 | }"> |
16 | - <th class="ddrTH">{= ?header }</th> | 19 | + <tr class="ddrTR"> |
20 | + <ui:forEach ui:resultSet="{= ?hrs }"> | ||
21 | + <th class="ddrTH" style="text-align: {= IF(?left, 'left', 'center') }" | ||
22 | + ><ui:parse ui:str="{= html:encodeBRs(spif:replaceAll(?header, ' ', ' ')) }" /></th> | ||
17 | </ui:forEach> | 23 | </ui:forEach> |
18 | </tr> | 24 | </tr> |
19 | - </ui:setContext> | ||
20 | - <ui:call ui:template="{= ?template }" arg:report="{= ?report }"> | ||
21 | <ui:forEach ui:resultSet="{# SELECT ?row ?rowIndex WHERE { ?rs spr:rowIndices ?rowIndex } }"> | 25 | <ui:forEach ui:resultSet="{# SELECT ?row ?rowIndex WHERE { ?rs spr:rowIndices ?rowIndex } }"> |
22 | <tr class="ddrTR"> | 26 | <tr class="ddrTR"> |
23 | - <ui:forEach ui:resultSet="{# SELECT ?cell WHERE { (?rs ?rowIndex) spr:rowCells (?cell ?cellIndex) } }"> | 27 | + <ui:forEach ui:resultSet="{# SELECT ?cell ?colIndex WHERE { (?rs ?rowIndex) spr:rowCells (?cell ?colIndex) } }"> |
24 | - <td class="ddrTD">{= ui:label(?cell) }</td> | 28 | + <!--td class="ddrTD" style="text-align: {= IF(spr:cell(?hrs, ?colIndex, 1), 'left', 'center') }"--> |
29 | + <td class="ddrTD">{= ?cell }</td> | ||
25 | </ui:forEach> | 30 | </ui:forEach> |
26 | </tr> | 31 | </tr> |
27 | </ui:forEach> | 32 | </ui:forEach> |
28 | - </ui:call> | ||
29 | </table> | 33 | </table> |
30 | <br /> | 34 | <br /> |
31 | -</div> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
35 | + </div> | ||
36 | + </ui:if> | ||
37 | +</ui:call> | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment