← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1645: (GIS) Improved code + minor map view bug fixed.

 

------------------------------------------------------------
revno: 1645
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-03-12 16:26:21 +0100
message:
  (GIS) Improved code + minor map view bug fixed.
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-03-12 13:27:25 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-03-12 15:26:21 +0000
@@ -2459,7 +2459,7 @@
 							fields: ['id', 'text'],
 							data: [[map_source_type_geojson, 'GeoJSON files'], [map_source_type_shapefile, 'Shapefiles'], [map_source_type_database, 'DHIS database']]
 						}),
-						listeners:{
+						listeners: {
 							'select': {
 								fn: function() {
 									var msv = Ext.getCmp('mapsource_cb').getValue();
@@ -3238,14 +3238,15 @@
 				MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude));
 			}
 			
-			if (MAPVIEW.longitude && MAPVIEW.latitude && MAPVIEW.zoom) {
-				MAP.setCenter(new OpenLayers.LonLat(MAPVIEW.longitude, MAPVIEW.latitude), MAPVIEW.zoom);
-			}
-			else if (MAPVIEW) {
-				MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude), MAPDATA.zoom);
-			}
-			
-			MAPVIEW = false;
+			if (MAPVIEW) {
+				if (MAPVIEW.longitude && MAPVIEW.latitude && MAPVIEW.zoom) {
+					MAP.setCenter(new OpenLayers.LonLat(MAPVIEW.longitude, MAPVIEW.latitude), MAPVIEW.zoom);
+				}
+				else {
+					MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude), MAPDATA.zoom);
+				}
+				MAPVIEW = false;
+			}
 			
 			toggleFeatureLabels(false);
 
@@ -3300,18 +3301,14 @@
 		MASK.hide();
 		return;
 	}
-	
+
 	for (var i = 0; i < mapvalues.length; i++) {
-		var featureId = mapvalues[i].featureId;
-		if (featureId != '') {
-			mv[featureId] = mapvalues[i].value;
-		}
+		mv[mapvalues[i].featureId] = mapvalues[i].featureId ? mapvalues[i].value : '';
 	}
-	
+
 	if (MAPSOURCE == map_source_type_geojson || MAPSOURCE == map_source_type_shapefile) {
 		for (var j = 0; j < features.length; j++) {
-			var featureId = features[j].attributes[nameColumn];
-			features[j].attributes.value = mv[featureId] ? mv[featureId] : 0;
+			features[j].attributes.value = mv[features[j].attributes[nameColumn]] ? mv[features[j].attributes[nameColumn]] : 0;
 		}
 	}
 	else if (MAPSOURCE == map_source_type_database) {
@@ -3324,7 +3321,7 @@
 			}
 		}
     }
-	
+
 	var options = {};
 	
 	/*hidden*/
@@ -3488,7 +3485,7 @@
 			MASK.msg = 'Applying organisation units relations...';
 			MASK.show();
 			
-            Ext.messageBlack.msg('Assign organisation units', '<span class="x-msg-hl">' + count_match + '</span> organisation units assigned.<br><br>Database: <span class="x-msg-hl">' + organisationUnits.length + '</span><br>Shapefile: <span class="x-msg-hl">' + features.length + '</span>');
+            Ext.messageBlack.msg('Assign organisation units', '<span class="x-msg-hl">' + count_match + '</span> organisation units assigned.<br/><br/>Database: <span class="x-msg-hl">' + organisationUnits.length + '</span><br>Shapefile: <span class="x-msg-hl">' + features.length + '</span>');
             
             Ext.getCmp('grid_gp').getStore().reload();
             loadMapData(organisationUnitAssignment, position);