← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20174: PT enums.

 

------------------------------------------------------------
revno: 20174
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 21:42:00 +0200
message:
  PT enums.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/i18n_app.properties
  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


--
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/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/i18n_app.properties	2015-09-10 20:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/i18n_app.properties	2015-09-15 19:42:00 +0000
@@ -202,3 +202,5 @@
 completed_only=Completed only
 events=Events
 include_only_completed_events_only=Include only completed events
+comma=Comma
+space=Space

=== 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-10 20:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2015-09-15 19:42:00 +0000
@@ -11,6 +11,8 @@
 		extendCore,
 		createViewport,
 		dimConf,
+        styleConf,
+        finalsStyleConf,
 
 		ns = {
 			core: {},
@@ -647,13 +649,13 @@
 			queryMode: 'local',
 			valueField: 'id',
 			editable: false,
-			value: 'normal',
+            value: finalsStyleConf.normal,
 			store: Ext.create('Ext.data.Store', {
 				fields: ['id', 'text'],
 				data: [
-					{id: 'comfortable', text: NS.i18n.comfortable},
-					{id: 'normal', text: NS.i18n.normal},
-					{id: 'compact', text: NS.i18n.compact}
+					{id: finalsStyleConf.compact, text: NS.i18n.compact},
+					{id: finalsStyleConf.normal, text: NS.i18n.normal},
+					{id: finalsStyleConf.comfortable, text: NS.i18n.comfortable}
 				]
 			})
 		});
@@ -668,13 +670,13 @@
 			queryMode: 'local',
 			valueField: 'id',
 			editable: false,
-			value: 'normal',
+			value: finalsStyleConf.normal,
 			store: Ext.create('Ext.data.Store', {
 				fields: ['id', 'text'],
 				data: [
-					{id: 'large', text: NS.i18n.large},
-					{id: 'normal', text: NS.i18n.normal},
-					{id: 'small', text: NS.i18n.small_}
+					{id: finalsStyleConf.large, text: NS.i18n.large},
+					{id: finalsStyleConf.normal, text: NS.i18n.normal},
+					{id: finalsStyleConf.small, text: NS.i18n.small_}
 				]
 			})
 		});
@@ -689,13 +691,13 @@
 			queryMode: 'local',
 			valueField: 'id',
 			editable: false,
-			value: 'space',
+			value: finalsStyleConf.space,
 			store: Ext.create('Ext.data.Store', {
 				fields: ['id', 'text'],
 				data: [
-					{id: 'comma', text: 'Comma'},
-					{id: 'space', text: 'Space'},
-					{id: 'none', text: 'None'}
+					{id: finalsStyleConf.none, text: NS.i18n.none},
+					{id: finalsStyleConf.space, text: NS.i18n.space},
+					{id: finalsStyleConf.comma, text: NS.i18n.comma}
 				]
 			})
 		});
@@ -881,13 +883,13 @@
 				showRowSubTotals.setValue(Ext.isBoolean(layout.showRowSubTotals) ? layout.showRowSubTotals : true);
 				showDimensionLabels.setValue(Ext.isBoolean(layout.showDimensionLabels) ? layout.showDimensionLabels : true);
 				hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false);
-                aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'DEFAULT');
-				dataApprovalLevel.setValue(Ext.isObject(layout.dataApprovalLevel) && Ext.isString(layout.dataApprovalLevel.id) ? layout.dataApprovalLevel.id : 'DEFAULT');
+                aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : finalsStyleConf.default_);
+				dataApprovalLevel.setValue(Ext.isObject(layout.dataApprovalLevel) && Ext.isString(layout.dataApprovalLevel.id) ? layout.dataApprovalLevel.id : finalsStyleConf.default_);
 				showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false);
                 completedOnly.setValue(Ext.isBoolean(layout.completedOnly) ? layout.completedOnly : false);
-				displayDensity.setValue(Ext.isString(layout.displayDensity) ? layout.displayDensity : 'normal');
-				fontSize.setValue(Ext.isString(layout.fontSize) ? layout.fontSize : 'normal');
-				digitGroupSeparator.setValue(Ext.isString(layout.digitGroupSeparator) ? layout.digitGroupSeparator : 'space');
+				displayDensity.setValue(Ext.isString(layout.displayDensity) ? layout.displayDensity : finalsStyleConf.normal);
+				fontSize.setValue(Ext.isString(layout.fontSize) ? layout.fontSize : finalsStyleConf.normal);
+				digitGroupSeparator.setValue(Ext.isString(layout.digitGroupSeparator) ? layout.digitGroupSeparator : finalsStyleConf.space);
 				legendSet.setValue(Ext.isObject(layout.legendSet) && Ext.isString(layout.legendSet.id) ? layout.legendSet.id : 0);
 				reportingPeriod.setValue(Ext.isBoolean(layout.reportingPeriod) ? layout.reportingPeriod : false);
 				organisationUnit.setValue(Ext.isBoolean(layout.organisationUnit) ? layout.organisationUnit : false);
@@ -2833,9 +2835,7 @@
             setGui,
             viewport,
 
-			accordionPanels = [],
-
-            dimConf = ns.core.conf.finals.dimension;
+			accordionPanels = [];
 
 		ns.app.stores = ns.app.stores || {};
 
@@ -6897,9 +6897,9 @@
                     version = 'v' + parseFloat(ns.core.init.systemInfo.version.split('.').join(''));
 
 				text += '<html>\n<head>\n';
-				text += '<link rel="stylesheet" href="http://dhis2-cdn.org/' + version + '/ext/resources/css/ext-plugin-gray.css" />\n';
-				text += '<script src="http://dhis2-cdn.org/' + version + '/ext/ext-all.js"></script>\n';
-				text += '<script src="http://dhis2-cdn.org/' + version + '/plugin/table.js"></script>\n';
+				text += '<link rel="stylesheet" href="//dhis2-cdn.org/' + version + '/ext/resources/css/ext-plugin-gray.css" />\n';
+				text += '<script src="//dhis2-cdn.org/' + version + '/ext/ext-all.js"></script>\n';
+				text += '<script src="//dhis2-cdn.org/' + version + '/plugin/table.js"></script>\n';
 				text += '</head>\n\n<body>\n';
 				text += '<div id="table1"></div>\n\n';
 				text += '<script>\n\n';
@@ -7775,6 +7775,9 @@
 				extendCore(ns.core);
 
 				dimConf = ns.core.conf.finals.dimension;
+                finalsStyleConf = ns.core.conf.finals.style;
+                styleConf = ns.core.conf.style;
+
 				ns.app.viewport = createViewport();
 
                 ns.core.app.getViewportWidth = function() { return ns.app.viewport.getWidth(); };

=== 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-10 14:47:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2015-09-15 19:42:00 +0000
@@ -146,21 +146,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: [
@@ -232,26 +249,34 @@
 				multiselect_fill_reportingrates: 315
 			};
 
-			conf.report = {
-				digitGroupSeparator: {
-					'comma': ',',
-					'space': '&nbsp;'
-				},
-				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] = '&nbsp;';
+                digitGroupSeparator[map.comma] = ',';
+                digitGroupSeparator[map.none] = '';
+            })();
 
             conf.url = {
                 analysisFields: [
@@ -390,11 +415,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
 
@@ -838,7 +863,7 @@
 					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
@@ -1731,15 +1756,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;
 				}
 
@@ -1751,11 +1776,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;
 				}
 
@@ -3018,8 +3043,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 + '">';