dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39796
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20175: PT enums.
------------------------------------------------------------
revno: 20175
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-16 00:59:55 +0200
message:
PT enums.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html
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-pivot/scripts/table.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/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-pivot/plugin.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-09-11 18:29:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-09-15 22:59:55 +0000
@@ -23,9 +23,8 @@
username: username,
password: password,
el: 'table1',
- uid: 'tWg9OiyV7mu',
- showDimensionLabels: true,
- displayDensity: 'compact'
+ uid: 'MwnpKMaxcPh',
+ showDimensionLabels: true
});
DHIS.getTable({
=== 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-09-15 19:42:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-09-15 22:59:55 +0000
@@ -583,11 +583,11 @@
queryMode: 'local',
valueField: 'id',
editable: false,
- value: 'DEFAULT',
+ value: finalsStyleConf.default_,
store: Ext.create('Ext.data.Store', {
fields: ['id', 'text'],
data: [
- {id: 'DEFAULT', text: NS.i18n.by_data_element},
+ {id: finalsStyleConf.default_, text: NS.i18n.by_data_element},
{id: 'COUNT', text: NS.i18n.count},
{id: 'SUM', text: NS.i18n.sum},
{id: 'STDDEV', text: NS.i18n.stddev},
@@ -610,11 +610,11 @@
displayField: 'name',
editable: false,
hidden: !(ns.core.init.systemInfo.hideUnapprovedDataInAnalytics && ns.core.init.user.viewUnapprovedData),
- value: 'DEFAULT',
+ value: finalsStyleConf.default_,
store: Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
data: function() {
- var data = [{id: 'DEFAULT', name: NS.i18n.show_all_data}],
+ var data = [{id: finalsStyleConf.default_, name: NS.i18n.show_all_data}],
levels = ns.core.init.dataApprovalLevels;
for (var i = 0; i < levels.length; i++) {
=== 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-09-15 19:42:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-09-15 22:59:55 +0000
@@ -160,7 +160,7 @@
'space': 'SPACE',
'comma': 'COMMA',
'none': 'NONE',
- 'default': 'DEFAULT'
+ 'default_': 'DEFAULT'
}
};
@@ -524,7 +524,7 @@
}
// in and aggregation type
- if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
+ if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== conf.finals.style.default_) {
webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -588,16 +588,16 @@
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.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'DEFAULT';
+ 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;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : 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;
layout.parentGraphMap = Ext.isObject(config.parentGraphMap) ? config.parentGraphMap : null;
@@ -857,9 +857,9 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || 'space';
+ separator = separator || conf.finals.style.space;
- if (separator === 'none') {
+ if (separator === conf.finals.style.space.none) {
return number;
}
@@ -2168,7 +2168,7 @@
}
// data approval level
- if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== 'DEFAULT') {
+ if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== conf.finals.style.default_) {
paramString += '&approvalLevel=' + xLayout.dataApprovalLevel.id;
}
=== 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-11 18:29:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-09-15 22:59:55 +0000
@@ -148,21 +148,38 @@
},
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'
+ }
};
- dimConf = conf.finals.dimension;
+ (function() {
+ dimConf = conf.finals.dimension;
- dimConf.objectNameMap = {};
- dimConf.objectNameMap[dimConf.data.objectName] = dimConf.data;
- dimConf.objectNameMap[dimConf.indicator.objectName] = dimConf.indicator;
- dimConf.objectNameMap[dimConf.dataElement.objectName] = dimConf.dataElement;
- dimConf.objectNameMap[dimConf.operand.objectName] = dimConf.operand;
- dimConf.objectNameMap[dimConf.dataSet.objectName] = dimConf.dataSet;
- dimConf.objectNameMap[dimConf.category.objectName] = dimConf.category;
- dimConf.objectNameMap[dimConf.period.objectName] = dimConf.period;
- dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
- dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ dimConf.objectNameMap = {};
+ dimConf.objectNameMap[dimConf.data.objectName] = dimConf.data;
+ dimConf.objectNameMap[dimConf.indicator.objectName] = dimConf.indicator;
+ dimConf.objectNameMap[dimConf.dataElement.objectName] = dimConf.dataElement;
+ dimConf.objectNameMap[dimConf.operand.objectName] = dimConf.operand;
+ dimConf.objectNameMap[dimConf.dataSet.objectName] = dimConf.dataSet;
+ dimConf.objectNameMap[dimConf.category.objectName] = dimConf.category;
+ dimConf.objectNameMap[dimConf.period.objectName] = dimConf.period;
+ dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
+ dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ })();
conf.period = {
periodTypes: [
@@ -234,26 +251,34 @@
multiselect_fill_reportingrates: 315
};
- conf.report = {
- digitGroupSeparator: {
- 'comma': ',',
- 'space': ' '
- },
- displayDensity: {
- 'xcompact': '2px',
- 'compact': '4px',
- 'normal': '6px',
- 'comfortable': '8px',
- 'xcomfortable': '10px'
- },
- fontSize: {
- 'xsmall': '9px',
- 'small': '10px',
- 'normal': '11px',
- 'large': '12px',
- 'xlarge': '14px'
- }
- };
+ 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] = '';
+ })();
conf.url = {
analysisFields: [
@@ -392,11 +417,11 @@
// completedOnly: 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
@@ -501,7 +526,7 @@
}
// in and aggregation type
- if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
+ if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== conf.finals.style.default_) {
webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -565,16 +590,16 @@
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.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'DEFAULT';
+ 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;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : 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;
layout.parentGraphMap = Ext.isObject(config.parentGraphMap) ? config.parentGraphMap : null;
@@ -834,13 +859,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.space.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
@@ -1733,15 +1758,15 @@
delete layout.completedOnly;
}
- 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;
}
@@ -1753,11 +1778,11 @@
delete layout.sorting;
}
- if (layout.aggregationType === 'DEFAULT') {
+ if (layout.aggregationType === conf.finals.style.default_) {
delete layout.aggregationType;
}
- if (layout.dataApprovalLevel && layout.dataApprovalLevel.id === 'DEFAULT') {
+ if (layout.dataApprovalLevel && layout.dataApprovalLevel.id === conf.finals.style.default_) {
delete layout.dataApprovalLevel;
}
@@ -2145,7 +2170,7 @@
}
// data approval level
- if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== 'DEFAULT') {
+ if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== conf.finals.style.default_) {
paramString += '&approvalLevel=' + xLayout.dataApprovalLevel.id;
}
@@ -3020,8 +3045,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 + '">';
=== 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-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-09-15 22:59:55 +0000
@@ -148,21 +148,38 @@
},
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'
+ }
};
- dimConf = conf.finals.dimension;
+ (function() {
+ dimConf = conf.finals.dimension;
- dimConf.objectNameMap = {};
- dimConf.objectNameMap[dimConf.data.objectName] = dimConf.data;
- dimConf.objectNameMap[dimConf.indicator.objectName] = dimConf.indicator;
- dimConf.objectNameMap[dimConf.dataElement.objectName] = dimConf.dataElement;
- dimConf.objectNameMap[dimConf.operand.objectName] = dimConf.operand;
- dimConf.objectNameMap[dimConf.dataSet.objectName] = dimConf.dataSet;
- dimConf.objectNameMap[dimConf.category.objectName] = dimConf.category;
- dimConf.objectNameMap[dimConf.period.objectName] = dimConf.period;
- dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
- dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ dimConf.objectNameMap = {};
+ dimConf.objectNameMap[dimConf.data.objectName] = dimConf.data;
+ dimConf.objectNameMap[dimConf.indicator.objectName] = dimConf.indicator;
+ dimConf.objectNameMap[dimConf.dataElement.objectName] = dimConf.dataElement;
+ dimConf.objectNameMap[dimConf.operand.objectName] = dimConf.operand;
+ dimConf.objectNameMap[dimConf.dataSet.objectName] = dimConf.dataSet;
+ dimConf.objectNameMap[dimConf.category.objectName] = dimConf.category;
+ dimConf.objectNameMap[dimConf.period.objectName] = dimConf.period;
+ dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
+ dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ })();
conf.period = {
periodTypes: [
@@ -234,26 +251,34 @@
multiselect_fill_reportingrates: 315
};
- conf.report = {
- digitGroupSeparator: {
- 'comma': ',',
- 'space': ' '
- },
- displayDensity: {
- 'xcompact': '2px',
- 'compact': '4px',
- 'normal': '6px',
- 'comfortable': '8px',
- 'xcomfortable': '10px'
- },
- fontSize: {
- 'xsmall': '9px',
- 'small': '10px',
- 'normal': '11px',
- 'large': '12px',
- 'xlarge': '14px'
- }
- };
+ 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] = '';
+ })();
conf.url = {
analysisFields: [
@@ -392,11 +417,11 @@
// completedOnly: 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
@@ -501,7 +526,7 @@
}
// in and aggregation type
- if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
+ if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== conf.finals.style.default_) {
webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -565,16 +590,16 @@
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.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'DEFAULT';
+ 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;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : 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;
layout.parentGraphMap = Ext.isObject(config.parentGraphMap) ? config.parentGraphMap : null;
@@ -834,13 +859,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.space.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
@@ -1733,15 +1758,15 @@
delete layout.completedOnly;
}
- 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;
}
@@ -1753,11 +1778,11 @@
delete layout.sorting;
}
- if (layout.aggregationType === 'DEFAULT') {
+ if (layout.aggregationType === conf.finals.style.default_) {
delete layout.aggregationType;
}
- if (layout.dataApprovalLevel && layout.dataApprovalLevel.id === 'DEFAULT') {
+ if (layout.dataApprovalLevel && layout.dataApprovalLevel.id === conf.finals.style.default_) {
delete layout.dataApprovalLevel;
}
@@ -2145,7 +2170,7 @@
}
// data approval level
- if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== 'DEFAULT') {
+ if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== conf.finals.style.default_) {
paramString += '&approvalLevel=' + xLayout.dataApprovalLevel.id;
}
@@ -3020,8 +3045,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 + '">';
=== 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-11 22:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-09-15 22:59:55 +0000
@@ -148,21 +148,38 @@
},
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'
+ }
};
- dimConf = conf.finals.dimension;
+ (function() {
+ dimConf = conf.finals.dimension;
- dimConf.objectNameMap = {};
- dimConf.objectNameMap[dimConf.data.objectName] = dimConf.data;
- dimConf.objectNameMap[dimConf.indicator.objectName] = dimConf.indicator;
- dimConf.objectNameMap[dimConf.dataElement.objectName] = dimConf.dataElement;
- dimConf.objectNameMap[dimConf.operand.objectName] = dimConf.operand;
- dimConf.objectNameMap[dimConf.dataSet.objectName] = dimConf.dataSet;
- dimConf.objectNameMap[dimConf.category.objectName] = dimConf.category;
- dimConf.objectNameMap[dimConf.period.objectName] = dimConf.period;
- dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
- dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ dimConf.objectNameMap = {};
+ dimConf.objectNameMap[dimConf.data.objectName] = dimConf.data;
+ dimConf.objectNameMap[dimConf.indicator.objectName] = dimConf.indicator;
+ dimConf.objectNameMap[dimConf.dataElement.objectName] = dimConf.dataElement;
+ dimConf.objectNameMap[dimConf.operand.objectName] = dimConf.operand;
+ dimConf.objectNameMap[dimConf.dataSet.objectName] = dimConf.dataSet;
+ dimConf.objectNameMap[dimConf.category.objectName] = dimConf.category;
+ dimConf.objectNameMap[dimConf.period.objectName] = dimConf.period;
+ dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
+ dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ })();
conf.period = {
periodTypes: [
@@ -234,26 +251,34 @@
multiselect_fill_reportingrates: 315
};
- conf.report = {
- digitGroupSeparator: {
- 'comma': ',',
- 'space': ' '
- },
- displayDensity: {
- 'xcompact': '2px',
- 'compact': '4px',
- 'normal': '6px',
- 'comfortable': '8px',
- 'xcomfortable': '10px'
- },
- fontSize: {
- 'xsmall': '9px',
- 'small': '10px',
- 'normal': '11px',
- 'large': '12px',
- 'xlarge': '14px'
- }
- };
+ 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] = '';
+ })();
conf.url = {
analysisFields: [
@@ -392,11 +417,11 @@
// completedOnly: 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
@@ -501,7 +526,7 @@
}
// in and aggregation type
- if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
+ if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== conf.finals.style.default_) {
webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -565,16 +590,16 @@
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.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'DEFAULT';
+ 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;
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
layout.completedOnly = Ext.isBoolean(config.completedOnly) ? config.completedOnly : 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;
layout.parentGraphMap = Ext.isObject(config.parentGraphMap) ? config.parentGraphMap : null;
@@ -834,13 +859,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.space.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
@@ -1733,15 +1758,15 @@
delete layout.completedOnly;
}
- 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;
}
@@ -1753,11 +1778,11 @@
delete layout.sorting;
}
- if (layout.aggregationType === 'DEFAULT') {
+ if (layout.aggregationType === conf.finals.style.default_) {
delete layout.aggregationType;
}
- if (layout.dataApprovalLevel && layout.dataApprovalLevel.id === 'DEFAULT') {
+ if (layout.dataApprovalLevel && layout.dataApprovalLevel.id === conf.finals.style.default_) {
delete layout.dataApprovalLevel;
}
@@ -2145,7 +2170,7 @@
}
// data approval level
- if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== 'DEFAULT') {
+ if (Ext.isObject(xLayout.dataApprovalLevel) && Ext.isString(xLayout.dataApprovalLevel.id) && xLayout.dataApprovalLevel.id !== conf.finals.style.default_) {
paramString += '&approvalLevel=' + xLayout.dataApprovalLevel.id;
}
@@ -3020,8 +3045,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 + '">';