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