← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15365: PT, column/row totals as separate options.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15365 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-22 15:17:00 +0200
message:
  PT, column/row totals as separate options.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml
  dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/i18n.json
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js


--
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-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2014-04-14 14:17:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2014-05-22 13:07:04 +0000
@@ -153,7 +153,12 @@
     /**
      * Indicates rendering of sub-totals for the table.
      */
-    private boolean totals;
+    private boolean rowTotals;
+
+    /**
+     * Indicates rendering of sub-totals for the table.
+     */
+    private boolean colTotals;
 
     /**
      * Indicates rendering of sub-totals for the table.
@@ -871,14 +876,27 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
-    public boolean isTotals()
-    {
-        return totals;
-    }
-
-    public void setTotals( boolean totals )
-    {
-        this.totals = totals;
+    public boolean isRowTotals()
+    {
+        return rowTotals;
+    }
+
+    public void setRowTotals( boolean rowTotals )
+    {
+        this.rowTotals = rowTotals;
+    }
+
+    @JsonProperty
+    @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public boolean isColTotals()
+    {
+        return colTotals;
+    }
+
+    public void setColTotals( boolean colTotals )
+    {
+        this.colTotals = colTotals;
     }
 
     @JsonProperty
@@ -1035,7 +1053,8 @@
             reportParams = reportTable.getReportParams() == null ? reportParams : reportTable.getReportParams();
             sortOrder = reportTable.getSortOrder();
             topLimit = reportTable.getTopLimit();
-            totals = reportTable.isTotals();
+            rowTotals = reportTable.isRowTotals();
+            colTotals = reportTable.isColTotals();
             subtotals = reportTable.isSubtotals();
             hideEmptyRows = reportTable.isHideEmptyRows();
             showHierarchy = reportTable.isShowHierarchy();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-05-15 17:03:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-05-22 13:07:04 +0000
@@ -160,6 +160,10 @@
         executeSql( "DELETE FROM period WHERE periodtypeid=(select periodtypeid from periodtype where name in ( 'Survey', 'OnChange', 'Relative' ))" );
         executeSql( "DELETE FROM periodtype WHERE name in ( 'Survey', 'OnChange', 'Relative' )" );
 
+        // upgrade report table totals
+        executeSql( "UPDATE reporttable SET rowtotals = totals, coltotals = totals" );
+        executeSql( "ALTER TABLE reporttable DROP COLUMN totals" );
+        
         // mapping
         executeSql( "DROP TABLE maporganisationunitrelation" );
         executeSql( "ALTER TABLE mapview DROP COLUMN mapid" );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2014-02-12 15:47:58 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2014-05-22 13:07:04 +0000
@@ -151,7 +151,9 @@
 
     <property name="topLimit" />
 
-    <property name="totals" />
+    <property name="rowTotals" />
+	  
+	<property name="colTotals" />
 
     <property name="subtotals" />
 

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties	2014-05-13 21:53:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties	2014-05-16 10:04:38 +0000
@@ -409,4 +409,5 @@
 open_last_table=Open last table
 go_to_charts=Go to charts
 open_this_map_as_chart=Open this map as chart
-open_last_chart=Open last chart
\ No newline at end of file
+open_last_chart=Open last chart
+clear=Clear
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/i18n.json'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/i18n.json	2014-05-13 21:53:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/i18n.json	2014-05-16 10:04:38 +0000
@@ -433,5 +433,6 @@
 "open_last_table",
 "go_to_charts",
 "open_this_map_as_chart",
-"open_last_chart"
+"open_last_chart",
+"clear"
 ]

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-05-13 21:53:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-05-16 10:04:38 +0000
@@ -1496,7 +1496,7 @@
 		});
 
 		item = {
-			text: GIS.i18n.close,
+			text: GIS.i18n.clear,
 			iconCls: 'gis-menu-item-icon-clear',
 			handler: function() {
 				layer.core.reset();

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-05-08 13:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-05-15 10:48:43 +0000
@@ -176,7 +176,7 @@
 	};
 
 	GIS.core.createSelectHandlers = function(gis, layer) {
-		var isRelocate = !!GIS.app ? (gis.init.user.isAdmin ? true : false) : false,
+		var isRelocate = !!GIS.app ? !!gis.init.user.isAdmin : false,
 			options = {},
 			infrastructuralPeriod,
 			defaultHoverSelect,
@@ -616,7 +616,9 @@
                 }));
 			}
 
-			menuItems[menuItems.length - 1].addCls('gis-menu-item-last');
+			if (menuItems.length) {
+                menuItems[menuItems.length - 1].addCls('gis-menu-item-last');
+            }
 
 			menu = new Ext.menu.Menu({
 				baseCls: 'gis-plugin',
@@ -2972,8 +2974,6 @@
 		gis.olmap.addLayers(layers);
 
 		GIS.core.instances.push(gis);
-g = gis;
-b = gis.layer.boundary;
 
 		return gis;
 	};

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties	2014-05-13 22:04:48 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties	2014-05-22 13:07:04 +0000
@@ -3,8 +3,7 @@
 column=Column
 filter=Filter
 table_layout=Table layout
-show_totals=Show totals
-show_subtotals=Show sub-totals
+show_subtotals=Show subtotals
 hide_empty_rows=Hide empty rows
 display_density=Display density
 font_size=Font size
@@ -158,4 +157,6 @@
 open_last_chart=Open last chart
 go_to_maps=Go to maps
 open_this_table_as_map=Open this table as map
-open_last_map=Open last map
\ No newline at end of file
+open_last_map=Open last map
+show_row_totals=Show row totals
+show_col_totals=Show column totals
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json	2014-05-13 22:04:48 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json	2014-05-22 13:07:04 +0000
@@ -4,7 +4,6 @@
 "column",
 "filter",
 "table_layout",
-"show_totals",
 "show_subtotals",
 "hide_empty_rows",
 "display_density",
@@ -159,5 +158,7 @@
 "open_last_chart",
 "go_to_maps",
 "open_this_table_as_map",
-"open_last_map"
+"open_last_map",
+"show_row_totals",
+"show_col_totals"
 ]

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-05-13 22:04:48 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-05-22 13:07:04 +0000
@@ -379,7 +379,8 @@
 	};
 
 	OptionsWindow = function() {
-		var showTotals,
+		var showRowTotals,
+            showColTotals,
 			showSubTotals,
 			hideEmptyRows,
             aggregationType,
@@ -398,8 +399,14 @@
 			comboboxWidth = 262,
 			window;
 
-		showTotals = Ext.create('Ext.form.field.Checkbox', {
-			boxLabel: NS.i18n.show_totals,
+        showColTotals = Ext.create('Ext.form.field.Checkbox', {
+			boxLabel: NS.i18n.show_col_totals,
+			style: 'margin-bottom:4px',
+			checked: true
+		});
+
+		showRowTotals = Ext.create('Ext.form.field.Checkbox', {
+			boxLabel: NS.i18n.show_row_totals,
 			style: 'margin-bottom:4px',
 			checked: true
 		});
@@ -593,7 +600,8 @@
 			bodyStyle: 'border:0 none',
 			style: 'margin-left:14px',
 			items: [
-				showTotals,
+                showColTotals,
+				showRowTotals,
 				showSubTotals,
 				hideEmptyRows,
                 aggregationType
@@ -643,7 +651,8 @@
 			hideOnBlur: true,
 			getOptions: function() {
 				return {
-					showTotals: showTotals.getValue(),
+					showRowTotals: showRowTotals.getValue(),
+                    showColTotals: showColTotals.getValue(),
 					showSubTotals: showSubTotals.getValue(),
 					hideEmptyRows: hideEmptyRows.getValue(),
                     aggregationType: aggregationType.getValue(),
@@ -662,7 +671,8 @@
 				};
 			},
 			setOptions: function(layout) {
-				showTotals.setValue(Ext.isBoolean(layout.showTotals) ? layout.showTotals : true);
+				showRowTotals.setValue(Ext.isBoolean(layout.showRowTotals) ? layout.showRowTotals : true);
+				showColTotals.setValue(Ext.isBoolean(layout.showColTotals) ? layout.showColTotals : true);
 				showSubTotals.setValue(Ext.isBoolean(layout.showSubTotals) ? layout.showSubTotals : true);
 				hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false);
                 aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default');
@@ -757,7 +767,8 @@
 					}
 
 					// cmp
-					w.showTotals = showTotals;
+					w.showRowTotals = showRowTotals;
+                    w.showColTotals = showColTotals;
 					w.showSubTotals = showSubTotals;
 					w.hideEmptyRows = hideEmptyRows;
                     w.aggregationType = aggregationType;
@@ -836,8 +847,11 @@
 				dimensions = [].concat(favorite.columns || [], favorite.rows || [], favorite.filters || []);
 
 				// Server sync
-				favorite.totals = favorite.showTotals;
-				delete favorite.showTotals;
+				favorite.rowTotals = favorite.showRowTotals;
+				delete favorite.showRowTotals;
+
+                favorite.colTotals = favorite.showColTotals;
+				delete favorite.showColTotals;
 
 				favorite.subtotals = favorite.showSubTotals;
 				delete favorite.showSubTotals;
@@ -4064,10 +4078,10 @@
 							periodOffset: 0,
 							listeners: {
 								select: function() {
-									var nsype = new PeriodType(),
+									var ptype = new PeriodType(),
 										periodType = this.getValue();
 
-									var periods = nsype.get(periodType).generatePeriods({
+									var periods = ptype.get(periodType).generatePeriods({
 										offset: this.periodOffset,
 										filterFuturePeriods: true,
 										reversePeriods: true

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2014-05-10 16:06:42 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2014-05-22 13:07:04 +0000
@@ -265,7 +265,9 @@
 
 				// filters: [Dimension]
 
-				// showTotals: boolean (true)
+				// showRowTotals: boolean (true)
+
+				// showColTotals: boolean (true)
 
 				// showSubTotals: boolean (true)
 
@@ -432,7 +434,8 @@
 					layout.filters = config.filters;
 
 					// properties
-					layout.showTotals = Ext.isBoolean(config.totals) ? config.totals : (Ext.isBoolean(config.showTotals) ? config.showTotals : true);
+					layout.showRowTotals = Ext.isBoolean(config.rowTotals) ? config.rowTotals : (Ext.isBoolean(config.showRowTotals) ? config.showRowTotals : true);
+					layout.showColTotals = Ext.isBoolean(config.colTotals) ? config.colTotals : (Ext.isBoolean(config.showColTotals) ? config.showColTotals : true);
 					layout.showSubTotals = Ext.isBoolean(config.subtotals) ? config.subtotals : (Ext.isBoolean(config.showSubTotals) ? config.showSubTotals : true);
 					layout.hideEmptyRows = Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : false;
                     layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'default';
@@ -1612,8 +1615,12 @@
 					}
 				}
 
-				if (layout.showTotals) {
-					delete layout.showTotals;
+				if (layout.showRowTotals) {
+					delete layout.showRowTotals;
+				}
+
+                if (layout.showColTotals) {
+					delete layout.showColTotals;
 				}
 
 				if (layout.showSubTotals) {
@@ -2068,8 +2075,12 @@
 					return !!xLayout.showSubTotals && xAxis && xAxis.dims > 1;
 				};
 
-				doTotals = function() {
-					return !!xLayout.showTotals;
+				doRowTotals = function() {
+					return !!xLayout.showRowTotals;
+				};
+
+                doColTotals = function() {
+					return !!xLayout.showColTotals;
 				};
 
 				doSortableColumnHeaders = function() {
@@ -2133,7 +2144,7 @@
 								spanCount = 0;
 							}
 
-							if (i === 0 && (j === xColAxis.size - 1) && doTotals()) {
+							if (i === 0 && (j === xColAxis.size - 1) && doRowTotals()) {
 								totalId = doSortableColumnHeaders() ? 'total_' : null;
 
 								dimHtml.push(getTdHtml({
@@ -2255,7 +2266,7 @@
 					}
 
 					// totals
-					if (xColAxis && doTotals()) {
+					if (xColAxis && doRowTotals()) {
 						for (var i = 0, empty = [], total = 0; i < valueObjects.length; i++) {
 							for (j = 0, obj; j < valueObjects[i].length; j++) {
 								obj = valueObjects[i][j];
@@ -2302,7 +2313,7 @@
 									}
 
 									// hide totals by adding collapsed = true to all items
-									if (doTotals()) {
+									if (doRowTotals()) {
 										totalValueObjects[i].collapsed = true;
 									}
 
@@ -2503,7 +2514,7 @@
 				getColTotalHtmlArray = function() {
 					var a = [];
 
-					if (xRowAxis && doTotals()) {
+					if (xRowAxis && doColTotals()) {
 						var xTotalColObjects;
 
 						// total col items
@@ -2571,7 +2582,7 @@
 						empty = [],
 						a = [];
 
-					if (doTotals()) {
+					if (doRowTotals() && doColTotals()) {
 						for (var i = 0, obj; i < totalColObjects.length; i++) {
 							obj = totalColObjects[i];
 
@@ -2600,7 +2611,7 @@
 						row,
 						a = [];
 
-					if (doTotals()) {
+					if (doColTotals()) {
 						if (xRowAxis) {
 							dimTotalArray = [getTdHtml({
 								type: 'dimensionSubtotal',