[Mapbender-commits] r7463 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 20 09:46:09 EST 2011


Author: verenadiewald
Date: 2011-01-20 06:46:09 -0800 (Thu, 20 Jan 2011)
New Revision: 7463

Modified:
   trunk/mapbender/http/plugins/mb_wfsGazetteer.js
Log:
add possibility to react to an element vars named activateLayer which switches on the given layers

Modified: trunk/mapbender/http/plugins/mb_wfsGazetteer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_wfsGazetteer.js	2011-01-20 09:25:38 UTC (rev 7462)
+++ trunk/mapbender/http/plugins/mb_wfsGazetteer.js	2011-01-20 14:46:09 UTC (rev 7463)
@@ -36,12 +36,12 @@
 	});
 	
 	$gazetteer.bind("receivefeaturecollection", function () {
-		if(options.activateWms) {
-			var activateWms = options.activateWms.split(",");
+		if(options.activateLayer) {
+			var activateLayer = options.activateLayer.split(",");
 			var map = $(this + ":maps").mapbender();
 			var wmsArray = map.wms;
-			for(var i = 0; i < activateWms.length; i++) {
-				activateWms[i] = $.trim(activateWms[i]);
+			for(var i = 0; i < activateLayer.length; i++) {
+				activateLayer[i] = $.trim(activateLayer[i]);
 			}
 			
 			for (var i in wmsArray) {
@@ -53,10 +53,14 @@
 					handleSelectedWms(map.elementName, currentWms.wms_id, "querylayer", 0);
 				} 
 				
-				//second step: activate all WMS from element var activateWms
-				if($.inArray(currentWms.wms_title, activateWms) != -1) {
-					handleSelectedWms(map.elementName, currentWms.wms_id, "visible", 1);
-					handleSelectedWms(map.elementName, currentWms.wms_id, "querylayer", 1);
+				for (var j in currentWms.objLayer) {
+					var currentLayer = currentWms.objLayer[j];
+					
+					//second step: activate all layer from element var activateLayer
+					if($.inArray(currentLayer.layer_name, activateLayer) != -1) {
+						currentWms.handleLayer(currentLayer.layer_name, "visible", 1);
+						currentWms.handleLayer(currentLayer.layer_name, "querylayer", 1);
+					}
 				}
 			}
 			map.setMapRequest();



More information about the Mapbender_commits mailing list