← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5019: (GIS) Predefined legend bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5019 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-10-24 13:18:05 +0200
message:
  (GIS) Predefined legend bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.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-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js	2011-10-10 15:08:48 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js	2011-10-24 11:14:16 +0000
@@ -158,7 +158,7 @@
 
             element = document.createElement("div");
             element.style.lineHeight = this.widget.legendNames[i] ? "12px" : "7px";
-            element.innerHTML = '<b style="color:#222">' + this.widget.legendNames[i] + '</b><br/>' + this.classification.bins[i].label;
+            element.innerHTML = '<b style="color:#222">' + (this.widget.legendNames[i] || '') + '</b><br/>' + this.classification.bins[i].label;
             this.legendDiv.appendChild(element);
 
             element = document.createElement("div");

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2011-10-10 15:08:48 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2011-10-24 11:14:16 +0000
@@ -176,7 +176,7 @@
                 this.legendDiv.appendChild(element);
             }
         }
-        else if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_predefined) {        
+        else if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_predefined) {
             for (var i = 0; i < this.classification.bins.length; i++) {
                 var element = document.createElement("div");
                 element.style.backgroundColor = this.colorInterpolation[i].toHexString();
@@ -188,7 +188,7 @@
 
                 element = document.createElement("div");
                 element.style.lineHeight = this.widget.legendNames[i] ? "12px" : "7px";
-                element.innerHTML = '<b style="color:#222">' + this.widget.legendNames[i] + '</b><br/>' + this.classification.bins[i].label;
+                element.innerHTML = '<b style="color:#222">' + (this.widget.legendNames[i] || '') + '</b><br/>' + this.classification.bins[i].label;
                 this.legendDiv.appendChild(element);
 
                 element = document.createElement("div");

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js	2011-10-10 15:08:48 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js	2011-10-24 11:14:16 +0000
@@ -188,7 +188,7 @@
 
                 element = document.createElement("div");
                 element.style.lineHeight = this.widget.legendNames[i] ? "12px" : "7px";
-                element.innerHTML = '<b style="color:#222">' + this.widget.legendNames[i] + '</b><br/>' + this.classification.bins[i].label;
+                element.innerHTML = '<b style="color:#222">' + (this.widget.legendNames[i] || '') + '</b><br/>' + this.classification.bins[i].label;
                 this.legendDiv.appendChild(element);
 
                 element = document.createElement("div");

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-10-10 14:37:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-10-24 11:14:16 +0000
@@ -1517,27 +1517,27 @@
 			params: {mapLegendSetId: mls},
             scope: this,
 			success: function(r) {
-				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends;
-				var colors = [];
-				var bounds = [];
-                var legendNames = [];
+				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends,
+                    colors = [],
+                    bounds = [],
+                    names = [];
 				for (var i = 0; i < mapLegends.length; i++) {
 					if (bounds[bounds.length-1] != mapLegends[i].startValue) {
 						if (bounds.length !== 0) {
 							colors.push(new mapfish.ColorRgb(240,240,240));
-                            legendNames.push('');
+                            names.push('');
 						}
 						bounds.push(mapLegends[i].startValue);
 					}
 					colors.push(new mapfish.ColorRgb());
 					colors[colors.length-1].setFromHex(mapLegends[i].color);
-                    legendNames.push(mapLegends[i].name);
+                    names.push(mapLegends[i].name);
 					bounds.push(mapLegends[i].endValue);
-				}              
+				}
 
 				this.colorInterpolation = colors;
 				this.bounds = bounds;
-                this.legendNames = legendNames;
+                this.legendNames = names;
                 
                 if (isMapView) {
                     this.setMapViewMap();

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-10-10 15:08:48 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-10-24 11:14:16 +0000
@@ -1495,10 +1495,10 @@
 			params: {mapLegendSetId: mls},
             scope: this,
 			success: function(r) {
-				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends;
-				var colors = [];
-				var bounds = [];
-                var legendNames = [];
+				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends,
+                    colors = [],
+                    bounds = [],
+                    names = [];
 				for (var i = 0; i < mapLegends.length; i++) {
 					if (bounds[bounds.length-1] != mapLegends[i].startValue) {
 						if (bounds.length !== 0) {