← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7108: added html rendering of optionSets to webapi

 

------------------------------------------------------------
revno: 7108
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-30 15:29:47 +0200
message:
  added html rendering of optionSets to webapi
added:
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/optionSets.xsl
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java
  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/model2html.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/java/org/hisp/dhis/api/view/XsltHtmlView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java	2012-03-22 15:11:32 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java	2012-05-30 13:29:47 +0000
@@ -60,11 +60,12 @@
         throws Exception
     {
         Object object = model.get( "model" );
+        Class<?> viewClass = JacksonUtils.getViewClass( model.get( "viewClass" ) );
         response.setContentType( getContentType() );
 
         Assert.notNull( object );
 
-        InputStream input = new ByteArrayInputStream( JacksonUtils.toXmlAsString( object ).getBytes() );
+        InputStream input = new ByteArrayInputStream( JacksonUtils.toXmlWithViewAsString( object, viewClass ).getBytes() );
         Source xmlSource = new StreamSource( input );
 
         Transformer transformer = TransformCacheImpl.instance().getHtmlTransformer();

=== 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-05-01 09:53:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl	2012-05-30 13:29:47 +0000
@@ -18,7 +18,7 @@
       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:userAuthorityGroups|
-      d:reportTables|d:mapLegends|d:mapLegendSets|d:mapLayers">
+      d:reportTables|d:mapLegends|d:mapLegendSets|d:mapLayers|d:optionSets">
 
     <h3>
       <xsl:value-of select="local-name()" />

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl	2012-05-11 19:04:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl	2012-05-30 13:29:47 +0000
@@ -51,6 +51,7 @@
   <xsl:include href="messageConversations.xsl" />
   <xsl:include href="messageConversation.xsl" />
   <xsl:include href="dataValueSets.xsl" />
+  <xsl:include href="optionSets.xsl" />
 
   <!-- Config elements -->
 

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/optionSets.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/optionSets.xsl	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/optionSets.xsl	2012-05-30 13:29:47 +0000
@@ -0,0 +1,35 @@
+<?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";
+    >
+
+  <xsl:template match="d:optionSet">
+    <div class="optionSet">
+      <h2> <xsl:value-of select="@name" /> </h2>
+
+      <table>
+        <tr>
+          <td>ID</td>
+          <td> <xsl:value-of select="@id" /> </td>
+        </tr>
+        <tr>
+          <td>Last Updated</td>
+          <td> <xsl:value-of select="@lastUpdated" /> </td>
+        </tr>
+        <tr>
+          <td>Options</td>
+          <td>
+          <ul>
+          <xsl:for-each select="d:options/d:option">
+              <li> <xsl:value-of select="." /> </li>
+          </xsl:for-each>
+          </ul>
+          </td>
+        </tr>
+      </table>
+
+    </div>
+  </xsl:template>
+
+</xsl:stylesheet>