dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10015
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2728: Improved code.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2728 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-01-24 12:55:04 +0100
message:
Improved code.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.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/mapping/script/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js 2011-01-21 16:22:09 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js 2011-01-24 11:33:18 +0000
@@ -364,11 +364,7 @@
exportValues: null,
- topLevelUnit: null,
-
- svgIdPolygon: null,
-
- svgIdPoint: null
+ topLevelUnit: null
};
G.user = {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2011-01-21 16:46:05 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2011-01-24 11:33:18 +0000
@@ -726,7 +726,7 @@
document.getElementById('periodField').value = values.dateValue;
document.getElementById('indicatorField').value = values.mapValueTypeValue;
document.getElementById('legendsField').value = G.util.getLegendsJSON.call(choropleth);
- svgElement = document.getElementById(G.vars.svgIdPolygon);
+ svgElement = document.getElementById(polygonLayer.svgId);
svg = svgElement.parentNode.innerHTML;
}
else {
@@ -741,7 +741,7 @@
document.getElementById('periodField').value = values.dateValue;
document.getElementById('indicatorField').value = values.mapValueTypeValue;
document.getElementById('legendsField').value = G.util.getLegendsJSON.call(symbol);
- svgElement = document.getElementById(G.vars.svgIdPoint);
+ svgElement = document.getElementById(pointLayer.svgId);
svg = svgElement.parentNode.innerHTML;
}
else {
@@ -765,10 +765,10 @@
document.getElementById('indicatorField2').value = values.mapValueTypeValue;
document.getElementById('legendsField2').value = G.util.getLegendsJSON.call(symbol);
- svgElement = document.getElementById(G.vars.svgIdPolygon);
+ svgElement = document.getElementById(polygonLayer.svgId);
var str1 = svgElement.parentNode.innerHTML;
str1 = svgElement.parentNode.innerHTML.replace('</svg>');
- var str2 = document.getElementById(G.vars.svgIdPoint).parentNode.innerHTML;
+ var str2 = document.getElementById(pointLayer.svgId).parentNode.innerHTML;
str2 = str2.substring(str2.indexOf('>')+1);
svg = str1 + str2;
}
@@ -1919,39 +1919,39 @@
});
/* Section: layers */
- var choroplethLayer = new OpenLayers.Layer.Vector('Polygon layer', {
- 'visibility': false,
- 'displayInLayerSwitcher': false,
- 'styleMap': new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(
- OpenLayers.Util.applyDefaults(
- {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'pointRadius': 5},
- OpenLayers.Feature.Vector.style['default']
- )
- ),
- 'select': new OpenLayers.Style(
- {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
- )
- })
- });
-
- var symbolLayer = new OpenLayers.Layer.Vector('Point layer', {
- 'visibility': false,
- 'displayInLayerSwitcher': false,
- 'styleMap': new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(
- OpenLayers.Util.applyDefaults(
- {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'pointRadius': 5},
- OpenLayers.Feature.Vector.style['default']
- )
- ),
- 'select': new OpenLayers.Style(
- {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
- )
- })
- });
-
- G.vars.map.addLayers([choroplethLayer, symbolLayer]);
+ polygonLayer = new OpenLayers.Layer.Vector('Polygon layer', {
+ 'visibility': false,
+ 'displayInLayerSwitcher': false,
+ 'styleMap': new OpenLayers.StyleMap({
+ 'default': new OpenLayers.Style(
+ OpenLayers.Util.applyDefaults(
+ {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'pointRadius': 5},
+ OpenLayers.Feature.Vector.style['default']
+ )
+ ),
+ 'select': new OpenLayers.Style(
+ {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
+ )
+ })
+ });
+
+ pointLayer = new OpenLayers.Layer.Vector('Point layer', {
+ 'visibility': false,
+ 'displayInLayerSwitcher': false,
+ 'styleMap': new OpenLayers.StyleMap({
+ 'default': new OpenLayers.Style(
+ OpenLayers.Util.applyDefaults(
+ {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'pointRadius': 5},
+ OpenLayers.Feature.Vector.style['default']
+ )
+ ),
+ 'select': new OpenLayers.Style(
+ {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
+ )
+ })
+ });
+
+ G.vars.map.addLayers([polygonLayer, pointLayer]);
var layerTree = new Ext.tree.TreePanel({
title: '<span class="panel-title">' + G.i18n.map_layers + '</span>',
@@ -2263,7 +2263,7 @@
choropleth = new mapfish.widgets.geostat.Choropleth({
id: 'choropleth',
map: G.vars.map,
- layer: choroplethLayer,
+ layer: polygonLayer,
title: '<span class="panel-title">' + G.i18n.polygon_layer + '</span>',
featureSelection: false,
legendDiv: 'polygonlegend',
@@ -2278,7 +2278,7 @@
symbol = new mapfish.widgets.geostat.Symbol({
id: 'symbol',
map: G.vars.map,
- layer: symbolLayer,
+ layer: pointLayer,
title: '<span class="panel-title">' + G.i18n.point_layer + '</span>',
featureSelection: false,
legendDiv: 'pointlegend',
@@ -2580,10 +2580,10 @@
G.vars.map.addControl(new OpenLayers.Control.ZoomBox());
if (!Ext.isIE) {
- G.vars.svgIdPolygon = G.vars.parameter.overlays.length ?
+ polygonLayer.svgId = G.vars.parameter.overlays.length ?
document.getElementsByTagName('svg')[G.vars.parameter.overlays.length].id : document.getElementsByTagName('svg')[0].id;
- G.vars.svgIdPoint = G.vars.parameter.overlays.length ?
+ pointLayer.svgId = G.vars.parameter.overlays.length ?
document.getElementsByTagName('svg')[G.vars.parameter.overlays.length + 1].id : document.getElementsByTagName('svg')[1].id;
}