[Mapbender-commits] r8812 - in trunk/mapbender/http: classes javascripts php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 7 00:33:53 PDT 2014


Author: hwbllmnn
Date: 2014-05-07 00:33:52 -0700 (Wed, 07 May 2014)
New Revision: 8812

Modified:
   trunk/mapbender/http/classes/class_map.php
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/classes/class_wmcToXml.php
   trunk/mapbender/http/javascripts/mod_loadwmc.js
   trunk/mapbender/http/javascripts/mod_savewmc.js
   trunk/mapbender/http/php/mod_savewmc_server.php
Log:
added saving of kml inside wmc


Modified: trunk/mapbender/http/classes/class_map.php
===================================================================
--- trunk/mapbender/http/classes/class_map.php	2014-04-24 12:59:44 UTC (rev 8811)
+++ trunk/mapbender/http/classes/class_map.php	2014-05-07 07:33:52 UTC (rev 8812)
@@ -15,7 +15,8 @@
 	private $zoomFullExtentArray = array();
 	private $isOverview = false;
 	private $wmsArray = array();
-	
+    private $kmls;
+
 	/**
 	 * @destructor
 	 * @param
@@ -29,7 +30,7 @@
 	 */
 	function __construct() {
 	}
-	
+
 	//-------------------------------------------------------------------------
 	// getter and setter
 	//-------------------------------------------------------------------------
@@ -41,8 +42,8 @@
 	}
 
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	public function getWidth () {
 		return $this->width;
@@ -56,8 +57,8 @@
 	}
 
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	public function getHeight () {
 		return $this->height;
@@ -78,17 +79,17 @@
 	}
 
 	/**
-	 * 
+	 *
 	 * @return String
 	 */
 	public function getFrameName () {
-		return $this->frameName;	
+		return $this->frameName;
 	}
-	
+
 	public function addZoomFullExtent ($aMapbenderBbox) {
 		array_push($this->zoomFullExtentArray, $aMapbenderBbox);
 	}
-	
+
 	public function getZoomFullExtentArray () {
 		return $this->zoomFullExtentArray;
 	}
@@ -100,21 +101,21 @@
 	}
 
 	/**
-	 * 
-	 * @return Mapbender_bbox 
+	 *
+	 * @return Mapbender_bbox
 	 */
 	public function getExtent () {
-		return $this->extent;	
+		return $this->extent;
 	}
 
 	/**
-	 * 
+	 *
 	 * @return Mapbender_bbox extent information
 	 */
 	public function getExtentInfo () {
-		return array($this->extent->min->x, $this->extent->min->y, $this->extent->max->x, $this->extent->max->y);	
-	}	
-	
+		return array($this->extent->min->x, $this->extent->min->y, $this->extent->max->x, $this->extent->max->y);
+	}
+
 	/**
 	 * converts the extent of the map so that the maximum	extent will be displayed
 	 *
@@ -126,26 +127,26 @@
 		$extenty = ($aMapbenderBbox->max->y - $aMapbenderBbox->min->y);
 		$centerx = $aMapbenderBbox->min->x + $extentx/2;
 		$centery = $aMapbenderBbox->min->y + $extenty/2;
-		$relation_bbox_x = $extentx / $extenty;     
-		if($relation_bbox_x <= $relation_px_x){                
+		$relation_bbox_x = $extentx / $extenty;
+		if($relation_bbox_x <= $relation_px_x){
 			$aMapbenderBbox->min->x = $centerx - $relation_px_x * $extenty / 2;
 			$aMapbenderBbox->max->x = $centerx + $relation_px_x * $extenty / 2;
 		}
-		if($relation_bbox_x > $relation_px_x){                
+		if($relation_bbox_x > $relation_px_x){
 			$aMapbenderBbox->min->y = $centery - $relation_px_y * $extentx / 2;
 			$aMapbenderBbox->max->y = $centery + $relation_px_y * $extentx / 2;
 		}
 		$this->setExtent($aMapbenderBbox);
 	}
 	/**
-	 * 
+	 *
 	 * @return Int scale of map
 	 */
 	public function getScale($mapResolutionDpi = MB_RESOLUTION){
 		$scale;
 		$xtenty;
 		$bbox = $this->getExtentInfo();
-		
+
 		if ($this->getEpsg() == "EPSG:4326") {
 			$pxLenx = ($bbox[2] - $bbox[0]) / $this->getWidth();
 			$pxLeny = ($bbox[3] - $bbox[1]) / $this->getHeight();
@@ -161,20 +162,20 @@
 			$scale = ($xtenty / $this->getHeight()) * ($mapResolutionDpi * 100);
 		}
 		return round($scale);
-	}	
-	
-	
+	}
+
+
 	/**
-	 * 
+	 *
 	 * @return String EPSG code of the map.
 	 */
 	public function getEpsg () {
-		return $this->extent->epsg;	
+		return $this->extent->epsg;
 	}
-	
+
 	public function getWms ($index) {
 		if (is_numeric($index)) {
-			$i = intval($index, 10); 
+			$i = intval($index, 10);
 			if ($i < count($this->wmsArray) && count($this->wmsArray) > 0 && $i >= 0) {
 				return $this->wmsArray[$i];
 			}
@@ -197,40 +198,48 @@
 	}
 
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	public function getWmsArray () {
-		return $this->wmsArray;	
+		return $this->wmsArray;
 	}
-	
+
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 * @param $wmsArray Object
 	 */
 	public function setWmsArray ($wmsArray) {
 		$this->wmsArray = $wmsArray;
 	}
-	
+
+    public function getKmls() {
+        return $this->kmls;
+    }
+
+    public function setKmls($kmls) {
+        $this->kmls = $kmls;
+    }
+
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	public function isOverview () {
 		return $this->isOverview;
 	}
-	
+
 	public function setIsOverview ($bool) {
 		$this->isOverview = $bool;
 	}
-	
+
 	/**
 	 * @param $value Object
 	 */
 	public function addWms ($value) {
 		array_push($this->wms, $value);
-	}	
+	}
 
 
 	// ------------------------------------------------------------------------
@@ -239,18 +248,18 @@
 
 	/**
 	 * Appends the WMS of another map to this map.
-	 * 
+	 *
 	 * @param $anotherMap Map
 	 */
 	public function append ($anotherMap) {
 		$this->wmsArray = array_merge($anotherMap->getWmsArray(), $this->wmsArray);
 	}
-		
+
 	/**
-	 * Merges this map with another map: Copies the map settings from the 
+	 * Merges this map with another map: Copies the map settings from the
 	 * other map and merges the WMS (keeping the settings of the other
 	 * map if there are duplicates)
-	 * 
+	 *
 	 * @param $anotherMap Map
 	 */
 	public function merge ($anotherMap) {
@@ -265,8 +274,8 @@
 
 	/**
 	 * Adds WMS to this map
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	public function appendWmsArray ($wmsArray) {
 		$this->wmsArray = array_merge($this->wmsArray, $wmsArray);
@@ -370,12 +379,12 @@
 
 	/**
 	 * Merge WMS into this map
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	public function mergeWmsArray ($wmsArray) {
-		if (func_num_args() > 1 
-			&& is_array($wmsArray) 
+		if (func_num_args() > 1
+			&& is_array($wmsArray)
 			&& count($wmsArray) > 0) {
 			$options = func_get_arg(1);
 
@@ -389,7 +398,7 @@
 				}
 				$this->mergeExtent($bboxArray);
 			}
-			
+
 			// visibility of WMS
 			if (isset($options["visible"])) {
 				if ($options["visible"]) {
@@ -425,7 +434,7 @@
 			// querylayer
 			if (isset($options["querylayer"])) {
 				$val = $options["querylayer"] ? 1 : 0;
-				
+
 				// set all queryable layers of WMS to querylayer
 				for ($i = 0; $i < count($wmsArray); $i++) {
 					$numLayers = count($wmsArray[$i]->objLayer);
@@ -439,25 +448,25 @@
 				}
 			}
 
-			
+
 			if ($options["show"] && is_numeric($options["show"]) && !isset($options["visible"])) {
 				$e = new mb_exception("show");
 				// set all layers of WMS to visible
 				for ($i = 0; $i < count($wmsArray); $i++) {
 					$numLayers = count($wmsArray[$i]->objLayer);
-					
+
 					// do not display if layer count is too big
 					if ($numLayers > intval($options["show"])) {
 						continue;
 					}
-					
+
 					for ($j = 0; $j < $numLayers; $j++) {
 						$wmsArray[$i]->objLayer[$j]->gui_layer_visible = 1;
 					}
 				}
 			}
 		}
-		
+
 		$this->wmsArray = wms::merge(array_merge($this->wmsArray, $wmsArray));
 	}
 
@@ -466,8 +475,8 @@
 	// Instantiation
 	// ------------------------------------------------------------------------
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 * @param $jsMapObject Object
 	 */
 	public function createFromJs ($jsMapObject) {
@@ -475,10 +484,10 @@
 
 		$srs = $jsMapObject->epsg;
 		$bbox = new Mapbender_bbox(
-			$b->min->x, 
-			$b->min->y, 
-			$b->max->x, 
-			$b->max->y, 
+			$b->min->x,
+			$b->min->y,
+			$b->max->x,
+			$b->max->y,
 			$srs
 		);
 
@@ -487,13 +496,17 @@
 		// there are no more map frames in Mapbender 2.6
 		$this->frameName = $jsMapObject->elementName;
 		$this->extent = $bbox;
-		
+
+        if(property_exists($jsMapObject, 'kmls')) {
+            $this->kmls = $jsMapObject->kmls;
+        }
+
 		if (isset($jsMapObject->isOverview) && $jsMapObject->isOverview == "1") {
 			$this->isOverview = true;
 		}
 
 		for ($i=0; $i < count($jsMapObject->wms); $i++){
-	
+
 			$currentWms = $jsMapObject->wms[$i];
 			$wms = new wms();
 
@@ -536,12 +549,12 @@
 				// add new layer to WMS
 				$pos = $currentLayer->layer_pos;
 				$parent = $currentLayer->layer_parent;
-				$wms->addLayer($pos, $parent); 
+				$wms->addLayer($pos, $parent);
 
 				$newLayerIndex = count($wms->objLayer) - 1;
 				// $newLayer is a short cut to the layer we just added
 				$newLayer = $wms->objLayer[$newLayerIndex];
-				
+
 				// set layer data
 				$newLayer->layer_uid = $currentLayer->layer_uid;
 				$newLayer->layer_name = $currentLayer->layer_name;
@@ -584,7 +597,7 @@
 					$newLayer->layer_epsg[$z]["maxx"] = $currentLayer->layer_epsg[$z]->maxx;
 					$newLayer->layer_epsg[$z]["maxy"] = $currentLayer->layer_epsg[$z]->maxy;
 				}
-				
+
 				// BEWARE THIS IS SUPER UGLY CODE
 				$newLayer->layer_style = array();
 				for ($z = 0; $z < count($currentLayer->layer_style); $z++) {
@@ -600,15 +613,15 @@
 		}
 		return true;
 	}
-	
-	
+
+
 	// ------------------------------------------------------------------------
 	// database functions
 	// ------------------------------------------------------------------------
 	public static function selectMainMapByApplication ($appId) {
 		return map::selectByApplication($appId, "mapframe1");
 	}
-	
+
 	public static function selectOverviewMapByApplication ($appId) {
 		$currentMap = map::selectByApplication($appId, "overview");
 		if ($currentMap !== null) {
@@ -632,20 +645,20 @@
 		$jsCodeArray = array();
 
 		// syntax has changed in 2.6! Map is no longer a frame
-		$registerMapString = "var currentWmcMap = Mapbender.modules['" . 
+		$registerMapString = "var currentWmcMap = Mapbender.modules['" .
 			$this->frameName . "'];" .
-			"currentWmcMap.elementName = '" . $this->frameName . "';" . 
-			"currentWmcMap.setWidth(" . $this->width . ");" . 
+			"currentWmcMap.elementName = '" . $this->frameName . "';" .
+			"currentWmcMap.setWidth(" . $this->width . ");" .
 			"currentWmcMap.setHeight(" . $this->height . ");";
-		$registerMapString = $this->isOverview() ? 
-			$this->wrapJsInTryCatch($registerMapString) : $registerMapString; 
+		$registerMapString = $this->isOverview() ?
+			$this->wrapJsInTryCatch($registerMapString) : $registerMapString;
 		array_push($jsCodeArray, $registerMapString);
-		
+
 		$emptyDivInMapString = "$('#' + currentWmcMap.elementName).css({border: '0px solid'}).children().not('div[id^=\'mod_gaz_draw\']').empty();";
-		$emptyDivInMapString = $this->isOverview() ? 
-			$this->wrapJsInTryCatch($emptyDivInMapString) : $emptyDivInMapString; 
+		$emptyDivInMapString = $this->isOverview() ?
+			$this->wrapJsInTryCatch($emptyDivInMapString) : $emptyDivInMapString;
 		array_push($jsCodeArray, $emptyDivInMapString);
-		
+
 		// if map is overview...
 		if ($this->isOverview) {
 			// ...set overview flag
@@ -654,21 +667,21 @@
 		}
 
 		// calculate extent
-		$calcExtentString = "currentWmcMap.setSrs(" . 
+		$calcExtentString = "currentWmcMap.setSrs(" .
 			$this->extent->toJavaScript() .
 			");";
-		$calcExtentString = $this->isOverview() ? 
-			$this->wrapJsInTryCatch($calcExtentString) : $calcExtentString; 
+		$calcExtentString = $this->isOverview() ?
+			$this->wrapJsInTryCatch($calcExtentString) : $calcExtentString;
 			array_push($jsCodeArray, $calcExtentString);
-		
+
 		$setWmsString = "currentWmcMap.setWms(" . $wmsJson . ");";
-		$setWmsString = $this->isOverview() ? 
-			$this->wrapJsInTryCatch($setWmsString) : $setWmsString; 
+		$setWmsString = $this->isOverview() ?
+			$this->wrapJsInTryCatch($setWmsString) : $setWmsString;
 		array_push($jsCodeArray, $setWmsString);
-		
+
 		$initWmsString = "currentWmcMap.initializeWms();";
-		$initWmsString = $this->isOverview() ? 
-			$this->wrapJsInTryCatch($initWmsString) : $initWmsString; 
+		$initWmsString = $this->isOverview() ?
+			$this->wrapJsInTryCatch($initWmsString) : $initWmsString;
 		array_push($jsCodeArray, $initWmsString);
 
 		return $jsCodeArray;
@@ -682,7 +695,7 @@
 	// ------------------------------------------------------------------------
 	// PRIVATE FUNCTIONS
 	// ------------------------------------------------------------------------
-	
+
 	private static function selectByApplication ($appId, $frameName) {
 		//cache only, when cache is explicitly demanded by element var!
 		//check if element var for caching gui is set to true!
@@ -691,7 +704,7 @@
 		$t = array('s');
 		$res = db_prep_query($sql,$v,$t);
 		$row = db_fetch_array($res);
-		
+
 		if (count($row['var_name']) == 1) {
 			$activatedGuiHtmlCache = $row['var_value'];
 			if ($activatedGuiHtmlCache == 'true') {
@@ -711,13 +724,13 @@
 			return $cache->cachedVariableFetch($mapByAppKey);
 		} else {
 			// find the mapframe in the application elements...
-			$sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND " . 
+			$sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND " .
 				"e_id = $2 AND e_public = 1 LIMIT 1";
 			$v = array($appId, $frameName);
 			$t = array('s', 's');
 			$res = db_prep_query($sql,$v,$t);
 			$row = db_fetch_array($res);
-		
+
 			// if found...
 			if ($row) {
 				$currentMap = new Map();
@@ -726,21 +739,21 @@
 				$currentMap->setWidth($row["e_width"]);
 				$currentMap->setHeight($row["e_height"]);
 				$currentMap->setFrameName($row["e_id"]);
-				
-				// get the WMS 
+
+				// get the WMS
 				$wmsArray = wms::selectMyWmsByApplication($appId);
-				
+
 //				$e = new mb_notice("WMS in this map: " . implode(",", $wmsArray));
-				
-				// if this is the overview, find the WMS index and 
+
+				// if this is the overview, find the WMS index and
 				// reset the WMS array
 				// BEWARE, SUPER UGLY CODE AHEAD!!
 				// (BUT THERE IS NO OTHER WAY TO DO IT)
 				if (strpos($row["e_js_file"], "mb_overview.js") !== false) {
 //					$e = new mb_exception("guess this is the OV");
 
-					$ov_sql = "SELECT var_value FROM gui_element_vars WHERE " . 
-						"var_name = 'overview_wms' AND fkey_e_id = $1 AND " . 
+					$ov_sql = "SELECT var_value FROM gui_element_vars WHERE " .
+						"var_name = 'overview_wms' AND fkey_e_id = $1 AND " .
 						"fkey_gui_id = $2";
 					$ov_v = array($frameName, $appId);
 					$ov_t = array('s', 's');
@@ -749,7 +762,7 @@
 					if ($ov_row) {
 						$ovIndex = intval($ov_row["var_value"]);
 					}
-				
+
 //					$e = new mb_exception("OV index: " . $ovIndex);
 					if (!isset($ovIndex)) {
 						$ovIndex = 0;
@@ -766,7 +779,7 @@
 			    		while ($row = db_fetch_array($res)) {
 	                			$count_wms++;
                 			}
-                
+
                 			if($ovIndex > $count_wms) {
                     				$e = new mb_exception("class_map.php: selectByApplication : OverviewIndex (set in overview element var 'overview_wms')does not exist!");
 						if ($cache->isActive) {
@@ -781,7 +794,7 @@
 				}
 
 				$currentMap->wmsArray = $wmsArray;
-			
+
 				// EXTENT
 				$sql = "SELECT gui_wms_epsg FROM gui_wms WHERE gui_wms_position = 0 AND fkey_gui_id = $1";
 				$v = array($appId);
@@ -807,7 +820,7 @@
 				if ($cache->isActive) {
 					$cache->cachedVariableAdd($mapByAppKey,$currentMap);
 				}
-				return $currentMap;			
+				return $currentMap;
 			}
 			else {
 				if ($cache->isActive) {
@@ -817,7 +830,7 @@
 			}
 		}
 	}
-	
 
+
 }
 ?>

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2014-04-24 12:59:44 UTC (rev 8811)
+++ trunk/mapbender/http/classes/class_wmc.php	2014-05-07 07:33:52 UTC (rev 8812)
@@ -1,7 +1,7 @@
 <?php
 # $Id$
 # http://www.mapbender.org/index.php/class_wmc.php
-# Copyright (C) 2002 CCGIS 
+# Copyright (C) 2002 CCGIS
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -208,7 +208,6 @@
 	 * 								mapped into the extension part of the WMC
 	 */
 	public function createFromJs($mapObject, $generalTitle,$extensionData, $id=null) {
-
 		if (count($mapObject) > 2) {
 			$e = new mb_exception("Save WMC only works for two concurrent map frames (overview plus main) at the moment.");
 		}
@@ -341,7 +340,7 @@
 		while ($row = db_fetch_array($res)) {
 			$keywordArray[]= $row["keyword"];
 		}
-		
+
 		return $keywordArray;
 	}
 
@@ -569,7 +568,7 @@
 				$owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
 				$wmsGetMapUrl = $owsproxyurl;
 				$wmsGetLegendUrl = $owsproxyurl;
-			} else { 
+			} else {
 				//service is not secured - exchange urls with the latest ones from database
 				$wmsGetMapUrl = $row["wms_getmap"];
 				$wmsGetLegendUrl = $row["wms_getlegendurl"];
@@ -582,11 +581,11 @@
   				$layer->Name = $layerName;
 				$e = new mb_notice("class_wmc: exchange old getmap url : ".$layer->Server->OnlineResource->attributes('xlink', true)->href." with new getmap url: ".$wmsGetMapUrl);
  				$layer->Server->OnlineResource->attributes('xlink', true)->href = $wmsGetMapUrl;
-				//Help for problem with xlink:href attributes: http://php.net/manual/de/class.simplexmlelement.php!!!!!	
+				//Help for problem with xlink:href attributes: http://php.net/manual/de/class.simplexmlelement.php!!!!!
 				//exchange legend urls
 				if (isset($row["wms_owsproxy"]) && $row["wms_owsproxy"] != '' && !is_null($row["wms_owsproxy"])) {
 					if($layer->StyleList->Style->LegendURL->OnlineResource){
-						$arURL = parse_url($layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href);	
+						$arURL = parse_url($layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href);
 						$query = $arURL["query"];
 						$url = $wmsGetLegendUrl . $query;
 						$layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href = $url;
@@ -598,7 +597,7 @@
 		$e = new mb_notice($updatedWMC);
 		$this->update_existing($updatedWMC, $this->wmc_id);
 		$endTime = microtime();
-		$e = new mb_notice((string)($endTime - $startTime));	
+		$e = new mb_notice((string)($endTime - $startTime));
 		return $updatedWMC;
 	}
 	/**
@@ -643,7 +642,7 @@
 
 			$NewKeywordList = $WMCDoc->createElementNS('http://opengis.net/context', 'wmc:KeywordList');
 			$WMCDoc->appendChild($NewKeywordList);
-			
+
 			foreach($this->wmc_keyword as $keyword) {
 				$Keyword = $WMCDoc->createElementNS('http://opengis.net/context', 'wmc:Keyword', $keyword);
 				$NewKeywordList->appendChild($Keyword);
@@ -651,7 +650,7 @@
 
 			$generalList = $xpath->query($query_general);
 			$general = $generalList->item(0);
-			
+
 			if($DocKeywordLists->item(0)) {
 				$tmpNode = $WMCDoc->importNode($DocKeywordLists->item(0),true);
 				$general->replaceChild($NewKeywordList,$tmpNode);
@@ -698,12 +697,12 @@
 					$delvInspireTopic= array($wmc_DB_ID);
 					$deltInspireTopic = array("s");
 					db_prep_query($delsqlInspireTopic, $delvInspireTopic,$deltInspireTopic);
-					
+
 					$delsql = "DELETE FROM wmc_md_topic_category WHERE fkey_wmc_serial_id = $1;";
 					$delv = array($wmc_DB_ID);
 					$delt = array("s");
 					db_prep_query($delsql, $delv,$delt);
-					
+
 					$delkwsql = "DELETE FROM wmc_keyword WHERE fkey_wmc_serial_id = $1;";
 					$delkwv = array($wmc_DB_ID);
 					$delkwt = array("s");
@@ -723,7 +722,7 @@
 						$this->wmc_abstract, $this->wmc_srs, $this->wmc_extent->minx,  $this->wmc_extent->miny, $this->wmc_extent->maxx, $this->wmc_extent->maxy, $wmc_DB_ID_new);
 					$t = array("s", "i", "s", "s", "i", "s","s", "s","s","i","i","i", "i", "i");
 					$res = db_prep_query($sql, $v, $t);
-					
+
 					//$sql = "SELECT max(wmc_serial_id) AS i FROM mb_user_wmc";
 					//$res = db_query($sql);
 					//$row = db_fetch_assoc($res);
@@ -746,8 +745,8 @@
 					$this->wmc_abstract, $this->wmc_srs, $this->wmc_extent->minx,  $this->wmc_extent->miny, $this->wmc_extent->maxx, $this->wmc_extent->maxy, $wmc_DB_ID_new);
 				$t = array("s", "i", "s", "s", "i", "s","s", "s","s","i","i","i", "i", "i");
 				$res = db_prep_query($sql, $v, $t);
-				
-				
+
+
 			}
 
 			if (db_error()) {
@@ -776,7 +775,7 @@
 						if($a = db_error()) {
 						}
 					}
-					
+
 					$keywordsql = <<<SQL
 INSERT INTO wmc_keyword (fkey_keyword_id,fkey_wmc_serial_id)
 	SELECT keyword.keyword_id,$1 FROM keyword
@@ -790,7 +789,7 @@
 					if($a = db_error()) {
 					}
 				}
-				
+
 				// update iso topic categories
 				$this->isoTopicCats = $this->isoTopicCats? $this->isoTopicCats: array();
 				foreach($this->isoTopicCats as $catId) {
@@ -801,7 +800,7 @@
 					$res = db_prep_query($catSql, $v, $t);
 
 				}
-				
+
 				// update inspire categories
 				$this->inspireCats = $this->inspireCats? $this->inspireCats: array();
 				foreach($this->inspireCats as $catId) {
@@ -812,7 +811,7 @@
 					$res = db_prep_query($catSql, $v, $t);
 
 				}
-				
+
 				// update custom categories
 				$this->customCats = $this->customCats? $this->customCats: array();
 				foreach($this->customCats as $catId) {
@@ -1077,7 +1076,7 @@
 		} else {
 			$e = new mb_notice("class_wmc.php: Updated load_count of layers in wmc!");
 			return true;
-		}		
+		}
 	}
 
 	public function extentToJavaScript() {
@@ -1155,7 +1154,7 @@
 		// will contain the JS code to create the maps
 		// representing the state stored in this WMC
 		$wmcJsArray = array();
-		
+
 		// set general extension data
 		if (count($this->generalExtensionArray) > 0) {
 			$json = new Mapbender_JSON();
@@ -1237,7 +1236,7 @@
 		//increment the load count for known layers - TODO: Why here? -layer will be counted more than once!!!!
 		$this->incrementLayerLoadCount(array_unique($layerIdArray));
 		// .. request the map
-		
+
 		array_push($wmcJsArray, "lock_maprequest = true;");
 		array_push($wmcJsArray, "eventAfterLoadWMS.trigger();"); //TODO: Why? Reload tree? Other way to do this?
 		array_push($wmcJsArray, "lock_maprequest = false;");
@@ -1328,7 +1327,7 @@
 		//if ($wmcXml) {
 		//	$e = new mb_exception("class_wmc.php: parsing wmc successfully");
 		//}
-		
+
 		$values = administration::parseXml($data);
 		if (!$values) {
 			throw new Exception("WMC document could not be parsed.");
@@ -1354,7 +1353,7 @@
 		//parse WMC per simpleXML and use xpath instead of old bib
 		//$wmcXml = new SimpleXMLElement($data);
 
-		
+
 		//$wmcXml = simplexml_load_string(mb_utf8_encode($data));
 		//echo (";");
 		//print_r($wmcXml.";");
@@ -1373,7 +1372,7 @@
 		//$this->wmc_version = $wmcXml->xpath('/ViewContext/@version');
 		//$title = $wmcXml->xpath('/standard:ViewContext/standard:Title');
 		//var_dump($title);
-		
+
 		//$e = new mb_exception("class_wmc.php: parsing wmc by xpath: title: ".$title[0]);
 		//$e = new mb_exception("class_wmc.php: parsing wmc by xpath: wmc_version: ".$this->wmc_version);
 
@@ -2017,7 +2016,7 @@
 		$wmcToXml = new WmcToXml($this);
 		$this->xml = $wmcToXml->getXml();
 	}
-} 
+}
 
 /**
  * @deprecated

Modified: trunk/mapbender/http/classes/class_wmcToXml.php
===================================================================
--- trunk/mapbender/http/classes/class_wmcToXml.php	2014-04-24 12:59:44 UTC (rev 8811)
+++ trunk/mapbender/http/classes/class_wmcToXml.php	2014-05-07 07:33:52 UTC (rev 8812)
@@ -1,7 +1,7 @@
 <?php
 # $Id: class_wmc.php 2466 2008-05-20 08:55:03Z christoph $
 # http://www.mapbender.org/index.php/class_wmc.php
-# Copyright (C) 2002 CCGIS 
+# Copyright (C) 2002 CCGIS
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,33 +19,33 @@
 
 /**
  * The XML representation of a WMC object.
- * 
+ *
  * Usage:
- * 
+ *
  * $wmcToXml = new WmcToXml($wmc);
  * $xml = $wmcToXml->getXml();
- * 
+ *
  */
 class WmcToXml {
 
 	private $wmc = null;
 	private $doc;
 	private $xml = "";
-	
+
 	/**
 	 * Constructor. Computes the XML of the WMC object given as parameter.
-	 * 
+	 *
 	 * @param $someWmc wmc
 	 */
 	public function __construct ($someWmc) {
 		$this->wmc = $someWmc;
 		$this->toXml();
-	} 
+	}
 
 	// ---------------------------------------------------------------------
 	// public functions
 	// ---------------------------------------------------------------------
-	
+
 	public function getXml () {
 		if (is_null($this->wmc)) {
 			return null;
@@ -55,16 +55,16 @@
 		}
 		return $this->xml;
 	}
-	
+
 	// ---------------------------------------------------------------------
 	// private functions
 	// ---------------------------------------------------------------------
-	
+
 	private function toXml () {
 		// generate XML
 		$this->doc = new DOMDocument("1.0", CHARSET);
 		$this->doc->preserveWhiteSpace = false;
-		
+
 		// ViewContext
 		$e_view_context = $this->doc->createElementNS("http://www.opengis.net/context", "ViewContext");
 		$e_view_context->setAttribute("version", "1.1.0");
@@ -72,13 +72,13 @@
 		$e_view_context->setAttribute("xsi:schemaLocation", "http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd");
 		$e_view_context->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
 		$e_view_context->setAttribute("xmlns:" . $this->wmc->extensionNamespace, $this->wmc->extensionNamespaceUrl);
-		
+
 		// General
-		$e_general = $this->createGeneralNode();	
+		$e_general = $this->createGeneralNode();
 		if ($e_general !== null) {
 			$e_view_context->appendChild($e_general);
-		}	
-		
+		}
+
 		// Layerlist
 		$e_layer_list = $this->doc->createElement("LayerList");
 
@@ -101,7 +101,7 @@
 			$currentWms = $currentWmsArray[$i];
 			for ($j = 0; $j < count($currentWms->objLayer); $j++) {
 				$currentLayer = $currentWms->objLayer[$j];
-				
+
 				$layerNode = null;
 				$found = false;
 				for ($k = 0; $k < count($overviewLayerArray); $k++) {
@@ -110,7 +110,7 @@
 						$layerNode = $this->createLayerNode($currentMap, $currentWms, $currentLayer, $currentOverviewLayer);
 						$found = true;
 						break;
-					}					
+					}
 				}
 				if (!$found) {
 					$layerNode = $this->createLayerNode($currentMap, $currentWms, $currentLayer);
@@ -141,7 +141,12 @@
 			$extensionData["ov_width"] = $this->wmc->overviewMap->getWidth();
 			$extensionData["ov_height"] = $this->wmc->overviewMap->getHeight();
 		}
-		
+
+
+        if($this->wmc->mainMap->getKmls()) {
+            $extensionData['kmls'] = json_encode($this->wmc->mainMap->getKmls());
+        }
+
 		// store epsg and bbox of root layer of 0th WMS
 		$firstWms = $this->wmc->mainMap->getWms(0);
 		if ($firstWms !== null) {
@@ -150,14 +155,14 @@
 				$extensionData["mainMapBox" . $i] = $currentLayerEpsg;
 			}
 		}
-		
+
 		if ($this->wmc->mainMap !== null) {
 			$extensionData["main_framename"] = $this->wmc->mainMap->getFrameName();
 		}
-				
+
 		// General
 		$e_general = $this->doc->createElement("General");
-		
+
 		// Window
 		$e_window = $this->doc->createElement("Window");
 		if ($this->wmc->mainMap->getWidth() && $this->wmc->mainMap->getHeight()) {
@@ -165,7 +170,7 @@
 			$e_window->setAttribute("height", $this->wmc->mainMap->getHeight());
 		}
 		$e_general->appendChild($e_window);
-		
+
 		// BoundingBox
 		$mainExtent = $this->wmc->mainMap->getExtent();
 		$e_bbox = $this->doc->createElement("BoundingBox");
@@ -175,11 +180,11 @@
 		$e_bbox->setAttribute("maxx", $mainExtent->max->x);
 		$e_bbox->setAttribute("maxy", $mainExtent->max->y);
 		$e_general->appendChild($e_bbox);
-				
+
 		// Title
 		$e_title = $this->doc->createElement("Title", $this->wmc->wmc_title);
 		$e_general->appendChild($e_title);
-				
+
 		// Keywords
 		if (count($this->wmc->wmc_keyword) > 0) {
 			$e_keyword_list = $this->doc->createElement("KeywordList");
@@ -189,22 +194,22 @@
 			}
 			$e_general->appendChild($e_keyword_list);
 		}
-				
+
 		// Abstract
 		if ($this->wmc->wmc_abstract) {
 			$e_abstract = $this->doc->createElement("Abstract", $this->wmc->wmc_abstract);
 			$e_general->appendChild($e_abstract);
 		}
-	
-		// Logo URL			
-		if ($this->wmc->wmc_logourl_width && $this->wmc->wmc_logourl_height && 
+
+		// Logo URL
+		if ($this->wmc->wmc_logourl_width && $this->wmc->wmc_logourl_height &&
 			$this->wmc->wmc_logourl_format && $this->wmc->wmc_logourl){
-			
+
 			$e_logo_url = $this->doc->createElement("LogoURL");
 			$e_logo_url->setAttribute("width", $this->wmc->wmc_logourl_width);
 			$e_logo_url->setAttribute("height", $this->wmc->wmc_logourl_height);
 			$e_logo_url->setAttribute("format", $this->wmc->wmc_logourl_format);
-		
+
 			$e_logo_url_or = $this->doc->createElement("OnlineResource");
 			$e_logo_url_or->setAttributeNS("http://www.opengis.net/context", "xmlns:xlink", "http://www.w3.org/1999/xlink");
 			$e_logo_url_or->setAttribute("xlink:type", "simple");
@@ -213,8 +218,8 @@
 
 			$e_general->appendChild($e_logo_url);
 		}
-				
-		// Description URL	
+
+		// Description URL
 		if ($this->wmc->wmc_descriptionurl){
 			$e_description_url = $this->doc->createElement("DescriptionURL");
 
@@ -226,17 +231,17 @@
 
 			$e_general->appendChild($e_description_url);
 		}
-				
+
 		// Contact information
 		$e_contact = $this->createContactInformationNode();
 		if ($e_contact !== null) {
 			$e_general->appendChild($e_contact);
 		}
 
-		// Extension data				
+		// Extension data
 		if (count($extensionData) > 0) {
 			$e_extensionGeneral = $this->doc->createElement("Extension");
-			
+
 			foreach ($extensionData as $keyExtensionData => $valueExtensionData) {
 				$e_currentExtensionTag = $this->addExtension($keyExtensionData, $valueExtensionData);
 				$e_extensionGeneral->appendChild($e_currentExtensionTag);
@@ -245,12 +250,12 @@
 				$e_currentExtensionTag = $this->addExtension($keyExtensionData, $valueExtensionData);
 				$e_extensionGeneral->appendChild($e_currentExtensionTag);
 			}
-			
+
 			$e_general->appendChild($e_extensionGeneral);
 		}
 		return $e_general;
 	}
-	
+
 	private function createLayerNode () {
 		if (func_num_args() == 3) {
 			$currentMap = func_get_arg(0);
@@ -262,7 +267,7 @@
 			$currentMap = func_get_arg(0);
 			$currentWms = func_get_arg(1);
 			$currentLayer = func_get_arg(2);
-			$currentOverviewLayer = func_get_arg(3);		
+			$currentOverviewLayer = func_get_arg(3);
 		}
 		else {
 			return null;
@@ -296,7 +301,7 @@
 		$currentLayerTitle = $currentLayer->gui_layer_title;
 		$e_layer_title = $this->doc->createElement("Title", $currentLayerTitle);
 		$e_layer->appendChild($e_layer_title);
-		
+
 		// Abstract
 		if ($currentWms->wms_abstract){
 			$e_layer_abstract = $this->doc->createElement("Abstract", $currentWms->wms_abstract);
@@ -311,7 +316,7 @@
 			$e_layer_data_url_or->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
 			$e_layer_data_url_or->setAttribute("xlink:type", "simple");
 			$e_layer_data_url_or->setAttribute("xlink:href", $currentLayer->layer_dataurl_href);
-			
+
 			$e_layer_data_url->appendChild($e_layer_data_url_or);
 			$e_layer->appendChild($e_layer_data_url);
 		}
@@ -329,7 +334,7 @@
 			$e_layer->appendChild($e_layer_metadata_url);
 		}
 
-		// SRS		
+		// SRS
 		$srsNode = $this->createSrsNode($currentMap, $currentWms);
 		if ($srsNode !== null) {
 			$e_layer->appendChild($srsNode);
@@ -358,7 +363,7 @@
 	private function createSrsNode ($currentMap, $currentWms) {
 		$wms_epsg = array();
 		$wms_epsg[0] = $currentMap->getEpsg();
-	
+
 		if ($currentWms->gui_wms_epsg != $currentMap->getEpsg()) {
 			$wms_epsg[1] = $currentWms->gui_wms_epsg;
 		}
@@ -377,7 +382,7 @@
 		$e_layer_format = $this->doc->createElement("FormatList");
 
 		$data_format_current = false;
-		
+
 		for ($k = 0; $k < count($currentWms->data_format); $k++){
 
 			if ($currentWms->data_type[$k] == "map") {
@@ -385,7 +390,7 @@
 
 				$e_format = $this->doc->createElement("Format", $layerFormat);
 
-				if ($data_format_current === false && ( 
+				if ($data_format_current === false && (
 						$currentWms->data_format[$k] == $currentWms->gui_wms_mapformat ||
 						$k == (count($currentWms->data_format)-1)
 				)){
@@ -419,7 +424,7 @@
 		$layerExtensionData["gui_status"] = $currentLayer->gui_layer_status;
 		$layerExtensionData["layer_epsg"] = $currentLayer->layer_epsg;
 		$layerExtensionData["gui_wms_opacity"] = $currentWms->gui_wms_opacity;
-		
+
 		for ($i = 0; $i < count($currentWms->gui_epsg); $i++) {
 			$found = false;
 			for ($j = 0; $j < count($layerExtensionData["layer_epsg"]); $j++) {
@@ -452,7 +457,7 @@
 
 		if (count($layerExtensionData) > 0) {
 			$e_extension = $this->doc->createElement("Extension");
-			
+
 			foreach ($layerExtensionData as $keyExtensionData => $valueExtensionData) {
 				$e_currentExtensionTag = $this->addExtension($keyExtensionData, $valueExtensionData);
 				$e_extension->appendChild($e_currentExtensionTag);
@@ -461,7 +466,7 @@
 		}
 		return null;
 	}
-	
+
 	private function addExtension ($key, $value) {
 		if (is_array($value)) {
 			if (is_numeric($key)) {
@@ -480,14 +485,14 @@
 		}
 		return $e_currentExtensionTag;
 	}
-	
+
 	private function createLayerStyleNode ($currentWms, $currentLayer) {
 		$e_layer_stylelist = $this->doc->createElement("StyleList");
-		
+
 		for ($k = 0; $k < count($currentLayer->layer_style); $k++) {
 
 			$currentStyle = $currentLayer->layer_style[$k];
-			
+
 			$layerStyle_current = 0;
 			if ($k === 0){
 				$layerStyle_current = 1; // To do: insert proper data
@@ -505,7 +510,7 @@
 				$e_layer_style->appendChild($e_layer_style_or);
 			}
 			else{
-				
+
 				if ($layerStyle_current == 1){
 					$e_layer_style->setAttribute("current", "1");
 				}
@@ -515,8 +520,8 @@
 
 				$e_layer_style_title = $this->doc->createElement("Title", $currentStyle["title"]);
 				$e_layer_style->appendChild($e_layer_style_title);
-				
-				
+
+
 				$e_layer_style_legendurl = $this->doc->createElement("LegendURL");
 
 				//TODO: determine correct layer style entries
@@ -535,40 +540,40 @@
 				$e_layer_style->appendChild($e_layer_style_legendurl);
 			}
 			$e_layer_stylelist->appendChild($e_layer_style);
-		}	
+		}
 		return $e_layer_stylelist;
 	}
-	
+
 	/**
-	 * 
-	 * @return 
+	 *
+	 * @return
 	 */
 	private function createContactInformationNode () {
-		
+
 		if ($this->wmc->wmc_contactemail || $this->wmc->wmc_contactorganization ||
-			$this->wmc->wmc_contactperson || $this->wmc->wmc_contactposition || 
-			$this->wmc->wmc_contactaddresstype || $this->wmc->wmc_contactaddress || 
+			$this->wmc->wmc_contactperson || $this->wmc->wmc_contactposition ||
+			$this->wmc->wmc_contactaddresstype || $this->wmc->wmc_contactaddress ||
 			$this->wmc->wmc_contactcity || $this->wmc->wmc_contactstateorprovince ||
-			$this->wmc->wmc_contactpostcode || $this->wmc->wmc_contactcountry || 
+			$this->wmc->wmc_contactpostcode || $this->wmc->wmc_contactcountry ||
 			$this->wmc->wmc_contactvoicetelephone || $this->wmc->wmc_contactfacsimiletelephone) {
-				
+
 			$e_contact = $this->doc->createElement("ContactInformation");
 			$e_contact_person_primary = $this->wmc->createContactPersonPrimaryNode();
 			if ($e_contact_person_primary !== null) {
 				$e_contact->appendChild($e_contact_person_primary);
 			}
-		
+
 			if ($this->wmc->wmc_contactposition){
 				$e_contact_position = $this->doc->createElement("ContactPosition", $this->wmc->wmc_contactposition);
 				$e_contact->appendChild($e_contact_position);
 			}
-		
-			if ($this->wmc->wmc_contactaddresstype || $this->wmc->wmc_contactaddress || 
+
+			if ($this->wmc->wmc_contactaddresstype || $this->wmc->wmc_contactaddress ||
 				$this->wmc->wmc_contactcity || $this->wmc->wmc_contactstateorprovince ||
 				$this->wmc->wmc_contactpostcode || $this->wmc->wmc_contactcountry) {
-		
+
 				$e_contact_address = $this->doc->createElement("ContactAddress");
-		
+
 				if ($this->wmc->wmc_contactaddresstype){
 					$e_address_type = $this->doc->createElement("AddressType", $this->wmc->wmc_contactaddresstype);
 					$e_contact_address->appendChild($e_address_type);
@@ -595,7 +600,7 @@
 				}
 				$e_contact->appendChild($e_contact_address);
 			}
-			
+
 			if ($this->wmc->wmc_contactvoicetelephone){
 				$e_voice_telephone = $this->doc->createElement("ContactVoiceTelephone", $this->wmc->wmc_contactvoicetelephone);
 				$e_contact->appendChild($e_voice_telephone);
@@ -609,14 +614,14 @@
 				$e_contact->appendChild($e_email);
 			}
 			return $e_contact;
-		}		
+		}
 		return null;
 	}
-	
+
 	private function createContactPersonPrimaryNode () {
 		if ($this->wmc->wmc_contactperson || $this->wmc->wmc_contactorganization){
 			$e_contact_person_primary = $this->doc->createElement("ContactPersonPrimary");
-	
+
 			if ($this->wmc->wmc_contactperson){
 				$e_contact_person = $this->doc->createElement("ContactPerson", $this->wmc->wmc_contactperson);
 				$e_contact_person_primary->appendChild($e_contact_person);
@@ -627,7 +632,7 @@
 			}
 			return $e_contact_person_primary;
 		}
-		return null;		
+		return null;
 	}
 
 }

Modified: trunk/mapbender/http/javascripts/mod_loadwmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_loadwmc.js	2014-04-24 12:59:44 UTC (rev 8811)
+++ trunk/mapbender/http/javascripts/mod_loadwmc.js	2014-05-07 07:33:52 UTC (rev 8812)
@@ -27,7 +27,7 @@
 	else {
 		options.editWmc = 0;
 	}
-	//if(Mapbender.modules.i18n){	
+	//if(Mapbender.modules.i18n){
 	//Mapbender.modules.i18n.queue(options.id, originalI18nObject, function (translatedObject) {
 	//	if (typeof translatedObject !== "object") {
 	//			return;
@@ -36,7 +36,7 @@
 	//});
 	//Mapbender.modules.i18n.localize(Mapbender.languageId);
 //}
-	
+
 });
 
 var originalI18nObject = {
@@ -73,7 +73,7 @@
 
 var translatedI18nObject = Mapbender.cloneObject(originalI18nObject);
 
-if(Mapbender.modules.i18n){	
+if(Mapbender.modules.i18n){
 	Mapbender.modules.i18n.queue(options.id, originalI18nObject, function (translatedObject) {
 		if (typeof translatedObject !== "object") {
 			return;
@@ -111,24 +111,24 @@
 		method: "mergeWmc",
 		message: translatedI18nObject.messageMergeSuccess
 	};
-	
+
 	var APPEND_WMC_OPTIONS = {
 		src: "../img/button_gray/wmc_append.png",
 		title: translatedI18nObject.labelAppendWmc,
 		method: "appendWmc",
 		message: translatedI18nObject.messageAppendSuccess
 	};
-	
+
 	var PUBLISH_WMC_OPTIONS = {
 		title: translatedI18nObject.labelPublishWmc,
 		method: "setWMCPublic"
 	};
-	
+
 	var OPENLAYERS_WMC_OPTIONS = {
 		src: "../img/OpenLayers.trac.png",
 		title: translatedI18nObject.labelOpenLayersExport
 	};
-	
+
 	var OPENLAYERSURL_WMC_OPTIONS = {
 		src: "../img/osgeo_graphics/geosilk/link.png",
 		title: translatedI18nObject.labelOpenLayersUrl
@@ -138,18 +138,18 @@
 		src: "../img/osgeo_graphics/geosilk/link.png",
 		title: translatedI18nObject.labelApi
 	};
-	
+
 	var DELETE_WMC_OPTIONS = {
 		src: "../img/button_gray/del_disabled.png",
 		title: translatedI18nObject.labelDeleteWmc,
 		method: "deleteWmc"
 	};
-	
+
 	var DISPLAY_WMC_OPTIONS = {
 		src: "../img/button_gray/wmc_xml.png",
 		title: translatedI18nObject.labelDisplayWmc
 	};
-	
+
 	var EDIT_WMC_OPTIONS = {
 		src: "../img/pencil.png",
 		title: translatedI18nObject.labelEditWmc,
@@ -165,7 +165,7 @@
 	this.events = {
 		loaded: new Mapbender.Event()
 	};
-	
+
 	this.load = function (id) {
 		loadMergeAppendCallback($.extend({}, LOAD_WMC_OPTIONS, {
 			parameters: {
@@ -173,10 +173,10 @@
 			}
 		}));
 	};
-	
+
 	this.show = function () {
 		// creates a new pop up (if it doesn't already exist)
-		// the pop up allows you to load, append, merge, 
+		// the pop up allows you to load, append, merge,
 		// display and delete WMC documents
 		if (tagName === "IMG") {
 			if($wmcPopup) {
@@ -202,9 +202,9 @@
 			$loadWmc.html(getInitialDialogHtml(options.id));
 		}
 
-		this.refreshList();			
+		this.refreshList();
 	};
-	
+
 	this.hide = function () {
 		if($wmcPopup && $wmcPopup.size() > 0) {
 			$wmcPopup.dialog('destroy');
@@ -219,7 +219,7 @@
 		that.hideApiList();
 		that.hideApiUrl();
 	};
-	
+
 	this.showWmcXml = function (id) {
 		that.hideDependendWindows();
 		var url = "../javascripts/mod_displayWmc.php?wmc_id=" + id + "&" + mb_session_name + "=" + mb_nr;
@@ -234,7 +234,7 @@
 			pos: [700,50]
 		}).parent().css({position:"absolute"});
 	};
-	
+
 	this.hideWmcXml = function () {
 		if($('.wmcDisplayPopup').size() > 0) {
 			$('.wmcDisplayPopup').dialog('destroy');
@@ -256,7 +256,7 @@
 			pos: [600,40]
 		}).parent().css({position:"absolute"});
 	};
-	
+
 	this.hideOpenLayers = function () {
 		if($('.wmcOpenLayersPopup').size() > 0) {
 			$('.wmcOpenLayersPopup').dialog('destroy');
@@ -276,7 +276,7 @@
 			pos: [600,40]
 		});
 	};
-	
+
 	this.hideApiUrl = function () {
 		if($('.wmcApiUrlPopup').size() > 0) {
 			$('.wmcApiUrlPopup').dialog('destroy');
@@ -326,7 +326,7 @@
 			$apiTable.append($trOl);
 		}
 		if (options.mobileUrl) {
-			//mobile client 
+			//mobile client
 			//get qr code for mobile client via ajax request
 			var req = new Mapbender.Ajax.Request({
 				url: serverSideFileName,
@@ -360,7 +360,7 @@
 			}
 		$("#api_dialog").append($apiTable);
 	};
-	
+
 	this.hideApiList = function () {
 		if($('.wmcApiDialog').size() > 0) {
 			$('.wmcApiDialog').dialog('destroy');
@@ -368,7 +368,7 @@
 		}
 	};
 
-	//end of the link-handle popup	
+	//end of the link-handle popup
 	this.refreshList = function () {
 		//alert("Options showPublic: "+options.showPublic);
 		var req = new Mapbender.Ajax.Request({
@@ -387,7 +387,7 @@
 		});
 		req.send();
 	};
-	
+
 	this.showWmcSaveForm = function (id) {
 		this.load(id);
 		Mapbender.modules[options.saveWmcTarget].getExistingWmcData(function (obj) {
@@ -413,9 +413,9 @@
 			//that.refreshList();
 		});
 	};
-	
+
 	var getInitialDialogHtml = function (id) {
-	
+
 		if (!options.listWmc && !options.uploadWmc) {
 			return "";
 		}
@@ -423,42 +423,42 @@
 
 		// add tabs if both modules are available
 		if (options.listWmc && options.uploadWmc) {
-			initialHtml += "<ul><li><a href='#" + id + "_wmclist'>" + 
-				translatedI18nObject.labelList + 
-				"</a></li><li><a href='#" + id + "_wmcUpload'>" + 
+			initialHtml += "<ul><li><a href='#" + id + "_wmclist'>" +
+				translatedI18nObject.labelList +
+				"</a></li><li><a href='#" + id + "_wmcUpload'>" +
 				translatedI18nObject.labelUpload + "</a></li></ul>";
 		}
 
 		initialHtml += "<div id='" + id + "_wmclist' >";
-		
+
 		// add listWMC if available
 		var t = translatedI18nObject;
 		if (options.listWmc) {
 			initialHtml += "<table width='100%' id='" + id + "_wmclist_table'>" +
 						"<thead><tr>" +
 							"<th>" + t.labelWmcName + "</td>" +
-							"<th>" + t.labelLastUpdate + "</td>" + 
-							"<th>" + t.labelCreated + "</td>" + 
-				(options.loadWmc ? "<th>" + t.labelLoad + "</td>" : "") + 
-				(options.mergeWmc ? "<th>" + t.labelMerge + "</td>" : "") + 
-				(options.appendWmc ? "<th>" + t.labelAppend + "</td>" : "") + 
-				(options.publishWmc ? "<th>" + t.labelPublic + "</td>" : "") + 
+							"<th>" + t.labelLastUpdate + "</td>" +
+							"<th>" + t.labelCreated + "</td>" +
+				(options.loadWmc ? "<th>" + t.labelLoad + "</td>" : "") +
+				(options.mergeWmc ? "<th>" + t.labelMerge + "</td>" : "") +
+				(options.appendWmc ? "<th>" + t.labelAppend + "</td>" : "") +
+				(options.publishWmc ? "<th>" + t.labelPublic + "</td>" : "") +
 				(options.showWmc ? "<th>" + t.labelShow + "</td>" : "") +
-				(options.showApi ? "<th>" + t.labelApi + "</td>" : "") + 
-				(options.editWmc ? "<th>" + t.labelEditWmc + "</td>" : "") + 
-				(options.deleteWmc ? "<th>" + t.labelDelete + "</td>" : "") + 
+				(options.showApi ? "<th>" + t.labelApi + "</td>" : "") +
+				(options.editWmc ? "<th>" + t.labelEditWmc + "</td>" : "") +
+				(options.deleteWmc ? "<th>" + t.labelDelete + "</td>" : "") +
 				"</tr></thead></table>";
 		}
-		
+
 		initialHtml += "</div>";
 		// add uploadWMC if available
 		if (options.uploadWmc) {
 			initialHtml += "<div id='" + id + "_wmcUpload' ></div>";
 		}
-		
+
 		return "<div style='display:none' id='" + id + "_tabs'>" + initialHtml + "</div>";
 	};
-	
+
 	/**
 	 * args.method
 	 * args.parameters
@@ -480,7 +480,7 @@
 					}
 					if (obj.javascript && typeof(obj.javascript) == "object") {
 						for (var j = 0; j < obj.javascript.length; j++) {
-							//TODO: prohibit multiple maprequests when load wmc, cause on maprequests the wmc maybe stored to session :-(   
+							//TODO: prohibit multiple maprequests when load wmc, cause on maprequests the wmc maybe stored to session :-(
 							//alert("Statement: " + obj.javascript[j]);
 							//eventAfterLoadWMS.trigger(); -- load the each wms again and saves the wmc to session for each wms - prohibit this behaviour!!!! - Done by global lock_maprequest in class_wmc.php line 1220+!!
 							//console.log("Statement: " + obj.javascript[j]);
@@ -491,7 +491,7 @@
 								extensionData: restoredWmcExtensionData
 							});
 						}
-					}	
+					}
 					that.hide();
 					new Mapbender.Notice(args.message);
 				}
@@ -502,7 +502,7 @@
 		});
 		req.send();
 	};
-	
+
 	var loadMergeAppendCallback = function(args){
 		if (constraintCheckRequired()) {
 			checkConstraints(args, function(args){
@@ -520,7 +520,7 @@
 		});
 		return $("<td></td>").append($img);
 	};
-	
+
 	var appendBoolTableCell = function (args, callback) {
 		var checked = args.isPublic ? 'checked="checked" ':'' ;
 		var disabled = args.disabled ? 'disabled="disabled" ':'' ;
@@ -531,18 +531,18 @@
 		});
 		return $("<td></td>").append(checkbox);
 	};
-	
+
 	var createLoadWmcCell = function (wmc) {
 		return createTableCell(
 			$.extend({
 				parameters: {
 					id: wmc.id
 				}
-			}, LOAD_WMC_OPTIONS), 
+			}, LOAD_WMC_OPTIONS),
 			loadMergeAppendCallback
 		);
 	};
-	
+
 	var createMergeWmcCell = function (wmc) {
 		//
 		// WORKAROUND....cannot serialize map object,
@@ -556,7 +556,7 @@
 			$target.push(mb_mapObj[i].$target);
 			delete mb_mapObj[i].$target;
 		}
-		
+
 		var $cell = createTableCell(
 			$.extend({
 				parameters: {
@@ -565,7 +565,7 @@
 					mapObject: $.toJSON(mb_mapObj),
 					generalTitle: translatedI18nObject.labelCurrentState
 				}
-			}, MERGE_WMC_OPTIONS), 
+			}, MERGE_WMC_OPTIONS),
 			loadMergeAppendCallback
 		);
 
@@ -575,9 +575,9 @@
 		for (var i = 0; i < mb_mapObj.length; i++) {
 			mb_mapObj[i].$target = $target[i];
 		}
-		return $cell;		
+		return $cell;
 	};
-	
+
 	var createAppendWmcCell = function (wmc) {
 		//
 		// WORKAROUND....cannot serialize map object,
@@ -591,7 +591,7 @@
 			$target.push(mb_mapObj[i].$target);
 			delete mb_mapObj[i].$target;
 		}
-		
+
 		var $cell = createTableCell(
 			$.extend({
 				parameters: {
@@ -600,7 +600,7 @@
 					mapObject: $.toJSON(mb_mapObj),
 					generalTitle: translatedI18nObject.labelCurrentState
 				}
-			}, APPEND_WMC_OPTIONS), 
+			}, APPEND_WMC_OPTIONS),
 			loadMergeAppendCallback
 		);
 
@@ -612,7 +612,7 @@
 		}
 		return $cell;
 	};
-	
+
 	var createPublishWmcCell = function (wmc) {
 		return appendBoolTableCell(
 			$.extend({}, PUBLISH_WMC_OPTIONS, {
@@ -621,7 +621,7 @@
 				parameters: {
 					id: wmc.id
 				}
-			}), 
+			}),
 			executeJavaScript
 		);
 	};
@@ -631,7 +631,7 @@
 			OPENLAYERS_WMC_OPTIONS, function(){
 				that.showOpenLayers(wmc.id);
 			}
-		);	
+		);
 	};
 
 	var createOpenLayersUrlWmcCell = function (wmc) {
@@ -639,7 +639,7 @@
 			OPENLAYERSURL_WMC_OPTIONS, function(){
 				that.showOpenLayersUrl(wmc.id);
 			}
-		);	
+		);
 	};
 
 	var createMobileUrlWmcCell = function (wmc) {
@@ -647,7 +647,7 @@
 			MOBILEURL_WMC_OPTIONS, function(){
 				that.showMobileUrl(wmc.id);
 			}
-		);	
+		);
 	};
 
 	var createApiWmcCell = function (wmc) {
@@ -655,7 +655,7 @@
 			API_WMC_OPTIONS, function(){
 				that.showApiList(wmc.id);
 			}
-		);	
+		);
 	};
 
 	var createDisplayWmcCell = function (wmc) {
@@ -664,18 +664,18 @@
 			function(){
 				that.showWmcXml(wmc.id);
 			}
-		);	
+		);
 	};
-	
+
 	var createEditWmcCell = function (wmc) {
 		return createTableCell(
 			EDIT_WMC_OPTIONS,
 			function(){
 				that.showWmcSaveForm(wmc.id);
 			}
-		);	
+		);
 	};
-	
+
 	var createDeleteWmcCell = function (wmc) {
 		var $deleteTd = createTableCell(
 			$.extend({}, DELETE_WMC_OPTIONS, {
@@ -683,7 +683,7 @@
 				parameters: {
 					id: wmc.id
 				}
-			}), 
+			}),
 			function(args){
 				if (!wmc.disabled && confirm(Mapbender.sprintf(translatedI18nObject.confirmDelete, wmc.title))) {
 					executeJavaScript(args);
@@ -691,23 +691,23 @@
 					wmcTable.fnDeleteRow(aPos[0]);
 				}
 			}
-		);	
+		);
 		return $deleteTd;
 	};
-	
+
 	var displayWmcList = function (wmcObj, status) {
-/*		
+/*
 		if(wmcListTableInitialized === true) {
 			wmcTable.fnClearTable();
-			
+
 			for (var i=0; i < wmcObj.wmc.length; i++) {
 				(function () {
-					
+
 					var currentIndex = i;
 					var currentWmc = wmcObj.wmc[currentIndex];
-					
+
 					var dataArray = [currentWmc.title, currentWmc.timestamp, currentWmc.timestamp_create];
-					
+
 					if (options.loadWmc) {
 						dataArray.push(createLoadWmcCell(currentWmc));
 					}
@@ -738,18 +738,18 @@
 			}
 		}
 		else {
-*/		
+*/
 		// create table
 		for (var i=0; i < wmcObj.wmc.length; i++) {
 			(function () {
 				var currentIndex = i;
 				var currentWmc = wmcObj.wmc[currentIndex];
-				
-				var $tr = $("<tr></tr>").append("<td>" + currentWmc.title + "</td><td>" + 
-					currentWmc.timestamp + "</td><td>" + 
+
+				var $tr = $("<tr></tr>").append("<td>" + currentWmc.title + "</td><td>" +
+					currentWmc.timestamp + "</td><td>" +
 					currentWmc.timestamp_create + "</td>"
 				);
-				
+
 				if (options.loadWmc) {
 					$tr.append(createLoadWmcCell(currentWmc));
 				}
@@ -777,13 +777,13 @@
 				$tr.appendTo("#" + options.id + "_wmclist_table");
 			})();
 		}
-/*			
+/*
 		}
-		
 
-	
-		
-		
+
+
+
+
 		if(wmcListTableInitialized === false) {
 */
 			// create horizontal tabs
@@ -791,7 +791,7 @@
 		if (options.listWmc && options.uploadWmc) {
 			$("#" + options.id + "_tabs").tabs().css("display", "block");
 		}
-		
+
 		// create upload
 		if (options.uploadWmc) {
 			$("#" + options.id + "_wmcUpload").upload({
@@ -810,7 +810,7 @@
 				}
 			});
 		}
-		
+
 		// create datatables
 		if (options.listWmc) {
 			wmcTable = $("#" + options.id + "_wmclist_table").dataTable({
@@ -818,22 +818,22 @@
 				"bJQueryUI": true
 			});
 		}
-/*			
+/*
 			wmcListTableInitialized = true;
 		}
 		else {
 			wmcTable.fnDraw();
 		}
-*/		
+*/
 	};
-	
+
 	var constraintCheckRequired = function () {
-		return options.checkLayerIdExists 
-			|| options.checkLayerIdValid 
-			|| options.checkLayerPermission 
+		return options.checkLayerIdExists
+			|| options.checkLayerIdValid
+			|| options.checkLayerPermission
 			|| options.checkLayerAvailability;
 	};
-	
+
 	var checkConstraints = function (args, callback) {
 		var req = new Mapbender.Ajax.Request({
 			url: serverSideFileName,
@@ -846,30 +846,30 @@
 				checkLayerAvailability: options.checkLayerAvailability
 			},
 			callback: function (obj, result, message) {
-				
+
 				var html = "";
 				var constraintTypeArray = [];
 				for (var constraintType in obj) {
 					var caseObj = obj[constraintType];
-	
+
 					if (caseObj.wms.length === 0) {
 						continue;
 					}
-	
+
 					html += "<fieldset>" + caseObj.message + translatedI18nObject.confirmLoadAnyway + "<br><br>";
-					
+
 					for (var index in caseObj.wms) {
 						var wms = caseObj.wms[index];
-						html += "<label for='" + constraintType + "_" + wms.index + "'>" + 
-							"<input id='" + options.id + "_" + constraintType + "_" + wms.index + "' " + 
+						html += "<label for='" + constraintType + "_" + wms.index + "'>" +
+							"<input id='" + options.id + "_" + constraintType + "_" + wms.index + "' " +
 							"type='checkbox' />" + wms.title  + "</label><br>";
 					}
 					html += "</fieldset><br>";
 					constraintTypeArray.push(constraintType);
 				}
-	
-				$("<div id='" + options.id + "_constraint_form' title='Warning'>" + 
-					"<style> fieldset label { display: block; }</style>" + 
+
+				$("<div id='" + options.id + "_constraint_form' title='Warning'>" +
+					"<style> fieldset label { display: block; }</style>" +
 					"<form>" + html + "</form></div>").dialog(
 					{
 						bgiframe: true,
@@ -904,19 +904,19 @@
 						}
 					}
 				);
-	
+
 				$("#" + options.id + "_constraint_form").dialog('open');
 			}
 		});
 		req.send();
 	};
-	
+
 	//
 	// constructor
 	//
 	var tagName = $loadWmc.get(0).tagName.toUpperCase();
 	if (tagName === "IMG") {
-	
+
 		$loadWmc.click(function () {
 			that.show();
 		}).mouseover(function () {
@@ -931,15 +931,15 @@
 	}
 	else {
 		that.show();
-	}	
-	
+	}
+
 /*	try {
-		
+
 		// checks if element var loadFromSession exists
 		if (loadFromSession === undefined) {
 			loadFromSession = 0;
 		}
-		
+
 		if (loadFromSession) {
 			Mapbender.events.init.register(function () {
 				load_wmc_session();

Modified: trunk/mapbender/http/javascripts/mod_savewmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.js	2014-04-24 12:59:44 UTC (rev 8811)
+++ trunk/mapbender/http/javascripts/mod_savewmc.js	2014-05-07 07:33:52 UTC (rev 8812)
@@ -3,16 +3,16 @@
  *
  * Description:
  * save workspace as WMC
- * 
+ *
  * Files:
  *  - http/javascripts/mod_savewmc.php
  *  - http/javascripts/mod_savewmc.js
  *  - http/php/mod_savewmc_server.php
  *
  * SQL:
- * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, 
- * > e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, 
- * > e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, 
+ * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment,
+ * > e_title, e_element, e_src, e_attributes, e_left, e_top, e_width,
+ * > e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file,
  * > e_mb_mod, e_target, e_requires, e_url) VALUES('<gui_id>','savewmc',2,1,
  * > 'save workspace as WMC','Save workspace as web map context document',
  * > 'img','../img/button_blink_red/wmc_save_off.png','',870,60,24,24,1,'',
@@ -25,15 +25,15 @@
  * > e_url) VALUES('gui1','lzw_compression',3,1,'','','','','',NULL ,NULL ,NULL ,NULL ,
  * > NULL ,'','','','','lzw.js','','','');
  * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, 
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
  * > context, var_type) VALUES('<gui_id>', 'savewmc', 'overwrite', '1', '',
  * > 'var');
- * > 
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, 
- * > context, var_type) VALUES('<gui_id>', 'savewmc', 'saveInSession', '1', 
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
+ * > context, var_type) VALUES('<gui_id>', 'savewmc', 'saveInSession', '1',
  * > '' ,'var');
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, 
- * > context, var_type) VALUES('<gui_id>', 'savewmc', 'lzwCompressed', 'false', 
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
+ * > context, var_type) VALUES('<gui_id>', 'savewmc', 'lzwCompressed', 'false',
  * > '' ,'var');
  *
  * Help:
@@ -41,22 +41,22 @@
  *
  * Maintainer:
  * http://www.mapbender.org/User:Christoph_Baudson
- * 
- * 
+ *
+ *
  * Parameters:
- * 
+ *
  * overwrite     - *[optional]* if set to 1, a WMC document is overwritten
  * 					if a WMC with the given name already exists
- * 
- * saveInSession - *[optional]* if set to 1, the state of the client is 
+ *
+ * saveInSession - *[optional]* if set to 1, the state of the client is
  * 					stored in the session after each map request in
  * 					the target map
- * 
  *
+ *
  * License:
  * Copyright (c) 2009, Open Source Geospatial Foundation
- * This program is dual licensed under the GNU General Public License 
- * and Simplified BSD license.  
+ * This program is dual licensed under the GNU General Public License
+ * and Simplified BSD license.
  * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
  */
 
@@ -94,7 +94,7 @@
 	var curDate = null;
 	do { curDate = new Date(); }
 	while(curDate-date < millis);
-} 
+}
 
 
 if (typeof originalI18nObj !== "object") {
@@ -113,21 +113,21 @@
 	var that = this;
 
 	this.extensionData = {};
-	
+
 	this.overwrite = overwrite;
 	this.saveInSession = saveInSession;
 	this.lzwCompressed = lzwCompressed;
 	this.events = {
 		saved: new Mapbender.Event()
 	};
-	
+
 	this.setExtensionData = function (obj) {
 		if (typeof obj === "object") {
 			$.extend(this.extensionData, obj);
 		}
 		return this;
 	};
-	
+
 	this.save = function (obj) {
 		if (typeof obj !== "object") {
 			new Mapbender.Exception("Invalid parameters.");
@@ -148,12 +148,12 @@
 		if (that.extensionData !== null) {
 			extensionDataString = $.toJSON(that.extensionData);
 		}
-	
+
 		if (storeInSession == 1 && browserCompatibilityMode == 0) {
 			//alert('AJAX will be set to asyncron!');
-			$.ajaxSetup({async:false}); 
+			$.ajaxSetup({async:false});
 		}
-		
+
 		//
 		// WORKAROUND....cannot serialize map object,
 		// as it contains a jQuery collection, which is
@@ -166,6 +166,11 @@
 			$target.push(mb_mapObj[i].$target);
 			delete mb_mapObj[i].$target;
 		}
+            var kml = $('#mapframe1').data('kml');
+            if(kml) {
+                mb_mapObj[0].kmls = kml._kmls;
+            }
+
 	    	var mapObjectToSend = $.toJSON(mb_mapObj);
 		//if compression is demanded see http://rosettacode.org/wiki/LZW_compression#JavaScript
 		if (beLzwCompressed == 'true') { //
@@ -177,10 +182,10 @@
 	        url: "../php/mod_savewmc_server.php",
 	        method: "saveWMC",
 			parameters : {
-			  saveInSession:storeInSession, 
+			  saveInSession:storeInSession,
 			  attributes:attributes,
 			  overwrite:overwrite,
-			  extensionData:extensionDataString, 
+			  extensionData:extensionDataString,
 			  lzwCompressed:beLzwCompressed,
 			  mapObject:mapObjectToSend
 			},
@@ -188,7 +193,7 @@
 				callbackFunction(result, status, message);
 				that.events.saved.trigger();
 			}
-	    }); 
+	    });
 	    req.send();
 
 		//
@@ -204,10 +209,10 @@
 		// buttons
 		//
 		$("#" + options.id + "_saveWMCForm").dialog('option', 'buttons', getButtons());
-		
+
 		// title
 		$("#" + options.id + "_saveWMCForm").dialog('option', 'title', translatedI18nObj.title);
-		
+
 		//
 		// form
 		//
@@ -215,17 +220,17 @@
 		$form.children("label").each(function () {
 			var forId = $(this).attr("for");
 			switch (forId) {
-				case options.id + "_wmctype" : 
+				case options.id + "_wmctype" :
 					$(this).text(translatedI18nObj.labelNewOrOverwrite).next()
 						.children().eq(0).text(translatedI18nObj.labelNewWmc);
 					break;
-				case options.id + "_wmcname" : 
+				case options.id + "_wmcname" :
 					$(this).text(translatedI18nObj.labelName);
 					break;
-				case options.id + "_wmcabstract" : 
+				case options.id + "_wmcabstract" :
 					$(this).text(translatedI18nObj.labelAbstract);
 					break;
-				case options.id + "_wmckeywords" : 
+				case options.id + "_wmckeywords" :
 					$(this).text(translatedI18nObj.labelKeywords);
 					break;
 			}
@@ -251,7 +256,7 @@
 		});
 		req.send();
 	};
-	
+
 	var createSelectBoxForExistingWmcs = function (obj) {
 		(function () {
 			$select = $("#" + options.id + "_wmctype").empty();
@@ -263,16 +268,16 @@
 					if (wmc.disabled) {
 						continue;
 					}
-					
-					select += "<option value='" + wmc.id + "'>" + 
+
+					select += "<option value='" + wmc.id + "'>" +
 						wmc.title + "</option>";
 				}
 			}
-			
+
 			$select.html(select).change(function () {
 				//
 				// reset fields if new wmc is saved
-				//		
+				//
 				if (this.value === "") {
 					$("#" + options.id + "_wmc_id").val("");
 					$("#" + options.id + "_wmcname").val("");
@@ -302,7 +307,7 @@
 			});
 		})();
 	};
-	
+
 	var getButtons = function () {
 		var buttonObj = {};
 		buttonObj[translatedI18nObj.labelSave] = function() {
@@ -326,7 +331,7 @@
 				}));
 			}
 			else{
-				//perfom validation	
+				//perfom validation
 			}
 			$(this).dialog('close');
 		};
@@ -336,14 +341,14 @@
 		};
 		return buttonObj;
 	};
-	
+
 	var mod_savewmc = function () {
 		that.getExistingWmcData(function (obj) {
 			createSelectBoxForExistingWmcs(obj);
 			$("#" + options.id + "_saveWMCForm").dialog('open');
 		});
 	};
-	
+
 	//
 	// constructor
 	//
@@ -373,7 +378,7 @@
     					}
 				}*/
 				//alert("Support of onBeforeUnload: "+supportsOnbeforeunload+" Browser:"+navigator.userAgent);
-				if (supportsOnbeforeunload) { 
+				if (supportsOnbeforeunload) {
 					//$(window).bind('beforeunload', function(){//after hint in web http://stackoverflow.com/questions/4376596/jquery-unload-or-beforeunload
 					window.onbeforeunload = function(e){//after hint in web http://stackoverflow.com/questions/4376596/jquery-unload-or-beforeunload
 						var e = e || window.event;
@@ -394,7 +399,7 @@
   						//return 'Any string';
 					};
 				} else {
-					$(window).bind('unload', function(){ 
+					$(window).bind('unload', function(){
 						//alert("Write WMC to session - onUnload!");
 						if (!window.resetSession) {
 							that.save({
@@ -404,7 +409,7 @@
 							//alert("onunload: no reset of session stored wmc requested - wmc will be saved into session!");
 							alert(translatedI18nObj.labelSaveInSession);
 						}
-					}); 
+					});
 				}
 		} else {
 			//alert("Your are in a browser compatibility mode - this make the application slow!");
@@ -422,20 +427,20 @@
 						}
 					});
 				});
-			},3500);	
-		}	
+			},3500);
+		}
 	}
 	});
-	
+
 	Mapbender.events.init.register(function () {
-	
+
 		var t = translatedI18nObj;
-		var savewmcHtml = '<div id="' + options.id + '_saveWMCForm" ' + 
-			'title="' + translatedI18nObj.title + '">' + 
-			'<style> fieldset label { display: block; }</style>' + 
-			wmcSaveFormHtml + 
+		var savewmcHtml = '<div id="' + options.id + '_saveWMCForm" ' +
+			'title="' + translatedI18nObj.title + '">' +
+			'<style> fieldset label { display: block; }</style>' +
+			wmcSaveFormHtml +
 			'</div>';
-	
+
 		var $saveWmcDialog = $(savewmcHtml).dialog({
 			bgiframe: true,
 			autoOpen: false,
@@ -455,9 +460,9 @@
 			buttons: getButtons()
 		});
 	});
-	
+
 //	Mapbender.events.localize.register(function () {
-if(Mapbender.modules.i18n){	
+if(Mapbender.modules.i18n){
 		Mapbender.modules.i18n.queue(options.id, originalI18nObj, function (translatedObj) {
 			if (typeof translatedObj !== "object") {
 				return;

Modified: trunk/mapbender/http/php/mod_savewmc_server.php
===================================================================
--- trunk/mapbender/http/php/mod_savewmc_server.php	2014-04-24 12:59:44 UTC (rev 8811)
+++ trunk/mapbender/http/php/mod_savewmc_server.php	2014-05-07 07:33:52 UTC (rev 8812)
@@ -2,8 +2,8 @@
 /*
  * License:
  * Copyright (c) 2009, Open Source Geospatial Foundation
- * This program is dual licensed under the GNU General Public License 
- * and Simplified BSD license.  
+ * This program is dual licensed under the GNU General Public License
+ * and Simplified BSD license.
  * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
  */
 
@@ -21,13 +21,13 @@
 	exit;
 }
 
-$json = new Mapbender_JSON(); 
+$json = new Mapbender_JSON();
 
 // get data from POST and SESSION
 $userId = Mapbender::session()->get("mb_user_id");
-$mapObject = $ajaxResponse->getParameter('mapObject'); 
+$mapObject = $ajaxResponse->getParameter('mapObject');
 $lzwCompressed = $ajaxResponse->getParameter('lzwCompressed');
-$saveInSession = $ajaxResponse->getParameter('saveInSession'); 
+$saveInSession = $ajaxResponse->getParameter('saveInSession');
 $extensionData = $json->decode($ajaxResponse->getParameter('extensionData'));
 $attributes =  $ajaxResponse->getParameter('attributes');
 $overwrite = $ajaxResponse->getParameter('overwrite');
@@ -37,7 +37,7 @@
 if ($lzwCompressed == 'true') {
 	//$e = new mb_exception('mod_savewmc_server.php: mapObject: '.implode(',',$mapObject));
 	$mapObject = lzw_decompress($mapObject);
-	
+
 	//$e = new mb_exception('mod_savewmc_server.php: mapObject uncompressed: '.$mapObject);
 	//$filename = TMPDIR."/formerly_compressed_json.txt";//will be set to new one cause ?
 } else {
@@ -61,7 +61,7 @@
 }
 
 if ($saveInSession === 1) {
-	// CLEAN SESSION WMC FILES 
+	// CLEAN SESSION WMC FILES
 	//do this by cronjob!
 	//$tmp = scandir(TMPDIR);
 	// get all files from tmp folder
@@ -73,7 +73,7 @@
              	   unlink(TMPDIR."/wmc/".$tmp[$p]);
            	 }
         	}
-    	}*/ 
+    	}*/
     	// store XML in tmp folder
     	if(Mapbender::session()->get("mb_wmc")) {
         	$filename = Mapbender::session()->get("mb_wmc");
@@ -96,14 +96,14 @@
 		Mapbender::session()->set("epsg",$epsg);
 	}
 	Mapbender::session()->set("previous_gui", Mapbender::session()->get("mb_user_gui"));
-	
+
 	$e = new mb_notice("mod_insertWMCIntoDB: save WMC in session succeeded.");
 	$ajaxResponse->setSuccess(true);
 	$ajaxResponse->setResult(_mb("saved wmc document to session"));
 }
 else {
 	// insert WMC into database
-	
+
 	if(isset($attributes->title)) {
 		$attributes->title = trim($attributes->title);
 		if($attributes->title == "") {
@@ -130,7 +130,7 @@
 	foreach ($wmc->keyword as &$val) {
 		$val = trim($val);
 	}
-	
+
 	$wmc->wmc_abstract = $attributes->abstract;
 	$isoTopicCat = $attributes->isoTopicCat;
 	foreach($isoTopicCat as $cat => $val) {



More information about the Mapbender_commits mailing list