← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8866: (GIS) Improved validation.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 8866 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-05 12:29:38 +0300
message:
  (GIS) Improved validation.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.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/app/index.html'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html	2012-11-04 18:50:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html	2012-11-05 09:02:05 +0000
@@ -10,9 +10,7 @@
 	<link rel="stylesheet" type="text/css" href="styles/style.css" />
 </head>
 
-<body>
-	<div id="slow" style="height:200px; width: 200px; padding: 20px"></div>
-	
+<body>	
 	<div id="layerItems"></div>
 	<div id="boundaryLegend"></div>
 	<div id="thematic1Legend"></div>
@@ -29,12 +27,9 @@
 		var GIS = {};
 		window.google = null;
 		document.body.oncontextmenu = function(){return false;};
-		document.getElementById('slow').innerHTML = "<a href=''>SLOW CONNECTION?</a>";
 	</script>
     
-<!--
     <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false";></script>
--->
 
     <script type="text/javascript" src="../../dhis-web-commons/javascripts/ext/ext-all.js"></script>
     <script type="text/javascript">
@@ -45,9 +40,6 @@
 			'Ext.ux.button.ColorButton',
 			'Ext.ux.panel.LayerItemPanel'
 		]);
-		Ext.onReady( function() {	
-			Ext.removeNode(document.getElementById('slow'));
-		});
     </script>
     
     <script type="text/javascript" src="scripts/openlayers/OpenLayers.js"></script>

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2012-11-04 17:28:17 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2012-11-05 09:24:07 +0000
@@ -1738,7 +1738,7 @@
 				],
 				listeners: {
 					show: function() {
-						this.setPosition(this.getPosition()[0], 100);
+						this.setPosition(mapWindow.x + 14, mapWindow.y + 67);
 					}
 				}
 			});
@@ -2024,6 +2024,7 @@
 				{
 					xtype: 'panel',
 					layout: 'hbox',
+					width: 422,
 					cls: 'gis-container-inner',
 					items: [
 						addButton,
@@ -2069,7 +2070,7 @@
 		};
 		
 		setMap = function(map) {
-			var views = map.mapViews,
+			var views = Ext.isDefined(map.mapViews) ? map.mapViews : [],
 				view,
 				center,
 				lonLat;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js	2012-11-04 18:50:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js	2012-11-05 09:24:07 +0000
@@ -452,6 +452,7 @@
 	getView: function() {
 		var level = this.cmp.level,
 			parent = this.cmp.parent.getSelectionModel().getSelection(),
+			store = GIS.store.organisationUnitLevels,
 			view;
 				
 		parent = parent.length ? parent : [{raw: GIS.init.rootNodes[0]}];
@@ -460,7 +461,7 @@
 			organisationUnitLevel: {
 				id: level.getValue(),
 				name: level.getRawValue(),
-				level: GIS.store.organisationUnitLevels.getById(level.getValue()).data.level
+				level: store.data.items.length && level.getValue() ? store.getById(level.getValue()).data.level : null
 			},
 			parentOrganisationUnit: {
 				id: parent[0].raw.id,

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js	2012-11-04 18:50:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js	2012-11-05 09:24:07 +0000
@@ -717,6 +717,7 @@
 	getView: function() {
 		var level = this.cmp.level,
 			parent = this.cmp.parent.getSelectionModel().getSelection(),
+			store = GIS.store.organisationUnitLevels,
 			view;
 				
 		parent = parent.length ? parent : [{raw: GIS.init.rootNodes[0]}];
@@ -729,7 +730,7 @@
 			organisationUnitLevel: {
 				id: level.getValue(),
 				name: level.getRawValue(),
-				level: GIS.store.organisationUnitLevels.getById(level.getValue()).data.level
+				level: store.data.items.length && level.getValue() ? store.getById(level.getValue()).data.level : null
 			},
 			parentOrganisationUnit: {
 				id: parent[0].raw.id,

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js	2012-11-04 18:50:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js	2012-11-05 09:24:07 +0000
@@ -1387,6 +1387,7 @@
 	getView: function() {
 		var level = this.cmp.level,
 			parent = this.cmp.parent.getSelectionModel().getSelection(),
+			store = GIS.store.organisationUnitLevels,
 			view;
 				
 		parent = parent.length ? parent : [{raw: GIS.init.rootNodes[0]}];
@@ -1427,7 +1428,7 @@
 			organisationUnitLevel: {
 				id: level.getValue(),
 				name: level.getRawValue(),
-				level: GIS.store.organisationUnitLevels.getById(level.getValue()).data.level
+				level: store.data.items.length && level.getValue() ? store.getById(level.getValue()).data.level : null
 			},
 			parentOrganisationUnit: {
 				id: parent[0].raw.id,

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js	2012-11-04 18:50:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js	2012-11-05 09:24:07 +0000
@@ -201,39 +201,6 @@
 		})
 	},
     
-    setUrl: function(url) {
-        this.url = url;
-        this.coreComp.setUrl(this.url);
-    },
-
-    requestSuccess: function(request) {
-        var doc = request.responseXML,
-			format = new OpenLayers.Format.GeoJSON();
-			
-        if (!doc || !doc.documentElement) {
-            doc = request.responseText;
-        }
-        
-        if (doc.length) {
-            doc = GIS.util.geojson.decode(doc, this);
-        }
-        else {
-			alert('No valid coordinates found'); //todo //i18n
-		}
-        
-        this.layer.removeFeatures(this.layer.features);
-        this.layer.addFeatures(format.read(doc));
-		this.layer.features = GIS.util.vector.getTransformedFeatureArray(this.layer.features);
-        this.features = this.layer.features.slice(0);
-        
-        this.loadData();
-    },
-
-    requestFailure: function(request) {
-        GIS.logg.push(request.status, request.statusText);        
-        console.log(request.status, request.statusText);
-    },
-    
     getColors: function(low, high) {
         var startColor = new mapfish.ColorRgb();
         startColor.setFromHex(low || this.cmp.colorLow.getValue());
@@ -1420,6 +1387,7 @@
 	getView: function() {
 		var level = this.cmp.level,
 			parent = this.cmp.parent.getSelectionModel().getSelection(),
+			store = GIS.store.organisationUnitLevels,
 			view;
 				
 		parent = parent.length ? parent : [{raw: GIS.init.rootNodes[0]}];
@@ -1460,7 +1428,7 @@
 			organisationUnitLevel: {
 				id: level.getValue(),
 				name: level.getRawValue(),
-				level: GIS.store.organisationUnitLevels.getById(level.getValue()).data.level
+				level: store.data.items.length && level.getValue() ? store.getById(level.getValue()).data.level : null
 			},
 			parentOrganisationUnit: {
 				id: parent[0].raw.id,
@@ -1652,6 +1620,11 @@
 					
 				if (!features.length) {
 					alert('No valid coordinates found'); //todo //i18n
+					GIS.mask.hide();
+					
+					this.config = {
+						extended: {}
+					};
 					return;
 				}
 				
@@ -1810,7 +1783,7 @@
 		this.store.features.loadFeatures(this.layer.features); 
 		
 		// Update filter window
-		if (this.cmp.filterWindow && this.cmp.filterWindow.isVisible()) { 
+		if (this.cmp.filterWindow && this.cmp.filterWindow.isVisible()) {
 			this.cmp.filterWindow.filter();
 		}