=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-05-20 15:46:34 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-05-25 12:46:06 +0000 @@ -278,17 +278,14 @@ }, getLegendsJSON: function() { - var json = '{'; - json += '"legends":'; - json += '['; + var json = '{"legends":['; for(var i = 0; i < this.imageLegend.length; i++) { json += '{'; json += '"label": "' + this.imageLegend[i].label + '",'; json += '"color": "' + this.imageLegend[i].color + '"'; json += i < this.imageLegend.length-1 ? '},' : '}'; } - json += ']'; - json += '}'; + json += ']}'; return json; }, === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-05-25 10:34:19 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-05-25 12:46:06 +0000 @@ -683,12 +683,12 @@ svg = G.util.mergeSvg(str1, [str2]); } else { - Ext.message.msg(false, 'Point layer not rendered'); + Ext.message.msg(false, '' + G.conf.thematic_layer_1 + ' not rendered'); return; } } else { - Ext.message.msg(false, 'Polygon layer not rendered'); + Ext.message.msg(false, '' + G.conf.thematic_layer_2 + ' not rendered'); return; } } @@ -702,7 +702,7 @@ svg = document.getElementById(polygonLayer.svgId).parentNode.innerHTML; } else { - Ext.message.msg(false, G.conf.thematic_layer_1 + ' not rendered'); + Ext.message.msg(false, '' + G.conf.thematic_layer_1 + ' not rendered'); return; } } @@ -716,7 +716,7 @@ svg = document.getElementById(pointLayer.svgId).parentNode.innerHTML; } else { - Ext.message.msg(false, G.conf.thematic_layer_2 + ' not rendered'); + Ext.message.msg(false, '' + G.conf.thematic_layer_2 + ' not rendered'); return; } } @@ -758,7 +758,7 @@ /* Section: predefined map legend set */ var predefinedMapLegendSetWindow = new Ext.Window({ id: 'predefinedmaplegendset_w', - title: ''+G.i18n.predefined_legend_sets+'', + title: '' + G.i18n.predefined_legend_sets + '', layout: 'accordion', closeAction: 'hide', width: G.conf.window_width, === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-04-12 17:22:06 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-05-25 12:46:06 +0000 @@ -197,6 +197,8 @@ var bins = []; var binCount = []; var sortedValues = []; + var maxDec = 0; + for (var i = 0; i < this.values.length; i++) { sortedValues.push(this.values[i]); } @@ -217,9 +219,6 @@ } binCount[nbBins - 1] = this.nbVal - mapfish.Util.sum(binCount); - - var imageLegend = []; - var maxDec = 0; for (var l = 0; l < bounds.length; l++) { var dec = G.util.getNumberOfDecimals(bounds[l].toString(), "."); @@ -232,15 +231,6 @@ bins[m] = new mapfish.GeoStat.Bin(binCount[m], bounds[m], bounds[m + 1], m == (nbBins - 1)); var labelGenerator = this.labelGenerator || this.defaultLabelGenerator; bins[m].label = labelGenerator(bins[m], m, nbBins, maxDec); - imageLegend[m] = {}; - imageLegend[m].label = bins[m].label.replace('  ', ' '); - } - - if (G.vars.activePanel.isPolygon()) { - choropleth.imageLegend = imageLegend; - } - else if (G.vars.activePanel.isPoint()) { - point.imageLegend = imageLegend; } return new mapfish.GeoStat.Classification(bins); === 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-05-25 10:07:22 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2011-05-25 12:46:06 +0000 @@ -66,9 +66,12 @@ this.colorInterpolation = mapLegendType == G.conf.map_legend_type_automatic ? mapfish.ColorRgb.getColorsArrayByRgbInterpolation(this.colors[0], this.colors[1], numColors) : this.widget.colorInterpolation; - - for (var i = 0; i < this.widget.imageLegend.length && i < this.colorInterpolation.length; i++) { - this.widget.imageLegend[i].color = this.colorInterpolation[i].toHexString(); + + for (var i = 0; i < this.classification.bins.length; i++) { + this.widget.imageLegend[i] = { + label: this.classification.bins[i].label.replace('  ', ' '), + color: this.colorInterpolation[i].toHexString() + }; } }, === 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-05-25 10:13:10 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js 2011-05-25 12:46:06 +0000 @@ -66,9 +66,12 @@ this.colorInterpolation = mapLegendType == G.conf.map_legend_type_automatic ? mapfish.ColorRgb.getColorsArrayByRgbInterpolation(this.colors[0], this.colors[1], numColors) : this.widget.colorInterpolation; - - for (var i = 0; i < this.widget.imageLegend.length && i < this.colorInterpolation.length; i++) { - this.widget.imageLegend[i].color = this.colorInterpolation[i].toHexString(); + + for (var i = 0; i < this.classification.bins.length; i++) { + this.widget.imageLegend[i] = { + label: this.classification.bins[i].label.replace('  ', ' '), + color: this.colorInterpolation[i].toHexString() + }; } }, === 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-05-25 10:34:19 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-05-25 12:46:06 +0000 @@ -58,8 +58,6 @@ legend: false, - imageLegend: false, - bounds: false, mapView: false, @@ -77,6 +75,8 @@ updateValues: false, isDrillDown: false, + + imageLegend: [], initComponent: function() { === 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-05-25 10:34:19 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-05-25 12:46:06 +0000 @@ -58,8 +58,6 @@ legend: false, - imageLegend: false, - bounds: false, mapView: false, @@ -77,6 +75,8 @@ updateValues: false, isDrillDown: false, + + imageLegend: [], initComponent: function() {