← Back to team overview

dhis2-devs team mailing list archive

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

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11134 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-06-03 20:55:28 +0200
message:
  (GIS) Offline fix.
modified:
  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/core.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.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/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2013-05-29 20:07:02 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2013-05-30 09:23:07 +0000
@@ -615,7 +615,9 @@
 							}
 							that.updateItem(value);
 
-							gis.viewport.downloadButton.xable();
+							if (gis.viewport) {
+								gis.viewport.downloadButton.xable();
+							}
 						}
 					}
 				});
@@ -907,7 +909,7 @@
 				layer: layer,
 				text: layer.name,
 				imageUrl: 'images/' + layer.id + '_14.png',
-				value: layer.id === visibleLayer.id ? true : false,
+				value: layer.id === visibleLayer.id && window.google ? true : false,
 				opacity: layer.layerOpacity,
 				numberFieldDisabled: layer.id !== visibleLayer.id
 			});
@@ -916,9 +918,7 @@
 			items.push(layer.item);
 		}
 
-		if (window.google) {
-			visibleLayer.item.setValue(true);
-		}
+		visibleLayer.item.setValue(!!window.google);
 
         panel = Ext.create('Ext.panel.Panel', {
 			renderTo: 'layerItems',
@@ -5231,11 +5231,6 @@
 					};
 					GIS.core.MapLoader(gis).load();
 				}
-
-                // Background
-				if (!window.google) {
-					gis.layer.openStreetMap.item.setValue(false);
-				}
 			};
 
 			viewport = Ext.create('Ext.container.Viewport', {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2013-05-29 21:57:02 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2013-05-30 09:23:07 +0000
@@ -1779,7 +1779,8 @@
 };
 
 GIS.core.getInstance = function(config) {
-	var gis = {};
+	var gis = {},
+		layers = [];
 
 	gis.baseUrl = config && config.baseUrl ? config.baseUrl : '../..';
 	gis.el = config && config.el ? config.el : null;
@@ -1790,17 +1791,20 @@
 	gis.olmap = GIS.core.getOLMap(gis);
 	gis.layer = GIS.core.getLayers(gis);
 
-	gis.olmap.addLayers([
-		gis.layer.googleStreets,
-		gis.layer.googleHybrid,
-		gis.layer.openStreetMap,
+	if (window.google) {
+		layers.push(gis.layer.googleStreets, gis.layer.googleHybrid);
+	}
+
+	layers.push(gis.layer.openStreetMap,
 		gis.layer.thematic4,
 		gis.layer.thematic3,
 		gis.layer.thematic2,
 		gis.layer.thematic1,
 		gis.layer.boundary,
 		gis.layer.facility
-	]);
+	);
+
+	gis.olmap.addLayers(layers);
 
 	return gis;
 };

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js	2013-04-16 10:02:32 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js	2013-05-30 09:23:07 +0000
@@ -90,10 +90,6 @@
 		};
 
 		afterRender = function(vp) {
-			if (window.google) {
-				gis.layer.googleStreets.setVisibility(true);
-			}
-
 			var len = Ext.query('.zoomInButton').length;
 
 			for (var i = 0; i < len; i++) {