← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19964: ER, upgraded to valueType enum

 

------------------------------------------------------------
revno: 19964
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 12:58:40 +0200
message:
  ER, upgraded to valueType enum
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-09-03 10:15:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-09-03 10:58:40 +0000
@@ -4123,7 +4123,7 @@
                 var layoutWindow = ns.app.aggregateLayoutWindow;
 
                 this.each( function(record) {
-                    if (Ext.Array.contains(['int', 'number'], record.data.valueType)) {
+                    if (Ext.Array.contains(ns.core.conf.valueType.numericTypes, record.data.valueType)) {
                         layoutWindow.valueStore.add(record.data);
                     }
                 });
@@ -4696,19 +4696,19 @@
 					return 'Ext.ux.panel.OrganisationUnitGroupSetContainer';
 				}
 
-				if (element.valueType === 'int' || element.valueType === 'number') {
+				if (Ext.Array.contains(ns.core.conf.valueType.numericTypes, element.valueType)) {
 					return 'Ext.ux.panel.DataElementIntegerContainer';
 				}
 
-				if (element.valueType === 'string') {
+				if (Ext.Array.contains(ns.core.conf.valueType.textTypes, element.valueType)) {
 					return 'Ext.ux.panel.DataElementStringContainer';
 				}
 
-				if (element.valueType === 'date') {
+				if (Ext.Array.contains(ns.core.conf.valueType.dateTypes, element.valueType)) {
 					return 'Ext.ux.panel.DataElementDateContainer';
 				}
 
-				if (element.valueType === 'bool' || element.valueType === 'trueOnly') {
+				if (Ext.Array.contains(ns.core.conf.valueType.booleanTypes, element.valueType)) {
 					return 'Ext.ux.panel.DataElementBooleanContainer';
 				}
 
@@ -4749,7 +4749,7 @@
 				allElements = [],
                 aggWindow = ns.app.aggregateLayoutWindow,
                 queryWindow = ns.app.queryLayoutWindow,
-                includeKeys = ['int', 'number', 'bool', 'boolean', 'trueOnly'],
+                includeKeys = ns.core.conf.valueType.aggregateTypes,
                 ignoreKeys = ['pe', 'ou'],
                 recordMap = {
 					'pe': {id: 'pe', name: 'Periods'},
@@ -4787,7 +4787,7 @@
 				element = dataElements[i];
 				allElements.push(element);
 
-				if (element.valueType === 'int' && element.filter) {
+				if (Ext.Array.contains(ns.core.conf.valueType.numericTypes, element.valueType) && element.filter) {
 					a = element.filter.split(':');
 					numberOfElements = a.length / 2;
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2015-09-02 18:25:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2015-09-03 10:58:40 +0000
@@ -152,6 +152,14 @@
                 ],
                 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'],
+            	booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+            	dateTypes: ['DATE','DATETIME'],
+            	aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+            }
 
             for (var i = 0, obj; i < conf.aggregationType.data.length; i++) {
                 obj = conf.aggregationType.data[i];