[Mapbender-commits] r5419 - branches/2.6/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 25 04:37:00 EST 2010


Author: christoph
Date: 2010-01-25 04:37:00 -0500 (Mon, 25 Jan 2010)
New Revision: 5419

Modified:
   branches/2.6/http/javascripts/mod_loadwmc.php
Log:


Modified: branches/2.6/http/javascripts/mod_loadwmc.php
===================================================================
--- branches/2.6/http/javascripts/mod_loadwmc.php	2010-01-25 09:36:31 UTC (rev 5418)
+++ branches/2.6/http/javascripts/mod_loadwmc.php	2010-01-25 09:37:00 UTC (rev 5419)
@@ -31,36 +31,67 @@
 		$_SESSION["mb_wmc"] = $wmc->toXml();
 		$e = new mb_notice("creating initial WMC.");
 	}
+	else {
+		if (!$wmc->createFromXml($_SESSION['mb_wmc'])) {
+			$jsString .= "var e = new Mb_notice('mod_loadwmc: load_wmc_session: error parsing wmc');";
+		}
+	}
 
-	if (isset($_SESSION['mb_wmc'])) {
+	$wmsTitleJs = "";
+	$wmsTitleArray = array();
+	if ($mergeWms) {
+		$e = new mb_notice("merging with WMS.");
+		$wmsArray = array();
+		for ($i = 0; $i < count($_SESSION["wms"]); $i++) {
+			$currentWms = new wms();
+			$currentWms->createObjFromXML($_SESSION["wms"][$i]);
+			array_push($wmsArray, $currentWms);
+			$wmsTitleArray[]= "<b>" . $currentWms->wms_title . "</b>";
+		}
+		$options = array();
+		if (isset($_SESSION["addwms_showWMS"])) {
+			$options["show"] = $_SESSION["addwms_showWMS"];
+		}
+		if (isset($_SESSION["addwms_zoomToExtent"])) {
+			$options["zoom"] = $_SESSION["addwms_zoomToExtent"];
+		}
+		if (count($options) > 0) {
+			$wmc->mergeWmsArray($wmsArray, $options);
+		}
+		else {
+			$wmc->mergeWmsArray($wmsArray);
+		}
 
-		if ($wmc->createFromXml($_SESSION['mb_wmc'])) {
-	
-			if ($mergeWms) {
-				$e = new mb_notice("merging with WMS.");
-				$wmsArray = array();
-				for ($i = 0; $i < count($_SESSION["wms"]); $i++) {
-					$currentWms = new wms();
-					$currentWms->createObjFromXML($_SESSION["wms"][$i]);
-					array_push($wmsArray, $currentWms);
-				}
-				$wmc->mergeWmsArray($wmsArray);
-				$_SESSION["command"] = "";
-				$_SESSION["wms"] = array();
+		if (count($_SESSION["wms"] > 0)) {
+			$wmsTitleHtml = implode("<br>", $wmsTitleArray);
+			$wmsTitleJs .= <<<JS
+			try {
+				Mapbender.Modules.dialogManager.openDialog({
+					content: "Folgende Dienste wurden zu 'Aktive Dienste' " + 
+						"hinzugefügt:<br><br>" + 
+						"$wmsTitleHtml",
+					modal: false,
+					effectShow: 'puff'
+				});
 			}
-	
-			$javaScriptArray = array();
-			$javaScriptArray = $wmc->toJavaScript();
+			catch (e) {
+				new Mb_warning(e.message);
+			};
+JS;
+			$wmsTitleJs .= "try{tab_open('treeGDE');}catch(exc){new Mb_warning(exc.message)}";
+		}
 
-			$jsString .= implode("", $javaScriptArray);
-		}
-		else {
-			$jsString .= "var e = new Mb_notice('mod_loadwmc: load_wmc_session: error parsing wmc');";
-		}
+		$_SESSION["command"] = "";
+		$_SESSION["wms"] = array();
+		unset($_SESSION["addwms_showWMS"]);
+		unset($_SESSION["addwms_zoomToExtent"]);
 	}
-	else {
-		$jsString .= "var e = new Mb_warning('mod_loadwmc: load_wmc_session: no wmc set!');";
-	}
+
+	$javaScriptArray = array();
+	$javaScriptArray = $wmc->toJavaScript();
+	$javaScriptArray[]= $wmsTitleJs;
+
+	$jsString .= implode("", $javaScriptArray);
 	return $jsString;
 }
 
@@ -98,4 +129,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