[Mapbender-commits] r8171 - branches/2.7/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 28 09:46:42 EDT 2011


Author: verenadiewald
Date: 2011-09-28 06:46:42 -0700 (Wed, 28 Sep 2011)
New Revision: 8171

Modified:
   branches/2.7/http/plugins/mb_handleStartUpWmsParams.php
Log:
check if module setBackground is set

Modified: branches/2.7/http/plugins/mb_handleStartUpWmsParams.php
===================================================================
--- branches/2.7/http/plugins/mb_handleStartUpWmsParams.php	2011-09-28 11:53:19 UTC (rev 8170)
+++ branches/2.7/http/plugins/mb_handleStartUpWmsParams.php	2011-09-28 13:46:42 UTC (rev 8171)
@@ -82,21 +82,35 @@
 
 var errormessages = options.errormessages;
 
-
 // set background WMS
-Mapbender.events.setBackgroundIsReady.register(function () {
-	if (apiBackgroundWms !== '') {
-		var newBackgroundWms = parseInt(apiBackgroundWms);
-		if (mod_setBackground_active !== false && wms[mod_setBackground_active]) {
-			wms[mod_setBackground_active].gui_wms_visible = 0;
-		}
-		wms[newBackgroundWms].gui_wms_visible = 2;
-		mod_setBackground_active = newBackgroundWms;
-		$("#setBackground > *").get(0).value = newBackgroundWms;
-		zoom(mod_setBackground_target, true, 1.0); 
-	}
-});
+if(typeof Mapbender.events.setBackgroundIsReady != "undefined") {
+        Mapbender.events.setBackgroundIsReady.register(function () {
+             if (apiBackgroundWms !== '') {
+                        var newBackgroundWms = parseInt(apiBackgroundWms);
+                        if (mod_setBackground_active !== false && wms[mod_setBackground_active]) {
+                                wms[mod_setBackground_active].gui_wms_visible = 0;
+                        }
+                        wms[newBackgroundWms].gui_wms_visible = 2;
+                        mod_setBackground_active = newBackgroundWms;
+                        $("#setBackground > *").get(0).value = newBackgroundWms;
+                        zoom(mod_setBackground_target, true, 1.0);
+                }
+        });
+}
+else {
+        if (apiBackgroundWms !== '') {
+                var newBackgroundWms = parseInt(apiBackgroundWms);
+                if (mod_setBackground_active !== false && wms[mod_setBackground_active]) {
+                        wms[mod_setBackground_active].gui_wms_visible = 0;
+                }
+                wms[newBackgroundWms].gui_wms_visible = 2;
+                mod_setBackground_active = newBackgroundWms;
+                $("#setBackground > *").get(0).value = newBackgroundWms;
+                zoom(mod_setBackground_target, true, 1.0);
+        }
 
+}
+
 // set queryability and visibility
 Mapbender.events.afterInit.register(function () {
 	if(apiVisibleLayers != '' || apiQueryLayers != '' || 



More information about the Mapbender_commits mailing list