dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40631
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20633: Dashboard plugins updated.
------------------------------------------------------------
revno: 20633
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-12 14:52:06 +0300
message:
Dashboard plugins updated.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/eventreport.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.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-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/eventreport.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/eventreport.js 2015-09-18 19:32:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/eventreport.js 2015-10-12 11:52:06 +0000
@@ -146,7 +146,26 @@
},
root: {
id: 'root'
- }
+ },
+ style: {
+ 'normal': 'NORMAL',
+ 'compact': 'COMPACT',
+ 'xcompact': 'XCOMPACT',
+ 'comfortable': 'COMFORTABLE',
+ 'xcomfortable': 'XCOMFORTABLE',
+ 'small': 'SMALL',
+ 'xsmall': 'XSMALL',
+ 'large': 'LARGE',
+ 'xlarge': 'XLARGE',
+ 'space': 'SPACE',
+ 'comma': 'COMMA',
+ 'none': 'NONE',
+ 'default_': 'DEFAULT'
+ },
+ dataType: {
+ 'aggregated_values': 'AGGREGATED_VALUES',
+ 'individual_cases': 'EVENTS'
+ }
};
dimConf = conf.finals.dimension;
@@ -205,6 +224,14 @@
]
};
+ conf.valueType = {
+ numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
+ textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
+ booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+ dateTypes: ['DATE','DATETIME'],
+ aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ };
+
// aggregation type
conf.aggregationType = {
data: [
@@ -218,7 +245,7 @@
],
idNameMap: {}
};
-
+
conf.valueType = {
numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
@@ -268,23 +295,34 @@
multiselect_fill_reportingrates: 315
};
- // report
- conf.report = {
- digitGroupSeparator: {
- 'comma': ',',
- 'space': ' '
- },
- displayDensity: {
- 'compact': '3px',
- 'normal': '5px',
- 'comfortable': '10px',
- },
- fontSize: {
- 'small': '10px',
- 'normal': '11px',
- 'large': '13px'
- }
- };
+ conf.style = {
+ displayDensity: {},
+ fontSize: {},
+ digitGroupSeparator: {}
+ };
+
+ (function() {
+ var map = conf.finals.style,
+ displayDensity = conf.style.displayDensity,
+ fontSize = conf.style.fontSize,
+ digitGroupSeparator = conf.style.digitGroupSeparator;
+
+ displayDensity[map.xcompact] = '2px';
+ displayDensity[map.compact] = '4px';
+ displayDensity[map.normal] = '6px';
+ displayDensity[map.comfortable] = '8px';
+ displayDensity[map.xcomfortable] = '10px';
+
+ fontSize[map.xsmall] = '9px';
+ fontSize[map.small] = '10px';
+ fontSize[map.normal] = '11px';
+ fontSize[map.large] = '12px';
+ fontSize[map.xlarge] = '14px';
+
+ digitGroupSeparator[map.space] = ' ';
+ digitGroupSeparator[map.comma] = ',';
+ digitGroupSeparator[map.none] = '';
+ })();
// url
conf.url = {
@@ -422,17 +460,17 @@
// collapseDataDimensions: boolean (false)
- // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_IERTANCE', 'ENROLLMENT'
+ // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_INSTANCE', 'ENROLLMENT'
// 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'
+ // displayDensity: string ('NORMAL') - 'COMPACT', 'NORMAL', 'COMFORTABLE'
+
+ // fontSize: string ('NORMAL') - 'SMALL', 'NORMAL', 'LARGE'
+
+ // digitGroupSeparator: string ('SPACE') - 'NONE', 'COMMA', 'SPACE'
// legendSet: object
@@ -584,7 +622,7 @@
layout.rows = config.rows;
layout.filters = config.filters;
- layout.dataType = Ext.isString(config.dataType) ? config.dataType : 'aggregated_values';
+ layout.dataType = Ext.isString(config.dataType) ? config.dataType : conf.finals.dataType.aggregated_values;
layout.program = config.program;
layout.programStage = config.programStage;
@@ -609,9 +647,9 @@
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : false;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
- layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : 'normal';
- layout.fontSize = Ext.isString(config.fontSize) && !Ext.isEmpty(config.fontSize) ? config.fontSize : 'normal';
- layout.digitGroupSeparator = Ext.isString(config.digitGroupSeparator) && !Ext.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : 'space';
+ layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : conf.finals.style.normal;
+ layout.fontSize = Ext.isString(config.fontSize) && !Ext.isEmpty(config.fontSize) ? config.fontSize : conf.finals.style.normal;
+ layout.digitGroupSeparator = Ext.isString(config.digitGroupSeparator) && !Ext.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : conf.finals.style.space;
layout.legendSet = Ext.isObject(config.legendSet) && Ext.isString(config.legendSet.id) ? config.legendSet : null;
// value
@@ -707,7 +745,7 @@
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
//alert('No values found');
- //return; // for ER, not for ER
+ //return; // for ER, not for PT
}
if (config.rows.length > 0 && config.headers.length !== config.rows[0].length) {
@@ -1008,13 +1046,13 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || 'space';
+ separator = separator || conf.finals.style.space;
- if (separator === 'none') {
+ if (separator === conf.finals.style.none) {
return number;
}
- return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, conf.report.digitGroupSeparator[separator]);
+ return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, conf.style.digitGroupSeparator[separator]);
};
// date
@@ -1966,15 +2004,15 @@
delete layout.showHierarchy;
}
- if (layout.displayDensity === 'normal') {
+ if (layout.displayDensity === conf.finals.style.normal) {
delete layout.displayDensity;
}
- if (layout.fontSize === 'normal') {
+ if (layout.fontSize === conf.finals.style.normal) {
delete layout.fontSize;
}
- if (layout.digitGroupSeparator === 'space') {
+ if (layout.digitGroupSeparator === conf.finals.style.space) {
delete layout.digitGroupSeparator;
}
@@ -2354,7 +2392,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2441,7 +2479,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2471,9 +2509,6 @@
dimensions = Ext.Array.clean([].concat(view.columns || [], view.rows || [])),
ignoreKeys = ['dy', 'longitude', 'latitude'],
dataTypeMap = {},
- 'aggregated_values': 'aggregate',
- 'individual_cases': 'query'
- },
nameItemsMap;
dataTypeMap[conf.finals.dataType.aggregated_values] = 'aggregate';
@@ -2491,7 +2526,7 @@
for (var i = 0, dim; i < dimensions.length; i++) {
dim = dimensions[i];
- if (Ext.Array.contains(ignoreKeys, dim.dimension) || (dim.dimension === 'pe' && !dim.items && !dim.filter)) {
+ if (Ext.Array.contains(ignoreKeys, dim.dimension) || (dim.dimension === 'pe' && (!(dim.items && dim.items.length) && !dim.filter))) {
continue;
}
@@ -2569,12 +2604,12 @@
paramString += view.showHierarchy ? '&hierarchyMeta=true' : '';
// limit
- if (view.dataType === 'aggregated_values' && (view.sortOrder && view.topLimit)) {
+ if (view.dataType === conf.finals.dataType.aggregated_values && (view.sortOrder && view.topLimit)) {
paramString += '&limit=' + view.topLimit + '&sortOrder=' + (view.sortOrder < 0 ? 'ASC' : 'DESC');
}
// output type
- if (view.dataType === 'aggregated_values' && view.outputType) {
+ if (view.dataType === conf.finals.dataType.aggregated_values && view.outputType) {
paramString += '&outputType=' + view.outputType;
}
@@ -2582,16 +2617,16 @@
if (view.completedOnly) {
paramString += '&completedOnly=true';
}
-
+
// sorting
- if (view.dataType === 'individual_cases' && view.sorting) {
+ if (view.dataType === conf.finals.dataType.individual_cases && view.sorting) {
if (view.sorting.id && view.sorting.direction) {
paramString += '&' + view.sorting.direction.toLowerCase() + '=' + view.sorting.id;
}
}
// paging
- if (view.dataType === 'individual_cases' && view.paging && !skipPaging) {
+ if (view.dataType === conf.finals.dataType.individual_cases && view.paging && !skipPaging) {
paramString += view.paging.pageSize ? '&pageSize=' + view.paging.pageSize : '';
paramString += view.paging.page ? '&page=' + view.paging.page : '';
}
@@ -2603,7 +2638,7 @@
if (view.collapseDataDimensions) {
paramString += '&collapseDataDimensions=true';
}
-
+
// relative period date
if (view.relativePeriodDate) {
paramString += '&relativePeriodDate=' + view.relativePeriodDate;
@@ -3473,8 +3508,8 @@
var cls = 'pivot',
table;
- cls += xLayout.displayDensity && xLayout.displayDensity !== 'normal' ? ' displaydensity-' + xLayout.displayDensity : '';
- cls += xLayout.fontSize && xLayout.fontSize !== 'normal' ? ' fontsize-' + xLayout.fontSize : '';
+ cls += xLayout.displayDensity && xLayout.displayDensity !== conf.finals.style.normal ? ' displaydensity-' + xLayout.displayDensity : '';
+ cls += xLayout.fontSize && xLayout.fontSize !== conf.finals.style.normal ? ' fontsize-' + xLayout.fontSize : '';
table = '<table id="' + xLayout.tableUuid + '" class="' + cls + '">';
@@ -3543,8 +3578,8 @@
xResponse.sortableIdObjects = [];
- cls += layout.displayDensity && layout.displayDensity !== 'normal' ? ' displaydensity-' + layout.displayDensity : '';
- cls += layout.fontSize && layout.fontSize !== 'normal' ? ' fontsize-' + layout.fontSize : '';
+ cls += layout.displayDensity && layout.displayDensity !== conf.finals.style.none ? ' displaydensity-' + layout.displayDensity : '';
+ cls += layout.fontSize && layout.fontSize !== conf.finals.style.normal ? ' fontsize-' + layout.fontSize : '';
html += '<table class="' + cls + '"><tr>';
html += '<td class="pivot-dim pivot-dim-subtotal">' + '#' + '</td>';
@@ -3685,7 +3720,7 @@
ajax = function(requestConfig, authConfig) {
authConfig = authConfig || config;
-
+
if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
@@ -4040,10 +4075,10 @@
};
}
- if (layout.dataType === 'aggregated_values') {
+ if (layout.dataType === 'AGGREGATED_VALUES') {
web.report.createReport(layout, response);
}
- else if (layout.dataType === 'individual_cases') {
+ else if (layout.dataType === 'EVENTS') {
web.report.getData(layout);
}
};
@@ -4102,7 +4137,7 @@
config.failure = failure;
ns.ajax(config, ns);
-
+
};
web.report.getData = function(layout, isUpdateGui) {
@@ -4216,7 +4251,7 @@
}
};
- map['aggregated_values'] = function() {
+ map['AGGREGATED_VALUES'] = function() {
var xLayout,
xResponse,
xColAxis,
@@ -4316,7 +4351,7 @@
getXResponse();
};
- map['individual_cases'] = function() {
+ map['EVENTS'] = function() {
var xResponse,
getReport,
getTitleHtml = function(title) {
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js 2015-09-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js 2015-10-12 11:52:06 +0000
@@ -670,17 +670,30 @@
}
},
chart: {
- series: 'series',
- category: 'category',
- filter: 'filter',
- column: 'column',
- stackedcolumn: 'stackedcolumn',
- bar: 'bar',
- stackedbar: 'stackedbar',
- line: 'line',
- area: 'area',
- pie: 'pie',
- radar: 'radar'
+ client: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ server: {
+ column: 'COLUMN',
+ stackedcolumn: 'STACKED_COLUMN',
+ bar: 'BAR',
+ stackedbar: 'STACKED_BAR',
+ line: 'LINE',
+ area: 'AREA',
+ pie: 'PIE',
+ radar: 'RADAR',
+ gauge: 'GAUGE'
+ }
},
data: {
domain: 'domain_',
@@ -702,6 +715,36 @@
}
};
+ conf.finals.chart.c2s = {};
+ conf.finals.chart.s2c = {};
+
+ (function() {
+ var client = conf.finals.chart.client,
+ server = conf.finals.chart.server,
+ c2s = conf.finals.chart.c2s,
+ s2c = conf.finals.chart.s2c;
+
+ c2s[client.column] = server.column;
+ c2s[client.stackedcolumn] = server.stackedcolumn;
+ c2s[client.bar] = server.bar;
+ c2s[client.stackedbar] = server.stackedbar;
+ c2s[client.line] = server.line;
+ c2s[client.area] = server.area;
+ c2s[client.pie] = server.pie;
+ c2s[client.radar] = server.radar;
+ c2s[client.gauge] = server.gauge;
+
+ s2c[server.column] = client.column;
+ s2c[server.stackedcolumn] = client.stackedcolumn;
+ s2c[server.bar] = client.bar;
+ s2c[server.stackedbar] = client.stackedbar;
+ s2c[server.line] = client.line;
+ s2c[server.area] = client.area;
+ s2c[server.pie] = client.pie;
+ s2c[server.radar] = client.radar;
+ s2c[server.gauge] = client.gauge;
+ })();
+
dimConf = conf.finals.dimension;
dimConf.objectNameMap = {};
@@ -1160,7 +1203,7 @@
layout.rows = config.rows;
layout.filters = config.filters;
- layout.type = Ext.isString(config.type) ? config.type : 'column';
+ layout.type = conf.finals.chart.s2c[config.type] || conf.finals.chart.client[config.type] || 'column';
layout.program = config.program;
layout.programStage = config.programStage;
@@ -2929,7 +2972,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -4073,7 +4116,7 @@
else if (xLayout.title) {
text += (text.length ? ', ' : '') + xLayout.title;
}
- else if (xLayout.type === conf.finals.chart.pie) {
+ else if (xLayout.type === conf.finals.chart.client.pie) {
var ids = Ext.Array.clean([].concat(columnIds || []));
if (Ext.isArray(ids) && ids.length) {
@@ -4327,7 +4370,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.column) {
+ if (item.type === conf.finals.chart.client.column) {
item.stacked = true;
}
}
@@ -4413,7 +4456,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.bar) {
+ if (item.type === conf.finals.chart.client.bar) {
item.stacked = true;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-09-15 23:16:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-10-12 11:52:06 +0000
@@ -409,6 +409,8 @@
// hideEmptyRows: boolean (false)
+ // skipRounding: boolean (false)
+
// aggregationType: string ('DEFAULT') - 'DEFAULT', 'COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'
// dataApprovalLevel: object
@@ -590,6 +592,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.skipRounding = Ext.isBoolean(config.skipRounding) ? config.skipRounding : false;
layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : conf.finals.style.default_;
layout.dataApprovalLevel = Ext.isObject(config.dataApprovalLevel) && Ext.isString(config.dataApprovalLevel.id) ? config.dataApprovalLevel : null;
@@ -1750,6 +1753,10 @@
delete layout.hideEmptyRows;
}
+ if (!layout.skipRounding) {
+ delete layout.skipRounding;
+ }
+
if (!layout.showHierarchy) {
delete layout.showHierarchy;
}
@@ -2184,6 +2191,11 @@
paramString += '&relativePeriodDate=' + xLayout.relativePeriodDate;
}
+ // skip rounding
+ if (xLayout.skipRounding) {
+ paramString += '&skipRounding=true';
+ }
+
return paramString.replace(/#/g, '.');
};
@@ -3255,10 +3267,10 @@
css += '.td-nobreak { white-space: nowrap; } \n';
css += '.td-hidden { display: none; } \n';
css += '.td-collapsed { display: none; } \n';
- css += 'table.pivot.displaydensity-comfortable td { padding: 7px } \n';
- css += 'table.pivot.displaydensity-compact td { padding: 3px } \n';
- css += 'table.pivot.fontsize-large td { font-size: 13px } \n';
- css += 'table.pivot.fontsize-small td { font-size: 10px } \n';
+ css += 'table.pivot.displaydensity-COMFORTABLE td { padding: 7px } \n';
+ css += 'table.pivot.displaydensity-COMPACT td { padding: 3px } \n';
+ css += 'table.pivot.fontsize-LARGE td { font-size: 13px } \n';
+ css += 'table.pivot.fontsize-SMALL td { font-size: 10px } \n';
css += '.pivot td { font-family: arial, sans-serif, helvetica neue, helvetica !important; padding: 5px; border: 1px solid #b2b2b2; font-size: 11px } \n';
css += '.pivot-dim { background-color: #dae6f8; text-align: center; } \n';
css += '.pivot-dim.highlighted { background-color: #c5d8f6; } \n';
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-09-15 23:25:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-10-12 11:52:06 +0000
@@ -673,18 +673,30 @@
}
},
chart: {
- series: 'series',
- category: 'category',
- filter: 'filter',
- column: 'column',
- stackedcolumn: 'stackedcolumn',
- bar: 'bar',
- stackedbar: 'stackedbar',
- line: 'line',
- area: 'area',
- pie: 'pie',
- radar: 'radar',
- gauge: 'gauge'
+ client: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ server: {
+ column: 'COLUMN',
+ stackedcolumn: 'STACKED_COLUMN',
+ bar: 'BAR',
+ stackedbar: 'STACKED_BAR',
+ line: 'LINE',
+ area: 'AREA',
+ pie: 'PIE',
+ radar: 'RADAR',
+ gauge: 'GAUGE'
+ }
},
data: {
domain: 'domain_',
@@ -706,6 +718,36 @@
}
};
+ conf.finals.chart.c2s = {};
+ conf.finals.chart.s2c = {};
+
+ (function() {
+ var client = conf.finals.chart.client,
+ server = conf.finals.chart.server,
+ c2s = conf.finals.chart.c2s,
+ s2c = conf.finals.chart.s2c;
+
+ c2s[client.column] = server.column;
+ c2s[client.stackedcolumn] = server.stackedcolumn;
+ c2s[client.bar] = server.bar;
+ c2s[client.stackedbar] = server.stackedbar;
+ c2s[client.line] = server.line;
+ c2s[client.area] = server.area;
+ c2s[client.pie] = server.pie;
+ c2s[client.radar] = server.radar;
+ c2s[client.gauge] = server.gauge;
+
+ s2c[server.column] = client.column;
+ s2c[server.stackedcolumn] = client.stackedcolumn;
+ s2c[server.bar] = client.bar;
+ s2c[server.stackedbar] = client.stackedbar;
+ s2c[server.line] = client.line;
+ s2c[server.area] = client.area;
+ s2c[server.pie] = client.pie;
+ s2c[server.radar] = client.radar;
+ s2c[server.gauge] = client.gauge;
+ })();
+
dimConf = conf.finals.dimension;
dimConf.objectNameMap = {};
@@ -923,7 +965,7 @@
getValidatedDimensionArray,
validateSpecialCases;
- // type: string ('column') - 'column', 'stackedcolumn', 'bar', 'stackedbar', 'line', 'area', 'pie'
+ // type: string ('COLUMN') - 'COLUMN', 'STACKED_COLUMN', 'BAR', 'STACKED_BAR', 'LINE', 'AREA', 'PIE'
// columns: [Dimension]
@@ -1186,7 +1228,7 @@
//config = analytical2layout(config);
// layout
- layout.type = Ext.isString(config.type) ? config.type.toLowerCase() : conf.finals.chart.column;
+ layout.type = conf.finals.chart.s2c[config.type] || conf.finals.chart.client[config.type] || 'column';
layout.columns = config.columns;
layout.rows = config.rows;
@@ -3414,7 +3456,7 @@
store = config.store || {},
width = app.getCenterRegionWidth(),
height = app.getCenterRegionHeight(),
- isLineBased = Ext.Array.contains(['line', 'area'], xLayout.type),
+ isLineBased = Ext.Array.contains(['LINE', 'AREA'], xLayout.type),
defaultConfig = {
//animate: true,
animate: false,
@@ -3507,7 +3549,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.column) {
+ if (item.type === conf.finals.chart.client.column) {
item.stacked = true;
}
}
@@ -3593,7 +3635,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.bar) {
+ if (item.type === conf.finals.chart.client.bar) {
item.stacked = true;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2015-09-15 23:25:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2015-10-12 11:52:06 +0000
@@ -673,18 +673,30 @@
}
},
chart: {
- series: 'series',
- category: 'category',
- filter: 'filter',
- column: 'column',
- stackedcolumn: 'stackedcolumn',
- bar: 'bar',
- stackedbar: 'stackedbar',
- line: 'line',
- area: 'area',
- pie: 'pie',
- radar: 'radar',
- gauge: 'gauge'
+ client: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ server: {
+ column: 'COLUMN',
+ stackedcolumn: 'STACKED_COLUMN',
+ bar: 'BAR',
+ stackedbar: 'STACKED_BAR',
+ line: 'LINE',
+ area: 'AREA',
+ pie: 'PIE',
+ radar: 'RADAR',
+ gauge: 'GAUGE'
+ }
},
data: {
domain: 'domain_',
@@ -706,6 +718,36 @@
}
};
+ conf.finals.chart.c2s = {};
+ conf.finals.chart.s2c = {};
+
+ (function() {
+ var client = conf.finals.chart.client,
+ server = conf.finals.chart.server,
+ c2s = conf.finals.chart.c2s,
+ s2c = conf.finals.chart.s2c;
+
+ c2s[client.column] = server.column;
+ c2s[client.stackedcolumn] = server.stackedcolumn;
+ c2s[client.bar] = server.bar;
+ c2s[client.stackedbar] = server.stackedbar;
+ c2s[client.line] = server.line;
+ c2s[client.area] = server.area;
+ c2s[client.pie] = server.pie;
+ c2s[client.radar] = server.radar;
+ c2s[client.gauge] = server.gauge;
+
+ s2c[server.column] = client.column;
+ s2c[server.stackedcolumn] = client.stackedcolumn;
+ s2c[server.bar] = client.bar;
+ s2c[server.stackedbar] = client.stackedbar;
+ s2c[server.line] = client.line;
+ s2c[server.area] = client.area;
+ s2c[server.pie] = client.pie;
+ s2c[server.radar] = client.radar;
+ s2c[server.gauge] = client.gauge;
+ })();
+
dimConf = conf.finals.dimension;
dimConf.objectNameMap = {};
@@ -923,7 +965,7 @@
getValidatedDimensionArray,
validateSpecialCases;
- // type: string ('column') - 'column', 'stackedcolumn', 'bar', 'stackedbar', 'line', 'area', 'pie'
+ // type: string ('COLUMN') - 'COLUMN', 'STACKED_COLUMN', 'BAR', 'STACKED_BAR', 'LINE', 'AREA', 'PIE'
// columns: [Dimension]
@@ -1186,7 +1228,7 @@
//config = analytical2layout(config);
// layout
- layout.type = Ext.isString(config.type) ? config.type.toLowerCase() : conf.finals.chart.column;
+ layout.type = conf.finals.chart.s2c[config.type] || conf.finals.chart.client[config.type] || 'column';
layout.columns = config.columns;
layout.rows = config.rows;
@@ -3414,7 +3456,7 @@
store = config.store || {},
width = app.getCenterRegionWidth(),
height = app.getCenterRegionHeight(),
- isLineBased = Ext.Array.contains(['line', 'area'], xLayout.type),
+ isLineBased = Ext.Array.contains(['LINE', 'AREA'], xLayout.type),
defaultConfig = {
//animate: true,
animate: false,
@@ -3507,7 +3549,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.column) {
+ if (item.type === conf.finals.chart.client.column) {
item.stacked = true;
}
}
@@ -3593,7 +3635,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.bar) {
+ if (item.type === conf.finals.chart.client.bar) {
item.stacked = true;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js 2015-09-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js 2015-10-12 11:52:06 +0000
@@ -670,17 +670,30 @@
}
},
chart: {
- series: 'series',
- category: 'category',
- filter: 'filter',
- column: 'column',
- stackedcolumn: 'stackedcolumn',
- bar: 'bar',
- stackedbar: 'stackedbar',
- line: 'line',
- area: 'area',
- pie: 'pie',
- radar: 'radar'
+ client: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ server: {
+ column: 'COLUMN',
+ stackedcolumn: 'STACKED_COLUMN',
+ bar: 'BAR',
+ stackedbar: 'STACKED_BAR',
+ line: 'LINE',
+ area: 'AREA',
+ pie: 'PIE',
+ radar: 'RADAR',
+ gauge: 'GAUGE'
+ }
},
data: {
domain: 'domain_',
@@ -702,6 +715,36 @@
}
};
+ conf.finals.chart.c2s = {};
+ conf.finals.chart.s2c = {};
+
+ (function() {
+ var client = conf.finals.chart.client,
+ server = conf.finals.chart.server,
+ c2s = conf.finals.chart.c2s,
+ s2c = conf.finals.chart.s2c;
+
+ c2s[client.column] = server.column;
+ c2s[client.stackedcolumn] = server.stackedcolumn;
+ c2s[client.bar] = server.bar;
+ c2s[client.stackedbar] = server.stackedbar;
+ c2s[client.line] = server.line;
+ c2s[client.area] = server.area;
+ c2s[client.pie] = server.pie;
+ c2s[client.radar] = server.radar;
+ c2s[client.gauge] = server.gauge;
+
+ s2c[server.column] = client.column;
+ s2c[server.stackedcolumn] = client.stackedcolumn;
+ s2c[server.bar] = client.bar;
+ s2c[server.stackedbar] = client.stackedbar;
+ s2c[server.line] = client.line;
+ s2c[server.area] = client.area;
+ s2c[server.pie] = client.pie;
+ s2c[server.radar] = client.radar;
+ s2c[server.gauge] = client.gauge;
+ })();
+
dimConf = conf.finals.dimension;
dimConf.objectNameMap = {};
@@ -1160,7 +1203,7 @@
layout.rows = config.rows;
layout.filters = config.filters;
- layout.type = Ext.isString(config.type) ? config.type : 'column';
+ layout.type = conf.finals.chart.s2c[config.type] || conf.finals.chart.client[config.type] || 'column';
layout.program = config.program;
layout.programStage = config.programStage;
@@ -2929,7 +2972,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -4073,7 +4116,7 @@
else if (xLayout.title) {
text += (text.length ? ', ' : '') + xLayout.title;
}
- else if (xLayout.type === conf.finals.chart.pie) {
+ else if (xLayout.type === conf.finals.chart.client.pie) {
var ids = Ext.Array.clean([].concat(columnIds || []));
if (Ext.isArray(ids) && ids.length) {
@@ -4327,7 +4370,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.column) {
+ if (item.type === conf.finals.chart.client.column) {
item.stacked = true;
}
}
@@ -4413,7 +4456,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.bar) {
+ if (item.type === conf.finals.chart.client.bar) {
item.stacked = true;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js 2015-09-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js 2015-10-12 11:52:06 +0000
@@ -146,7 +146,26 @@
},
root: {
id: 'root'
- }
+ },
+ style: {
+ 'normal': 'NORMAL',
+ 'compact': 'COMPACT',
+ 'xcompact': 'XCOMPACT',
+ 'comfortable': 'COMFORTABLE',
+ 'xcomfortable': 'XCOMFORTABLE',
+ 'small': 'SMALL',
+ 'xsmall': 'XSMALL',
+ 'large': 'LARGE',
+ 'xlarge': 'XLARGE',
+ 'space': 'SPACE',
+ 'comma': 'COMMA',
+ 'none': 'NONE',
+ 'default_': 'DEFAULT'
+ },
+ dataType: {
+ 'aggregated_values': 'AGGREGATED_VALUES',
+ 'individual_cases': 'EVENTS'
+ }
};
dimConf = conf.finals.dimension;
@@ -205,6 +224,14 @@
]
};
+ conf.valueType = {
+ numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
+ textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
+ booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+ dateTypes: ['DATE','DATETIME'],
+ aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ };
+
// aggregation type
conf.aggregationType = {
data: [
@@ -218,7 +245,7 @@
],
idNameMap: {}
};
-
+
conf.valueType = {
numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
@@ -268,23 +295,34 @@
multiselect_fill_reportingrates: 315
};
- // report
- conf.report = {
- digitGroupSeparator: {
- 'comma': ',',
- 'space': ' '
- },
- displayDensity: {
- 'compact': '3px',
- 'normal': '5px',
- 'comfortable': '10px',
- },
- fontSize: {
- 'small': '10px',
- 'normal': '11px',
- 'large': '13px'
- }
- };
+ conf.style = {
+ displayDensity: {},
+ fontSize: {},
+ digitGroupSeparator: {}
+ };
+
+ (function() {
+ var map = conf.finals.style,
+ displayDensity = conf.style.displayDensity,
+ fontSize = conf.style.fontSize,
+ digitGroupSeparator = conf.style.digitGroupSeparator;
+
+ displayDensity[map.xcompact] = '2px';
+ displayDensity[map.compact] = '4px';
+ displayDensity[map.normal] = '6px';
+ displayDensity[map.comfortable] = '8px';
+ displayDensity[map.xcomfortable] = '10px';
+
+ fontSize[map.xsmall] = '9px';
+ fontSize[map.small] = '10px';
+ fontSize[map.normal] = '11px';
+ fontSize[map.large] = '12px';
+ fontSize[map.xlarge] = '14px';
+
+ digitGroupSeparator[map.space] = ' ';
+ digitGroupSeparator[map.comma] = ',';
+ digitGroupSeparator[map.none] = '';
+ })();
// url
conf.url = {
@@ -422,17 +460,17 @@
// collapseDataDimensions: boolean (false)
- // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_IERTANCE', 'ENROLLMENT'
+ // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_INSTANCE', 'ENROLLMENT'
// 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'
+ // displayDensity: string ('NORMAL') - 'COMPACT', 'NORMAL', 'COMFORTABLE'
+
+ // fontSize: string ('NORMAL') - 'SMALL', 'NORMAL', 'LARGE'
+
+ // digitGroupSeparator: string ('SPACE') - 'NONE', 'COMMA', 'SPACE'
// legendSet: object
@@ -584,7 +622,7 @@
layout.rows = config.rows;
layout.filters = config.filters;
- layout.dataType = Ext.isString(config.dataType) ? config.dataType : 'aggregated_values';
+ layout.dataType = Ext.isString(config.dataType) ? config.dataType : conf.finals.dataType.aggregated_values;
layout.program = config.program;
layout.programStage = config.programStage;
@@ -609,9 +647,9 @@
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : false;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
- layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : 'normal';
- layout.fontSize = Ext.isString(config.fontSize) && !Ext.isEmpty(config.fontSize) ? config.fontSize : 'normal';
- layout.digitGroupSeparator = Ext.isString(config.digitGroupSeparator) && !Ext.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : 'space';
+ layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : conf.finals.style.normal;
+ layout.fontSize = Ext.isString(config.fontSize) && !Ext.isEmpty(config.fontSize) ? config.fontSize : conf.finals.style.normal;
+ layout.digitGroupSeparator = Ext.isString(config.digitGroupSeparator) && !Ext.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : conf.finals.style.space;
layout.legendSet = Ext.isObject(config.legendSet) && Ext.isString(config.legendSet.id) ? config.legendSet : null;
// value
@@ -707,7 +745,7 @@
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
//alert('No values found');
- //return; // for ER, not for ER
+ //return; // for ER, not for PT
}
if (config.rows.length > 0 && config.headers.length !== config.rows[0].length) {
@@ -1008,13 +1046,13 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || 'space';
+ separator = separator || conf.finals.style.space;
- if (separator === 'none') {
+ if (separator === conf.finals.style.none) {
return number;
}
- return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, conf.report.digitGroupSeparator[separator]);
+ return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, conf.style.digitGroupSeparator[separator]);
};
// date
@@ -1966,15 +2004,15 @@
delete layout.showHierarchy;
}
- if (layout.displayDensity === 'normal') {
+ if (layout.displayDensity === conf.finals.style.normal) {
delete layout.displayDensity;
}
- if (layout.fontSize === 'normal') {
+ if (layout.fontSize === conf.finals.style.normal) {
delete layout.fontSize;
}
- if (layout.digitGroupSeparator === 'space') {
+ if (layout.digitGroupSeparator === conf.finals.style.space) {
delete layout.digitGroupSeparator;
}
@@ -2354,7 +2392,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2441,7 +2479,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2470,12 +2508,12 @@
var paramString,
dimensions = Ext.Array.clean([].concat(view.columns || [], view.rows || [])),
ignoreKeys = ['dy', 'longitude', 'latitude'],
- dataTypeMap = {
- 'aggregated_values': 'aggregate',
- 'individual_cases': 'query'
- },
+ dataTypeMap = {},
nameItemsMap;
+ dataTypeMap[conf.finals.dataType.aggregated_values] = 'aggregate';
+ dataTypeMap[conf.finals.dataType.individual_cases] = 'query';
+
format = format || 'json';
paramString = '/api/analytics/events/' + dataTypeMap[view.dataType] + '/' + view.program.id + '.' + format + '?';
@@ -2488,7 +2526,7 @@
for (var i = 0, dim; i < dimensions.length; i++) {
dim = dimensions[i];
- if (Ext.Array.contains(ignoreKeys, dim.dimension) || (dim.dimension === 'pe' && !dim.items && !dim.filter)) {
+ if (Ext.Array.contains(ignoreKeys, dim.dimension) || (dim.dimension === 'pe' && (!(dim.items && dim.items.length) && !dim.filter))) {
continue;
}
@@ -2566,12 +2604,12 @@
paramString += view.showHierarchy ? '&hierarchyMeta=true' : '';
// limit
- if (view.dataType === 'aggregated_values' && (view.sortOrder && view.topLimit)) {
+ if (view.dataType === conf.finals.dataType.aggregated_values && (view.sortOrder && view.topLimit)) {
paramString += '&limit=' + view.topLimit + '&sortOrder=' + (view.sortOrder < 0 ? 'ASC' : 'DESC');
}
// output type
- if (view.dataType === 'aggregated_values' && view.outputType) {
+ if (view.dataType === conf.finals.dataType.aggregated_values && view.outputType) {
paramString += '&outputType=' + view.outputType;
}
@@ -2579,16 +2617,16 @@
if (view.completedOnly) {
paramString += '&completedOnly=true';
}
-
+
// sorting
- if (view.dataType === 'individual_cases' && view.sorting) {
+ if (view.dataType === conf.finals.dataType.individual_cases && view.sorting) {
if (view.sorting.id && view.sorting.direction) {
paramString += '&' + view.sorting.direction.toLowerCase() + '=' + view.sorting.id;
}
}
// paging
- if (view.dataType === 'individual_cases' && view.paging && !skipPaging) {
+ if (view.dataType === conf.finals.dataType.individual_cases && view.paging && !skipPaging) {
paramString += view.paging.pageSize ? '&pageSize=' + view.paging.pageSize : '';
paramString += view.paging.page ? '&page=' + view.paging.page : '';
}
@@ -2600,7 +2638,7 @@
if (view.collapseDataDimensions) {
paramString += '&collapseDataDimensions=true';
}
-
+
// relative period date
if (view.relativePeriodDate) {
paramString += '&relativePeriodDate=' + view.relativePeriodDate;
@@ -3470,8 +3508,8 @@
var cls = 'pivot',
table;
- cls += xLayout.displayDensity && xLayout.displayDensity !== 'normal' ? ' displaydensity-' + xLayout.displayDensity : '';
- cls += xLayout.fontSize && xLayout.fontSize !== 'normal' ? ' fontsize-' + xLayout.fontSize : '';
+ cls += xLayout.displayDensity && xLayout.displayDensity !== conf.finals.style.normal ? ' displaydensity-' + xLayout.displayDensity : '';
+ cls += xLayout.fontSize && xLayout.fontSize !== conf.finals.style.normal ? ' fontsize-' + xLayout.fontSize : '';
table = '<table id="' + xLayout.tableUuid + '" class="' + cls + '">';
@@ -3540,8 +3578,8 @@
xResponse.sortableIdObjects = [];
- cls += layout.displayDensity && layout.displayDensity !== 'normal' ? ' displaydensity-' + layout.displayDensity : '';
- cls += layout.fontSize && layout.fontSize !== 'normal' ? ' fontsize-' + layout.fontSize : '';
+ cls += layout.displayDensity && layout.displayDensity !== conf.finals.style.none ? ' displaydensity-' + layout.displayDensity : '';
+ cls += layout.fontSize && layout.fontSize !== conf.finals.style.normal ? ' fontsize-' + layout.fontSize : '';
html += '<table class="' + cls + '"><tr>';
html += '<td class="pivot-dim pivot-dim-subtotal">' + '#' + '</td>';
@@ -3682,7 +3720,7 @@
ajax = function(requestConfig, authConfig) {
authConfig = authConfig || config;
-
+
if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
@@ -4037,10 +4075,10 @@
};
}
- if (layout.dataType === 'aggregated_values') {
+ if (layout.dataType === 'AGGREGATED_VALUES') {
web.report.createReport(layout, response);
}
- else if (layout.dataType === 'individual_cases') {
+ else if (layout.dataType === 'EVENTS') {
web.report.getData(layout);
}
};
@@ -4099,6 +4137,7 @@
config.failure = failure;
ns.ajax(config, ns);
+
};
web.report.getData = function(layout, isUpdateGui) {
@@ -4212,7 +4251,7 @@
}
};
- map['aggregated_values'] = function() {
+ map['AGGREGATED_VALUES'] = function() {
var xLayout,
xResponse,
xColAxis,
@@ -4312,7 +4351,7 @@
getXResponse();
};
- map['individual_cases'] = function() {
+ map['EVENTS'] = function() {
var xResponse,
getReport,
getTitleHtml = function(title) {
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-09-15 23:16:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-10-12 11:52:06 +0000
@@ -409,6 +409,8 @@
// hideEmptyRows: boolean (false)
+ // skipRounding: boolean (false)
+
// aggregationType: string ('DEFAULT') - 'DEFAULT', 'COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'
// dataApprovalLevel: object
@@ -590,6 +592,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.skipRounding = Ext.isBoolean(config.skipRounding) ? config.skipRounding : false;
layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : conf.finals.style.default_;
layout.dataApprovalLevel = Ext.isObject(config.dataApprovalLevel) && Ext.isString(config.dataApprovalLevel.id) ? config.dataApprovalLevel : null;
@@ -1750,6 +1753,10 @@
delete layout.hideEmptyRows;
}
+ if (!layout.skipRounding) {
+ delete layout.skipRounding;
+ }
+
if (!layout.showHierarchy) {
delete layout.showHierarchy;
}
@@ -2184,6 +2191,11 @@
paramString += '&relativePeriodDate=' + xLayout.relativePeriodDate;
}
+ // skip rounding
+ if (xLayout.skipRounding) {
+ paramString += '&skipRounding=true';
+ }
+
return paramString.replace(/#/g, '.');
};
@@ -3255,10 +3267,10 @@
css += '.td-nobreak { white-space: nowrap; } \n';
css += '.td-hidden { display: none; } \n';
css += '.td-collapsed { display: none; } \n';
- css += 'table.pivot.displaydensity-comfortable td { padding: 7px } \n';
- css += 'table.pivot.displaydensity-compact td { padding: 3px } \n';
- css += 'table.pivot.fontsize-large td { font-size: 13px } \n';
- css += 'table.pivot.fontsize-small td { font-size: 10px } \n';
+ css += 'table.pivot.displaydensity-COMFORTABLE td { padding: 7px } \n';
+ css += 'table.pivot.displaydensity-COMPACT td { padding: 3px } \n';
+ css += 'table.pivot.fontsize-LARGE td { font-size: 13px } \n';
+ css += 'table.pivot.fontsize-SMALL td { font-size: 10px } \n';
css += '.pivot td { font-family: arial, sans-serif, helvetica neue, helvetica !important; padding: 5px; border: 1px solid #b2b2b2; font-size: 11px } \n';
css += '.pivot-dim { background-color: #dae6f8; text-align: center; } \n';
css += '.pivot-dim.highlighted { background-color: #c5d8f6; } \n';
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-09-15 23:25:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-10-12 11:52:06 +0000
@@ -673,18 +673,30 @@
}
},
chart: {
- series: 'series',
- category: 'category',
- filter: 'filter',
- column: 'column',
- stackedcolumn: 'stackedcolumn',
- bar: 'bar',
- stackedbar: 'stackedbar',
- line: 'line',
- area: 'area',
- pie: 'pie',
- radar: 'radar',
- gauge: 'gauge'
+ client: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ server: {
+ column: 'COLUMN',
+ stackedcolumn: 'STACKED_COLUMN',
+ bar: 'BAR',
+ stackedbar: 'STACKED_BAR',
+ line: 'LINE',
+ area: 'AREA',
+ pie: 'PIE',
+ radar: 'RADAR',
+ gauge: 'GAUGE'
+ }
},
data: {
domain: 'domain_',
@@ -706,6 +718,36 @@
}
};
+ conf.finals.chart.c2s = {};
+ conf.finals.chart.s2c = {};
+
+ (function() {
+ var client = conf.finals.chart.client,
+ server = conf.finals.chart.server,
+ c2s = conf.finals.chart.c2s,
+ s2c = conf.finals.chart.s2c;
+
+ c2s[client.column] = server.column;
+ c2s[client.stackedcolumn] = server.stackedcolumn;
+ c2s[client.bar] = server.bar;
+ c2s[client.stackedbar] = server.stackedbar;
+ c2s[client.line] = server.line;
+ c2s[client.area] = server.area;
+ c2s[client.pie] = server.pie;
+ c2s[client.radar] = server.radar;
+ c2s[client.gauge] = server.gauge;
+
+ s2c[server.column] = client.column;
+ s2c[server.stackedcolumn] = client.stackedcolumn;
+ s2c[server.bar] = client.bar;
+ s2c[server.stackedbar] = client.stackedbar;
+ s2c[server.line] = client.line;
+ s2c[server.area] = client.area;
+ s2c[server.pie] = client.pie;
+ s2c[server.radar] = client.radar;
+ s2c[server.gauge] = client.gauge;
+ })();
+
dimConf = conf.finals.dimension;
dimConf.objectNameMap = {};
@@ -923,7 +965,7 @@
getValidatedDimensionArray,
validateSpecialCases;
- // type: string ('column') - 'column', 'stackedcolumn', 'bar', 'stackedbar', 'line', 'area', 'pie'
+ // type: string ('COLUMN') - 'COLUMN', 'STACKED_COLUMN', 'BAR', 'STACKED_BAR', 'LINE', 'AREA', 'PIE'
// columns: [Dimension]
@@ -1186,7 +1228,7 @@
//config = analytical2layout(config);
// layout
- layout.type = Ext.isString(config.type) ? config.type.toLowerCase() : conf.finals.chart.column;
+ layout.type = conf.finals.chart.s2c[config.type] || conf.finals.chart.client[config.type] || 'column';
layout.columns = config.columns;
layout.rows = config.rows;
@@ -3414,7 +3456,7 @@
store = config.store || {},
width = app.getCenterRegionWidth(),
height = app.getCenterRegionHeight(),
- isLineBased = Ext.Array.contains(['line', 'area'], xLayout.type),
+ isLineBased = Ext.Array.contains(['LINE', 'AREA'], xLayout.type),
defaultConfig = {
//animate: true,
animate: false,
@@ -3507,7 +3549,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.column) {
+ if (item.type === conf.finals.chart.client.column) {
item.stacked = true;
}
}
@@ -3593,7 +3635,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.bar) {
+ if (item.type === conf.finals.chart.client.bar) {
item.stacked = true;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js 2015-09-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js 2015-10-12 11:52:06 +0000
@@ -670,17 +670,30 @@
}
},
chart: {
- series: 'series',
- category: 'category',
- filter: 'filter',
- column: 'column',
- stackedcolumn: 'stackedcolumn',
- bar: 'bar',
- stackedbar: 'stackedbar',
- line: 'line',
- area: 'area',
- pie: 'pie',
- radar: 'radar'
+ client: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ server: {
+ column: 'COLUMN',
+ stackedcolumn: 'STACKED_COLUMN',
+ bar: 'BAR',
+ stackedbar: 'STACKED_BAR',
+ line: 'LINE',
+ area: 'AREA',
+ pie: 'PIE',
+ radar: 'RADAR',
+ gauge: 'GAUGE'
+ }
},
data: {
domain: 'domain_',
@@ -702,6 +715,36 @@
}
};
+ conf.finals.chart.c2s = {};
+ conf.finals.chart.s2c = {};
+
+ (function() {
+ var client = conf.finals.chart.client,
+ server = conf.finals.chart.server,
+ c2s = conf.finals.chart.c2s,
+ s2c = conf.finals.chart.s2c;
+
+ c2s[client.column] = server.column;
+ c2s[client.stackedcolumn] = server.stackedcolumn;
+ c2s[client.bar] = server.bar;
+ c2s[client.stackedbar] = server.stackedbar;
+ c2s[client.line] = server.line;
+ c2s[client.area] = server.area;
+ c2s[client.pie] = server.pie;
+ c2s[client.radar] = server.radar;
+ c2s[client.gauge] = server.gauge;
+
+ s2c[server.column] = client.column;
+ s2c[server.stackedcolumn] = client.stackedcolumn;
+ s2c[server.bar] = client.bar;
+ s2c[server.stackedbar] = client.stackedbar;
+ s2c[server.line] = client.line;
+ s2c[server.area] = client.area;
+ s2c[server.pie] = client.pie;
+ s2c[server.radar] = client.radar;
+ s2c[server.gauge] = client.gauge;
+ })();
+
dimConf = conf.finals.dimension;
dimConf.objectNameMap = {};
@@ -1160,7 +1203,7 @@
layout.rows = config.rows;
layout.filters = config.filters;
- layout.type = Ext.isString(config.type) ? config.type : 'column';
+ layout.type = conf.finals.chart.s2c[config.type] || conf.finals.chart.client[config.type] || 'column';
layout.program = config.program;
layout.programStage = config.programStage;
@@ -2929,7 +2972,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -4073,7 +4116,7 @@
else if (xLayout.title) {
text += (text.length ? ', ' : '') + xLayout.title;
}
- else if (xLayout.type === conf.finals.chart.pie) {
+ else if (xLayout.type === conf.finals.chart.client.pie) {
var ids = Ext.Array.clean([].concat(columnIds || []));
if (Ext.isArray(ids) && ids.length) {
@@ -4327,7 +4370,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.column) {
+ if (item.type === conf.finals.chart.client.column) {
item.stacked = true;
}
}
@@ -4413,7 +4456,7 @@
for (var i = 0, item; i < chart.series.items.length; i++) {
item = chart.series.items[i];
- if (item.type === conf.finals.chart.bar) {
+ if (item.type === conf.finals.chart.client.bar) {
item.stacked = true;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-09-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-10-12 11:52:06 +0000
@@ -146,7 +146,26 @@
},
root: {
id: 'root'
- }
+ },
+ style: {
+ 'normal': 'NORMAL',
+ 'compact': 'COMPACT',
+ 'xcompact': 'XCOMPACT',
+ 'comfortable': 'COMFORTABLE',
+ 'xcomfortable': 'XCOMFORTABLE',
+ 'small': 'SMALL',
+ 'xsmall': 'XSMALL',
+ 'large': 'LARGE',
+ 'xlarge': 'XLARGE',
+ 'space': 'SPACE',
+ 'comma': 'COMMA',
+ 'none': 'NONE',
+ 'default_': 'DEFAULT'
+ },
+ dataType: {
+ 'aggregated_values': 'AGGREGATED_VALUES',
+ 'individual_cases': 'EVENTS'
+ }
};
dimConf = conf.finals.dimension;
@@ -205,6 +224,14 @@
]
};
+ conf.valueType = {
+ numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
+ textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
+ booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+ dateTypes: ['DATE','DATETIME'],
+ aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ };
+
// aggregation type
conf.aggregationType = {
data: [
@@ -218,7 +245,7 @@
],
idNameMap: {}
};
-
+
conf.valueType = {
numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
@@ -268,23 +295,34 @@
multiselect_fill_reportingrates: 315
};
- // report
- conf.report = {
- digitGroupSeparator: {
- 'comma': ',',
- 'space': ' '
- },
- displayDensity: {
- 'compact': '3px',
- 'normal': '5px',
- 'comfortable': '10px',
- },
- fontSize: {
- 'small': '10px',
- 'normal': '11px',
- 'large': '13px'
- }
- };
+ conf.style = {
+ displayDensity: {},
+ fontSize: {},
+ digitGroupSeparator: {}
+ };
+
+ (function() {
+ var map = conf.finals.style,
+ displayDensity = conf.style.displayDensity,
+ fontSize = conf.style.fontSize,
+ digitGroupSeparator = conf.style.digitGroupSeparator;
+
+ displayDensity[map.xcompact] = '2px';
+ displayDensity[map.compact] = '4px';
+ displayDensity[map.normal] = '6px';
+ displayDensity[map.comfortable] = '8px';
+ displayDensity[map.xcomfortable] = '10px';
+
+ fontSize[map.xsmall] = '9px';
+ fontSize[map.small] = '10px';
+ fontSize[map.normal] = '11px';
+ fontSize[map.large] = '12px';
+ fontSize[map.xlarge] = '14px';
+
+ digitGroupSeparator[map.space] = ' ';
+ digitGroupSeparator[map.comma] = ',';
+ digitGroupSeparator[map.none] = '';
+ })();
// url
conf.url = {
@@ -422,17 +460,17 @@
// collapseDataDimensions: boolean (false)
- // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_IERTANCE', 'ENROLLMENT'
+ // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_INSTANCE', 'ENROLLMENT'
// 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'
+ // displayDensity: string ('NORMAL') - 'COMPACT', 'NORMAL', 'COMFORTABLE'
+
+ // fontSize: string ('NORMAL') - 'SMALL', 'NORMAL', 'LARGE'
+
+ // digitGroupSeparator: string ('SPACE') - 'NONE', 'COMMA', 'SPACE'
// legendSet: object
@@ -584,7 +622,7 @@
layout.rows = config.rows;
layout.filters = config.filters;
- layout.dataType = Ext.isString(config.dataType) ? config.dataType : 'aggregated_values';
+ layout.dataType = Ext.isString(config.dataType) ? config.dataType : conf.finals.dataType.aggregated_values;
layout.program = config.program;
layout.programStage = config.programStage;
@@ -609,9 +647,9 @@
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : false;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
- layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : 'normal';
- layout.fontSize = Ext.isString(config.fontSize) && !Ext.isEmpty(config.fontSize) ? config.fontSize : 'normal';
- layout.digitGroupSeparator = Ext.isString(config.digitGroupSeparator) && !Ext.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : 'space';
+ layout.displayDensity = Ext.isString(config.displayDensity) && !Ext.isEmpty(config.displayDensity) ? config.displayDensity : conf.finals.style.normal;
+ layout.fontSize = Ext.isString(config.fontSize) && !Ext.isEmpty(config.fontSize) ? config.fontSize : conf.finals.style.normal;
+ layout.digitGroupSeparator = Ext.isString(config.digitGroupSeparator) && !Ext.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : conf.finals.style.space;
layout.legendSet = Ext.isObject(config.legendSet) && Ext.isString(config.legendSet.id) ? config.legendSet : null;
// value
@@ -707,7 +745,7 @@
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
//alert('No values found');
- //return; // for ER, not for ER
+ //return; // for ER, not for PT
}
if (config.rows.length > 0 && config.headers.length !== config.rows[0].length) {
@@ -1008,13 +1046,13 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || 'space';
+ separator = separator || conf.finals.style.space;
- if (separator === 'none') {
+ if (separator === conf.finals.style.none) {
return number;
}
- return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, conf.report.digitGroupSeparator[separator]);
+ return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, conf.style.digitGroupSeparator[separator]);
};
// date
@@ -1966,15 +2004,15 @@
delete layout.showHierarchy;
}
- if (layout.displayDensity === 'normal') {
+ if (layout.displayDensity === conf.finals.style.normal) {
delete layout.displayDensity;
}
- if (layout.fontSize === 'normal') {
+ if (layout.fontSize === conf.finals.style.normal) {
delete layout.fontSize;
}
- if (layout.digitGroupSeparator === 'space') {
+ if (layout.digitGroupSeparator === conf.finals.style.space) {
delete layout.digitGroupSeparator;
}
@@ -2354,7 +2392,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2441,7 +2479,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2470,12 +2508,12 @@
var paramString,
dimensions = Ext.Array.clean([].concat(view.columns || [], view.rows || [])),
ignoreKeys = ['dy', 'longitude', 'latitude'],
- dataTypeMap = {
- 'aggregated_values': 'aggregate',
- 'individual_cases': 'query'
- },
+ dataTypeMap = {},
nameItemsMap;
+ dataTypeMap[conf.finals.dataType.aggregated_values] = 'aggregate';
+ dataTypeMap[conf.finals.dataType.individual_cases] = 'query';
+
format = format || 'json';
paramString = '/api/analytics/events/' + dataTypeMap[view.dataType] + '/' + view.program.id + '.' + format + '?';
@@ -2488,7 +2526,7 @@
for (var i = 0, dim; i < dimensions.length; i++) {
dim = dimensions[i];
- if (Ext.Array.contains(ignoreKeys, dim.dimension) || (dim.dimension === 'pe' && !dim.items && !dim.filter)) {
+ if (Ext.Array.contains(ignoreKeys, dim.dimension) || (dim.dimension === 'pe' && (!(dim.items && dim.items.length) && !dim.filter))) {
continue;
}
@@ -2566,12 +2604,12 @@
paramString += view.showHierarchy ? '&hierarchyMeta=true' : '';
// limit
- if (view.dataType === 'aggregated_values' && (view.sortOrder && view.topLimit)) {
+ if (view.dataType === conf.finals.dataType.aggregated_values && (view.sortOrder && view.topLimit)) {
paramString += '&limit=' + view.topLimit + '&sortOrder=' + (view.sortOrder < 0 ? 'ASC' : 'DESC');
}
// output type
- if (view.dataType === 'aggregated_values' && view.outputType) {
+ if (view.dataType === conf.finals.dataType.aggregated_values && view.outputType) {
paramString += '&outputType=' + view.outputType;
}
@@ -2579,16 +2617,16 @@
if (view.completedOnly) {
paramString += '&completedOnly=true';
}
-
+
// sorting
- if (view.dataType === 'individual_cases' && view.sorting) {
+ if (view.dataType === conf.finals.dataType.individual_cases && view.sorting) {
if (view.sorting.id && view.sorting.direction) {
paramString += '&' + view.sorting.direction.toLowerCase() + '=' + view.sorting.id;
}
}
// paging
- if (view.dataType === 'individual_cases' && view.paging && !skipPaging) {
+ if (view.dataType === conf.finals.dataType.individual_cases && view.paging && !skipPaging) {
paramString += view.paging.pageSize ? '&pageSize=' + view.paging.pageSize : '';
paramString += view.paging.page ? '&page=' + view.paging.page : '';
}
@@ -2600,7 +2638,7 @@
if (view.collapseDataDimensions) {
paramString += '&collapseDataDimensions=true';
}
-
+
// relative period date
if (view.relativePeriodDate) {
paramString += '&relativePeriodDate=' + view.relativePeriodDate;
@@ -3470,8 +3508,8 @@
var cls = 'pivot',
table;
- cls += xLayout.displayDensity && xLayout.displayDensity !== 'normal' ? ' displaydensity-' + xLayout.displayDensity : '';
- cls += xLayout.fontSize && xLayout.fontSize !== 'normal' ? ' fontsize-' + xLayout.fontSize : '';
+ cls += xLayout.displayDensity && xLayout.displayDensity !== conf.finals.style.normal ? ' displaydensity-' + xLayout.displayDensity : '';
+ cls += xLayout.fontSize && xLayout.fontSize !== conf.finals.style.normal ? ' fontsize-' + xLayout.fontSize : '';
table = '<table id="' + xLayout.tableUuid + '" class="' + cls + '">';
@@ -3540,8 +3578,8 @@
xResponse.sortableIdObjects = [];
- cls += layout.displayDensity && layout.displayDensity !== 'normal' ? ' displaydensity-' + layout.displayDensity : '';
- cls += layout.fontSize && layout.fontSize !== 'normal' ? ' fontsize-' + layout.fontSize : '';
+ cls += layout.displayDensity && layout.displayDensity !== conf.finals.style.none ? ' displaydensity-' + layout.displayDensity : '';
+ cls += layout.fontSize && layout.fontSize !== conf.finals.style.normal ? ' fontsize-' + layout.fontSize : '';
html += '<table class="' + cls + '"><tr>';
html += '<td class="pivot-dim pivot-dim-subtotal">' + '#' + '</td>';
@@ -3682,7 +3720,7 @@
ajax = function(requestConfig, authConfig) {
authConfig = authConfig || config;
-
+
if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
@@ -4037,10 +4075,10 @@
};
}
- if (layout.dataType === 'aggregated_values') {
+ if (layout.dataType === 'AGGREGATED_VALUES') {
web.report.createReport(layout, response);
}
- else if (layout.dataType === 'individual_cases') {
+ else if (layout.dataType === 'EVENTS') {
web.report.getData(layout);
}
};
@@ -4099,6 +4137,7 @@
config.failure = failure;
ns.ajax(config, ns);
+
};
web.report.getData = function(layout, isUpdateGui) {
@@ -4212,7 +4251,7 @@
}
};
- map['aggregated_values'] = function() {
+ map['AGGREGATED_VALUES'] = function() {
var xLayout,
xResponse,
xColAxis,
@@ -4312,7 +4351,7 @@
getXResponse();
};
- map['individual_cases'] = function() {
+ map['EVENTS'] = function() {
var xResponse,
getReport,
getTitleHtml = function(title) {
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-09-15 23:16:55 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-10-12 11:52:06 +0000
@@ -409,6 +409,8 @@
// hideEmptyRows: boolean (false)
+ // skipRounding: boolean (false)
+
// aggregationType: string ('DEFAULT') - 'DEFAULT', 'COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'
// dataApprovalLevel: object
@@ -590,6 +592,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.skipRounding = Ext.isBoolean(config.skipRounding) ? config.skipRounding : false;
layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : conf.finals.style.default_;
layout.dataApprovalLevel = Ext.isObject(config.dataApprovalLevel) && Ext.isString(config.dataApprovalLevel.id) ? config.dataApprovalLevel : null;
@@ -1750,6 +1753,10 @@
delete layout.hideEmptyRows;
}
+ if (!layout.skipRounding) {
+ delete layout.skipRounding;
+ }
+
if (!layout.showHierarchy) {
delete layout.showHierarchy;
}
@@ -2184,6 +2191,11 @@
paramString += '&relativePeriodDate=' + xLayout.relativePeriodDate;
}
+ // skip rounding
+ if (xLayout.skipRounding) {
+ paramString += '&skipRounding=true';
+ }
+
return paramString.replace(/#/g, '.');
};
@@ -3255,10 +3267,10 @@
css += '.td-nobreak { white-space: nowrap; } \n';
css += '.td-hidden { display: none; } \n';
css += '.td-collapsed { display: none; } \n';
- css += 'table.pivot.displaydensity-comfortable td { padding: 7px } \n';
- css += 'table.pivot.displaydensity-compact td { padding: 3px } \n';
- css += 'table.pivot.fontsize-large td { font-size: 13px } \n';
- css += 'table.pivot.fontsize-small td { font-size: 10px } \n';
+ css += 'table.pivot.displaydensity-COMFORTABLE td { padding: 7px } \n';
+ css += 'table.pivot.displaydensity-COMPACT td { padding: 3px } \n';
+ css += 'table.pivot.fontsize-LARGE td { font-size: 13px } \n';
+ css += 'table.pivot.fontsize-SMALL td { font-size: 10px } \n';
css += '.pivot td { font-family: arial, sans-serif, helvetica neue, helvetica !important; padding: 5px; border: 1px solid #b2b2b2; font-size: 11px } \n';
css += '.pivot-dim { background-color: #dae6f8; text-align: center; } \n';
css += '.pivot-dim.highlighted { background-color: #c5d8f6; } \n';