← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12488: Improve tabular report (WIP).

 

------------------------------------------------------------
revno: 12488
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-08 10:59:38 +0700
message:
  Improve tabular report (WIP).
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm


--
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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java	2013-10-08 03:59:38 +0000
@@ -192,6 +192,7 @@
         for ( String dimension : aggregateReport.getDimension() )
         {
             String dimensionId = DataQueryParams.getDimensionFromParam( dimension );
+           
             String[] filters = dimension.split( DataQueryParams.DIMENSION_NAME_SEP );
             if ( filters.length > 1 )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java	2013-10-08 03:59:38 +0000
@@ -32,8 +32,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 
 import org.hisp.dhis.analytics.DataQueryParams;
 import org.hisp.dhis.dataelement.DataElement;
@@ -143,7 +145,7 @@
     {
         return dataElements;
     }
-    
+
     private Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
 
     public Collection<OrganisationUnit> getOrgunits()
@@ -165,6 +167,13 @@
         return userOrgunitChildren;
     }
 
+    private Map<String, String> mapFilters = new HashMap<String, String>();
+
+    public Map<String, String> getMapFilters()
+    {
+        return mapFilters;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -182,6 +191,12 @@
         for ( String dimension : tabularReport.getDimension() )
         {
             String dimensionId = DataQueryParams.getDimensionFromParam( dimension );
+            
+            String[] filters = dimension.split( DataQueryParams.DIMENSION_NAME_SEP );
+            if ( filters.length > 1 )
+            {
+                mapFilters.put( dimensionId, dimension.substring( dimensionId.length() + 1, dimension.length() ) );
+            }
 
             if ( ORGUNIT_DIM_ID.equals( dimensionId ) )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-08 03:59:38 +0000
@@ -1104,15 +1104,10 @@
 									for (var i = 0; i < f.items.length; i++) {
 										var filter = f.items[i].id.split(';');
 										var id = filter[0];
-										var filterVal = "";
-										if( filter.length == 3 ){
-											filterVal = filter[1] + ";" + filter[2];
-										}
-										
 										var name = TR.util.string.getEncodedString(f.items[i].name);
 										var valueType = f.items[i].valueType;
 										TR.store.dataelement.selected.add({id: id, name: name, valueType: valueType});
-										TR.util.multiselect.addFilterField( 'filterPanel', id, name, valueType, filterVal );
+										TR.util.multiselect.addFilterField( 'filterPanel', id, name, valueType, f.filters[id] );
 									}
 									
 									if( f.singleEvent == 'false' )
@@ -1130,7 +1125,6 @@
 								}
 								
 								TR.exe.execute();
-								
 							}
 						});
 					}				
@@ -1244,11 +1238,6 @@
 									for (var i = 0; i < f.items.length; i++) {
 										var filter = f.items[i].id.split(';');
 										var id = filter[0];
-										var filterVal = "";
-										if( filter.length == 3 ){
-											filterVal = filter[1] + ";" + filter[2];
-										}
-										
 										var name = TR.util.string.getEncodedString(f.items[i].name);
 										var valueType = f.items[i].valueType;
 										TR.store.dataelement.selected.add({id: id, name: name, valueType: valueType});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-10-08 03:59:38 +0000
@@ -57,7 +57,6 @@
 			},
 		#end
 		
-		
 		#foreach( $attr in $attributes )
 		{
 			"id": "$attr.uid",
@@ -82,5 +81,10 @@
 		}#if( $velocityCount < $dataElements.size() ),#end
 		#end
 		
-	]
+	],
+	filters:{
+		#foreach( $de in $mapFilters.keySet() )
+			"$de": "$mapFilters.get($de)" #if( $velocityCount < $mapFilters.keySet().size() ),#end
+		#end
+	}
 }
\ No newline at end of file