dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32697
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16671: ER separate options for col/row totals.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16671 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-09-09 14:39:40 +0200
message:
ER separate options for col/row totals.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/en.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/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/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-09-09 11:00:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-09-09 12:20:09 +0000
@@ -112,7 +112,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.
@@ -306,16 +311,29 @@
}
@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;
+ @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+ 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
@@ -423,7 +441,8 @@
programStage = eventReport.getProgramStage();
startDate = eventReport.getStartDate();
endDate = eventReport.getEndDate();
- totals = eventReport.isTotals();
+ rowTotals = eventReport.isRowTotals();
+ colTotals = eventReport.isColTotals();
subtotals = eventReport.isSubtotals();
hideEmptyRows = eventReport.isHideEmptyRows();
countType = eventReport.getCountType();
=== 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-09-09 11:00:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-09-09 12:20:09 +0000
@@ -162,9 +162,11 @@
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
+ // upgrade reporttable and eventreport totals
executeSql( "UPDATE reporttable SET rowtotals = totals, coltotals = totals" );
executeSql( "ALTER TABLE reporttable DROP COLUMN totals" );
+ executeSql( "UPDATE eventreport SET rowtotals = totals, coltotals = totals" );
+ executeSql( "ALTER TABLE eventreport DROP COLUMN totals" );
// mapping
executeSql( "DROP TABLE maporganisationunitrelation" );
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-09-09 11:00:47 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-09-09 12:20:09 +0000
@@ -112,7 +112,9 @@
<element type="string" column="dimension" />
</list>
- <property name="totals" />
+ <property name="rowTotals" />
+
+ <property name="colTotals" />
<property name="subtotals" />
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/en.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/en.properties 2014-09-09 10:47:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/en.properties 2014-09-09 12:37:59 +0000
@@ -163,3 +163,5 @@
open_this_table_as_chart=Open this table as chart
open_last_chart=Open last chart
show_dimension_labels=Show dimension labels
+show_col_totals=Show column totals
+show_row_totals=Show row totals
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2014-09-09 11:36:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2014-09-09 12:37:59 +0000
@@ -1556,7 +1556,8 @@
};
AggregateOptionsWindow = function() {
- var showTotals,
+ var showColTotals,
+ showRowTotals,
showSubTotals,
hideEmptyRows,
showDimensionLabels,
@@ -1580,8 +1581,14 @@
checkboxBottomMargin = 2,
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:' + checkboxBottomMargin + 'px',
+ checked: true
+ });
+
+ showRowTotals = Ext.create('Ext.form.field.Checkbox', {
+ boxLabel: NS.i18n.show_row_totals,
style: 'margin-bottom:' + checkboxBottomMargin + 'px',
checked: true
});
@@ -1703,7 +1710,8 @@
bodyStyle: 'border:0 none',
style: 'margin-left:14px',
items: [
- showTotals,
+ showColTotals,
+ showRowTotals,
showSubTotals,
hideEmptyRows,
showDimensionLabels,
@@ -1742,7 +1750,8 @@
hideOnBlur: true,
getOptions: function() {
return {
- showTotals: showTotals.getValue(),
+ showColTotals: showColTotals.getValue(),
+ showRowTotals: showRowTotals.getValue(),
showSubTotals: showSubTotals.getValue(),
hideEmptyRows: hideEmptyRows.getValue(),
sortOrder: limit.getSortOrder(),
@@ -1757,7 +1766,8 @@
};
},
setOptions: function(layout) {
- showTotals.setValue(Ext.isBoolean(layout.showTotals) ? layout.showTotals : true);
+ showColTotals.setValue(Ext.isBoolean(layout.showColTotals) ? layout.showColTotals : true);
+ showRowTotals.setValue(Ext.isBoolean(layout.showRowTotals) ? layout.showRowTotals : true);
showSubTotals.setValue(Ext.isBoolean(layout.showSubTotals) ? layout.showSubTotals : true);
hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false);
limit.setValues(layout.sortOrder, layout.topLimit);
@@ -1842,7 +1852,8 @@
//}
// cmp
- w.showTotals = showTotals;
+ w.showColTotals = showColTotals;
+ w.showRowTotals = showRowTotals;
w.showSubTotals = showSubTotals;
w.hideEmptyRows = hideEmptyRows;
w.limit = limit;
@@ -1985,7 +1996,8 @@
hideOnBlur: true,
getOptions: function() {
return {
- showTotals: false,
+ showColTotals: false,
+ showRowTotals: false,
showSubTotals: false,
hideEmptyRows: false,
sortOrder: 0,
@@ -2135,8 +2147,11 @@
favorite = Ext.clone(ns.app.layout);
// 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;
@@ -6126,8 +6141,11 @@
var config = Ext.decode(r.responseText);
// sync
- config.showTotals = config.totals;
- delete config.totals;
+ config.showRowTotals = config.rowTotals;
+ delete config.rowTotals;
+
+ config.showColTotals = config.colTotals;
+ delete config.colTotals;
config.showSubTotals = config.subtotals;
delete config.subtotals;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2014-09-09 11:36:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2014-09-09 12:37:59 +0000
@@ -296,7 +296,9 @@
// filters: [Dimension]
- // showTotals: boolean (true)
+ // showRowTotals: boolean (true)
+
+ // showColTotals: boolean (true)
// showSubTotals: boolean (true)
@@ -477,7 +479,8 @@
}
// 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.countType = Ext.isString(config.countType) && !Ext.isEmpty(config.countType) ? config.countType : 'events';
@@ -2029,7 +2032,9 @@
var getRoundedHtmlValue,
getTdHtml,
doSubTotals,
- doTotals,
+ doRowTotals,
+ doColTotals,
+ doSortableColumnHeaders,
getColAxisHtmlArray,
getRowHtmlArray,
rowAxisHtmlArray,
@@ -2162,8 +2167,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() {
@@ -2270,7 +2279,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({
@@ -2413,7 +2422,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];
@@ -2454,17 +2463,17 @@
// if value row is empty
if (isValueRowEmpty) {
- // Hide values by adding collapsed = true to all items
+ // hide values by adding collapsed = true to all items
for (var j = 0; j < valueRow.length; j++) {
valueRow[j].collapsed = true;
}
- // Hide totals by adding collapsed = true to all items
- if (doTotals()) {
+ // hide totals by adding collapsed = true to all items
+ if (doRowTotals()) {
totalValueObjects[i].collapsed = true;
}
- // Hide/reduce parent dim span
+ // hide/reduce parent dim span
dimLeaf = axisAllObjects[i][xRowAxis.dims-1];
recursiveReduce(dimLeaf);
}
@@ -2661,7 +2670,7 @@
getColTotalHtmlArray = function() {
var a = [];
- if (xRowAxis && doTotals()) {
+ if (xRowAxis && doColTotals()) {
var xTotalColObjects;
// Total col items
@@ -2729,7 +2738,7 @@
empty = [],
a = [];
- if (doTotals()) {
+ if (doRowTotals() && doColTotals()) {
for (var i = 0, obj; i < totalColObjects.length; i++) {
obj = totalColObjects[i];
@@ -2758,7 +2767,7 @@
row,
a = [];
- if (doTotals()) {
+ if (doColTotals()) {
if (xRowAxis) {
dimTotalArray = [getTdHtml({
type: 'dimensionSubtotal',