dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23323
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11345: basic rendering of events as html
------------------------------------------------------------
revno: 11345
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-07-05 11:25:13 +0700
message:
basic rendering of events as html
added:
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/event.xsl
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/event/DataValue.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.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-dxf2/src/main/java/org/hisp/dhis/dxf2/event/DataValue.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/event/DataValue.java 2013-07-04 08:55:19 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/event/DataValue.java 2013-07-05 04:25:13 +0000
@@ -29,7 +29,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.hisp.dhis.common.DxfNamespaces;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java 2013-07-04 08:55:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java 2013-07-05 04:25:13 +0000
@@ -37,7 +37,6 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
-import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -46,14 +45,13 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.InputStream;
import java.util.Map;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@Controller
-@RequestMapping(value = EventController.RESOURCE_PATH)
+@RequestMapping( value = EventController.RESOURCE_PATH )
public class EventController
{
public static final String RESOURCE_PATH = "/events";
@@ -84,17 +82,18 @@
if ( options.hasLinks() )
{
- event.setHref( ContextUtils.getRootPath( request ) + "/events/" + uid );
+ event.setHref( ContextUtils.getRootPath( request ) + RESOURCE_PATH + "/" + uid );
}
model.addAttribute( "model", event );
+ model.addAttribute( "viewClass", options.getViewClass( "detailed" ) );
- return StringUtils.uncapitalize( "event" );
+ return "event";
}
@RequestMapping( method = RequestMethod.POST, consumes = "application/xml" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_DATAVALUE_ADD')" )
- public void postXmlObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
+ public void postXmlObject( HttpServletResponse response, HttpServletRequest request ) throws Exception
{
ImportSummaries importSummaries = eventService.saveEventsXml( request.getInputStream() );
JacksonUtils.toXml( response.getOutputStream(), importSummaries );
@@ -102,13 +101,13 @@
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_DATAVALUE_ADD')" )
- public void postJsonObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
+ public void postJsonObject( HttpServletResponse response, HttpServletRequest request ) throws Exception
{
ImportSummaries importSummaries = eventService.saveEventsJson( request.getInputStream() );
JacksonUtils.toJson( response.getOutputStream(), importSummaries );
}
- @ExceptionHandler(IllegalArgumentException.class)
+ @ExceptionHandler( IllegalArgumentException.class )
public void handleError( IllegalArgumentException ex, HttpServletResponse response )
{
ContextUtils.conflictResponse( response, ex.getMessage() );
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/event.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/event.xsl 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/event.xsl 2013-07-05 04:25:13 +0000
@@ -0,0 +1,41 @@
+<?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:event">
+ <div class="event">
+ <table>
+ <tr>
+ <td>ID</td>
+ <td> <xsl:value-of select="@event" /> </td>
+ </tr>
+ <tr>
+ <td>Program</td>
+ <td> <xsl:value-of select="@program" /> </td>
+ </tr>
+ <tr>
+ <td>Program Stage</td>
+ <td> <xsl:value-of select="@programStage" /> </td>
+ </tr>
+ <tr>
+ <td>Organisation Unit</td>
+ <td> <xsl:value-of select="@orgUnit" /> </td>
+ </tr>
+ <tr>
+ <td>Event Date</td>
+ <td> <xsl:value-of select="@eventDate" /> </td>
+ </tr>
+ <tr>
+ <td>Completed</td>
+ <td> <xsl:value-of select="@completed" /> </td>
+ </tr>
+ <tr>
+ <td>Stored By</td>
+ <td> <xsl:value-of select="@storedBy" /> </td>
+ </tr>
+ </table>
+
+ </div>
+ </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 2013-05-31 05:04:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl 2013-07-05 04:25:13 +0000
@@ -57,6 +57,7 @@
<xsl:include href="optionSets.xsl" />
<xsl:include href="program.xsl" />
<xsl:include href="programStage.xsl" />
+ <xsl:include href="event.xsl" />
<!-- Config elements -->