← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16831: PT text value issue fixed + DV options window layout.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16831 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-26 13:34:25 +0200
message:
  PT text value issue fixed + DV options window layout.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js


--
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/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2014-09-23 14:00:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2014-09-26 11:32:57 +0000
@@ -577,6 +577,10 @@
 						console.log('Response: headers.length !== rows[0].length');
 					}
 
+for (var i = 0; i < config.rows.length; i++) {
+    config.rows[i][2] = '2text';
+}
+
 					return config;
 				}();
 			};
@@ -1823,21 +1827,23 @@
                 return response;
             };
 
-            service.response.getValue = function(responseValue) {
-                if (Ext.isNumber(parseFloat(responseValue))) {
-                    return parseFloat(responseValue);
-                }
-
-                if (Ext.isBoolean(responseValue)) {
-                    return !!responseValue ? 1 : 0;
-                }
-
-                if (Ext.isString(responseValue)) {
-                    return 0;
-                }
-
-                return;
-            };
+            service.response.getValue = function(str) {
+				var n = parseFloat(str);
+
+                if (Ext.isBoolean(str)) {
+                    return 1;
+                }
+
+                // return string if
+                // - parsefloat(string) is not a number
+                // - string is just starting with a number
+                // - string is a valid date
+				if (!Ext.isNumber(n) || n != str || new Date(str).toString() !== 'Invalid Date') {
+					return 0;
+				}
+
+                return n;
+			};
         }());
 
 		// web
@@ -2092,24 +2098,38 @@
                         getHtmlValue;
 
                     getHtmlValue = function(config) {
+                        var str = config.htmlValue,
+                            n = parseFloat(config.htmlValue);
+
                         if (config.collapsed) {
                             return '';
                         }
 
-                        if (Ext.isBoolean(config.htmlValue)) {
-                            return config.htmlValue;
-                        }
-
-                        if (config.htmlValue && isValue) {
-                            return Ext.isNumber(parseFloat(config.htmlValue)) ? parseFloat(config.htmlValue).toString() : config.htmlValue;
-                        }
-
-                        if (config.value && isValue) {
-                            return Ext.isNumber(parseFloat(config.value)) ? parseFloat(config.value).toString() : config.value;
-                        }
-
-                        return config.htmlValue || '';
-                    };
+                        if (isValue) {
+                            if (Ext.isBoolean(str)) {
+                                return str;
+                            }
+
+                            if (!Ext.isNumber(n) || n != str || new Date(str).toString() !== 'Invalid Date') {
+                                return str;
+                            }
+
+                            return n;
+                        }
+
+                        return str || '';
+                    }
+
+                        //if (config.htmlValue && isValue) {
+                            //return Ext.isNumber(parseFloat(config.htmlValue)) ? parseFloat(config.htmlValue).toString() : config.htmlValue;
+                        //}
+
+                        //if (config.value && isValue) {
+                            //return Ext.isNumber(parseFloat(config.value)) ? parseFloat(config.value).toString() : config.value;
+                        //}
+
+                        //return config.htmlValue || '';
+                    //};
 
 					if (!Ext.isObject(config)) {
 						return '';

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2014-09-24 12:43:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2014-09-26 11:32:57 +0000
@@ -473,8 +473,8 @@
 			baseLineValue,
 			baseLineTitle,
 
+            rangeAxisMinValue,
             rangeAxisMaxValue,
-            rangeAxisMinValue,
             rangeAxisSteps,
             rangeAxisDecimals,
 			rangeAxisTitle,
@@ -551,15 +551,15 @@
 			style: 'margin-bottom:4px'
 		});
 
+		rangeAxisMinValue = Ext.create('Ext.form.field.Number', {
+			width: numberWidth,
+			height: 18,
+			labelWidth: 125
+		});
+
 		rangeAxisMaxValue = Ext.create('Ext.form.field.Number', {
 			width: numberWidth,
 			height: 18,
-			labelWidth: 125
-		});
-
-		rangeAxisMinValue = Ext.create('Ext.form.field.Number', {
-			width: numberWidth,
-			height: 18,
 			labelWidth: 125,
             style: 'margin-left:1px'
 		});
@@ -568,6 +568,7 @@
 			width: labelWidth + 5 + numberWidth,
 			height: 18,
 			fieldLabel: 'Range axis tick steps',
+			labelStyle: 'color:#333',
 			labelWidth: 125,
 			minValue: 1
 		});
@@ -576,6 +577,7 @@
 			width: labelWidth + 5 + numberWidth,
 			height: 18,
 			fieldLabel: 'Range axis decimals',
+			labelStyle: 'color:#333',
 			labelWidth: 125,
 			minValue: 0
 		});
@@ -709,7 +711,7 @@
 
 		window = Ext.create('Ext.window.Window', {
 			title: NS.i18n.chart_options,
-			bodyStyle: 'background-color:#fff; padding:5px 5px 3px',
+			bodyStyle: 'background-color:#fff; padding:3px',
 			closeAction: 'hide',
 			autoShow: true,
 			modal: true,