← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18086: ER EV GIS option set issue fixed + DV EV tooltip style fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18086 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-01-21 15:55:44 +0100
message:
  ER EV GIS option set issue fixed + DV EV tooltip style fix.
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-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.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


--
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-01-16 13:29:05 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-01-21 14:50:27 +0000
@@ -488,6 +488,19 @@
 					this.valueCmp.setOptionValues(a[1].split(';'));
 				}
             },
+            getRecordsByCode: function(options, codeArray) {
+                var records = [];
+
+                for (var i = 0; i < options.length; i++) {
+                    for (var j = 0; j < codeArray.length; j++) {
+                        if (options[i].code === codeArray[j]) {
+                            records.push(options[i]);
+                        }
+                    }
+                }
+
+                return records;
+            },
             initComponent: function() {
                 var container = this,
                     idProperty = 'code',
@@ -637,7 +650,7 @@
                 });
 
                 this.valueStore = Ext.create('Ext.data.Store', {
-					fields: ['id', 'name'],
+					fields: [idProperty, nameProperty],
                     listeners: {
                         add: function() {
                             container.valueCmp.select(this.getRange());
@@ -663,20 +676,20 @@
                         minWidth: 266,
                         cls: 'optionselector'
                     },
-                    setOptionValues: function(optionArray) {
-                        var options = [];
-
-                        for (var i = 0; i < optionArray.length; i++) {
-                            options.push({
-                                code: optionArray[i],
-                                name: optionArray[i]
-                            });
-                        }
-
-                        container.valueStore.removeAll();
-                        container.valueStore.loadData(options);
-
-                        this.setValue(options);
+                    setOptionValues: function(codeArray) {
+                        var me = this,
+                            records = [];
+
+                        dhis2.er.store.get('optionSets', container.dataElement.optionSet.id).done( function(obj) {
+                            if (Ext.isObject(obj) && Ext.isArray(obj.options) && obj.options.length) {
+                                records = container.getRecordsByCode(obj.options, codeArray);
+
+                                container.valueStore.removeAll();
+                                container.valueStore.loadData(records);
+
+                                me.setValue(records);
+                            }
+                        });
                     },
 					listeners: {
                         change: function(cmp, newVal, oldVal) {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-01-16 12:43:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-01-21 14:50:27 +0000
@@ -487,6 +487,19 @@
 					this.valueCmp.setOptionValues(a[1].split(';'));
 				}
             },
+            getRecordsByCode: function(options, codeArray) {
+                var records = [];
+
+                for (var i = 0; i < options.length; i++) {
+                    for (var j = 0; j < codeArray.length; j++) {
+                        if (options[i].code === codeArray[j]) {
+                            records.push(options[i]);
+                        }
+                    }
+                }
+
+                return records;
+            },
             initComponent: function() {
                 var container = this,
                     idProperty = 'code',
@@ -636,7 +649,7 @@
                 });
 
                 this.valueStore = Ext.create('Ext.data.Store', {
-					fields: ['id', 'name'],
+					fields: [idProperty, nameProperty],
                     listeners: {
                         add: function() {
                             container.valueCmp.select(this.getRange());
@@ -662,20 +675,20 @@
                         minWidth: 266,
                         cls: 'optionselector'
                     },
-                    setOptionValues: function(optionArray) {
-                        var options = [];
-
-                        for (var i = 0; i < optionArray.length; i++) {
-                            options.push({
-                                code: optionArray[i],
-                                name: optionArray[i]
-                            });
-                        }
-
-                        container.valueStore.removeAll();
-                        container.valueStore.loadData(options);
-
-                        this.setValue(options);
+                    setOptionValues: function(codeArray) {
+                        var me = this,
+                            records = [];
+
+                        dhis2.ev.store.get('optionSets', container.dataElement.optionSet.id).done( function(obj) {
+                            if (Ext.isObject(obj) && Ext.isArray(obj.options) && obj.options.length) {
+                                records = container.getRecordsByCode(obj.options, codeArray);
+
+                                container.valueStore.removeAll();
+                                container.valueStore.loadData(records);
+
+                                me.setValue(records);
+                            }
+                        });
                     },
 					listeners: {
                         change: function(cmp, newVal, oldVal) {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-01-16 12:43:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-01-21 14:54:09 +0000
@@ -1534,6 +1534,19 @@
 					this.valueCmp.setOptionValues(a[1].split(';'));
 				}
             },
+            getRecordsByCode: function(options, codeArray) {
+                var records = [];
+
+                for (var i = 0; i < options.length; i++) {
+                    for (var j = 0; j < codeArray.length; j++) {
+                        if (options[i].code === codeArray[j]) {
+                            records.push(options[i]);
+                        }
+                    }
+                }
+
+                return records;
+            },
             initComponent: function() {
                 var container = this,
                     idProperty = 'code',
@@ -1564,7 +1577,7 @@
                 });
 
                 this.searchStore = Ext.create('Ext.data.Store', {
-					fields: [idProperty, 'name'],
+					fields: [idProperty, nameProperty],
 					data: [],
 					loadOptionSet: function(optionSetId, key, pageSize) {
 						var store = this;
@@ -1663,7 +1676,7 @@
                 });
 
                 this.valueStore = Ext.create('Ext.data.Store', {
-					fields: ['id', 'name'],
+					fields: [idProperty, nameProperty],
                     listeners: {
                         add: function() {
                             container.valueCmp.select(this.getRange());
@@ -1688,20 +1701,20 @@
                     listConfig: {
                         cls: 'optionselector'
                     },
-                    setOptionValues: function(optionArray) {
-                        var options = [];
-
-                        for (var i = 0; i < optionArray.length; i++) {
-                            options.push({
-                                code: optionArray[i],
-                                name: optionArray[i]
-                            });
-                        }
-
-                        container.valueStore.removeAll();
-                        container.valueStore.loadData(options);
-
-                        this.setValue(options);
+                    setOptionValues: function(codeArray) {
+                        var me = this,
+                            records = [];
+
+                        dhis2.gis.store.get('optionSets', container.dataElement.optionSet.id).done( function(obj) {
+                            if (Ext.isObject(obj) && Ext.isArray(obj.options) && obj.options.length) {
+                                records = container.getRecordsByCode(obj.options, codeArray);
+
+                                container.valueStore.removeAll();
+                                container.valueStore.loadData(records);
+
+                                me.setValue(records);
+                            }
+                        });
                     },
 					listeners: {
                         change: function(cmp, newVal, oldVal) {

=== 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-01-20 19:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-01-21 12:02:34 +0000
@@ -2966,7 +2966,7 @@
                         renderer: function(si, item) {
                             if (item.value) {
                                 var value = item.value[1] === '0.0' ? '-' : item.value[1];
-                                this.update('<div style="text-align:center"><div style="font-size:17px; font-weight:bold">' + value + '</div><div style="font-size:10px">' + si.data[conf.finals.data.domain] + '</div></div>');
+                                this.update('<div style="font-size:17px; font-weight:bold">' + value + '</div><div style="font-size:10px">' + si.data[conf.finals.data.domain] + '</div>');
                             }
                         }
                     };
@@ -3895,12 +3895,12 @@
 	applyCss = function() {
         var css = '';
 
-        // chart tips css
-        css += '.dv-chart-tips { border-radius: 2px; padding: 2px 3px 0; border: 0 none; background-color: #222; } \n';
-        css += '.dv-chart-tips .x-tip-body { background-color: #222; font-size: 13px; font-weight: normal; color: #fff; -webkit-text-stroke: 0; } \n';
-        css += '.dv-chart-tips .x-tip-body div { font-family: arial,sans-serif,ubuntu,consolas !important; } \n';
+        // tooltip
+        css += '.dv-chart-tips { border-radius: 2px; padding: 2px 3px 0; border: 0 none; background-color: #000; opacity: 0.9 } \n';
+        css += '.dv-chart-tips .x-tip-body { background-color: #000; font-size: 13px; font-weight: normal; color: #fff; } \n';
+        css += '.dv-chart-tips .x-tip-body div { text-align: center; font-family: arial,sans-serif,ubuntu,consolas !important; } \n';
 
-        // load mask css
+        // load mask
         css += '.x-mask-msg { padding: 0; border: 0 none; background-image: none; background-color: transparent; } \n';
         css += '.x-mask-msg div { background-position: 11px center; } \n';
         css += '.x-mask-msg .x-mask-loading { border: 0 none; \n background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';

=== 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-01-20 17:42:18 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js	2015-01-21 12:02:34 +0000
@@ -3329,11 +3329,11 @@
                 getDefaultTips = function() {
                     return {
                         trackMouse: true,
-                        cls: 'dv-chart-tips',
+                        cls: 'ev-chart-tips',
                         renderer: function(si, item) {
                             if (item.value) {
                                 var value = item.value[1] === '0.0' ? '-' : item.value[1];
-                                this.update('<div style="text-align:center"><div style="font-size:17px; font-weight:bold">' + value + '</div><div style="font-size:10px">' + si.data[conf.finals.data.domain] + '</div></div>');
+                                this.update('<div style="font-size:17px; font-weight:bold">' + value + '</div><div style="font-size:10px">' + si.data[conf.finals.data.domain] + '</div>');
                             }
                         }
                     };
@@ -4391,11 +4391,14 @@
 	};
 
     applyCss = function() {
-        var css = '.dv-chart-tips { border-radius: 2px; padding: 0px 3px 1px; border: 2px solid #000; background-color: #000; } \n';
-        css += '.dv-chart-tips .x-tip-body { background-color: #000; font-size: 13px; font-weight: normal; color: #fff; -webkit-text-stroke: 0; } \n';
-        css += '.dv-chart-tips .x-tip-body div { font-family: arial,sans-serif,ubuntu,consolas !important; } \n';
-
-        // load mask css
+        var css = '';
+
+        // tooltip
+        css += '.ev-chart-tips { border-radius: 2px; padding: 2px 3px 0; border: 0 none; background-color: #000; opacity: 0.9 } \n';
+        css += '.ev-chart-tips .x-tip-body { background-color: #000; font-size: 13px; font-weight: normal; color: #fff; } \n';
+        css += '.ev-chart-tips .x-tip-body div { text-align: center; font-family: arial,sans-serif,ubuntu,consolas !important; } \n';
+
+        // load mask
         css += '.x-mask-msg { padding: 0; border: 0 none; background-image: none; background-color: transparent; } \n';
         css += '.x-mask-msg div { background-position: 11px center; } \n';
         css += '.x-mask-msg .x-mask-loading { border: 0 none; \n background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';