← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19754: GIS legendset validation issue fixed.

 

------------------------------------------------------------
revno: 19754
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-08-09 18:17:04 +0200
message:
  GIS legendset validation issue fixed.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.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-mapping/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-08-06 15:33:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-08-09 16:17:04 +0000
@@ -2571,7 +2571,12 @@
                 Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
-                        var set = Ext.decode(r.responseText)[elementUrl][0].legendSet;
+                        var elements = Ext.decode(r.responseText)[elementUrl],
+                            set;
+
+                        if (Ext.Array.from(elements).length) {
+                            set = Ext.isObject(elements[0]) ? elements[0].legendSet || null : null;
+                        }
 
                         if (set) {
                             view.legendSet = set;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-08-06 15:33:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-08-09 16:17:04 +0000
@@ -3961,7 +3961,12 @@
                 Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
-                        var set = Ext.decode(r.responseText)[elementUrl][0].legendSet;
+                        var elements = Ext.decode(r.responseText)[elementUrl],
+                            set;
+
+                        if (Ext.Array.from(elements).length) {
+                            set = Ext.isObject(elements[0]) ? elements[0].legendSet || null : null;
+                        }
 
                         if (set) {
                             view.legendSet = set;

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-08-06 13:27:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-08-09 16:17:04 +0000
@@ -3961,7 +3961,12 @@
                 Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
-                        var set = Ext.decode(r.responseText)[elementUrl][0].legendSet;
+                        var elements = Ext.decode(r.responseText)[elementUrl],
+                            set;
+
+                        if (Ext.Array.from(elements).length) {
+                            set = Ext.isObject(elements[0]) ? elements[0].legendSet || null : null;
+                        }
 
                         if (set) {
                             view.legendSet = set;
@@ -7337,7 +7342,7 @@
         };
 
         initialize = function() {
-            var el = Ext.get(config.el);
+            var el = Ext.get(config.el);            
 
             if (!validateConfig()) {
                 return;

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-08-06 13:27:58 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-08-09 16:17:04 +0000
@@ -3961,7 +3961,12 @@
                 Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
-                        var set = Ext.decode(r.responseText)[elementUrl][0].legendSet;
+                        var elements = Ext.decode(r.responseText)[elementUrl],
+                            set;
+
+                        if (Ext.Array.from(elements).length) {
+                            set = Ext.isObject(elements[0]) ? elements[0].legendSet || null : null;
+                        }
 
                         if (set) {
                             view.legendSet = set;
@@ -7337,7 +7342,7 @@
         };
 
         initialize = function() {
-            var el = Ext.get(config.el);
+            var el = Ext.get(config.el);            
 
             if (!validateConfig()) {
                 return;