← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5461: added xsl for messageConversations

 

------------------------------------------------------------
revno: 5461
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-16 20:36:39 +0100
message:
  added xsl for messageConversations
added:
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversation.xsl
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversations.xsl
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.java
  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/webdomain/Resources.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.java	2011-12-15 12:10:50 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.java	2011-12-16 19:36:39 +0000
@@ -42,6 +42,7 @@
 import org.hisp.dhis.indicator.IndicatorTypes;
 import org.hisp.dhis.indicator.Indicators;
 import org.hisp.dhis.mapping.Maps;
+import org.hisp.dhis.message.MessageConversations;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSets;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroups;
 import org.hisp.dhis.organisationunit.OrganisationUnits;
@@ -127,6 +128,7 @@
         resources.add( new Resource( "IndicatorGroupSets", IndicatorGroupSets.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "IndicatorTypes", IndicatorTypes.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "Maps", Maps.class, requestMethods, mediaTypes ) );
+        resources.add( new Resource( "MessageConversations", MessageConversations.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "OrganisationUnits", OrganisationUnits.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "OrganisationUnitGroups", OrganisationUnitGroups.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "OrganisationUnitGroupSets", OrganisationUnitGroupSets.class, requestMethods, mediaTypes ) );

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversation.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversation.xsl	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversation.xsl	2011-12-16 19:36:39 +0000
@@ -0,0 +1,58 @@
+<?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:messageConversation">
+    <div class="messageConversation">
+      <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>Code</td>
+          <td> <xsl:value-of select="@code" /> </td>
+        </tr>
+      </table>
+
+      <xsl:apply-templates select="d:lastSender|d:messages" />
+
+    </div>
+  </xsl:template>
+
+  <xsl:template match="d:lastSender">
+    <h3>Last Sender</h3>
+    <table border="1" class="lastSender">
+      <xsl:apply-templates select="." mode="row"/>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="d:messages">
+    <h3>Messages</h3>
+    <xsl:apply-templates />
+  </xsl:template>
+
+  <xsl:template match="d:message">
+    <table style="width: 800px;">
+      <tr>
+        <td>Text</td>
+        <td> <xsl:value-of select="d:text" /> </td>
+      </tr>
+      <tr>
+        <td>Sender</td>
+        <td> <xsl:value-of select="d:sender/@name" /> </td>
+      </tr>
+    </table>
+    <br/>
+  </xsl:template>
+
+</xsl:stylesheet>

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversations.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversations.xsl	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/messageConversations.xsl	2011-12-16 19:36:39 +0000
@@ -0,0 +1,51 @@
+<?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:messageConversations">
+    <h3> <xsl:value-of select="local-name()" /> </h3>
+
+    <h4>Starting a new conversation</h4>
+    <p>This is done through a POST to <code>/api/messageConversations using</code> the format below.</p>
+
+  <pre style="font-size: 0.9em;">
+  <![CDATA[
+  <message>
+    <subject>The subject</subject>
+    <text>This is the text</text>
+
+    <users>
+      <user id="uid1" />
+      <user id="uid2" />
+      <user id="uid3" />
+      <user id="uid4" />
+    </users>
+  </message>
+  ]]>
+  </pre>
+
+    <p>
+      Example using curl:<br/>
+      <code>curl -u admin:district -X POST -H "Content-Type: application/xml" -d @input.xml http://localhost:8080/api/messageConversations</code>
+    </p>
+    <h4>Replying to a conversation</h4>
+    <p>
+      This is done with a POST to <code>/api/messageConversations/{uid-of-conversation}?subject=subject</code>. The body of this will be the actual reply.<br/>
+      <br/>Example using curl:<br/>
+      <code>curl -u admin:district -X POST -H "Content-Type: text/plain" -d "this is a reply" http://localhost:8080/api/messageConversations/adfad134?subject=subject</code>
+    </p>
+
+    <h4>Writing a feedback</h4>
+    <p>This is done with a POST to <code>/api/messageConversations/feedback</code><br/>
+      <br/>Example using curl:<br/>
+      <code>curl -u admin:district -X POST -H "Content-Type: text/plain" -d "this is my feedback" http://localhost:8080/api/messageConversations/feedback</code>
+    </p>
+    
+    <table>
+      <xsl:apply-templates select="child::*" mode="row" />
+    </table>
+  </xsl:template>
+
+</xsl:stylesheet>

=== 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	2011-12-15 20:52:31 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl	2011-12-16 19:36:39 +0000
@@ -1,49 +1,51 @@
 <?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";
-    exclude-result-prefixes="d"
+                xmlns="http://www.w3.org/1999/xhtml";
+                xmlns:d="http://dhis2.org/schema/dxf/2.0";
+                exclude-result-prefixes="d"
     >
-    
-    <xsl:output method="html"/>
-    
-    <!-- html page level settings -->
-    <xsl:include href="html-wrapper.xsl"/>
-
-    <!-- for list views -->
-    <xsl:include href="list.xsl"/>
-
-    <!-- for rendering elements -->
-    <xsl:include href="resource.xsl"/>
-    <xsl:include href="map.xsl"/>
-    <xsl:include href="chart.xsl"/>
-    <xsl:include href="category.xsl" />
-    <xsl:include href="categoryOption.xsl" />
-    <xsl:include href="categoryCombo.xsl" />
-    <xsl:include href="categoryOptionCombo.xsl" />
-    <xsl:include href="dataElement.xsl"/>
-    <xsl:include href="dataElementGroup.xsl"/>
-    <xsl:include href="dataElementGroupSet.xsl"/>
-    <xsl:include href="document.xsl"/>
-    <xsl:include href="indicator.xsl"/>
-    <xsl:include href="indicatorType.xsl"/>
-    <xsl:include href="indicatorGroup.xsl"/>
-    <xsl:include href="indicatorGroupSet.xsl"/>
-    <xsl:include href="organisationUnit.xsl"/>
-    <xsl:include href="organisationUnitGroup.xsl"/>
-    <xsl:include href="organisationUnitGroupSet.xsl"/>
-    <xsl:include href="dataSet.xsl"/>
-    <xsl:include href="attributeType.xsl"/>
-    <xsl:include href="report.xsl"/>
-    <xsl:include href="reportTable.xsl"/>
-    <xsl:include href="validationRule.xsl"/>
-    <xsl:include href="validationRuleGroup.xsl"/>
-    <xsl:include href="sqlView.xsl"/>
-    <xsl:include href="user.xsl"/>
-    <xsl:include href="grid.xsl"/>
-
-    <!-- Config elements -->    
-
-    <xsl:include href="config/sms.xsl"/>
+
+  <xsl:output method="html" />
+
+  <!-- html page level settings -->
+  <xsl:include href="html-wrapper.xsl" />
+
+  <!-- for list views -->
+  <xsl:include href="list.xsl" />
+
+  <!-- for rendering elements -->
+  <xsl:include href="resource.xsl" />
+  <xsl:include href="map.xsl" />
+  <xsl:include href="chart.xsl" />
+  <xsl:include href="category.xsl" />
+  <xsl:include href="categoryOption.xsl" />
+  <xsl:include href="categoryCombo.xsl" />
+  <xsl:include href="categoryOptionCombo.xsl" />
+  <xsl:include href="dataElement.xsl" />
+  <xsl:include href="dataElementGroup.xsl" />
+  <xsl:include href="dataElementGroupSet.xsl" />
+  <xsl:include href="document.xsl" />
+  <xsl:include href="indicator.xsl" />
+  <xsl:include href="indicatorType.xsl" />
+  <xsl:include href="indicatorGroup.xsl" />
+  <xsl:include href="indicatorGroupSet.xsl" />
+  <xsl:include href="organisationUnit.xsl" />
+  <xsl:include href="organisationUnitGroup.xsl" />
+  <xsl:include href="organisationUnitGroupSet.xsl" />
+  <xsl:include href="dataSet.xsl" />
+  <xsl:include href="attributeType.xsl" />
+  <xsl:include href="report.xsl" />
+  <xsl:include href="reportTable.xsl" />
+  <xsl:include href="validationRule.xsl" />
+  <xsl:include href="validationRuleGroup.xsl" />
+  <xsl:include href="sqlView.xsl" />
+  <xsl:include href="user.xsl" />
+  <xsl:include href="grid.xsl" />
+  <xsl:include href="messageConversations.xsl" />
+  <xsl:include href="messageConversation.xsl" />
+
+  <!-- Config elements -->
+
+  <xsl:include href="config/sms.xsl" />
 
 </xsl:stylesheet>