← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1440: (GIS) Minor fix.

 

------------------------------------------------------------
revno: 1440
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-02-16 20:41:38 +0100
message:
  (GIS) Minor fix.
modified:
  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/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-02-16 17:59:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-02-16 19:41:38 +0000
@@ -55,58 +55,60 @@
 }
 
 function toggleFeatureLabels(classify) {
-	var layer = MAP.getLayersByName('Thematic map')[0];
-	
-	function activateLabels() {
-		layer.styleMap = new OpenLayers.StyleMap({
-			'default': new OpenLayers.Style(
-				OpenLayers.Util.applyDefaults(
-					{'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'label': '${' + MAPDATA.nameColumn + '}', 'fontFamily': 'tahoma' },
-					OpenLayers.Feature.Vector.style['default']
-				)
-			),
-			'select': new OpenLayers.Style(
-				{'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
-			)
-		});
-		layer.refresh();
-		LABELS = true;
-	}
-	
-	function deactivateLabels() {
-		layer.styleMap = new OpenLayers.StyleMap({
-			'default': new OpenLayers.Style(
-				OpenLayers.Util.applyDefaults(
-					{'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1 },
-					OpenLayers.Feature.Vector.style['default']
-				)
-			),
-			'select': new OpenLayers.Style(
-				{'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
-			)
-		});
-		layer.refresh();
-		LABELS = false;
-	}
-	
-	if (classify) {
-		if (LABELS) {
-			deactivateLabels();
+	if (MAPDATA) {
+		var layer = MAP.getLayersByName('Thematic map')[0];
+		
+		function activateLabels() {
+			layer.styleMap = new OpenLayers.StyleMap({
+				'default': new OpenLayers.Style(
+					OpenLayers.Util.applyDefaults(
+						{'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'label': '${' + MAPDATA.nameColumn + '}', 'fontFamily': 'tahoma' },
+						OpenLayers.Feature.Vector.style['default']
+					)
+				),
+				'select': new OpenLayers.Style(
+					{'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
+				)
+			});
+			layer.refresh();
+			LABELS = true;
+		}
+		
+		function deactivateLabels() {
+			layer.styleMap = new OpenLayers.StyleMap({
+				'default': new OpenLayers.Style(
+					OpenLayers.Util.applyDefaults(
+						{'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1 },
+						OpenLayers.Feature.Vector.style['default']
+					)
+				),
+				'select': new OpenLayers.Style(
+					{'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'}
+				)
+			});
+			layer.refresh();
+			LABELS = false;
+		}
+		
+		if (classify) {
+			if (LABELS) {
+				deactivateLabels();
+			}
+			else {
+				activateLabels();
+			}
+			
+			if (ACTIVEPANEL == 'choropleth') {
+				choropleth.classify(true);
+			}
+			else if (ACTIVEPANEL == 'mapping') {
+				mapping.classify(true);
+			}
 		}
 		else {
-			activateLabels();
-		}
-		
-		if (ACTIVEPANEL == 'choropleth') {
-			choropleth.classify(true);
-		}
-		else if (ACTIVEPANEL == 'mapping') {
-			mapping.classify(true);
-		}
-	}
-	else {
-		if (LABELS) {
-			activateLabels();
+			if (LABELS) {
+				activateLabels();
+			}
 		}
 	}
 }