← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6331: fixed paging for webapi

 

------------------------------------------------------------
revno: 6331
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-03-21 12:55:51 +0100
message:
  fixed paging for webapi
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl	2012-03-21 09:12:51 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl	2012-03-21 11:55:51 +0000
@@ -1,63 +1,65 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
-                xmlns="http://www.w3.org/1999/xhtml";
-                xmlns:d="http://dhis2.org/schema/dxf/2.0";
+    xmlns="http://www.w3.org/1999/xhtml";
+    xmlns:d="http://dhis2.org/schema/dxf/2.0";
     >
 
-  <xsl:include href="identifiable-row.xsl"/>
+  <xsl:include href="identifiable-row.xsl" />
 
   <!-- match all plural elements -->
-  <xsl:template match="d:dxf2/resources|d:maps|d:charts|d:categoryCombos|d:categories|
-    d:categoryOptions|d:categoryOptionCombos|d:dataElements|d:indicators|
-    d:organisationUnits|d:dataElementGroups|d:dataElementGroupSets|d:dataSets|
-    d:documents|d:indicatorGroups|d:indicatorGroupSets|d:organisationUnitGroups|
-    d:organisationUnitGroupSets|d:indicatorTypes|d:attributeTypes|d:reports|d:constants|
-    d:sqlViews|d:validationRules|d:validationRuleGroups|d:users|d:userGroups|d:reportTables">
-
-    <xsl:choose>
-      <xsl:when test="@page">
-        <table>
-          <tr>
-            <td>Page <xsl:value-of select="@page" /> / <xsl:value-of select="@pageCount" /></td>
-
-            <xsl:if test="@prevPage">
-              <td>
-                <xsl:element name="a">
-                  <xsl:attribute name="href">
-                    <xsl:value-of select="@prevPage" />
-                  </xsl:attribute>
-                  <xsl:text>Previous Page</xsl:text>
-                </xsl:element>
-              </td>
-            </xsl:if>
-
-            <xsl:if test="@nextPage">
-            <td>
-              <xsl:element name="a">
-                <xsl:attribute name="href">
-                  <xsl:value-of select="@nextPage" />
-                </xsl:attribute>
-                <xsl:text>Next Page</xsl:text>
-              </xsl:element>
-            </td>
-            </xsl:if>
-          </tr>
-        </table>
-      </xsl:when>
-      <xsl:otherwise>
-        <table>
-          <tr>
-            <td>Page 1 / 1</td>
-          </tr>
-        </table>
-      </xsl:otherwise>
-    </xsl:choose>
-
-    <h3> <xsl:value-of select="local-name()" /> </h3>
+  <xsl:template match="d:dxf2">
+    <xsl:apply-templates select="pager"/>
+    <xsl:apply-templates select="d:*"/>
+  </xsl:template>
+
+  <xsl:template match="d:resources|d:maps|d:charts|d:categoryCombos|d:categories|
+      d:categoryOptions|d:categoryOptionCombos|d:dataElements|d:indicators|
+      d:organisationUnits|d:dataElementGroups|d:dataElementGroupSets|d:dataSets|
+      d:documents|d:indicatorGroups|d:indicatorGroupSets|d:organisationUnitGroups|
+      d:organisationUnitGroupSets|d:indicatorTypes|d:attributeTypes|d:reports|d:constants|
+      d:sqlViews|d:validationRules|d:validationRuleGroups|d:users|d:userGroups|d:reportTables">
+
+    <h3>
+      <xsl:value-of select="local-name()" />
+    </h3>
 
     <table>
-      <xsl:apply-templates select="child::*" mode="row"/>
+      <xsl:apply-templates select="child::*" mode="row" />
     </table>
+
+  </xsl:template>
+
+  <xsl:template match="pager">
+      <table>
+        <tr>
+          <td>Page
+            <xsl:value-of select="page" /> /
+            <xsl:value-of select="pageCount" />
+          </td>
+
+          <xsl:if test="prevPage">
+            <td>
+              <xsl:element name="a">
+                <xsl:attribute name="href">
+                  <xsl:value-of select="prevPage" />
+                </xsl:attribute>
+                <xsl:text>Previous Page</xsl:text>
+              </xsl:element>
+            </td>
+          </xsl:if>
+
+          <xsl:if test="nextPage">
+            <td>
+              <xsl:element name="a">
+                <xsl:attribute name="href">
+                  <xsl:value-of select="nextPage" />
+                </xsl:attribute>
+                <xsl:text>Next Page</xsl:text>
+              </xsl:element>
+            </td>
+          </xsl:if>
+        </tr>
+      </table>
   </xsl:template>
 
 </xsl:stylesheet>