[Mapbender-commits] r4549 - in trunk/mapbender: conf http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 28 08:41:23 EDT 2009


Author: christoph
Date: 2009-08-28 08:41:23 -0400 (Fri, 28 Aug 2009)
New Revision: 4549

Modified:
   trunk/mapbender/conf/session.conf
   trunk/mapbender/http/javascripts/mod_loadwmc.php
Log:
add wms via API configurations

Modified: trunk/mapbender/conf/session.conf
===================================================================
--- trunk/mapbender/conf/session.conf	2009-08-28 12:39:09 UTC (rev 4548)
+++ trunk/mapbender/conf/session.conf	2009-08-28 12:41:23 UTC (rev 4549)
@@ -22,6 +22,8 @@
 }
 Mapbender::session()->set("wms",$arr_wms);
 unset($i);
+Mapbender::session()->set("addwms_showWMS", $_REQUEST["addwms_showWMS"]);
+Mapbender::session()->set("addwms_zoomToExtent", $_REQUEST["addwms_zoomToExtent"]);
 
 Mapbender::session()->set("mb_myWmc","");
 Mapbender::session()->set("mb_myWmc_action","");

Modified: trunk/mapbender/http/javascripts/mod_loadwmc.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_loadwmc.php	2009-08-28 12:39:09 UTC (rev 4548)
+++ trunk/mapbender/http/javascripts/mod_loadwmc.php	2009-08-28 12:41:23 UTC (rev 4549)
@@ -31,40 +31,48 @@
 		Mapbender::session()->set("mb_wmc",$wmc->toXml());
 		$e = new mb_notice("creating initial WMC.");
 	}
+	else {
+		if (!$wmc->createFromXml(Mapbender::session()->get("mb_wmc"))) {
+			$jsString .= "var e = new Mb_notice('mod_loadwmc: load_wmc_session: error parsing wmc');";
+		}
+	}
 
-	if (Mapbender::session()->get("mb_wmc")) {
 
-		if ($wmc->createFromXml(Mapbender::session()->get("mb_wmc"))) {
-	
-			if ($mergeWms) {
-				$e = new mb_notice("merging with WMS.");
-				$wmsArray = array();
-				$inputWmsArray = Mapbender::session()->get("wms");
-				if ($inputWmsArray && is_array($inputWmsArray)) {
-					for ($i = 0; $i < count(); $i++) {
-						$currentWms = new wms();
-						$currentWms->createObjFromXML($inputWmsArray[$i]);
-						array_push($wmsArray, $currentWms);
-					}
-				}
-				$wmc->mergeWmsArray($wmsArray);
-				Mapbender::session()->set("command","");
-				Mapbender::session()->set("wms",array());
-
+	if ($mergeWms) {
+		$e = new mb_notice("merging with WMS.");
+		$wmsArray = array();
+		$inputWmsArray = Mapbender::session()->get("wms");
+		if ($inputWmsArray && is_array($inputWmsArray)) {
+			for ($i = 0; $i < count($inputWmsArray); $i++) {
+				$currentWms = new wms();
+				$currentWms->createObjFromXML($inputWmsArray[$i]);
+				array_push($wmsArray, $currentWms);
 			}
-	
-			$javaScriptArray = array();
-			$javaScriptArray = $wmc->toJavaScript();
-
-			$jsString .= implode("", $javaScriptArray);
 		}
+		$options = array();
+		if (Mapbender::session()->exists("addwms_showWMS")) {
+			$options["show"] = Mapbender::session()->get("addwms_showWMS");
+		}
+		if (Mapbender::session()->exists("addwms_zoomToExtent"))) {
+			$options["zoom"] = Mapbender::session()->get("addwms_zoomToExtent");
+		}
+		if (count($options) > 0) {
+			$wmc->mergeWmsArray($wmsArray, $options);
+		}
 		else {
-			$jsString .= "var e = new Mb_notice('mod_loadwmc: load_wmc_session: error parsing wmc');";
+			$wmc->mergeWmsArray($wmsArray);
 		}
+		Mapbender::session()->set("command","");
+		Mapbender::session()->set("wms",array());
+
+		Mapbender::session()->delete("addwms_showWMS");
+		Mapbender::session()->delete("addwms_zoomToExtent");
 	}
-	else {
-		$jsString .= "var e = new Mb_warning('mod_loadwmc: load_wmc_session: no wmc set!');";
-	}
+
+	$javaScriptArray = array();
+	$javaScriptArray = $wmc->toJavaScript();
+
+	$jsString .= implode("", $javaScriptArray);
 	return $jsString;
 }
 
@@ -102,4 +110,4 @@
 // Creates a pop up with a dialogue to load, view or delete WMC documents
 //
 include("mod_loadwmc.js");
-?>
\ No newline at end of file
+?>



More information about the Mapbender_commits mailing list