← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7855: Fix to report table controller

 

------------------------------------------------------------
revno: 7855
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-08-03 10:50:38 +0200
message:
  Fix to report table controller
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java


--
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/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2012-08-02 12:39:33 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2012-08-03 08:50:38 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.system.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -98,7 +99,28 @@
     // GET - Dynamic data
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = "/data", method = RequestMethod.GET )
+    @RequestMapping( value = "/data", method = RequestMethod.GET ) // For json, jsonp
+    public String getReportTableDynamicData( @RequestParam( required = false, value = "in" ) List<String> indicators,
+        @RequestParam( required = false, value = "de" ) List<String> dataElements,
+        @RequestParam( required = false, value = "ds" ) List<String> dataSets,
+        @RequestParam( value = "ou" ) List<String> orgUnits,
+        @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
+        @RequestParam( required = false ) boolean orgUnitIsParent,
+        @RequestParam( required = false ) boolean minimal,
+        RelativePeriods relatives,
+        Model model,
+        HttpServletResponse response ) throws Exception
+    {
+        Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
+            orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
+
+        model.addAttribute( "model", grid );
+        model.addAttribute( "viewClass", "detailed" );
+
+        return grid != null ? "reportTableData" : null;
+    }
+
+    @RequestMapping( value = "/data.html", method = RequestMethod.GET )
     public void getReportTableDynamicDataHtml( @RequestParam( required = false, value = "in" ) List<String> indicators,
         @RequestParam( required = false, value = "de" ) List<String> dataElements,
         @RequestParam( required = false, value = "ds" ) List<String> dataSets,
@@ -249,7 +271,19 @@
     // GET - Report table data
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = "/{uid}/data", method = RequestMethod.GET )
+    @RequestMapping( value = "/{uid}/data", method = RequestMethod.GET ) // For json, jsonp
+    public String getReportTableData( @PathVariable( "uid" ) String uid, Model model,
+        @RequestParam( value = "ou", required = false ) String organisationUnitUid,
+        @RequestParam( value = "pe", required = false ) String period,
+        HttpServletResponse response ) throws Exception
+    {
+        model.addAttribute( "model", getReportTableGrid( uid, organisationUnitUid, period ) );
+        model.addAttribute( "viewClass", "detailed" );
+
+        return "grid";
+    }
+
+    @RequestMapping( value = "/{uid}/data.html", method = RequestMethod.GET )
     public void getReportTableHtml( @PathVariable( "uid" ) String uid,
         @RequestParam( value = "ou", required = false ) String organisationUnitUid,
         @RequestParam( value = "pe", required = false ) String period,