[Mapbender-commits] r1303 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 8 10:56:28 EDT 2007


Author: christoph
Date: 2007-05-08 10:56:28 -0400 (Tue, 08 May 2007)
New Revision: 1303

Modified:
   trunk/mapbender/http/javascripts/map.php
Log:
avoid "undefined" being appended to map request URL

Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php	2007-05-08 14:50:55 UTC (rev 1302)
+++ trunk/mapbender/http/javascripts/map.php	2007-05-08 14:56:28 UTC (rev 1303)
@@ -389,9 +389,7 @@
 	mb_mapObj[ind].layers[mb_mapObj[ind].layers.length] = layers;
 	mb_mapObj[ind].styles[mb_mapObj[ind].styles.length] = styles;
 	mb_mapObj[ind].querylayers[mb_mapObj[ind].querylayers.length] = querylayers;  
-	for(var i=0; i<mb_loadWmsSubFunctions.length; i++){
-		eval(mb_loadWmsSubFunctions[i]);
-	}
+	mb_execloadWmsSubFunctions();
 	return true; 
 }
 //CB
@@ -521,7 +519,14 @@
 						// add vendor-specifics
 						for(var v=0; v < mb_vendorSpecific.length; v++){
 							var vendorSpecificString = eval(mb_vendorSpecific[v]); 
-							newMapURL += "&" + vendorSpecificString; 
+
+							// if eval doesn't evaluate a function, the result is undefined.
+							// Sometimes it is necessary not to evaluate a function, for
+							// example if you want to change a variable from the current
+							// scope (see mod_addSLD.php) 
+							if (typeof(vendorSpecificString) != "undefined") {
+								newMapURL += "&" + vendorSpecificString; 
+							}
 						}           
 						// add Filter
 						if(mb_mapObj[i].wms[ii].wms_filter != ""){
@@ -600,7 +605,13 @@
 					// add vendor-specific
 					for(var v=0; v<mb_vendorSpecific.length; v++){
 						var vendorSpecificString = eval(mb_vendorSpecific[v]); 
-						newMapURL += "&" + vendorSpecificString; 
+						// if eval doesn't evaluate a function, the result is undefined.
+						// Sometimes it is necessary not to evaluate a function, for
+						// example if you want to change a variable from the current
+						// scope (see mod_addSLD.php) 
+						if (typeof(vendorSpecificString) != "undefined") {
+							newMapURL += "&" + vendorSpecificString;
+						} 
 					}
 					// add Filter
 					if(mb_mapObj[i].wms[ii].wms_filter != ""){



More information about the Mapbender_commits mailing list