dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36786
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18807: ER EV option for hiding n/a data implemented.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18807 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-03 17:50:41 +0200
message:
ER EV option for hiding n/a data implemented.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java
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-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml
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/i18n_app.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
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/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/eventchart/EventChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2015-03-31 14:49:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2015-04-03 15:26:23 +0000
@@ -121,6 +121,11 @@
* Indicates whether to collapse all data dimensions into a single dimension.
*/
private boolean collapseDataDimensions;
+
+ /**
+ * Indicates whether to hide n/a data.
+ */
+ private boolean hideNaData;
// -------------------------------------------------------------------------
// Analytical properties
=== 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 2015-03-31 14:49:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2015-04-01 15:34:05 +0000
@@ -156,6 +156,11 @@
* Indicates rendering of empty rows for the table.
*/
private boolean hideEmptyRows;
+
+ /**
+ * Indicates rendering of empty rows for the table.
+ */
+ private boolean hideNaData;
/**
* Indicates rendering of empty rows for the table.
@@ -444,6 +449,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isHideNaData()
+ {
+ return hideNaData;
+ }
+
+ public void setHideNaData( boolean hideNaData )
+ {
+ this.hideNaData = hideNaData;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public EventOutputType getOutputType()
{
return outputType;
@@ -554,6 +572,7 @@
rowSubTotals = report.isRowSubTotals();
colSubTotals = report.isColSubTotals();
hideEmptyRows = report.isHideEmptyRows();
+ hideNaData = report.isHideNaData();
rowTotals = report.isRowTotals();
colTotals = report.isColTotals();
showHierarchy = report.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 2015-03-31 15:22:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-04-03 15:32:17 +0000
@@ -432,6 +432,7 @@
executeSql( "update eventchart set regression = false where regression is null" );
executeSql( "update eventchart set hidetitle = false where hidetitle is null" );
executeSql( "update eventchart set hidesubtitle = false where hidesubtitle is null" );
+ executeSql( "update eventchart set hidenadata = false where hidenadata is null" );
executeSql( "update reporttable set showdimensionlabels = false where showdimensionlabels is null" );
executeSql( "update eventreport set showdimensionlabels = false where showdimensionlabels is null" );
@@ -517,6 +518,7 @@
executeSql( "update eventreport set showhierarchy = false where showhierarchy is null" );
executeSql( "update eventreport set counttype = 'events' where counttype is null" );
+ executeSql( "update eventreport set hidenadata = false where hidenadata is null" );
// eventreport col/rowtotals = keep existing || copy from totals || true
executeSql( "update eventreport set totals = true where totals is null" );
=== 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 2015-03-31 14:49:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2015-04-03 15:26:23 +0000
@@ -160,7 +160,7 @@
<property name="colSubTotals" />
<property name="hideEmptyRows" />
-
+
<property name="aggregationType" length="40">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2015-03-05 16:29:11 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2015-04-03 15:32:17 +0000
@@ -128,6 +128,8 @@
<property name="showData" />
<property name="hideEmptyRows" />
+
+ <property name="hideNaData" />
<property name="rangeAxisMaxValue" />
=== 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 2015-03-05 16:29:11 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2015-04-03 15:26:23 +0000
@@ -134,6 +134,8 @@
<property name="colSubTotals" />
<property name="hideEmptyRows" />
+
+ <property name="hideNaData" />
<property name="showHierarchy" />
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties 2015-03-16 16:37:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties 2015-04-01 15:34:05 +0000
@@ -192,3 +192,4 @@
user_sub_units=User sub-units
user_sub_x2_units=User sub-x2-units
collapse_data_dimensions=Collapse data dimensions
+hide_na_data=Hide n/a data
=== 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 2015-03-31 10:21:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-04-03 15:43:32 +0000
@@ -1907,7 +1907,7 @@
}
}
});
-nissa = window;
+
return window;
};
@@ -2233,6 +2233,7 @@
showRowSubTotals,
showDimensionLabels,
hideEmptyRows,
+ hideNaData,
limit,
outputType,
aggregationType,
@@ -2251,7 +2252,7 @@
comboboxWidth = 280,
comboBottomMargin = 1,
checkboxBottomMargin = 2,
- separatorTopMargin = 6,
+ separatorTopMargin = 10,
window;
showColTotals = Ext.create('Ext.form.field.Checkbox', {
@@ -2260,14 +2261,14 @@
checked: true
});
+ showColSubTotals = Ext.create('Ext.form.field.Checkbox', {
+ boxLabel: NS.i18n.show_col_subtotals,
+ 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
- });
-
- showColSubTotals = Ext.create('Ext.form.field.Checkbox', {
- boxLabel: NS.i18n.show_col_subtotals,
style: 'margin-top:' + separatorTopMargin + 'px; margin-bottom:' + checkboxBottomMargin + 'px',
checked: true
});
@@ -2280,12 +2281,17 @@
showDimensionLabels = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_dimension_labels,
- style: 'margin-top:' + separatorTopMargin + 'px; margin-bottom:' + comboBottomMargin + 'px',
+ style: 'margin-top:' + separatorTopMargin + 'px; margin-bottom:' + checkboxBottomMargin + 'px',
checked: true
});
hideEmptyRows = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.hide_empty_rows,
+ style: 'margin-top:' + separatorTopMargin + 'px; margin-bottom:' + checkboxBottomMargin + 'px',
+ });
+
+ hideNaData = Ext.create('Ext.form.field.Checkbox', {
+ boxLabel: NS.i18n.hide_na_data,
style: 'margin-bottom:' + checkboxBottomMargin + 'px',
});
@@ -2392,11 +2398,12 @@
style: 'margin-left:14px',
items: [
showColTotals,
+ showColSubTotals,
showRowTotals,
- showColSubTotals,
showRowSubTotals,
showDimensionLabels,
hideEmptyRows,
+ hideNaData,
limit,
outputType
//aggregationType
@@ -2438,6 +2445,7 @@
showRowSubTotals: showRowSubTotals.getValue(),
showDimensionLabels: showDimensionLabels.getValue(),
hideEmptyRows: hideEmptyRows.getValue(),
+ hideNaData: hideNaData.getValue(),
sortOrder: limit.getSortOrder(),
topLimit: limit.getTopLimit(),
outputType: outputType.getValue(),
@@ -2456,6 +2464,7 @@
showRowSubTotals.setValue(Ext.isBoolean(layout.showRowSubTotals) ? layout.showRowSubTotals : true);
showDimensionLabels.setValue(Ext.isBoolean(layout.showDimensionLabels) ? layout.showDimensionLabels : true);
hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false);
+ hideNaData.setValue(Ext.isBoolean(layout.hideNaData) ? layout.hideNaData : false);
limit.setValues(layout.sortOrder, layout.topLimit);
outputType.setValue(Ext.isString(layout.outputType) ? layout.outputType : 'EVENT');
//aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default');
@@ -2543,6 +2552,7 @@
w.showRowSubTotals = showRowSubTotals;
w.showDimensionLabels = showDimensionLabels;
w.hideEmptyRows = hideEmptyRows;
+ w.hideNaData = hideNaData;
w.limit = limit;
w.outputType = outputType;
w.showHierarchy = showHierarchy;
@@ -2688,6 +2698,7 @@
showRowTotals: false,
showSubTotals: false,
hideEmptyRows: false,
+ hideNaData: false,
sortOrder: 0,
topLimit: 0,
showHierarchy: false,
@@ -7405,6 +7416,7 @@
url += '&columns=' + columnNames.join(';');
url += '&rows=' + rowNames.join(';');
url += ns.app.layout.hideEmptyRows ? '&hideEmptyRows=true' : '';
+ url += ns.app.layout.hideNaData ? '&hideNaData=true' : '';
window.open(url, isNewTab ? '_blank' : '_top');
}
=== 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 2015-03-31 14:37:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2015-04-01 15:34:05 +0000
@@ -314,6 +314,8 @@
// hideEmptyRows: boolean (false)
+ // : boolean (false)
+
// outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_INSTANCE', 'ENROLLMENT'
// aggregationType: string ('default') - 'default', 'count', 'sum'
@@ -493,6 +495,7 @@
layout.showRowSubTotals = Ext.isBoolean(config.rowSubTotals) ? config.rowSubTotals : (Ext.isBoolean(config.showRowSubTotals) ? config.showRowSubTotals : true);
layout.showDimensionLabels = Ext.isBoolean(config.showDimensionLabels) ? config.showDimensionLabels : (Ext.isBoolean(config.showDimensionLabels) ? config.showDimensionLabels : true);
layout.hideEmptyRows = Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : false;
+ layout.hideNaData = Ext.isBoolean(config.hideNaData) ? config.hideNaData : false;
layout.outputType = Ext.isString(config.outputType) && !Ext.isEmpty(config.outputType) ? config.outputType : 'EVENT';
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : 'normal';
@@ -1808,6 +1811,10 @@
delete layout.hideEmptyRows;
}
+ if (!layout.hideNaData) {
+ delete layout.hideNaData;
+ }
+
if (!layout.showHierarchy) {
delete layout.showHierarchy;
}
@@ -1902,6 +1909,12 @@
for (var j = 0, id, fullId, parsedId, displayId; j < response.rows.length; j++) {
id = response.rows[j][i] || emptyId;
+
+ // hide NA data
+ if (xLayout.hideNaData && id === emptyId) {
+ continue;
+ }
+
fullId = header.name + id;
parsedId = parseFloat(id);
@@ -1946,6 +1959,12 @@
for (var k = 0, id, fullId, name, isHierarchy; k < response.rows.length; k++) {
id = response.rows[k][i] || emptyId;
+
+ // hide NA data
+ if (xLayout.hideNaData && id === emptyId) {
+ continue;
+ }
+
fullId = header.name + id;
isHierarchy = service.layout.isHierarchy(xLayout, response, id);
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties 2015-03-05 17:32:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties 2015-04-03 15:43:32 +0000
@@ -213,3 +213,4 @@
this_financial_year=This financial year
user_sub_units=User sub-units
user_sub_x2_units=User sub-x2-units
+hide_na_data=Hide n/a data
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-03-11 10:59:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-04-03 15:43:32 +0000
@@ -1543,6 +1543,7 @@
AggregateOptionsWindow = function() {
var showValues,
hideEmptyRows,
+ hideNaData,
showTrendLine,
targetLineValue,
targetLineTitle,
@@ -1586,6 +1587,11 @@
style: 'margin-bottom:' + checkboxBottomMargin + 'px'
});
+ hideNaData = Ext.create('Ext.form.field.Checkbox', {
+ boxLabel: NS.i18n.hide_na_data,
+ style: 'margin-bottom:' + checkboxBottomMargin + 'px',
+ });
+
showTrendLine = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.trend_line,
style: 'margin-bottom:' + checkboxBottomMargin + 'px'
@@ -1768,6 +1774,7 @@
items: [
showValues,
hideEmptyRows,
+ hideNaData,
showTrendLine,
{
xtype: 'container',
@@ -1849,6 +1856,7 @@
return {
showValues: showValues.getValue(),
hideEmptyRows: hideEmptyRows.getValue(),
+ hideNaData: hideNaData.getValue(),
showTrendLine: showTrendLine.getValue(),
targetLineValue: targetLineValue.getValue(),
targetLineTitle: targetLineTitle.getValue(),
@@ -2020,6 +2028,7 @@
// cmp
w.showValues = showValues;
w.hideEmptyRows = hideEmptyRows;
+ w.hideNaData = hideNaData;
w.showTrendLine = showTrendLine;
w.targetLineValue = targetLineValue;
w.targetLineTitle = targetLineTitle;
@@ -6692,6 +6701,7 @@
url += '&columns=' + columnNames.join(';');
url += '&rows=' + rowNames.join(';');
url += ns.app.layout.hideEmptyRows ? '&hideEmptyRows=true' : '';
+ url += ns.app.layout.hideNaData ? '&hideNaData=true' : '';
window.open(url, isNewTab ? '_blank' : '_top');
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2015-02-25 14:51:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2015-04-03 15:43:32 +0000
@@ -356,23 +356,25 @@
// showValues: boolean (true)
- // showTotals: boolean (true)
+ // showTotals: boolean (true)
- // showSubTotals: boolean (true)
+ // showSubTotals: boolean (true)
// hideEmptyRows: boolean (false)
- // aggregationType: string ('default') - 'default', 'count', 'sum'
-
- // showHierarchy: boolean (false)
-
- // displayDensity: string ('normal') - 'compact', 'normal', 'comfortable'
-
- // fontSize: string ('normal') - 'small', 'normal', 'large'
-
- // digitGroupSeparator: string ('space') - 'none', 'comma', 'space'
-
- // legendSet: object
+ // hideNaData: boolean (false)
+
+ // aggregationType: string ('default') - 'default', 'count', 'sum'
+
+ // showHierarchy: boolean (false)
+
+ // displayDensity: string ('normal') - 'compact', 'normal', 'comfortable'
+
+ // fontSize: string ('normal') - 'small', 'normal', 'large'
+
+ // digitGroupSeparator: string ('space') - 'none', 'comma', 'space'
+
+ // legendSet: object
// hideLegend: boolean (false)
@@ -565,6 +567,7 @@
// properties
layout.showValues = Ext.isBoolean(config.showData) ? config.showData : (Ext.isBoolean(config.showValues) ? config.showValues : true);
layout.hideEmptyRows = Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : (Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : true);
+ layout.hideNaData = Ext.isBoolean(config.hideNaData) ? config.hideNaData : false;
layout.showTrendLine = Ext.isBoolean(config.regression) ? config.regression : (Ext.isBoolean(config.showTrendLine) ? config.showTrendLine : false);
layout.targetLineValue = Ext.isNumber(config.targetLineValue) ? config.targetLineValue : null;
layout.targetLineTitle = Ext.isString(config.targetLineLabel) && !Ext.isEmpty(config.targetLineLabel) ? config.targetLineLabel :
@@ -1734,6 +1737,10 @@
delete layout.hideEmptyRows;
}
+ if (!layout.hideNaData) {
+ delete layout.hideNaData;
+ }
+
if (!layout.showHierarchy) {
delete layout.showHierarchy;
}
@@ -1824,6 +1831,12 @@
for (var j = 0, id, fullId, parsedId, displayId; j < response.rows.length; j++) {
id = response.rows[j][i] || emptyId;
+
+ // hide NA data
+ if (xLayout.hideNaData && id === emptyId) {
+ continue;
+ }
+
fullId = header.name + id;
parsedId = parseFloat(id);
displayId = Ext.isNumber(parsedId) ? parsedId : (names[id] || id);
@@ -1849,6 +1862,12 @@
for (var k = 0, id, fullId, name, isHierarchy; k < response.rows.length; k++) {
id = response.rows[k][i] || emptyId;
+
+ // hide NA data
+ if (xLayout.hideNaData && id === emptyId) {
+ continue;
+ }
+
fullId = header.name + id;
isHierarchy = service.layout.isHierarchy(xLayout, response, id);
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-03-31 16:03:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-03-31 16:30:59 +0000
@@ -6595,7 +6595,17 @@
NS.instances.push(ns);
- ns.core = NS.getCore(init);
+ ns.init = init;
+ ns.alert = function(msg, isAlert) {
+ if (isAlert) {
+ alert(msg);
+ }
+ else {
+ console.log(msg);
+ }
+ };
+
+ ns.core = NS.getCore(ns);
extendCore(ns.core);
dimConf = ns.core.conf.finals.dimension;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-03-31 16:03:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-03-31 16:30:59 +0000
@@ -16,8 +16,9 @@
NS.isDebug = false;
NS.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- NS.getCore = function(init) {
- var conf = {},
+ NS.getCore = function(ns) {
+ var init = ns.init,
+ conf = {},
api = {},
support = {},
service = {},
@@ -434,6 +435,12 @@
return;
}
+ // in and aggregation type
+ if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
+ ns.alert('Indicators and aggregation types cannot be specified together', true);
+ return;
+ }
+
return true;
};
@@ -1921,14 +1928,7 @@
map = xLayout.dimensionNameItemsMap,
dx = dimConf.indicator.dimensionName,
co = dimConf.category.dimensionName,
- aggTypes = {
- 'count': 'COUNT',
- 'sum': 'SUM',
- 'stddev': 'STDDEV',
- 'variance': 'VARIANCE',
- 'min': 'MIN',
- 'max': 'MAX'
- };
+ aggTypes = ['COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'];
for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
dimName = axisDimensionNames[i];
@@ -1976,7 +1976,7 @@
}
// aggregation type
- if (xLayout.aggregationType) {
+ if (Ext.Array.contains(aggTypes, xLayout.aggregationType)) {
paramString += '&aggregationType=' + xLayout.aggregationType;
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2015-03-31 16:03:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2015-03-31 16:28:36 +0000
@@ -972,7 +972,7 @@
}
sortOrder.setValue(Ext.isNumber(layout.sortOrder) ? layout.sortOrder : 0);
- aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'DEFAULT');
+ aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default');
// rangeAxisMaxValue
if (Ext.isNumber(layout.rangeAxisMaxValue)) {
@@ -6676,7 +6676,17 @@
NS.instances.push(ns);
- ns.core = NS.getCore(init);
+ ns.init = init;
+ ns.alert = function(msg, isAlert) {
+ if (isAlert) {
+ alert(msg);
+ }
+ else {
+ console.log(msg);
+ }
+ };
+
+ ns.core = NS.getCore(ns);
extendCore(ns.core);
dimConf = ns.core.conf.finals.dimension;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js 2015-03-31 16:03:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js 2015-03-31 16:28:36 +0000
@@ -515,8 +515,9 @@
DV.isDebug = false;
DV.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- DV.getCore = function(init) {
- var conf = {},
+ DV.getCore = function(ns) {
+ var init = ns.init,
+ conf = {},
api = {},
support = {},
service = {},
@@ -1030,6 +1031,12 @@
return;
}
+ // in and aggregation type
+ if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
+ ns.alert('Indicators and aggregation types cannot be specified together', true);
+ return;
+ }
+
return true;
};
@@ -2179,14 +2186,7 @@
addCategoryDimension = false,
map = xLayout.dimensionNameItemsMap,
dx = dimConf.indicator.dimensionName,
- aggTypes = {
- 'count': 'COUNT',
- 'sum': 'SUM',
- 'stddev': 'STDDEV',
- 'variance': 'VARIANCE',
- 'min': 'MIN',
- 'max': 'MAX'
- };
+ aggTypes = ['COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'];
for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
dimName = axisDimensionNames[i];
@@ -2230,7 +2230,7 @@
}
// aggregation type
- if (xLayout.aggregationType) {
+ if (Ext.Array.contains(aggTypes, xLayout.aggregationType)) {
paramString += '&aggregationType=' + xLayout.aggregationType;
}