[Mapbender-commits] r2741 - in branches/dev_lenkne/http: classes css frames html img/button_silver_blue javascripts php print tools

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Aug 5 11:35:27 EDT 2008


Author: lenkne
Date: 2008-08-05 11:35:27 -0400 (Tue, 05 Aug 2008)
New Revision: 2741

Removed:
   branches/dev_lenkne/http/img/button_silver_blue/Kopie (2) von back_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie (2) von closePolygon_off2.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von back_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von back_off_disabled.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von delete_node_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von forward_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von line_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von measure_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von metadata_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von new_node_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von pan_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von point_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von repaint_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von resizemapsize_off.png
   branches/dev_lenkne/http/img/button_silver_blue/Kopie von rubber_off2.png
   branches/dev_lenkne/http/php/database-mysql.php
   branches/dev_lenkne/http/php/database-pgsql.php
Modified:
   branches/dev_lenkne/http/classes/class_kml.php
   branches/dev_lenkne/http/classes/class_locale.php
   branches/dev_lenkne/http/classes/class_map.php
   branches/dev_lenkne/http/classes/class_wmc.php
   branches/dev_lenkne/http/classes/class_wmcToXml.php
   branches/dev_lenkne/http/classes/class_wms.php
   branches/dev_lenkne/http/css/administration_alloc.css
   branches/dev_lenkne/http/css/popup.css
   branches/dev_lenkne/http/frames/index.php
   branches/dev_lenkne/http/frames/login.php
   branches/dev_lenkne/http/html/mod_treefolder2.php
   branches/dev_lenkne/http/javascripts/geometry.js
   branches/dev_lenkne/http/javascripts/map.js
   branches/dev_lenkne/http/javascripts/map.php
   branches/dev_lenkne/http/javascripts/mod_addWMSfromfilteredList_ajax.php
   branches/dev_lenkne/http/javascripts/mod_box1.js
   branches/dev_lenkne/http/javascripts/mod_digitize_tab.php
   branches/dev_lenkne/http/javascripts/mod_loadwmc.php
   branches/dev_lenkne/http/javascripts/mod_log.php
   branches/dev_lenkne/http/javascripts/mod_savewmc.php
   branches/dev_lenkne/http/javascripts/mod_wfs_SpatialRequest.php
   branches/dev_lenkne/http/javascripts/mod_wfs_gazetteer_client.php
   branches/dev_lenkne/http/javascripts/popup.js
   branches/dev_lenkne/http/javascripts/wfs.js
   branches/dev_lenkne/http/php/mb_validateSession.php
   branches/dev_lenkne/http/php/mod_editGuiWms.php
   branches/dev_lenkne/http/php/mod_editUser.php
   branches/dev_lenkne/http/php/mod_loadCapabilitiesList.php
   branches/dev_lenkne/http/php/mod_map1.php
   branches/dev_lenkne/http/php/mod_mapOV.php
   branches/dev_lenkne/http/php/mod_setLocale.php
   branches/dev_lenkne/http/php/mod_wfs.php
   branches/dev_lenkne/http/php/mod_wfs_conf.php
   branches/dev_lenkne/http/php/mod_wfs_edit.php
   branches/dev_lenkne/http/php/mod_wfs_gazetteer_server.php
   branches/dev_lenkne/http/php/mod_wfs_server.php
   branches/dev_lenkne/http/print/mod_printPDF_pdf.php
   branches/dev_lenkne/http/print/printPDF.conf
   branches/dev_lenkne/http/print/printPDF_b.conf
   branches/dev_lenkne/http/tools/mapbender_setup.php
Log:


Modified: branches/dev_lenkne/http/classes/class_kml.php
===================================================================
--- branches/dev_lenkne/http/classes/class_kml.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/classes/class_kml.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -16,8 +16,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
 
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
 class kml {
 
 		var $kml_id;
@@ -172,4 +173,4 @@
 
 } 
 // end class
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/classes/class_locale.php
===================================================================
--- branches/dev_lenkne/http/classes/class_locale.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/classes/class_locale.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -17,8 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 
 /**
  * sets the locale, depending on various settings:
@@ -101,19 +100,21 @@
 				}
 				
 				$locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];				
-				bindtextdomain(LOCALE_DOMAIN, LOCALE_DIR);
-				textdomain(LOCALE_DOMAIN);
-				if (setlocale(LC_ALL, $locale)) {
-					$this->name = $locale;
+				$selectedLocale = setlocale(LC_MESSAGES, $locale);
+				if ($selectedLocale) {
+					$this->name = $selectedLocale;
 					$_SESSION["mb_lang"] = $languageId;
 					$_SESSION["mb_locale"] = $this->name;
 					$e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
+					// from http://de3.php.net/manual/de/function.gettext.php
+					$path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
+					$enc = bind_textdomain_codeset("Mapbender", "UTF-8");
+					$dom = textdomain("Mapbender");
 					return true;
 				}
-				$e = new Mb_notice("locale " . $locale . " not found.");
-
 			}
 		}
+		$e = new Mb_notice("locale " . $locale . " not found.");
 		return false;
 	}
 	
@@ -134,7 +135,7 @@
 	  else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0)
 	    return 'bsd';  
 	  else {
-	    throw new Mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
+	    $e = new mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
 	    return null;
 	  }
 	}
@@ -212,4 +213,4 @@
 	    }		
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/classes/class_map.php
===================================================================
--- branches/dev_lenkne/http/classes/class_map.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/classes/class_map.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -362,7 +362,7 @@
 	private static function selectByApplication ($appId, $frameName) {
 		// find the mapframe in the application elements...
 		$sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND " . 
-				"e_id = $2 LIMIT 1";
+				"e_id = $2 AND e_public = 1 LIMIT 1";
 		$v = array($appId, $frameName);
 		$t = array('s', 's');
 		$res = db_prep_query($sql,$v,$t);
@@ -390,7 +390,7 @@
 //				$e = new mb_exception("guess this is the OV");
 				$pattern = "/[\.\/a-zA-Z_]*\?wms=([0-9]*)[^0-9]*/";
 				$ovIndex = preg_replace($pattern, "\$1", $row["e_src"]);
-				$e = new mb_exception("OV index: " . $ovIndex);
+//				$e = new mb_exception("OV index: " . $ovIndex);
 				if (!$ovIndex) {
 					$ovIndex = 0;
 				}
@@ -403,8 +403,14 @@
 
 			$currentMap->wmsArray = $wmsArray;
 			
-			// TO DO: EXTENT!
-			
+			// EXTENT
+			$minx = $wmsArray[0]->objLayer[0]->layer_epsg[0]["minx"];
+			$miny = $wmsArray[0]->objLayer[0]->layer_epsg[0]["miny"];
+			$maxx = $wmsArray[0]->objLayer[0]->layer_epsg[0]["maxx"];
+			$maxy = $wmsArray[0]->objLayer[0]->layer_epsg[0]["maxy"];
+			$epsg = $wmsArray[0]->objLayer[0]->layer_epsg[0]["epsg"];
+			$mapExtent = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $epsg);
+			$currentMap->setExtent($mapExtent);
 			return $currentMap;			
 		}
 		else {
@@ -414,4 +420,4 @@
 	
 
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/classes/class_wmc.php
===================================================================
--- branches/dev_lenkne/http/classes/class_wmc.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/classes/class_wmc.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -153,6 +153,8 @@
 		// get the map objects "overview" and "mapframe1"
 		$this->mainMap = map::selectMainMapByApplication($appId);
 		$this->overviewMap = map::selectOverviewMapByApplication($appId);
+		$this->createXml();
+		$this->saveAsFile();
 	}
 
 	/**
@@ -379,7 +381,7 @@
 			array_push($wmcJsArray, "setMapRequest('" . $this->overviewMap->getFrameName() . "');");
 		}
 
-		array_push($wmcJsArray, "eventAfterLoadWMS.trigger()");
+		array_push($wmcJsArray, "eventAfterLoadWMS.trigger();");
 		return $wmcJsArray;
 	}
 	
@@ -420,6 +422,23 @@
 		}
 	}
 
+	/**
+	 * Adds a WMS to this WMC
+	 * 
+	 * @return 
+	 */
+	public function appendWmsArray ($wmsArray) {
+		return $this->mainMap->appendWmsArray($wmsArray);
+	}
+	
+	/**
+	 * Merges a WMS into this WMC
+	 * 
+	 * @return 
+	 */
+	public function mergeWmsArray ($wmsArray) {
+		$this->mainMap->mergeWmsArray($wmsArray);
+	}
 
 // ---------------------------------------------------------------------------
 // private functions
@@ -763,7 +782,19 @@
 							$extension = false;
 						}
 						if ($extension == true){
-							$currentLayer["extension"][$tag] = $value;
+							if ($value !== "") {
+								if (isset($currentLayer["extension"][$tag])) {
+									if (!is_array($currentLayer["extension"][$tag])) {
+										$firstValue = $currentLayer["extension"][$tag];
+										$currentLayer["extension"][$tag] = array();
+										array_push($currentLayer["extension"][$tag], $firstValue);
+									}	
+									array_push($currentLayer["extension"][$tag], $value);
+								}
+								else {
+									$currentLayer["extension"][$tag] = $value;									
+								}
+							}
 						}
 						if ($tag == "EXTENSION" && $type == "open") {
 							$currentLayer["extension"] = array();
@@ -893,7 +924,6 @@
 			$wms->wms_getfeatureinfo = $currentLayer["url"]; // TODO : Add correct data
 			
 			$styleIndex = $currentLayer["styleIndex"];
-			$e = new mb_notice("StyleIndex: " . $styleIndex);
 			$wms->wms_getlegendurl = $currentLayer["style"][$styleIndex]["legendurl"];
 
 			$wms->wms_filter = ""; // TODO : Add correct data
@@ -935,6 +965,38 @@
 			$wms->objLayer[0]->gui_layer_minscale = 0;
 			$wms->objLayer[0]->gui_layer_maxscale = 0;
 
+			// layer epsg
+			if ($currentLayer["extension"]["EPSG"]) {
+				$layerEpsgArray = array();
+				$layerMinXArray = array();
+				$layerMinYArray = array();
+				$layerMaxXArray = array();
+				$layerMaxYArray = array();
+				if (!is_array($currentLayer["extension"]["EPSG"])) {
+					$layerEpsgArray[0] = $currentLayer["extension"]["EPSG"];
+					$layerMinXArray[0] = $currentLayer["extension"]["MINX"];
+					$layerMinYArray[0] = $currentLayer["extension"]["MINY"];
+					$layerMaxXArray[0] = $currentLayer["extension"]["MAXX"];
+					$layerMaxYArray[0] = $currentLayer["extension"]["MAXY"];
+				}
+				else {
+					$layerEpsgArray = $currentLayer["extension"]["EPSG"];
+					$layerMinXArray = $currentLayer["extension"]["MINX"];
+					$layerMinYArray = $currentLayer["extension"]["MINY"];
+					$layerMaxXArray = $currentLayer["extension"]["MAXX"];
+					$layerMaxYArray = $currentLayer["extension"]["MAXY"];
+				}
+	
+				for ($i=0; $i < count($layerEpsgArray); $i++) {
+					$currentLayerEpsg = array();
+					$currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
+					$currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
+					$currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]); 
+					$currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
+					$currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+					array_push($wms->objLayer[0]->layer_epsg, $currentLayerEpsg);
+				}
+			}			
 			// add WMS
 			array_push($wmsArray, $wms);
 
@@ -999,7 +1061,7 @@
  * @deprecated
  */
 function mb_utf8_encode ($str) {
-	if(CHARSET=="UTF-8") return utf8_encode($str);
+//	if(CHARSET=="UTF-8") return utf8_encode($str);
 	return $str;
 }
 
@@ -1007,7 +1069,7 @@
  * @deprecated
  */
 function mb_utf8_decode ($str) {
-	if(CHARSET=="UTF-8") return utf8_decode($str);
+//	if(CHARSET=="UTF-8") return utf8_decode($str);
 	return $str;
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/classes/class_wmcToXml.php
===================================================================
--- branches/dev_lenkne/http/classes/class_wmcToXml.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/classes/class_wmcToXml.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -108,17 +108,22 @@
 	}
 
 	private function createGeneralNode () {
+		$extensionData = array();
 		if ($this->wmc->overviewMap !== null) {
 			$ovExtent = $this->wmc->overviewMap->getExtent();
-			$extensionData->ov_minx = $ovExtent->min->x;
-			$extensionData->ov_miny = $ovExtent->min->y;
-			$extensionData->ov_maxx = $ovExtent->max->x;
-			$extensionData->ov_maxy = $ovExtent->max->y;
-			$extensionData->ov_srs = $ovExtent->epsg;
-			$extensionData->ov_framename = $this->wmc->overviewMap->getFrameName();
-			$extensionData->ov_width = $this->wmc->overviewMap->getWidth();
-			$extensionData->ov_height = $this->wmc->overviewMap->getHeight();
+			$extensionData["ov_minx"] = $ovExtent->min->x;
+			$extensionData["ov_miny"] = $ovExtent->min->y;
+			$extensionData["ov_maxx"] = $ovExtent->max->x;
+			$extensionData["ov_maxy"] = $ovExtent->max->y;
+			$extensionData["ov_srs"] = $ovExtent->epsg;
+			$extensionData["ov_framename"] = $this->wmc->overviewMap->getFrameName();
+			$extensionData["ov_width"] = $this->wmc->overviewMap->getWidth();
+			$extensionData["ov_height"] = $this->wmc->overviewMap->getHeight();
 		}
+		
+		if ($this->wmc->mainMap !== null) {
+			$extensionData["main_framename"] = $this->wmc->mainMap->getFrameName();
+		}
 				
 		// General
 		$e_general = $this->doc->createElement("General");
@@ -364,6 +369,8 @@
 		$layerExtensionData["gui_selectable"] = $currentLayer->gui_layer_selectable;
 		$layerExtensionData["gui_queryable"] = $currentLayer->gui_layer_queryable;
 		$layerExtensionData["gui_status"] = $currentLayer->gui_layer_status;
+		$layerExtensionData["layer_epsg"] = $currentLayer->layer_epsg;
+		
 		if ($currentMap->isOverview()) {
 			$layerExtensionData["isOverviewLayer"] = 1;
 		}
@@ -375,7 +382,7 @@
 			$e_extension = $this->doc->createElement("Extension");
 			
 			foreach ($layerExtensionData as $keyExtensionData => $valueExtensionData) {
-				$e_currentExtensionTag = $this->doc->createElement($this->wmc->extensionNamespace.":".$keyExtensionData, $valueExtensionData);
+				$e_currentExtensionTag = $this->addExtension($keyExtensionData, $valueExtensionData);
 				$e_extension->appendChild($e_currentExtensionTag);
 			}
 			return $e_extension;
@@ -383,6 +390,23 @@
 		return null;
 	}
 	
+	private function addExtension ($key, $value) {
+		if (is_array($value)) {
+			if (is_numeric($key)) {
+				$key = "data" . $key;
+			}
+			$e_currentExtensionTag = $this->doc->createElement($this->wmc->extensionNamespace.":".$key);
+			foreach ($value as $childKey => $childValue) {
+				$newNode = $this->addExtension($childKey, $childValue);
+				$e_currentExtensionTag->appendChild($newNode);
+			}
+		}
+		else {
+			$e_currentExtensionTag = $this->doc->createElement($this->wmc->extensionNamespace.":".$key, $value);
+		}
+		return $e_currentExtensionTag;
+	}
+	
 	private function createLayerStyleNode ($currentWms, $currentLayer) {
 		$e_layer_stylelist = $this->doc->createElement("StyleList");
 		
@@ -533,4 +557,4 @@
 	}
 
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/classes/class_wms.php
===================================================================
--- branches/dev_lenkne/http/classes/class_wms.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/classes/class_wms.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -625,13 +625,13 @@
 		if(!$this->wms_title || $this->wms_title == "" || !$this->wms_getmap || $this->wms_getmap == ""){
 			$this->wms_status = false;
 			$this->optimizeWMS();
-			
+			$e = new mb_exception("class_wms: createObjFromXML: WMS " . $url . " could not be loaded.");
 			return false;
 		}
 		else{
 			$this->wms_status = true;
 			$this->optimizeWMS();
-
+			$e = new mb_notice("class_wms: createObjFromXML: WMS " . $url . " has been loaded successfully.");
 			return true;
 		}
 	}
@@ -857,19 +857,40 @@
 		}
 		$newLayer->layer_abstract = $currentLayer["abstract"];
 
-
 		//
 		// set layer epsg
 		//
 		$newLayer->layer_epsg = array();
-		if ($currentExtent !== null) {
-			$currentLayerEpsg = array();
-			$currentLayerEpsg["epsg"] = $currentExtent->epsg;
-			$currentLayerEpsg["minx"] = $currentExtent->min->x;
-			$currentLayerEpsg["miny"] = $currentExtent->min->y; 
-			$currentLayerEpsg["maxx"] = $currentExtent->max->x;
-			$currentLayerEpsg["maxy"] = $currentExtent->max->y;
-			array_push($newLayer->layer_epsg, $currentLayerEpsg);
+		if ($currentLayer["extension"]["EPSG"]) {
+			$layerEpsgArray = array();
+			$layerMinXArray = array();
+			$layerMinYArray = array();
+			$layerMaxXArray = array();
+			$layerMaxYArray = array();
+			if (!is_array($currentLayer["extension"]["EPSG"])) {
+				$layerEpsgArray[0] = $currentLayer["extension"]["EPSG"];
+				$layerMinXArray[0] = $currentLayer["extension"]["MINX"];
+				$layerMinYArray[0] = $currentLayer["extension"]["MINY"];
+				$layerMaxXArray[0] = $currentLayer["extension"]["MAXX"];
+				$layerMaxYArray[0] = $currentLayer["extension"]["MAXY"];
+			}
+			else {
+				$layerEpsgArray = $currentLayer["extension"]["EPSG"];
+				$layerMinXArray = $currentLayer["extension"]["MINX"];
+				$layerMinYArray = $currentLayer["extension"]["MINY"];
+				$layerMaxXArray = $currentLayer["extension"]["MAXX"];
+				$layerMaxYArray = $currentLayer["extension"]["MAXY"];
+			}
+
+			for ($i=0; $i < count($layerEpsgArray); $i++) {
+				$currentLayerEpsg = array();
+				$currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
+				$currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
+				$currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]); 
+				$currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
+				$currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+				array_push($newLayer->layer_epsg, $currentLayerEpsg);
+			}
 		}
 
 
@@ -2023,4 +2044,4 @@
 	}
 	
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/css/administration_alloc.css
===================================================================
--- branches/dev_lenkne/http/css/administration_alloc.css	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/css/administration_alloc.css	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,16 +1,28 @@
 body{
 	background-color : #ffffff;
-	font-family: Arial, Helvetica, sans-serif;
+	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
 }
 select {
 	font-size: 11;
-	font-family: "Times New Roman", Times, serif;
+	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
 	width: 200px;
 	font-weight : bold;
 }
 .select_short{
 	width: auto;
 }
+table{
+	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size:11;
+}   
+
+.wms_button{
+	color: black;
+	border: solid thin;
+	height:22px;
+	width:60px;
+}
+
 checkbox{
 	background-color : #0066ff; 
 }
@@ -93,4 +105,4 @@
 	left: auto;
 	color : Red;
 	font-size : 13;
-}
\ No newline at end of file
+}

Modified: branches/dev_lenkne/http/css/popup.css
===================================================================
--- branches/dev_lenkne/http/css/popup.css	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/css/popup.css	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,33 +1,49 @@
 @CHARSET "UTF-8";
 /*fixes*/
 div.jqmNotice iframe {width:100%;height:100%;}
-div.jqmNotice div.scrollDiv {overflow:auto;position:relative;top:0px;left:0px;right:0px;bottom:0px;width:100%;height:100%;}
+div.jqmNotice div.scrollDiv {position:relative;top:0px;left:0px;right:0px;bottom:0px;width:100%;height:100%;}
 
+div.scrollDiv {
+ overflow: auto;
+}
+
+/* exploder V6 only */
+* html div.scrollDiv {
+ overflow-y: scroll;
+}
+
+/* exploder V7 only */
+*+html div.scrollDiv {
+ overflow-y: scroll;
+}
+
 div.jqmNotice {
     display: none;
     overflow:hidden;
     position: absolute;
     
 /*styles that can change*/
-    background:#EEEEEE url(../img/info_on.gif) 5px 5px no-repeat;
+    background:#EEEEEE url(../img/info_on.gif) 8px 8px no-repeat;
     border: 1px solid #000;
-    padding: 0;
-    padding-bottom:30px;
+    -moz-border-radius:10px;
+    padding: 0px;
+/*    padding-bottom:30px;
+*/
 }
 
 div.jqmNotice .jqResize {
 	position: absolute; 
-	right: 2px; 
-	bottom: 2px;
+	right: 5px; 
+	bottom: 5px;
 	width:16px;
 	height:16px;
 	background:url(../img/resize.gif);
 }
 
-.jqmnTitle{margin: 0 25px;}
+.jqmnTitle{margin: 0 30px;}
   
 .jqmnTitle h1{
-  margin: 5px 0;
+  margin: 9px 0;
   padding-left:5px;
   width: 100%;
   font-size:12px;
@@ -38,12 +54,37 @@
 div.jqmNotice .jqmClose {
   position: absolute;
   cursor: pointer;
-  right: 4px;
-  top: 6px;
+  right: 8px;
+  top: 10px;
 }
 
 .jqmnContent{
   border-top:1px;
   color:#000;
-  padding:0 20px 5px;
-}
\ No newline at end of file
+  margin:0px 20px 25px;
+}
+.balloonTL{
+	position:absolute;
+	background-image:url("../img/balloon_ul.png");
+	width:100px;
+	height:80px;
+}
+.balloonTR{
+	position:absolute;
+	background-image:url("../img/balloon_ur.png");
+	width:100px;
+	height:80px;
+}
+.balloonBR{
+	position:absolute;
+	background-image:url("../img/balloon_lr.png");
+	width:100px;
+	height:80px;
+}
+.balloonBL{
+	position:absolute;
+	background-image:url("../img/balloon_ll.png");
+	width:100px;
+	height:80px;
+}
+

Modified: branches/dev_lenkne/http/frames/index.php
===================================================================
--- branches/dev_lenkne/http/frames/index.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/frames/index.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -32,6 +32,7 @@
 //
 if (!in_array($gui_id, $_SESSION["mb_user_guis"])) {
 	$e = new mb_exception("mb_validateSession.php: User: " . $_SESSION["mb_user_id"] . " not allowed to access GUI " . $gui_id);
+	session_write_close();
 	header("Location: ".LOGIN);
 	die();
 }
@@ -79,6 +80,8 @@
 <?php
 $currentApplication = new gui($gui_id);
 echo $currentApplication->toHtml();
-echo "<script type='text/javascript' src='../javascripts/map.php?".$urlParameters."&mb_myBBOX=".$_REQUEST["mb_myBBOX"]."'></script>";
+$mapPhpParameters = $urlParameters."&mb_myBBOX=".$_REQUEST["mb_myBBOX"];
+echo "<script type='text/javascript' src='../javascripts/map.php?".$mapPhpParameters."'></script>";
+
 ?>
-</html>
\ No newline at end of file
+</html>

Modified: branches/dev_lenkne/http/frames/login.php
===================================================================
--- branches/dev_lenkne/http/frames/login.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/frames/login.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -173,6 +173,7 @@
 				if(isset($_REQUEST["mb_myBBOX"])){
 					$myURL .= "&mb_myBBOX=".$_REQUEST["mb_myBBOX"];
 				}
+				session_write_close();
 				header ($myURL);
 				exit;
 			}

Modified: branches/dev_lenkne/http/html/mod_treefolder2.php
===================================================================
--- branches/dev_lenkne/http/html/mod_treefolder2.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/html/mod_treefolder2.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -2,7 +2,7 @@
 # $Id$
 # http://www.mapbender.org/index.php/Mod_treefolder2.php
 # Copyright (C) 2007 Melchior Moos
-# 
+#
 # 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
 # the Free Software Foundation; either version 2, or (at your option)
@@ -24,7 +24,7 @@
 <HTML>
 <HEAD>
 <?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
 ?>
 <TITLE>Treefolder</TITLE>
 <?php
@@ -44,12 +44,23 @@
    $v = array($_REQUEST['e_id_css'],$_SESSION["mb_user_gui"]);
    $t = array('s','s');
    $res = db_prep_query($sql,$v,$t);
-   $e_target = db_result($res,0,"e_target");   
-   echo "mod_treeGDE_map = '".$e_target."';";   
+   $e_target = db_result($res,0,"e_target");
+   echo "mod_treeGDE_map = '".$e_target."';";
 echo "</script>";
+session_write_close();
 ?>
 <SCRIPT language="JavaScript" type="text/javascript">
 
+var msgObj = {};
+msgObj.tooltipHandleWms = '<?php echo _mb("(De)activate this service");?>';
+msgObj.tooltipLayerVisible = '<?php echo _mb("Toggles the visibility of this service");?>';
+msgObj.tooltipLayerQuerylayer = '<?php echo _mb("Toggles the queryability of this service");?>';
+msgObj.tooltipLayerContextMenu = '<?php echo _mb("Opens the layer context menu");?>';
+msgObj.tooltipWmsContextMenu = '<?php echo _mb("Opens the WMS context menu");?>';
+msgObj.tooltipRemoveWms = '<?php echo _mb("Removes the selected WMS");?>';
+msgObj.tooltipMoveSelectionUp = '<?php echo _mb("Moves the selection up");?>';
+msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
+
 var jst_container = "document.getElementById('treeContainer')";
 var jst_image_folder = imagedir;
 var jst_display_root = false;
@@ -64,7 +75,7 @@
 var errors = 0;
 var state=Array();
 var treeState = "";
-var arrNodes = 
+var arrNodes =
 [
 	['root_id', ['Layer','javascript:_foo()']
 
@@ -117,13 +128,13 @@
 //var menu_layer_switch = ['menu_zoom', ['Zjjj&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
 //var menu_info_switch = ['menu_zoom', ['Zmn&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
 
-parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].reloadTree();");
-parent.mb_registerInitFunctions("window.frames['treeGDE'].loadTree();");
+parent.eventAfterLoadWMS.register(reloadTree);
+parent.eventInit.register(loadTree);
 if(showstatus=='true'||alerterror=='true'){
-	parent.mb_registerSubFunctions("window.frames['treeGDE'].init_mapcheck();");
+	parent.eventAfterMapRequest.register(init_mapcheck);
 	init_mapcheck();
 }
-parent.mb_registerSubFunctions("window.frames['treeGDE'].updateScale();");
+parent.eventAfterMapRequest.register(updateScale);
 if(wmsbuttons != "true")
 	jst_highlight = false;
 
@@ -133,11 +144,11 @@
 	if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
 		selectedMap=i;
 		selectedWMS=ii;
-		selectedLayer=iii;		
+		selectedLayer=iii;
 		return;
 	}
 	//scalehints
-	var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));	
+	var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
 	if(scale < parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
 		if(selectedLayer==0)
 		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
@@ -166,10 +177,10 @@
 	if(!init)return;
 	for(var i=0; i<parent.mb_mapObj.length; i++){
 		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
-		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
 			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
 				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
-					if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){                    
+					if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){
 						if(iii==0)
 						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
 						else
@@ -196,12 +207,12 @@
 function operaLoad(){
 	initArray();
 	renderTree();
-	setTimeout('initWmsCheckboxen();updateScale();',100);	
+	setTimeout('initWmsCheckboxen();updateScale();',100);
 }
 
 function loadTree(){
 	if(window.opera){
-		setTimeout('operaLoad()',200);	
+		setTimeout('operaLoad()',200);
 		return;
 	}
 	initArray();
@@ -222,7 +233,7 @@
 		init_mapcheck();
 	renderTree();
 	if(window.opera)
-		setTimeout('initWmsCheckboxen();updateScale();',100);	
+		setTimeout('initWmsCheckboxen();updateScale();',100);
 	else{
 		initWmsCheckboxen();
 		updateScale();
@@ -235,7 +246,7 @@
 	this.onerror=null;
 	this.onabort=null;
 	if(state[wms]!=-1 && alerterror=='true'){
-		state[wms]=-1;	
+		state[wms]=-1;
 		if(confirm('Failed to Load WMS "'+parent.mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+parent.mb_mapObj[map].wms[wms].wms_getmap.substr(0,parent.mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
 			window.open(this.src,"");
 		}
@@ -265,13 +276,12 @@
 			state[wms]=0;
 			parent.frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
 			parent.frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
-	
 			if(showstatus=='true')
 				setNodeImage(img, "loading_folder.gif");
 		}
 
 		if(state[wms]!=-1)
-			setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);		
+			setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);
 	}
 }
 
@@ -349,7 +359,7 @@
 		l=selectedLayer;
 	}
 	if(j==-1||k==-1||l==-1){
-		alert("You have to select the WMS you want to move up!")		
+		alert("You have to select the WMS you want to move up!")
 		return;
 	}
 	var lid=parent.mb_mapObj[j].wms[k].objLayer[l].layer_id;
@@ -381,7 +391,7 @@
 		l=selectedLayer;
 	}
 	if(j==-1||k==-1||l==-1){
-		alert("You have to select the WMS you want to move down!")		
+		alert("You have to select the WMS you want to move down!")
 		return;
 	}
 	var lid=parent.mb_mapObj[j].wms[k].objLayer[l].layer_id;
@@ -391,7 +401,7 @@
 	}
 	treeState = getState();
 	parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
-	parent.mb_execloadWmsSubFunctions();	
+	parent.mb_execloadWmsSubFunctions();
 	//find layer and select
 	for(k=0;k<parent.mb_mapObj[j].wms.length;k++){
 		for(l=0;l<parent.mb_mapObj[j].wms[k].objLayer.length;l++){
@@ -413,7 +423,7 @@
 		l=selectedLayer;
 	}
 	if(j==-1||k==-1||l==-1){
-		alert("You have to select the WMS you want to delete!")		
+		alert("You have to select the WMS you want to delete!")
 		return;
 	}
 	if(l!=0){
@@ -429,15 +439,15 @@
 		return;
 	}
 	if(confirm('Are you sure you want to remove "'+parent.mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
-  		parent.mb_mapObjremoveWMS(j,k); 
+  		parent.mb_mapObjremoveWMS(j,k);
 		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
-		parent.mb_execloadWmsSubFunctions();	
+		parent.mb_execloadWmsSubFunctions();
 	}
 }
 
 function updateParent(path){
 	if(lock_check)return;
-	var reset_lock=!lock_update; 
+	var reset_lock=!lock_update;
 	lock_update=true;
 	var state=getChildrenCheckState(path, 0);
 	//enableCheckbox(path, (state!=-1)); //3rd state
@@ -452,10 +462,10 @@
 function handleSelectedWMS(path){
 	if(lock_update)return;
 	var t = path.split("|");
-	var reset_lock=!lock_check; 
+	var reset_lock=!lock_check;
 	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
 	var layername = parent.mb_mapObj[ind].wms[parent.getWMSIndexById(mod_treeGDE_map,t[t.length-1])].objLayer[0].layer_name;
-	var bChk = IsChecked(path, 0);	
+	var bChk = IsChecked(path, 0);
 	handleSelectedLayer(mod_treeGDE_map,t[t.length-1],layername,"visible",bChk?"1":"0");
 	lock_check=true;
 	checkChildren(path, 0, bChk);
@@ -470,17 +480,18 @@
 	}
 }
 
-function handleSelection(path){
+function handleSelection(path, box){
 	if(lock_update)return;
-	var reset_lock=!lock_check; 
+	var reset_lock=!lock_check;
 	lock_check=true;
-	var bChk = IsChecked(path, 0);	
+	var bChk = IsChecked(path, box);	
 //	enableCheckbox(path, 0, true);
-	checkChildren(path, 0, bChk);
+	checkChildren(path, box, bChk);
 	if(reset_lock){
 		var t = path.split("|");
 		lock_check=false;
 		parent.mb_restateLayers(mod_treeGDE_map,t[1]);
+		if(box==0)
 		parent.setSingleMapRequest(mod_treeGDE_map,t[1]);
 	}
 }
@@ -490,14 +501,14 @@
 	var controls="";
 	if(parent.mb_mapObj.length > 0){
 		for(var i=0; i<parent.mb_mapObj.length; i++){
-			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
 				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
 					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
-						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){          
-							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];     
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){ 
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
 								if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
-									continue;				
+									continue;
 								var c_menu="[";
 								if(reverse=="true"){
 									if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
@@ -514,10 +525,10 @@
 								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
 								c_menu+="]";
 								controls=null;
-								if(switchwms=='true')controls='<INPUT type="checkbox" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
+								if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
 								if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
 								addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
-								parentObj = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;              
+								parentObj = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;
 							}
 							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"||parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
 								var parentLayer = "";
@@ -528,8 +539,8 @@
 										if(parent.mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt(parent.mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
 											j=jj;
 											break;
-										}										
-									}									
+										}
+									}
 									parentLayer = "|" + parent.mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
 								}
 								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
@@ -549,8 +560,8 @@
 									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
 									c_menu+="]";
 									
-									controls='<input type="checkbox" '+(temp.layer_name==""?'style="display:none;" ':"")+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"');updateParent('"+parentObj+parentLayer+"');"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)":"")+"\" />";
-									if(ficheckbox == 'true')controls+='<input type="checkbox" '+(temp.gui_layer_querylayer=='1'?'checked ':'')+(temp.gui_layer_queryable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);checkChildren('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1, this.checked?1:0)\" />";
+									controls='<input type="checkbox"  title="' + msgObj.tooltipLayerVisible + '"'+(temp.layer_name==""?'style="display:none;" ':"")+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"');updateParent('"+parentObj+parentLayer+"');"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)":"")+"\" />";
+									if(ficheckbox == 'true')controls+='<input type="checkbox" title="' + msgObj.tooltipLayerQuerylayer + '" '+(temp.gui_layer_querylayer=='1'?'checked ':'')+(temp.gui_layer_queryable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);checkChildren('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1, this.checked?1:0)\" />";
 									if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
 									addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
 								}
@@ -561,20 +572,20 @@
 			}
 		}
 	}
-	init=true;   
+	init=true;
 }
 
 function initWmsCheckboxen(){
 	var hidden=0;
 	if(parent.mb_mapObj.length > 0){
 		for(var i=0; i<parent.mb_mapObj.length; i++){
-			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
 				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
 					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
-						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){          
-							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];     
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){                    
-								updateParent(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id);                  
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
+								updateParent(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id);
 							}
 						}
 					}
@@ -598,9 +609,9 @@
 <SCRIPT language="JavaScript" type="text/javascript">
 if(wmsbuttons=='true'){
 	document.writeln("<div>"); 
-	document.writeln('<a href="javascript:move_up()"><img src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>'); 
-	document.writeln('<a href="javascript:move_down()"><img src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>'); 
-	document.writeln('<a href="javascript:remove_wms()"><img src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>'); 
+	document.writeln('<a href="javascript:move_up()"><img title="'+msgObj.tooltipMoveSelectionUp+'" src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>'); 
+	document.writeln('<a href="javascript:move_down()"><img title="'+msgObj.tooltipMoveSelectionDown+'" src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>'); 
+	document.writeln('<a href="javascript:remove_wms()"><img title="'+msgObj.tooltipRemoveWms+'" src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>'); 
 	document.writeln("</div>"); 
 }
 </SCRIPT>

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie (2) von back_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie (2) von closePolygon_off2.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von back_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von back_off_disabled.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von delete_node_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von forward_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von line_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von measure_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von metadata_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von new_node_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von pan_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von point_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von repaint_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von resizemapsize_off.png
===================================================================
(Binary files differ)

Deleted: branches/dev_lenkne/http/img/button_silver_blue/Kopie von rubber_off2.png
===================================================================
(Binary files differ)

Modified: branches/dev_lenkne/http/javascripts/geometry.js
===================================================================
--- branches/dev_lenkne/http/javascripts/geometry.js	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/geometry.js	2008-08-05 15:35:27 UTC (rev 2741)
@@ -348,8 +348,8 @@
 																		// MULTILINESTRING
 																		//
 																		this.addMember(geomType.line);
-																		this.get(-1).addGeometry();
 																		for (var m = 0; m < coordinates.length; m++) {
+																			this.get(-1).addGeometry();
 																			var currentLine = coordinates[m];
 																			for (var n = 0; n < currentLine.length; n++) {
 																				var currentPoint = currentLine[n];
@@ -372,8 +372,8 @@
 																				var currentPoint = currentPolygon[n];
 																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
 																			}
+																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		}
-																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		this.close();
 																		break;
 																		
@@ -389,8 +389,8 @@
 																				var currentPoint = currentPolygon[n];
 																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
 																			}
+																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		}
-																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		this.close();
 																		break;
 							
@@ -1057,6 +1057,19 @@
 	};
 
 	/**
+	 * removes an element with a given name. If an element with this name exists, it is removed.
+	 *
+	 * @param {String} aName the name of the element to delete
+	 */
+	this.delElement = function(aName){
+		var i = this.getElementIndexByName(aName);
+		if (i !== false) {
+			name.splice(i, 1);
+			value.splice(i, 1);
+		}
+	}
+	
+	/**
 	 * checks if an index is valid
 	 *
 	 * @private
@@ -1262,17 +1275,27 @@
 	 * @param {Float} y y coordinate within the map frame
 	 */
 	var displayIcon = function (url, x, y) {
-		var newImg = document.createElement("img");
-		newImg.src = url;
-		newImg.className = "mapsymbol";
-		newImg.style.cursor = "help";
-		newImg.style.position = "absolute";
-
-		// center the image at x, y
-		newImg.style.top = y - Math.round(newImg.height/2);
-		newImg.style.left = x - Math.round(newImg.width/2);
-		newImg.style.zIndex = 100;
-		that.canvasDivTag.getTag().appendChild(newImg);
+		if(ie){
+			var newImg = document.createElement("img");
+			var newImgTop = y - Math.round(80/2);
+			var newImgLeft = x - Math.round(80/2);
+			that.canvasDivTag.getTag().innerHTML = "<img src='" + url + "' style='position:absolute;top:"+newImgTop+";left:"+newImgLeft+";z-index:100'/>";
+		}
+		else{
+			var newImg = document.createElement("img");
+			newImg.src = url;
+			that.canvasDivTag.getTag().appendChild(newImg);	
+			//newImg.className = "mapsymbol";
+			//newImg.style.cursor = "help";
+			newImg.style.position = "absolute";
+			
+			// center the image at x, y
+			newImg.style.top = y - Math.round(80/2);
+			newImg.style.left = x - Math.round(80/2);
+	//		newImg.style.top = y - Math.round(80);
+	//		newImg.style.left = x;
+			newImg.style.zIndex = 100;
+		}
 	};
 	
 	/**
@@ -1486,7 +1509,7 @@
 		mG = new MultiGeometry(geomType.point);
 		mG.addGeometry();
 		mG.get(-1).addPoint(center);
-		highlight.add(mG);
+		highlight.add(mG,snappingColor);
 		highlight.paint();
 	};
 	this.getTolerance = function() {
@@ -1549,6 +1572,11 @@
 	/**
 	 * @private
 	 */
+	var snappingColor = aColor;
+	
+	/**
+	 * @private
+	 */
 	var lineWidth = 2;
 
 	/**

Modified: branches/dev_lenkne/http/javascripts/map.js
===================================================================
--- branches/dev_lenkne/http/javascripts/map.js	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/map.js	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,690 +1,754 @@
-/**
- * used in mod_box1, mod_dragMapSize, mod_pan
- */
-var mb_start_x = 0;
-var mb_start_y = 0;
-var mb_end_x = 0;
-var mb_end_y = 0;
-
-/**
- * @deprecated
- */
-function mb_execloadWmsSubFunctions(){
-	eventAfterLoadWMS.trigger();
-}
-
-function mb_execWfsReadSubFunctions(geom) { 	 
-	for(var i=0; i<mb_WfsReadSubFunctions.length; i++){ 	 
-		mb_WfsReadSubFunctions[i](geom); 	 
-	} 	 
-}
-
-function mb_execWfsWriteSubFunctions() { 	 
-	for(var i=0; i<mb_WfsWriteSubFunctions.length; i++){
-		mb_WfsWriteSubFunctions[i](); 	 
-	} 	 
-}
-
-function mb_setWmcExtensionData(anArray) {
-	for (var i in anArray) {
-		if (typeof(anArray[i]) != "undefined") {
-			currentWmcExtensionData[i] = anArray[i];
-		}
-	}
-}
-
-function mb_getWmcExtensionData(arrayKey) {
-	for (var i in restoredWmcExtensionData) {
-		if (arrayKey == i) {
-			return restoredWmcExtensionData[i];
-		}
-	}
-	var e = new Mb_warning("mb_getWmcExtensionData: "+arrayKey+" not found. Maybe this GUI does not allow loading or saving WMC documents from/to the session");
-	return null;
-}
-
-
-eventAfterInit.register(function () {
-	// performs a map request for each map frame
-	for (var i = 0; i < mb_mapObj.length; i++){
-		setMapRequest(mb_mapObj[i].frameName);
-	}      	
-});
-
-function mb_registerMapObj(frameName, elementName,wms_index,width, height){
-	mb_mapObj.push(new mb_mapObj_const(frameName, elementName, width, height, wms_index));    
-}
-
-
-function mb_mapObjremoveWMS(objind,wmsind){
-	var wms_ID = null;
-	var i;
-	var new_wmsarray = [];
-	var new_layerarray = [];
-	var new_querylayerarray = [];
-	var new_stylesarray = [];
-	var new_mapURLarray = [];
-	
-	for	(i=0;i<mb_mapObj[objind].wms.length; i++){
-		if(i != wmsind){
-			new_wmsarray[new_wmsarray.length] = mb_mapObj[objind].wms[i];
-			new_layerarray[new_layerarray.length] = mb_mapObj[objind].layers[i];
-			new_querylayerarray[new_querylayerarray.length] = mb_mapObj[objind].querylayers[i];
-			new_stylesarray[new_stylesarray.length] = mb_mapObj[objind].styles[i];
-			new_mapURLarray[new_mapURLarray.length] = mb_mapObj[objind].mapURL[i];
-		}
-		else {
-			wms_ID = mb_mapObj[objind].wms[i].wms_id;
-		}
-	}
-	mb_mapObj[objind].wms = new_wmsarray; 
-	mb_mapObj[objind].layers = new_layerarray; 
-	mb_mapObj[objind].querylayers = new_querylayerarray; 
-	mb_mapObj[objind].styles = new_stylesarray; 
-	mb_mapObj[objind].mapURL = new_mapURLarray;
-
-	var another_new_wmsarray = [];
-	for	(i=0;i<wms.length; i++){
-		if(wms[i].wms_id != wms_ID){
-			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
-		}
-	}
-	wms = another_new_wmsarray; 
-}
-function setExtent(width,height,epsg){
-   for(var i=0; i < wms[0].gui_epsg.length; i++){
-      if(wms[0].gui_epsg[i] == epsg){      
-         var bbox_minx = parseFloat(wms[0].gui_minx[i]);
-         var bbox_miny = parseFloat(wms[0].gui_miny[i]);
-         var bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
-         var bbox_maxy = parseFloat(wms[0].gui_maxy[i]);     
-   
-         var extenty = bbox_maxy - bbox_miny;
-         var extentx = bbox_maxx - bbox_minx;
-
-         var relation_px_x = width / height;
-         var relation_px_y = height / width;
-         var relation_bbox_x = extentx / extenty;         
-         var centerx = bbox_minx + (extentx/2);
-         var centery = bbox_miny + (extenty/2);
-         if(relation_bbox_x <= relation_px_x){                
-                bbox_minx = centerx - relation_px_x * extenty / 2;
-                bbox_maxx = centerx + relation_px_x * extenty / 2;
-         }
-        
-         if(relation_bbox_x > relation_px_x){                
-                bbox_miny = centery - relation_px_y * extentx / 2;
-                bbox_maxy = centery + relation_px_y * extentx / 2;
-         }
-        return bbox_minx  +","+ bbox_miny +","+ bbox_maxx  +","+ bbox_maxy;
-     }
-   }
-}
-function setMapRequest(frameName){
-	var functionName = 'setMapRequest';
-
-	var ret = eventBeforeMapRequest.trigger({frameName:frameName}, "AND");
-	if (ret === false) {
-		return true;
-	}
-
-	var ts = mb_timestamp();
-	var myMapIds = [];
-	for (var i=0; i < mb_mapObj.length; i++){
-		var currentMapObject = mb_mapObj[i];
-		if (currentMapObject.frameName != frameName) {
-			continue;
-		}
-		
-		var newMapRequest = "";
-		for (var ii = 0; ii < currentMapObject.wms.length; ii++){
-			var currentWms = currentMapObject.wms[ii];
-			if (!(currentWms.gui_wms_visible > 0)) {
-				continue;
-			}
-			myMapIds.push("map_"+ii);
-			
-			newMapRequest += getLayerHtmlCode(frameName, i, ii);
-			
-		}
-		writeTag(mb_mapObj[i].frameName, mb_mapObj[i].elementName, newMapRequest);
-	}
-	eventAfterMapRequest.trigger({
-		"frameName": frameName,
-		"myMapIds": myMapIds.join(",")
-	});
-/*
-	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
-		eval(mb_MapRequestSubFunctions[i]);
-	}
-*/
-}
-
-function getLayerHtmlCode (frameName, i, ii) {
-	var currentMapObject = mb_mapObj[i];
-	var currentWms = currentMapObject.wms[ii];
-
-	var myDivId = "div_" + ii;          
-	var myMapId = "map_" + ii;
-	//disable Layer which are out of scale
-	var validLayers = mb_checkScale(frameName, i, ii);
-	var layerNames = validLayers.toString();
-
-	var newMapURL = false;
-	var opacityString = "";
-	if (currentMapObject.layers[ii] !== "" && layerNames !== ''){
-		// get map URL
-		newMapURL = currentMapObject.getMapUrl(i, ii);
-
-		var currentOpacity = currentWms.gui_wms_mapopacity;
-		if (currentOpacity != 1) {
-			opacityString += "opacity:" + currentOpacity + "; ";
-			opacityString += "Filter: Alpha(Opacity=" + currentOpacity*100 + "); ";
-			opacityString += "-moz-opacity:" + currentOpacity + " ; ";
-			opacityString += "-khtml-opacity:" + currentOpacity;
-		}
-	}
-
-	var imageString = "<img id='"+myMapId+"' name='mapimage' ";
-	imageString += "src='" + newMapURL + "' ";
-	imageString += "width='"+currentMapObject.width+"' ";
-	imageString += "height='"+currentMapObject.height+"' ";
-	imageString += "border='0'>";
-
-	var newMapRequest = "<div id='"+myDivId+"' ";
-	newMapRequest += "style=\"position:absolute; top:0px; left:0px; ";
-	newMapRequest += "z-index:" + ii + ";" + opacityString + "\">";
-	newMapRequest += imageString;
-	newMapRequest += "</div>";   
-
-	currentMapObject.mapURL[ii]= newMapURL;	
-	currentWms.mapURL = newMapURL;
-
-	if (mb_log && currentWms.mapURL) {
-		var tmp = eval(mb_log + "('" +newMapURL + "','" + ts + "')");
-	}
-
-	return newMapRequest;
-}
-
-function setSingleMapRequest(frameName,wms_id){
-	var functionName = 'setSingleMapRequest';
-	
-	eventBeforeMapRequest.trigger({frameName:frameName});
-
-	var ts = mb_timestamp();	
-
-	for(i = 0; i < mb_mapObj.length; i++){
-		var currentMapObject = mb_mapObj[i];
-		if (currentMapObject.frameName != frameName) {
-			continue;
-		}
-		
-		for (var ii=0; ii < currentMapObject.wms.length; ii++){ 
-			var currentWms = currentMapObject.wms[ii];
-			if (currentWms.wms_id != wms_id) {
-				continue;
-			}
-
-			var newMapRequest = getLayerHtmlCode(frameName, i, ii);
-
-			if (mb_log) {
-				var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
-			}
-			var myDivId = "div_" + ii;          
-			writeTag(currentMapObject.frameName, myDivId, newMapRequest);
-			var myMapId = "map_" + ii;
-			eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
-			return true;
-		}      
-	}  
-	return false; 
-}
-
-
-function mb_restateLayers(frameName,wms_id){
-	//alert(frameName + " / " + wms_id);
-	var ind = getMapObjIndexByName(frameName);	
-	for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-		if(mb_mapObj[ind].wms[i].wms_id == wms_id){
-			var cnt_layers = 0;
-			var cnt_querylayers = 0;
-			var layers = "";
-			var styles = "";
-			var querylayers = "";
-			for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
-				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
-					if(cnt_layers > 0){layers += ","; styles += ","; }
-					layers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name;
-					//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name); 
-					styles += ""; 
-					cnt_layers++;
-				}            
-				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
-					if(cnt_querylayers > 0){querylayers += ",";}
-					querylayers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name; 
-					cnt_querylayers++;
-				}
-			}
-			mb_mapObj[ind].layers[i] = layers;
-			mb_mapObj[ind].querylayers[i] = querylayers;
-			mb_mapObj[ind].styles[i] = styles;
-		}
-	}
-}
-
-function mb_checkScale(frameName,mObj,wmsObj){
-	var thisLayer = mb_mapObj[mObj].layers[wmsObj].split(",");
-	var thisScale = mb_getScale(frameName);  
-	var str_layer = "";
-	var cnt_layer = 0;
-	for(var i=0; i<mb_mapObj[mObj].wms[wmsObj].objLayer.length; i++){  
-		var myLayername = mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_name;
-		var myMinscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_minscale;
-		var myMaxscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_maxscale;
-		for(var ii=0; ii<thisLayer.length; ii++){
-			var minscaleOK = false;
-			var maxscaleOK = false;   
-			if(thisLayer[ii] == myLayername){
-				if(myMinscale === 0 || thisScale >= myMinscale){minscaleOK = true;}
-				if(myMaxscale === 0 || thisScale <= myMaxscale){maxscaleOK = true;}
-				if(maxscaleOK === true && minscaleOK === true  && !mb_mapObj[mObj].wms[wmsObj].objLayer[i].has_childs){
+/**
+ * used in mod_box1, mod_dragMapSize, mod_pan
+ */
+var mb_start_x = 0;
+var mb_start_y = 0;
+var mb_end_x = 0;
+var mb_end_y = 0;
+
+/**
+ * @deprecated
+ */
+function mb_execloadWmsSubFunctions(){
+	eventAfterLoadWMS.trigger();
+}
+
+function mb_execWfsReadSubFunctions(geom) { 	 
+	for(var i=0; i<mb_WfsReadSubFunctions.length; i++){ 	 
+		mb_WfsReadSubFunctions[i](geom); 	 
+	} 	 
+}
+
+function mb_execWfsWriteSubFunctions() { 	 
+	for(var i=0; i<mb_WfsWriteSubFunctions.length; i++){
+		mb_WfsWriteSubFunctions[i](); 	 
+	} 	 
+}
+
+function mb_setWmcExtensionData(anArray) {
+	for (var i in anArray) {
+		if (typeof(anArray[i]) != "undefined") {
+			currentWmcExtensionData[i] = anArray[i];
+		}
+	}
+}
+
+function mb_getWmcExtensionData(arrayKey) {
+	for (var i in restoredWmcExtensionData) {
+		if (arrayKey == i) {
+			return restoredWmcExtensionData[i];
+		}
+	}
+	var e = new Mb_warning("mb_getWmcExtensionData: "+arrayKey+" not found. Maybe this GUI does not allow loading or saving WMC documents from/to the session");
+	return null;
+}
+
+
+eventAfterInit.register(function () {
+	// performs a map request for each map frame
+	for (var i = 0; i < mb_mapObj.length; i++){
+		setMapRequest(mb_mapObj[i].frameName);
+	}      	
+});
+
+eventBeforeFeatureInfo.register(function() {
+	for (var j=0; j<mb_mapObj.length; j++) {
+		var mapObj = mb_mapObj[j];
+
+		//
+		// set list of visible layers, active querylayers 
+		// and styles for each WMS in this map
+		//
+		
+		var cnt_layers;
+		var cnt_querylayers;
+		var styles;
+		var layers;
+		var querylayers = "";
+		for(i=0; i< mapObj.wms.length; i++){
+			cnt_layers = 0;
+			cnt_querylayers = 0;
+			styles = "";
+			layers = "";
+			querylayers = "";
+	
+			for(var ii=0; ii<mapObj.wms[i].objLayer.length; ii++){
+				// layer is visible and not root layer
+				if(mapObj.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
+					if(cnt_layers > 0){
+						layers += ","; styles += ","; 
+					}
+					layers += wms[i].objLayer[ii].layer_name; 
+					styles += ""; 
+					cnt_layers++;
+				}            
+				// layer is queryable and not root layer
+				if(mapObj.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
+					if(cnt_querylayers > 0){
+						querylayers += ",";
+					}
+					querylayers += wms[i].objLayer[ii].layer_name; 
+					cnt_querylayers++;
+				}                          
+			}
+			mapObj.layers[i] = layers;
+			mapObj.styles[i] = styles;
+			mapObj.querylayers[i] = querylayers;
+		}
+	}
+});
+
+function mb_registerMapObj(frameName, elementName,wms_index,width, height){
+	mb_mapObj.push(new mb_mapObj_const(frameName, elementName, width, height, wms_index));    
+}
+
+
+function mb_mapObjremoveWMS(objind,wmsind){
+	var wms_ID = null;
+	var i;
+	var new_wmsarray = [];
+	var new_layerarray = [];
+	var new_querylayerarray = [];
+	var new_stylesarray = [];
+	var new_mapURLarray = [];
+	
+	for	(i=0;i<mb_mapObj[objind].wms.length; i++){
+		if(i != wmsind){
+			new_wmsarray[new_wmsarray.length] = mb_mapObj[objind].wms[i];
+			new_layerarray[new_layerarray.length] = mb_mapObj[objind].layers[i];
+			new_querylayerarray[new_querylayerarray.length] = mb_mapObj[objind].querylayers[i];
+			new_stylesarray[new_stylesarray.length] = mb_mapObj[objind].styles[i];
+			new_mapURLarray[new_mapURLarray.length] = mb_mapObj[objind].mapURL[i];
+		}
+		else {
+			wms_ID = mb_mapObj[objind].wms[i].wms_id;
+		}
+	}
+	mb_mapObj[objind].wms = new_wmsarray; 
+	mb_mapObj[objind].layers = new_layerarray; 
+	mb_mapObj[objind].querylayers = new_querylayerarray; 
+	mb_mapObj[objind].styles = new_stylesarray; 
+	mb_mapObj[objind].mapURL = new_mapURLarray;
+
+	var another_new_wmsarray = [];
+	for	(i=0;i<wms.length; i++){
+		if(wms[i].wms_id != wms_ID){
+			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
+		}
+	}
+	wms = another_new_wmsarray; 
+}
+function setExtent(width,height,epsg){
+   for(var i=0; i < wms[0].gui_epsg.length; i++){
+      if(wms[0].gui_epsg[i] == epsg){      
+         var bbox_minx = parseFloat(wms[0].gui_minx[i]);
+         var bbox_miny = parseFloat(wms[0].gui_miny[i]);
+         var bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
+         var bbox_maxy = parseFloat(wms[0].gui_maxy[i]);     
+   
+         var extenty = bbox_maxy - bbox_miny;
+         var extentx = bbox_maxx - bbox_minx;
+
+         var relation_px_x = width / height;
+         var relation_px_y = height / width;
+         var relation_bbox_x = extentx / extenty;         
+         var centerx = bbox_minx + (extentx/2);
+         var centery = bbox_miny + (extenty/2);
+         if(relation_bbox_x <= relation_px_x){                
+                bbox_minx = centerx - relation_px_x * extenty / 2;
+                bbox_maxx = centerx + relation_px_x * extenty / 2;
+         }
+        
+         if(relation_bbox_x > relation_px_x){                
+                bbox_miny = centery - relation_px_y * extentx / 2;
+                bbox_maxy = centery + relation_px_y * extentx / 2;
+         }
+        return bbox_minx  +","+ bbox_miny +","+ bbox_maxx  +","+ bbox_maxy;
+     }
+   }
+}
+function setMapRequest(frameName){
+	var functionName = 'setMapRequest';
+
+	var ret = eventBeforeMapRequest.trigger({frameName:frameName}, "AND");
+	if (ret === false) {
+		return true;
+	}
+
+	var ts = mb_timestamp();
+	var myMapIds = [];
+	for (var i=0; i < mb_mapObj.length; i++){
+		var currentMapObject = mb_mapObj[i];
+		if (currentMapObject.frameName != frameName) {
+			continue;
+		}
+		
+		var newMapRequest = "";
+		for (var ii = 0; ii < currentMapObject.wms.length; ii++){
+			var currentWms = currentMapObject.wms[ii];
+			if (!(currentWms.gui_wms_visible > 0)) {
+				continue;
+			}
+			myMapIds.push("map_"+ii);
+			
+			newMapRequest += getLayerHtmlCode(frameName, i, ii);
+			
+		}
+		writeTag(mb_mapObj[i].frameName, mb_mapObj[i].elementName, newMapRequest);
+	}
+	eventAfterMapRequest.trigger({
+		"frameName": frameName,
+		"myMapIds": myMapIds.join(",")
+	});
+/*
+	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
+		eval(mb_MapRequestSubFunctions[i]);
+	}
+*/
+}
+
+function getLayerHtmlCode (frameName, i, ii) {
+	var currentMapObject = mb_mapObj[i];
+	var currentWms = currentMapObject.wms[ii];
+
+	var myDivId = "div_" + ii;          
+	var myMapId = "map_" + ii;
+	//disable Layer which are out of scale
+	var validLayers = mb_checkScale(frameName, i, ii);
+	var layerNames = validLayers.toString();
+
+	var newMapURL = false;
+	var opacityString = "";
+	if (currentMapObject.layers[ii] !== "" && layerNames !== ''){
+		// get map URL
+		newMapURL = currentMapObject.getMapUrl(i, ii);
+
+		var currentOpacity = currentWms.gui_wms_mapopacity;
+		if (currentOpacity != 1) {
+			opacityString += "opacity:" + currentOpacity + "; ";
+			opacityString += "Filter: Alpha(Opacity=" + currentOpacity*100 + "); ";
+			opacityString += "-moz-opacity:" + currentOpacity + " ; ";
+			opacityString += "-khtml-opacity:" + currentOpacity;
+		}
+	}
+
+	var imageString = "";
+	if (newMapURL) {
+		imageString = "<img id='"+myMapId+"' name='mapimage' ";
+		imageString += "src='" + newMapURL + "' ";
+		imageString += "width='"+currentMapObject.width+"' ";
+		imageString += "height='"+currentMapObject.height+"' ";
+		imageString += "border='0'>";	
+	}
+
+	var newMapRequest = "<div id='"+myDivId+"' ";
+	newMapRequest += "style=\"position:absolute; top:0px; left:0px; ";
+	newMapRequest += "z-index:" + ii + ";" + opacityString + "\">";
+	newMapRequest += imageString;
+	newMapRequest += "</div>";   
+
+	currentMapObject.mapURL[ii]= newMapURL;	
+	currentWms.mapURL = newMapURL;
+
+	if (mb_log && currentWms.mapURL) {
+		var tmp = eval(mb_log + "('" +newMapURL + "','" + ts + "')");
+	}
+
+	return newMapRequest;
+}
+
+function setSingleMapRequest(frameName,wms_id){
+	var functionName = 'setSingleMapRequest';
+	
+	eventBeforeMapRequest.trigger({frameName:frameName});
+
+	var ts = mb_timestamp();	
+
+	for(i = 0; i < mb_mapObj.length; i++){
+		var currentMapObject = mb_mapObj[i];
+		if (currentMapObject.frameName != frameName) {
+			continue;
+		}
+		
+		for (var ii=0; ii < currentMapObject.wms.length; ii++){ 
+			var currentWms = currentMapObject.wms[ii];
+			if (currentWms.wms_id != wms_id) {
+				continue;
+			}
+
+			var newMapRequest = getLayerHtmlCode(frameName, i, ii);
+
+			if (mb_log) {
+				var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
+			}
+			var myDivId = "div_" + ii;          
+			writeTag(currentMapObject.frameName, myDivId, newMapRequest);
+			var myMapId = "map_" + ii;
+			eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
+			return true;
+		}      
+	}  
+	return false; 
+}
+
+
+function mb_restateLayers(frameName,wms_id){
+	//alert(frameName + " / " + wms_id);
+	var ind = getMapObjIndexByName(frameName);	
+	for(var i=0; i<mb_mapObj[ind].wms.length; i++){
+		if(mb_mapObj[ind].wms[i].wms_id == wms_id){
+			var cnt_layers = 0;
+			var cnt_querylayers = 0;
+			var layers = "";
+			var styles = "";
+			var querylayers = "";
+			for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
+				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
+					if(cnt_layers > 0){layers += ","; styles += ","; }
+					layers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name;
+					//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name); 
+					styles += ""; 
+					cnt_layers++;
+				}            
+				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
+					if(cnt_querylayers > 0){querylayers += ",";}
+					querylayers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name; 
+					cnt_querylayers++;
+				}
+			}
+			mb_mapObj[ind].layers[i] = layers;
+			mb_mapObj[ind].querylayers[i] = querylayers;
+			mb_mapObj[ind].styles[i] = styles;
+		}
+	}
+}
+
+function mb_checkScale(frameName,mObj,wmsObj){
+	var thisLayer = mb_mapObj[mObj].layers[wmsObj].split(",");
+	var thisScale = mb_getScale(frameName);  
+	var str_layer = "";
+	var cnt_layer = 0;
+	for(var i=0; i<mb_mapObj[mObj].wms[wmsObj].objLayer.length; i++){  
+		var myLayername = mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_name;
+		var myMinscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_minscale;
+		var myMaxscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_maxscale;
+		for(var ii=0; ii<thisLayer.length; ii++){
+			var minscaleOK = false;
+			var maxscaleOK = false;   
+			if(thisLayer[ii] == myLayername){
+				if(myMinscale === 0 || thisScale >= myMinscale){minscaleOK = true;}
+				if(myMaxscale === 0 || thisScale <= myMaxscale){maxscaleOK = true;}
+				if(maxscaleOK === true && minscaleOK === true  && !mb_mapObj[mObj].wms[wmsObj].objLayer[i].has_childs){
 					if(cnt_layer > 0){str_layer += ","; }//str_styles += ","; str_titles += ",";str_parent += ","; str_legendurls += ",";}
-					str_layer += thisLayer[ii];
-					cnt_layer++;
-				}
-			}
-		}
-	}
-	var str_layerstyles = [];
-	str_layerstyles[0] = str_layer;
-	return str_layerstyles;
-}
-
-function setFeatureInfoRequest(fName,x,y, path) {
-	var functionName = 'setFeatureInfoRequest';
-	var ts = mb_timestamp();
-	eventBeforeFeatureInfo.trigger({"fName":fName});
-/*
-	for(var i=0; i<mb_FeatureInfoPreFunctions.length; i++){
-		eval(mb_FeatureInfoPreFunctions[i]);
-	}   
-*/
-	var cnt_fi = 0;
-	for(i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == fName){
-			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
-				var newfeatureInfoRequest = "";
-				var requestParams = "";
-				var validation = false;
-				newfeatureInfoRequest += mb_mapObj[i].wms[ii].wms_getfeatureinfo;          
-            	newfeatureInfoRequest += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getfeatureinfo);
-            	
-				if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){requestParams += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=feature_info&";}
-				if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){requestParams += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetFeatureInfo&SERVICE=WMS&";}
-				requestParams += "SRS="+mb_mapObj[i].epsg+"&";
-				requestParams += "BBOX="+mb_mapObj[i].extent+"&";
-				requestParams += "WIDTH="+mb_mapObj[i].width+"&";
-				requestParams += "HEIGHT="+mb_mapObj[i].height+"&";
-				requestParams += "LAYERS="+mb_mapObj[i].layers[ii]+"&";
-				requestParams += "STYLES="+mb_mapObj[i].styles[ii]+"&";
-				requestParams += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
-				requestParams += "INFO_FORMAT="+mb_mapObj[i].wms[ii].gui_wms_featureinfoformat+"&";
-				requestParams += "EXCEPTIONS=application/vnd.ogc.se_xml&";
-				if(mb_feature_count > 0){             
-					requestParams += "FEATURE_COUNT="+mb_feature_count+"&";
-				}
-				requestParams += "QUERY_LAYERS="+mb_mapObj[i].querylayers[ii]+"&";
-				requestParams += "X=" + x  + "&";
-				requestParams += "Y=" + y;
-				
-				if(mb_mapObj[i].querylayers[ii] !== "" && mb_mapObj[i].layers[ii] !== ""){
-					validation = true;
-				}
-				//add vendor-specific
-				for(var v=0; v < mb_vendorSpecific.length; v++){
-					var vendorSpecificString = eval(mb_vendorSpecific[v]); 
-					requestParams += "&" + vendorSpecificString; 
-				}
-				if(mb_log && validation){
-					var tmp = eval(mb_log + "('" + newfeatureInfoRequest + requestParams + "','" + ts + "')");
-				}
-				if(document.getElementById("FeatureInfoRedirect") && validation){
-					newfeatureInfoRequest += requestParams;
-					if(path){
-						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr;
-					}
-					else{
-						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = newfeatureInfoRequest;
-					}
-					cnt_fi++;
-            	}
-				else if(path && validation){
-					newfeatureInfoRequest += requestParams;
-					try{
-						var p = new mb_popup("Feature Info","url:"+path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr,300,400);
-						p.show();
-					}catch(e){
-						window.open(path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
-					}
-					cnt_fi++;
-				}
-				else if(validation){
-					newfeatureInfoRequest += requestParams;
-					try{
-						var p = new mb_popup("Feature Info","url:"+newfeatureInfoRequest,300,400);
-						p.show();
-					}
-					catch(e){
-						window.open(newfeatureInfoRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					
-					}
-					cnt_fi++;
-				}    
-			}
-		}
-	}
-   	if(cnt_fi === 0){
-		alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
-	}
-}
-
-/*
- * global function to zoom a mapobject
- * 
- * use: mb_mapObj.zoom() {@link mb_mapObj_const#zoom}
- * @deprecated
- * 
- */
-function zoom(frameName,in_, factor,x,y) {
-	var obj = getMapObjByName(frameName);
-	if(x && y){
-		obj.zoom(in_, factor, x, y);
-	}
-	else{
-		obj.zoom(in_, factor, false, false);
-	}	
-	setMapRequest(frameName);
-}
-function mb_panMap(frameName,dir){
-   var ind = getMapObjIndexByName(frameName);
-   var arrayBBox = mb_mapObj[ind].extent.split(",");
-   var minx = parseFloat(arrayBBox[0]);
-   var miny = parseFloat(arrayBBox[1]);
-   var maxx = parseFloat(arrayBBox[2]);
-   var maxy = parseFloat(arrayBBox[3]);
-   var xtentx = parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]);
-   var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
-
-   if(dir == "NW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "N"){miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "NE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "W"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2);}
-   if(dir == "E"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2);}
-   if(dir == "SW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-   if(dir == "S"){miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-   if(dir == "SE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-  mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-  setMapRequest(frameName);
-}
-
-function handleSelectedLayer (frameName, wms_title, layerName, type, status) {
-//	alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
-//	type = {visible || querylayer] status = {0 || 1}
-	for (var i=0; i < mb_mapObj.length; i++) {
-		if (mb_mapObj[i].frameName == frameName) {
-			var cnt_layer = 0;
-			var str_layer = "";
-			var myMapObj = i;
-			for (var ii = 0; ii < mb_mapObj[i].wms.length; ii++) {
-				if (mb_mapObj[i].wms[ii].wms_title == wms_title) { //ii is true
-					var myWMS = ii; 
-					if (type == "visible") {
-						var arrayLayer = mb_mapObj[i].layers[ii].split(",");
-					}
-					if (type == "querylayer") {
-						var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");
-					}
-					for (var iii = 1; iii < mb_mapObj[i].wms[ii].objLayer.length; iii++) {
-						var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
-						if (type == "querylayer") {
-							if (layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;                   
-							}
-						}
-						else if (type == "visible") {
-							if (layer_name == layerName && status == 1) {
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;                   
-							}
-						}
-						for (var iiii = 0; iiii < arrayLayer.length; iiii++) {
-							if (layer_name == arrayLayer[iiii] && layer_name != layerName) {
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;             
-							}
-						}
-					}
-				}   
-			}         
-		}
-	}
-	if (type == "visible") {
-		mb_mapObj[myMapObj].layers[myWMS] = str_layer;
-		var array_str_layer = str_layer.split(",");
-		var str_styles = "";
-		for (var cnt=0; cnt < array_str_layer.length; cnt++) {
-			if (cnt > 0) {
-				str_styles += ",";
-			}
-			str_styles += "";
-		}
-		mb_mapObj[myMapObj].styles[myWMS] = str_styles;
-	}
-	if (type == "querylayer") {
-		mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;
-	}
-/*
-	if(type == 'visible'){
-		setSingleMapRequest(frameName,wms_title);
-	}
-*/
-}
-
-function handleSelectedLayer_array(mapObj, array_wms, array_layer, type, status){
-	//alert(mapObj+" / "+array_wms[0]+" / "+ array_layer[0]+" / "+ type+" / "+ status);
-	var ind = getMapObjIndexByName(mapObj);
-	for(var j=0; j<array_wms.length; j++){
-		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-			if(mb_mapObj[ind].wms[i].wms_id == array_wms[j]){
-				var check = false;
-				for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
-					if(mb_mapObj[ind].wms[i].wms_id == array_wms[j] && mb_mapObj[ind].wms[i].objLayer[ii].layer_name == array_layer[j]){
-						if(type == "visible"){
-							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible = parseInt(status, 10);
-							//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name);
-							check = true;
-						}
-                        if(type == "querylayer" && (mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == "1" || mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == 1)){
-							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer = parseInt(status, 10);
-						}
-					}
-				}
-                mb_restateLayers(mapObj, array_wms[j]);
-                //alert('restate');
-                /*
-                * hier noch checken, welche wms sich geaendert haben und disctinct eine singleRequest aufrufen:
-                */ 
-                if(check === true){					
-                    
-                    if(mb_mapObj[ind].wms[i].gui_wms_visible == 1){
-						setSingleMapRequest(mapObj,mb_mapObj[ind].wms[i].wms_id);
-                        //alert('sSMR');
-					}
-				}
-			}
-		}
-	}
-}
-
-function makeClickPos2RealWorldPos(frameName, myClickX, myClickY) {
-	var ind = getMapObjIndexByName(frameName);
-	var width = parseInt(mb_mapObj[ind].width, 10);
-	var height = parseInt(mb_mapObj[ind].height, 10);
-	var arrayBBox = mb_mapObj[ind].extent.split(",");
-	var minX = parseFloat(arrayBBox[0]);
-	var minY = parseFloat(arrayBBox[1]);
-	var maxX = parseFloat(arrayBBox[2]);
-	var maxY = parseFloat(arrayBBox[3]);
-	var deltaX = (maxX - minX)/width;
-	var deltaY = (maxY - minY)/height;
-	if(deltaX > 0){
-		var roundx = 1/Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
-	}
-	else{
-		var roundx =  Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
-	}
-	if(deltaY > 0){
-		var roundy = 1/Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
-	}
-	else{
-		var roundy =  Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
-	}	
-	var xtentx = maxX - minX;
-	var xtenty =  maxY - minY;
-	var posX = parseFloat(minX + (myClickX / width) * xtentx);
-	var posY = parseFloat(maxY - (myClickY / height) * xtenty);
-	posX = Math.round(posX * roundx)/roundx;
-	posY = Math.round(posY * roundy)/roundy;
-	return [posX, posY];
-}
-
-function makeRealWorld2mapPos(frameName,rw_posx, rw_posy){
-   var ind = getMapObjIndexByName(frameName);
-   var mpObj = mb_mapObj[ind]; 
-   var arrayBBox = mpObj.extent.split(",");
-   var minX = parseFloat(arrayBBox[0]);
-   var minY = parseFloat(arrayBBox[1]);
-   var maxX = parseFloat(arrayBBox[2]);
-   var maxY = parseFloat(arrayBBox[3]);
-   return [Math.round((rw_posx - minX)*mpObj.width/(maxX - minX)), Math.round((maxY - rw_posy)*mpObj.height/(maxY - minY))];
-}
-
-// function for object-identification 
-function getMapObjIndexByName(frameName){
-	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == frameName){
-			return i;
-		}
-	}   
-}
-function getMapObjByName(frameName){
-	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == frameName){
-			return mb_mapObj[i];
-		}
-	}
-	return false;
-}
-function getWMSIDByTitle(frameName,wms_title){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
-         //return i;
-         return mb_mapObj[ind].wms[i].wms_id;
-      }
-   }
-}
-function getWMSIndexById(frameName,wms_id){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_id == wms_id){
-         return i;
-      }
-   }
-}
-//scale
-function mb_getScale(frameName) {
-
-	var myScale = eventBeforeGetScale.trigger({"frameName":frameName});
-/*
-   for(var i=0; i<mb_GetScalePreFunctions.length; i++){
-		var myScale = eval(mb_GetScalePreFunctions[i]);
-	}
-*/
-   if(typeof(myScale) == "number"){
-      var Y_str = myScale;
-   }
-   else{
-      var ind = getMapObjIndexByName(frameName);
-      var arrayBBox = mb_mapObj[ind].extent.split(",");
-      var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
-      var scaleY = (xtenty / mb_mapObj[ind].height) *(mb_resolution * 100);
-      if (scaleY<1){
-      	var Y_str = scaleY;
-      }else{
-      	var Y_str = Math.round(scaleY);
-      }
-   }   
-   return Y_str;   
-}
-
-function mb_repaintScale(frameName, x, y, scale){
-   var ind = getMapObjIndexByName(frameName);
-   if(x === null && y === null){
-      var arrayBBox = mb_mapObj[ind].extent.split(",");
-      x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
-      y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
-   }
-   var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
-   var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
-   var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
-   var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
-   mb_repaint(frameName,minx, miny, maxx, maxy);
-}
-function mb_repaint(frameName,minx,miny,maxx,maxy){
-   var ind = getMapObjIndexByName(frameName);
-   mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-   setMapRequest(frameName);
-}
-/*
- * converts the extent of the mapobject so that the maximum	extent will be displayed {@link mb_mapObj_const#calculateExtent}
- * use: mb_mapObj.calculateExtent
- * @deprecated
- * 
- */
-function mb_calculateExtent(frameName,minx,miny,maxx,maxy){
-  var map = getMapObjByName(frameName);
-  var extent = new Extent(minx,miny,maxx,maxy);
-  map.calculateExtent(extent);
-}
-/*
- * @class extent
- * @param {float} minx
- * @param {float} miny
- * @param {float} maxx
- * @param {float} maxy
- * @return the extent as object
- * @type Object
- */
-function Extent(minx,miny,maxx,maxy){
-	this.minx = parseFloat(minx);
-	this.miny = parseFloat(miny);
-	this.maxx = parseFloat(maxx);
-	this.maxy = parseFloat(maxy);
-	this.extentx = this.maxx - this.minx;
-	this.extenty = this.maxy - this.miny;
-	this.centerx = this.minx + this.extentx/2;
-	this.centery = this.miny + this.extenty/2;	
-	return this;
-}
-
+					str_layer += thisLayer[ii];
+					cnt_layer++;
+				}
+			}
+		}
+	}
+	var str_layerstyles = [];
+	str_layerstyles[0] = str_layer;
+	return str_layerstyles;
+}
+
+function setFeatureInfoRequest(fName,x,y, path) {
+	var functionName = 'setFeatureInfoRequest';
+	var ts = mb_timestamp();
+	eventBeforeFeatureInfo.trigger({"fName":fName});
+/*
+	for(var i=0; i<mb_FeatureInfoPreFunctions.length; i++){
+		eval(mb_FeatureInfoPreFunctions[i]);
+	}   
+*/
+	var cnt_fi = 0;
+	for(i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == fName){
+			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
+				var newfeatureInfoRequest = "";
+				var requestParams = "";
+				var validation = false;
+				newfeatureInfoRequest += mb_mapObj[i].wms[ii].wms_getfeatureinfo;          
+            	newfeatureInfoRequest += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getfeatureinfo);
+            	
+				if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){requestParams += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=feature_info&";}
+				if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){requestParams += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetFeatureInfo&SERVICE=WMS&";}
+				requestParams += "SRS="+mb_mapObj[i].epsg+"&";
+				requestParams += "BBOX="+mb_mapObj[i].extent+"&";
+				requestParams += "WIDTH="+mb_mapObj[i].width+"&";
+				requestParams += "HEIGHT="+mb_mapObj[i].height+"&";
+				requestParams += "LAYERS="+mb_mapObj[i].layers[ii]+"&";
+				requestParams += "STYLES="+mb_mapObj[i].styles[ii]+"&";
+				requestParams += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
+				requestParams += "INFO_FORMAT="+mb_mapObj[i].wms[ii].gui_wms_featureinfoformat+"&";
+				requestParams += "EXCEPTIONS=application/vnd.ogc.se_xml&";
+				if(mb_feature_count > 0){             
+					requestParams += "FEATURE_COUNT="+mb_feature_count+"&";
+				}
+				requestParams += "QUERY_LAYERS="+mb_mapObj[i].querylayers[ii]+"&";
+				requestParams += "X=" + x  + "&";
+				requestParams += "Y=" + y;
+				
+				if(mb_mapObj[i].querylayers[ii] !== "" && mb_mapObj[i].layers[ii] !== ""){
+					validation = true;
+				}
+				//add vendor-specific
+				for(var v=0; v < mb_vendorSpecific.length; v++){
+					var vendorSpecificString = eval(mb_vendorSpecific[v]); 
+					requestParams += "&" + vendorSpecificString; 
+				}
+				if(mb_log && validation){
+					var tmp = eval(mb_log + "('" + newfeatureInfoRequest + requestParams + "','" + ts + "')");
+				}
+				if(document.getElementById("FeatureInfoRedirect") && validation){
+					newfeatureInfoRequest += requestParams;
+					if(path){
+						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr;
+					}
+					else{
+						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = newfeatureInfoRequest;
+					}
+					cnt_fi++;
+            	}
+				else if(path && validation){
+					newfeatureInfoRequest += requestParams;
+					try{
+						var p = new mb_popup({
+							title:"Feature Info",
+							url:path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr,
+							width:600,
+							height:500,
+							top:200,
+							left:600
+						});
+						p.show();
+					}catch(e){
+						window.open(path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
+					}
+					cnt_fi++;
+				}
+				else if(validation){
+					newfeatureInfoRequest += requestParams;
+					try{
+						var p = new mb_popup({
+							title:"Feature Info",
+							url:newfeatureInfoRequest,
+							width:600,
+							height:500,
+							top:200,
+							left:600
+						});
+						p.show();
+					}
+					catch(e){
+						window.open(newfeatureInfoRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					
+					}
+					cnt_fi++;
+				}    
+			}
+		}
+	}
+   	if(cnt_fi === 0){
+		alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
+	}
+}
+
+/*
+ * global function to zoom a mapobject
+ * 
+ * use: mb_mapObj.zoom() {@link mb_mapObj_const#zoom}
+ * @deprecated
+ * 
+ */
+function zoom(frameName,in_, factor,x,y) {
+	var obj = getMapObjByName(frameName);
+	if(x && y){
+		obj.zoom(in_, factor, x, y);
+	}
+	else{
+		obj.zoom(in_, factor, false, false);
+	}	
+	setMapRequest(frameName);
+}
+function mb_panMap(frameName,dir){
+   var ind = getMapObjIndexByName(frameName);
+   var arrayBBox = mb_mapObj[ind].extent.split(",");
+   var minx = parseFloat(arrayBBox[0]);
+   var miny = parseFloat(arrayBBox[1]);
+   var maxx = parseFloat(arrayBBox[2]);
+   var maxy = parseFloat(arrayBBox[3]);
+   var xtentx = parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]);
+   var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
+
+   if(dir == "NW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
+   if(dir == "N"){miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
+   if(dir == "NE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
+   if(dir == "W"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2);}
+   if(dir == "E"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2);}
+   if(dir == "SW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
+   if(dir == "S"){miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
+   if(dir == "SE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
+  mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+  setMapRequest(frameName);
+}
+
+function handleSelectedLayer (frameName, wms_title, layerName, type, status) {
+//	alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
+//	type = {visible || querylayer] status = {0 || 1}
+	for (var i=0; i < mb_mapObj.length; i++) {
+		if (mb_mapObj[i].frameName == frameName) {
+			var cnt_layer = 0;
+			var str_layer = "";
+			var myMapObj = i;
+			for (var ii = 0; ii < mb_mapObj[i].wms.length; ii++) {
+				if (mb_mapObj[i].wms[ii].wms_title == wms_title) { //ii is true
+					var myWMS = ii; 
+					if (type == "visible") {
+						var arrayLayer = mb_mapObj[i].layers[ii].split(",");
+					}
+					if (type == "querylayer") {
+						var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");
+					}
+					for (var iii = 1; iii < mb_mapObj[i].wms[ii].objLayer.length; iii++) {
+						var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
+						if (type == "querylayer") {
+							if (layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
+								if (cnt_layer > 0) {
+									str_layer += ",";
+								}
+								str_layer += layer_name;
+								cnt_layer++;                   
+							}
+						}
+						else if (type == "visible") {
+							if (layer_name == layerName && status == 1) {
+								if (cnt_layer > 0) {
+									str_layer += ",";
+								}
+								str_layer += layer_name;
+								cnt_layer++;                   
+							}
+						}
+						for (var iiii = 0; iiii < arrayLayer.length; iiii++) {
+							if (layer_name == arrayLayer[iiii] && layer_name != layerName) {
+								if (cnt_layer > 0) {
+									str_layer += ",";
+								}
+								str_layer += layer_name;
+								cnt_layer++;             
+							}
+						}
+					}
+				}   
+			}         
+		}
+	}
+	if (type == "visible") {
+		mb_mapObj[myMapObj].layers[myWMS] = str_layer;
+		var array_str_layer = str_layer.split(",");
+		var str_styles = "";
+		for (var cnt=0; cnt < array_str_layer.length; cnt++) {
+			if (cnt > 0) {
+				str_styles += ",";
+			}
+			str_styles += "";
+		}
+		mb_mapObj[myMapObj].styles[myWMS] = str_styles;
+	}
+	if (type == "querylayer") {
+		mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;
+	}
+/*
+	if(type == 'visible'){
+		setSingleMapRequest(frameName,wms_title);
+	}
+*/
+}
+
+function handleSelectedLayer_array(mapObj, array_wms, array_layer, type, status){
+	//alert(mapObj+" / "+array_wms[0]+" / "+ array_layer[0]+" / "+ type+" / "+ status);
+	var ind = getMapObjIndexByName(mapObj);
+	for(var j=0; j<array_wms.length; j++){
+		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
+			if(mb_mapObj[ind].wms[i].wms_id == array_wms[j]){
+				var check = false;
+				for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
+					if(mb_mapObj[ind].wms[i].wms_id == array_wms[j] && mb_mapObj[ind].wms[i].objLayer[ii].layer_name == array_layer[j]){
+						if(type == "visible"){
+							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible = parseInt(status, 10);
+							//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name);
+							check = true;
+						}
+                        if(type == "querylayer" && (mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == "1" || mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == 1)){
+							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer = parseInt(status, 10);
+						}
+					}
+				}
+                mb_restateLayers(mapObj, array_wms[j]);
+                //alert('restate');
+                /*
+                * hier noch checken, welche wms sich geaendert haben und disctinct eine singleRequest aufrufen:
+                */ 
+                if(check === true){					
+                    
+                    if(mb_mapObj[ind].wms[i].gui_wms_visible == 1){
+						setSingleMapRequest(mapObj,mb_mapObj[ind].wms[i].wms_id);
+                        //alert('sSMR');
+					}
+				}
+			}
+		}
+	}
+}
+
+function makeClickPos2RealWorldPos(frameName, myClickX, myClickY) {
+	var ind = getMapObjIndexByName(frameName);
+	var width = parseInt(mb_mapObj[ind].width, 10);
+	var height = parseInt(mb_mapObj[ind].height, 10);
+	var arrayBBox = mb_mapObj[ind].extent.split(",");
+	var minX = parseFloat(arrayBBox[0]);
+	var minY = parseFloat(arrayBBox[1]);
+	var maxX = parseFloat(arrayBBox[2]);
+	var maxY = parseFloat(arrayBBox[3]);
+	var deltaX = (maxX - minX)/width;
+	var deltaY = (maxY - minY)/height;
+	if(deltaX > 0){
+		var roundx = 1/Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
+	}
+	else{
+		var roundx =  Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
+	}
+	if(deltaY > 0){
+		var roundy = 1/Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
+	}
+	else{
+		var roundy =  Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
+	}	
+	var xtentx = maxX - minX;
+	var xtenty =  maxY - minY;
+	var posX = parseFloat(minX + (myClickX / width) * xtentx);
+	var posY = parseFloat(maxY - (myClickY / height) * xtenty);
+	posX = Math.round(posX * roundx)/roundx;
+	posY = Math.round(posY * roundy)/roundy;
+	return [posX, posY];
+}
+
+function makeRealWorld2mapPos(frameName,rw_posx, rw_posy){
+   var ind = getMapObjIndexByName(frameName);
+   var mpObj = mb_mapObj[ind]; 
+   var arrayBBox = mpObj.extent.split(",");
+   var minX = parseFloat(arrayBBox[0]);
+   var minY = parseFloat(arrayBBox[1]);
+   var maxX = parseFloat(arrayBBox[2]);
+   var maxY = parseFloat(arrayBBox[3]);
+   return [Math.round((rw_posx - minX)*mpObj.width/(maxX - minX)), Math.round((maxY - rw_posy)*mpObj.height/(maxY - minY))];
+}
+
+// function for object-identification 
+function getMapObjIndexByName(frameName){
+	for(var i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == frameName){
+			return i;
+		}
+	}   
+}
+function getMapObjByName(frameName){
+	for(var i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == frameName){
+			return mb_mapObj[i];
+		}
+	}
+	return false;
+}
+function getWMSIDByTitle(frameName,wms_title){
+   var ind = getMapObjIndexByName(frameName);
+   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
+         //return i;
+         return mb_mapObj[ind].wms[i].wms_id;
+      }
+   }
+}
+function getWMSIndexById(frameName,wms_id){
+   var ind = getMapObjIndexByName(frameName);
+   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+      if(mb_mapObj[ind].wms[i].wms_id == wms_id){
+         return i;
+      }
+   }
+}
+//scale
+function mb_getScale(frameName) {
+
+	var myScale = eventBeforeGetScale.trigger({"frameName":frameName});
+/*
+   for(var i=0; i<mb_GetScalePreFunctions.length; i++){
+		var myScale = eval(mb_GetScalePreFunctions[i]);
+	}
+*/
+   if(typeof(myScale) == "number"){
+      var Y_str = myScale;
+   }
+   else{
+      var ind = getMapObjIndexByName(frameName);
+      var arrayBBox = mb_mapObj[ind].extent.split(",");
+      var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
+      var scaleY = (xtenty / mb_mapObj[ind].height) *(mb_resolution * 100);
+      if (scaleY<1){
+      	var Y_str = scaleY;
+      }else{
+      	var Y_str = Math.round(scaleY);
+      }
+   }   
+   return Y_str;   
+}
+
+function mb_repaintScale(frameName, x, y, scale){
+   var ind = getMapObjIndexByName(frameName);
+   if(x === null && y === null){
+      var arrayBBox = mb_mapObj[ind].extent.split(",");
+      x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
+      y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
+   }
+   var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
+   var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
+   var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
+   var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
+   mb_repaint(frameName,minx, miny, maxx, maxy);
+}
+function mb_repaint(frameName,minx,miny,maxx,maxy){
+   var ind = getMapObjIndexByName(frameName);
+   mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+   setMapRequest(frameName);
+}
+/*
+ * converts the extent of the mapobject so that the maximum	extent will be displayed {@link mb_mapObj_const#calculateExtent}
+ * use: mb_mapObj.calculateExtent
+ * @deprecated
+ * 
+ */
+function mb_calculateExtent(frameName,minx,miny,maxx,maxy){
+  var map = getMapObjByName(frameName);
+  var extent = new Extent(minx,miny,maxx,maxy);
+  map.calculateExtent(extent);
+}
+/*
+ * @class extent
+ * @param {float} minx
+ * @param {float} miny
+ * @param {float} maxx
+ * @param {float} maxy
+ * @return the extent as object
+ * @type Object
+ */
+function Extent(minx,miny,maxx,maxy){
+	this.minx = parseFloat(minx);
+	this.miny = parseFloat(miny);
+	this.maxx = parseFloat(maxx);
+	this.maxy = parseFloat(maxy);
+	this.extentx = this.maxx - this.minx;
+	this.extenty = this.maxy - this.miny;
+	this.centerx = this.minx + this.extentx/2;
+	this.centery = this.miny + this.extenty/2;	
+	return this;
+}
+

Modified: branches/dev_lenkne/http/javascripts/map.php
===================================================================
--- branches/dev_lenkne/http/javascripts/map.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/map.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -45,7 +45,6 @@
 */
 $_SESSION["mb_user_gui"] = $gui_id;
 
-session_write_close();
 ob_start();
 header('Content-type: application/x-javascript');
 
@@ -146,4 +145,4 @@
 		}
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/javascripts/mod_addWMSfromfilteredList_ajax.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_addWMSfromfilteredList_ajax.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_addWMSfromfilteredList_ajax.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -20,269 +20,372 @@
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset='<?php echo CHARSET;?>'>
-<title>Add WMS from Filtered Catalog</title>
-<link rel="stylesheet" type="text/css" href="../css/administration_alloc.css">
-<STYLE TYPE="text/css">
-<!--
-body{
-	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-	font-size:10pt
-}    
-   
-table{
-	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-	font-size:11;
-}   
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
-.wms_button{
-	color: black;
-	border: solid thin;
-	height:22px;
-	width:60px;
-}
--->
-</STYLE>
-<?php
-include '../include/dyn_css.php';
-?>
-<script type="text/javascript">
-<!--
-var global_source = "capabilities";  // "capabilities" || "db"
-var phpUrl = "../php/mod_addWMSfromfilteredList_server.php?<?php echo $urlParameters;?>";
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
-// ----------------- Load service --------------------
+<head>
+	<meta http-equiv="cache-control" content="no-cache" />
+	<meta http-equiv="pragma" content="no-cache" />
+	<meta http-equiv="expires" content="0" />
+	<?php printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />",CHARSET);	?>
+	<title>Add WMS</title>
+	<script type="text/javascript">
+	<!--
+	// Set default for element variables if they are undefined
+	option_all        = (typeof(option_all) !== 'undefined')        ? option_all        : '1';
+	option_group      = (typeof(option_group) !== 'undefined')      ? option_group      : '1';
+	option_gui        = (typeof(option_gui) !== 'undefined')        ? option_gui        : '1';
+	option_dball      = (typeof(option_dball) !== 'undefined')      ? option_dball      : '1';
+	option_dbgroup    = (typeof(option_dbgroup) !== 'undefined')    ? option_dbgroup    : '1';
+	option_dbgui      = (typeof(option_dbgui) !== 'undefined')      ? option_dbgui      : '1';
+	capabilitiesInput = (typeof(capabilitiesInput) !== 'undefined') ? capabilitiesInput : '0';
+	gui_list          = (typeof(gui_list) !== 'undefined')          ? gui_list          : '';
 
-function mod_addWMSfromDB(gui_id, wms_id) {
-	window.opener.mod_addWMSById_load(gui_id, wms_id);
-}
-
-function mod_addWMSfromfilteredList(pointer_name,version){
-
-	var load = false;
-	var conjunctionCharacter = window.opener.mb_getConjunctionCharacter(pointer_name);
+	var guis = gui_list.split(',');
 	
-	if (version == '1.0.0') {
-		load = pointer_name + conjunctionCharacter + "REQUEST=capabilities&WMTVER=1.0.0";
+	if(gui_list === '') {
+		guis = [];
 	}
-	else if (version == '1.1.0' || version == '1.1.1') {
-		load = pointer_name + conjunctionCharacter + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=" + version;
-	}
-	if (load !== false) {
-		window.opener.mod_addWMS_load(load);
-	}
-}
 
-// -----------------  Retrieve data --------------------
+	var global_source = 'capabilities';  // [capabilities,db]
+	var phpUrl        = '../php/mod_addWMSfromfilteredList_server.php?<?php echo $urlParameters;?>';
 
-function setSource(sourceValue) {
-	global_source = sourceValue;
-}
+	// Load service
 
-function getGroups() {
-	imageOn();
-	window.opener.mb_ajax_json(phpUrl, {"command":"getGroups"}, function (json, status) {
-		imageOff();
-		displayGroups(json.group);
-	});
-}
+	function mod_addWMSfromDB(gui_id,wms_id) {
+		parent.mod_addWMSById_load(gui_id,wms_id);
+	}
 
-function getGUIs() {
-	imageOn();
-	window.opener.mb_ajax_json(phpUrl, {"command":"getGUIs"}, function (json, status) {
-		imageOff();
-		displayGUIs(json.gui);
-	});
-}
+	function mod_addWMSfromfilteredList(pointer_name,version){
+		//TODO: load active
+		var load                 = false;
+		var conjunctionCharacter = parent.mb_getConjunctionCharacter(pointer_name);
+		
+		if(version == '1.0.0') {
+			load = pointer_name + conjunctionCharacter + 'REQUEST=capabilities&WMTVER=1.0.0';
+		}
+		else if(version == '1.1.0' || version == '1.1.1') {
+			load = pointer_name + conjunctionCharacter + 'REQUEST=GetCapabilities&SERVICE=WMS&VERSION=' + version;
+		}
+		if(load !== false) {
+			parent.mod_addWMS_load(load);
+		}
+	}
 
-function getWMSByGUI(guiId) {
-	imageOn();
-	window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGUI", "guiId":guiId}, function (json, status) {
-		imageOff();
-		displayWMS(json.wms, guiId);
-	});
-}
+	function mod_addWmsfromURL(){
+		var capabilities = document.getElementById('CapURL').value;
+		parent.mod_addWMS_load(capabilities);
+	}
 
-function getWMSByGroup(groupId) {
-	imageOn();
-	window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGroup", "groupId":groupId}, function (json, status) {
-		imageOff();
-		displayWMS(json.wms);
-	});
-}
+	// Retrieve data
 
-function getAllWMS() {
-	imageOn();
-	window.opener.mb_ajax_json(phpUrl, {"command":"getAllWMS"}, function (json, status) {
-		imageOff();
-		displayWMS(json.wms);
-	});
-}
+	function setSource(sourceValue) {
+		global_source = sourceValue;
+	}
 
-// -----------------  Display results --------------------
+	function getGroups() {
+		imageOn();
+		parent.mb_ajax_json(phpUrl, {"command":"getGroups"}, function (json, status) {
+			imageOff();
+			displayGroups(json.group);
+		});
+	}
 
-function removeChildNodes(node) {
-	while (node.childNodes.length > 0) {
-		var childNode = node.firstChild;
-		node.removeChild(childNode);
+	function getGUIs() {
+		imageOn();
+		parent.mb_ajax_json(phpUrl, {"command":"getGUIs"}, function (json, status) {
+			imageOff();
+			displayGUIs(json.gui);
+		});
 	}
-}
 
-function setTableHeader(text, titleLeft, titleRight) {
-	document.getElementById("resultTable").style.visibility = 'visible';
-	document.getElementById("resultString").innerHTML = text;
-	document.getElementById("titleLeft").innerHTML = titleLeft;
-	document.getElementById("titleRight").innerHTML = titleRight;
-	removeChildNodes(document.getElementById("resultTableBody"));
-}
+	function getWMSByGUI(guiId) {
+		if(guiId=="")
+			return getAllWMS();
+		imageOn();
+		parent.mb_ajax_json(phpUrl, {"command":"getWMSByGUI", "guiId":guiId}, function (json, status) {
+			imageOff();
+			displayWMS(json.wms, guiId);
+		});
+	}
 
-function addRow(tableId, leftText, rightText, onClick) {
-	var leftNode = document.createElement("td");
-	var leftDivNode = createDiv(leftText, onClick);
-	leftNode.appendChild(leftDivNode);
+	function getWMSByGroup(groupId) {
+		imageOn();
+		parent.mb_ajax_json(phpUrl, {"command":"getWMSByGroup", "groupId":groupId}, function (json, status) {
+			imageOff();
+			displayWMS(json.wms);
+		});
+	}
 
-	var rightNode = document.createElement("td");
-	var rightDivNode = createDiv(rightText, onClick);
-	rightNode.appendChild(rightDivNode);
+	function getAllWMS() {
+		imageOn();
+		parent.mb_ajax_json(phpUrl, {"command":"getAllWMS"}, function (json, status) {
+			imageOff();
+			displayWMS(json.wms);
+		});
+	}
 
-	var rowNode = document.createElement("tr");
-	rowNode.setAttribute("onmouseover", "this.style.backgroundColor = \"#F08080\"");
-	rowNode.setAttribute("onmouseout", "this.style.backgroundColor = \"#FFFFFF\"");
-	rowNode.appendChild(leftNode);
-	rowNode.appendChild(rightNode);
-	
-	document.getElementById(tableId).appendChild(rowNode);
-}
+	// -----------------  Display results --------------------
 
-function createDiv(text, onClick) {
-	var divNode = document.createElement("div");
-	divNode.style.cursor = "pointer";
-	divNode.setAttribute("onclick", onClick);
-	divNode.innerHTML = text;
-	return divNode;
-}
+	function removeChildNodes(node) {
+		while (node.childNodes.length > 0) {
+			var childNode = node.firstChild;
+			node.removeChild(childNode);
+		}
+	}
 
-function imageOn() {
-	document.getElementById("searchImage").style.visibility = "visible";
-	document.getElementById("resultTable").style.visibility = "hidden";
-	document.getElementById("resultString").style.visibility = "hidden";
-}
+	function setTableHeader(text,titleLeft,titleRight) {
+		document.getElementById('resultString').innerHTML = text;
+		document.getElementById('titleLeft').innerHTML    = titleLeft;
+		document.getElementById('titleRight').innerHTML   = titleRight;
+		
+		removeChildNodes(document.getElementById('resultTableBody'));
+	}
 
-function imageOff() {
-	document.getElementById("searchImage").style.visibility = "hidden";
-	document.getElementById("resultTable").style.visibility = "visible";
-	document.getElementById("resultString").style.visibility = "visible";
-}
+	function addTableRow(leftText,rightText,onClick) {
+		var resultTableBoy        = document.getElementById('resultTableBody');
+		var leftTableCell         = document.createElement('td');
+		var rightTableCell        = document.createElement('td');
+		var leftTableCellContent  = document.createElement('strong');
+		var rightTableCellContent = document.createElement('em');
+		var tableRow              = document.createElement('tr');
+				
+		leftTableCellContent.innerHTML  = leftText;
+		rightTableCellContent.innerHTML = rightText;
 
-function noResult() {
-	document.getElementById("resultTable").style.visibility = 'hidden';
-	document.getElementById("resultString").innerHTML = noResultText;
-}
+		leftTableCell.appendChild(leftTableCellContent);
+		rightTableCell.appendChild(rightTableCellContent);
+		tableRow.appendChild(leftTableCell);
+		tableRow.appendChild(rightTableCell);
+		
+		tableRow.setAttribute('onclick',onClick);
 
-function setButtons() {
-	if (typeof(option_all) != "undefined" && option_all == '0') {
-		var child = document.getElementById("button_all"); 
-		child.parentNode.removeChild(child);
+		if(resultTableBoy.childNodes.length % 2 !== 0) {
+			tableRow.className += tableRow.className + ' alternate';
+		}
+
+		resultTableBoy.appendChild(tableRow);
 	}
-	if (typeof(option_group) != "undefined" && option_group == '0') {
-		var child = document.getElementById("button_group");
-		child.parentNode.removeChild(child);
+
+	function imageOn() {
+		document.getElementById("progressIndicator").style.visibility = "visible";
+		document.getElementById("progressIndicator").style.display = "block";
+		document.getElementById("resultTable").style.visibility = "hidden";
+		document.getElementById("resultTable").style.display = "none";
+		document.getElementById("resultString").style.visibility = "hidden";
+		document.getElementById("resultString").style.display = "none";
 	}
-	if (typeof(option_gui) != "undefined" && option_gui == '0') {
-		var child = document.getElementById("button_gui");
-		child.parentNode.removeChild(child);
+
+	function imageOff() {
+		document.getElementById("progressIndicator").style.visibility = "hidden";
+		document.getElementById("progressIndicator").style.display = "none";
+		document.getElementById("resultTable").style.visibility = "visible";
+		document.getElementById("resultTable").style.display = "block";
+		document.getElementById("resultString").style.visibility = "visible";
+		document.getElementById("resultString").style.display = "block";
 	}
-	if (typeof(option_db) != "undefined" && option_db == '0') {
-		var child = document.getElementById("button_db");
-		child.parentNode.removeChild(child);
+
+	function noResult() {
+		document.getElementById("resultTable").style.visibility = 'hidden';
+		document.getElementById("resultString").innerHTML = noResultText;
 	}
-}
 
-function displayGroups (groupArray) {
-	if (groupArray.length > 0) {
-		setTableHeader(selectGroupText, groupNameText, groupAbstractText);
+	function setButtons() {
+		var containerCapabilities = document.getElementById('container_capabilities');
+		var containerButtons      = document.getElementById('container_buttons');
+		var optionButton          = false;
+
+		// If only one is active load list imidiately
+		if(
+			parseInt(option_all) + 
+			parseInt(option_group) + 
+			parseInt(option_gui) + 
+			parseInt(option_dbgui) + 
+			parseInt(option_dbgroup) + 
+			parseInt(option_dball)
+		=== 1) {
+			if(option_all === '1') {
+				optionButton = document.getElementById('button_all');
+			}
+			if(option_group === '1') {
+				optionButton = document.getElementById('button_group');
+			}
+			if(option_gui === '1') {
+				optionButton = document.getElementById('button_gui');
+			}
+			if(option_dball === '1'){
+				optionButton = document.getElementById('button_dbAll');
+			}
+			if(option_dbgroup === '1') {
+				optionButton = document.getElementById('button_dbGroup');
+			}
+			if(option_dbgui === '1') {
+				optionButton = document.getElementById('button_dbGui');
+			}
+
+			if(optionButton) {
+				optionButton.onclick();
+				containerButtons.parentNode.removeChild(containerButtons);
+				
+				return;
+			}
+		}
+
+		if(typeof(option_all) !== 'undefined' && option_all === '0') {
+			optionButton = document.getElementById('button_all'); 
+			optionButton.parentNode.removeChild(optionButton);
+		}
+		if(typeof(option_group) !== 'undefined' && option_group === '0') {
+			optionButton = document.getElementById('button_group');
+			optionButton.parentNode.removeChild(optionButton);
+		}
+		if(typeof(option_gui) !== 'undefined' && option_gui === '0') {
+			optionButton = document.getElementById('button_gui');
+			optionButton.parentNode.removeChild(optionButton);
+		}
+		if(option_dball === '0') {
+			optionButton = document.getElementById('button_dbAll');
+			optionButton.parentNode.removeChild(optionButton);
+		}
+		if(option_dbgroup === '0') {
+			optionButton = document.getElementById('button_dbGroup');
+			optionButton.parentNode.removeChild(optionButton);
+		}
+		if(option_dbgui === '0') {
+			optionButton = document.getElementById('button_dbGui');
+			optionButton.parentNode.removeChild(optionButton);
+		}
 		
-		for (var i = 0; i < groupArray.length; i++) {
-			var onClick = "getWMSByGroup('" + groupArray[i].id + "')";
-			addRow("resultTableBody", groupArray[i].name, groupArray[i].description, onClick);	
+		if(capabilitiesInput === '0') {
+			optionButton = document.getElementById('capabilitiesForm');
+			optionButton.parentNode.removeChild(optionButton);
+			containerCapabilities.parentNode.removeChild(containerCapabilities);
 		}
 	}
-	else {
-		noResult();
+
+	function displayGroups (groupArray) {
+		if (groupArray.length > 0) {
+			setTableHeader(selectGroupText, groupNameText, groupAbstractText);
+			
+			for (var i = 0; i < groupArray.length; i++) {
+				var onClick = "getWMSByGroup('" + groupArray[i].id + "')";
+				addTableRow(groupArray[i].name, groupArray[i].description, onClick);	
+			}
+		}
+		else {
+			noResult();
+		}
 	}
-}
 
-function displayGUIs (guiArray) {
-	if (guiArray.length > 0) {
-		setTableHeader(selectGuiText, guiNameText, guiAbstractText);
-		
-		for (var i = 0; i < guiArray.length; i++) {
-			var onClick = "getWMSByGUI('" + guiArray[i].id + "')";
-			addRow("resultTableBody", guiArray[i].name, guiArray[i].description, onClick);	
+	function displayGUIs (guiArray) {
+		if (guiArray.length > 0) {
+			setTableHeader(selectGuiText, guiNameText, guiAbstractText);
+			
+			for (var i = 0; i < guiArray.length; i++) {
+				var onClick = "getWMSByGUI('" + guiArray[i].id + "')";
+				if(guis.length>0){
+					for(var j=0; j < guis.length; j++){
+						if(guiArray[i].id==guis[j]){
+							addTableRow(guiArray[i].name, guiArray[i].description, onClick);	
+							break;
+						}
+					}
+				}
+				else
+					addTableRow(guiArray[i].name, guiArray[i].description, onClick);	
+			}
 		}
+		else {
+			noResult();
+		}
 	}
-	else {
-		noResult();
-	}
-}
 
-function displayWMS (wmsArray, guiId) {
-	if (wmsArray.length > 0) {
-		setTableHeader(selectWmsText, wmsNameText, wmsAbstractText);
+	function displayWMS (wmsArray, guiId) {
+		if (wmsArray.length > 0) {
+			setTableHeader(selectWmsText, wmsNameText, wmsAbstractText);
 
-		for (var i = 0; i < wmsArray.length; i++) {
+			for (var i = 0; i < wmsArray.length; i++) {
 
-			if (global_source == "db" && typeof(guiId) !== "undefined" ) {
-				var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
-			}		
-			else {
-				var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
+				if (global_source == "db" && typeof(guiId) !== "undefined" ) {
+					var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
+				}		
+				else {
+					var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
+				}
+				addTableRow(wmsArray[i].title, wmsArray[i].abstract, onClick);
 			}
-			addRow("resultTableBody", wmsArray[i].title, wmsArray[i].abstract, onClick);
 		}
+		else {
+			noResult();
+		}
 	}
-	else {
-		noResult();
-	}
-}
+	-->
+	</script>
+	<?php include("../include/dyn_css.php"); ?>
+	<script type="text/javascript">
+	var wmsNameText = '<?php echo _mb("WMS name");?>';
+	var wmsAbstractText = '<?php echo _mb("WMS abstract");?>';
+	var selectWmsText = '<?php echo _mb("Please select a WMS") . ":";?>';
+	var selectGuiText = '<?php echo _mb("Please select an application") . ":";?>';
+	var selectGroupText = '<?php echo _mb("Please select a group") . ":";?>';
+	var groupAbstractText = '<?php echo _mb("group abstract");?>';
+	var groupNameText = '<?php echo _mb("group name");?>';
+	var guiAbstractText = '<?php echo _mb("application abstract");?>';
+	var guiNameText = '<?php echo _mb("application name");?>';
+	var noResultText = '<?php echo _mb("no result");?>';
+	</script>
 
-// -->
-</script>
 </head>
-<body onLoad="window.focus();setButtons();">
 
-<form name='addWMSForm'>
-	<table border='0' cellpadding='3'  rules='rows'>
-		<tr>
-			<td><input type='button' class='wms_button' name='button_all' id='button_all' value='all wms' onclick='setSource("capabilities");getAllWMS()'></td>
-			<td><input type='button' class='wms_button' name='button_group' id='button_group' value='group' onclick = 'setSource("capabilities");getGroups()'></td>	
-			<td><input type='button' class='wms_button' name='button_gui' id='button_gui' value='gui' onclick = 'setSource("capabilities");getGUIs()'></td>
-			<td><input type='button' class='wms_button' name='button_db' id='button_db' value='db' onclick = 'setSource("db");getGUIs()'></td>
-		</tr>
-	</table>
+<body onLoad="setButtons();">
+<h1><?php echo _mb("Add WMS"); ?></h1>
+<p><?php echo _mb("Enter a Capabilities-URL of a WMS or select one or more WMS from list."); ?></p>
+<p><em><?php echo _mb("Hint: Possibly you need to zoom in for showing layers from external map service. The operator of the external service is responsible for the display ranges. PortalU does not have a stake in this behaviour."); ?></em></p>
+
+<form id="capabilitiesForm" name="addURLForm" method="post" action="">
+<fieldset id="container_capabilities">
+<legend>Capabilities</legend>
+	<p>
+		<label for="CapURL"><?php echo _mb("Capabilities-URL"); ?>:</label> 
+		<input type="text" id="CapURL" name="CapURL" /> 
+		<input type="button" id="addCapURL" name="addCapURL" value="<?php echo _mb("Add"); ?>" onclick="mod_addWmsfromURL();" />
+	</p>
+</fieldset>
 </form>
 
-<div id='searchImage' name='searchImage' style='visibility:hidden'>
-	<img src='../img/indicator_wheel.gif'>
-</div>
+<form id="addWMSForm" name="addWMSForm" method="post" action="">
+<fieldset id="container_buttons">
+<legend>WMS list(s)</legend>
+	<p>
+		<label><?php echo _mb("Available WMS list(s)"); ?>:</label> 
+		<input type="button" name="button_all"     id="button_all"     value="<?php echo _mb("All WMS"); ?>"            onclick="setSource('capabilities');getWMSByGUI(gui_list)"> 
+		<input type="button" name="button_group"   id="button_group"   value="<?php echo _mb("WMS by Group"); ?>"              onclick="setSource('capabilities');getGroups()"> 
+		<input type="button" name="button_gui"     id="button_gui"     value="<?php echo _mb("WMS by GUI"); ?>"                onclick="setSource('capabilities');getGUIs()"> 
+		<input type="button" name="button_dbAll"   id="button_dbAll"   value="<?php echo _mb("Database (All WMS)"); ?>" onclick="setSource('db');getWMSByGUI(gui_list)">
+		<input type="button" name="button_dbGroup" id="button_dbGroup" value="<?php echo _mb("Database (Group)"); ?>"   onclick="setSource('db');getGroups()"> 
+		<input type="button" name="button_dbGui"   id="button_dbGui"   value="<?php echo _mb("Database (GUI)"); ?>"     onclick="setSource('db');getGUIs()"> 
+	</p>
+</fieldset>
+</form>
 
-<div id='resultString' name='resultString'></div>
+<p id="progressIndicator" name="progressIndicator">
+	<img src="../img/indicator_wheel.gif" />
+	<?php echo _mb("Loading"); ?> ... 
+</p>
 
-<br>
+<h2 id="resultString" name="resultString"></h2>
 
-<table id='resultTable' name='resultTable' border=1 width="98%" cellpadding=3 rules='rows' style='visibility:hidden'>
-	<thead bgcolor="#FAEBD7">
+<table id="resultTable" name="resultTable">
+	<thead>
 		<tr>
-			<td id='titleLeft' name='titleLeft' width=200 height=10></td>
-			<td id='titleRight' name='titleRight' align=left class=fieldnames_s></td>
+			<th id="titleLeft" name="titleLeft"></th>
+			<th id="titleRight" name="titleRight"></th>
 		</tr>
 	</thead>
-	<tbody id='resultTableBody' name='resultTableBody'>
+	<tbody id="resultTableBody" name="resultTableBody">
 	</tbody>
 </table>
-</div>
 </body>
+
 </html>
\ No newline at end of file

Modified: branches/dev_lenkne/http/javascripts/mod_box1.js
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_box1.js	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_box1.js	2008-08-05 15:35:27 UTC (rev 2741)
@@ -17,13 +17,13 @@
 	mb_isActive = true;
 	mb_getMousePos(e,mb_isBF);
 	mb_start_x = clickX;
-	mb_start_y = clickY
+	mb_start_y = clickY;
 	mb_end_x = mb_start_x+1;
 	mb_end_y = mb_start_y+1;
 	mb_offset_left = mb_start_x;
 	mb_offset_top = mb_start_y;
 	mb_offset_bottom = mb_start_y;
-	mb_offset_right = mb_start_x
+	mb_offset_right = mb_start_x;
 	mb_drawBox(mb_start_x,mb_start_y,mb_end_x,mb_end_y);
 	return false;
 }
@@ -121,7 +121,7 @@
 		var maxy = y2;
 	}
    // area or clickpoint ?
-	var ret = new Array();
+	var ret = [];
 	if((maxx - minx) > 3 && (miny - maxy) > 3){
 		var posMin = makeClickPos2RealWorldPos(mb_isBF,minx,miny);
 		var posMax = makeClickPos2RealWorldPos(mb_isBF,maxx,maxy);

Modified: branches/dev_lenkne/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_digitize_tab.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_digitize_tab.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -135,14 +135,7 @@
 	executeDigitizeSubFunctions();
 }
 
-function mb_registerGML(frameName,obj){
-	var ind = parent.getMapObjIndexByName(frameName);
-	parent.mb_mapObj[ind].geom = obj;
-}
-
 function mod_digitize_go(e){
-	mb_registerGML(mod_digitize_target,d);   
-
 	// ie workaround
 	if (e == undefined) {
 		e = parent.frames[mod_digitize_target].event;
@@ -1293,9 +1286,9 @@
 					}
 					var formElementHtml = featureTypeElement['f_form_element_html']; 
 					if (!formElementHtml || !formElementHtml.match(/<select/)) {
-						str += "\t\t\t\t<input id = 'datatype_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
-						str += "\t\t\t\t<input id = 'mandatory_" + elementName + "' name='mandatory' type='hidden' value = '" + isMandatory + "'>\n";
-						str += "\t\t\t\t<input id = '" + elementName + "' name='" + elementLabel + "' type='text' class = '"+featureTypeElement['f_style_id']+"' size=20 value = '" + elementValue + "'>\n";
+						str += "\t\t\t\t<input id = 'datatype_mb_digitize_form_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
+						str += "\t\t\t\t<input id = 'mandatory_mb_digitize_form_" + elementName + "' name='mandatory' type='hidden' value = '" + isMandatory + "'>\n";
+						str += "\t\t\t\t<input id = 'mb_digitize_form_" + elementName + "' name='" + elementLabel + "' type='text' class = '"+featureTypeElement['f_style_id']+"' size=20 value = '" + elementValue + "'>\n";
 					}
 					else {
 							while (formElementHtml.match(/\\/)) {
@@ -1393,7 +1386,8 @@
 				}
 				else if (myform.elements[i].type == 'text' ){
 					if (myform.elements[i].id) {
-						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].value);
+						var elementId = String(myform.elements[i].id).replace(/mb_digitize_form_/, "");
+						d.get(m).e.setElement(elementId, myform.elements[i].value);
 					}
 					else {
 						errorMessage = msgObj.messageErrorFormEvaluation;
@@ -1402,7 +1396,8 @@
 				// selectbox
 				else if (typeof(myform.elements[i].selectedIndex) == 'number') {
 					if (myform.elements[i].id) {
-						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].options[myform.elements[i].selectedIndex].value);
+						var elementId = String(myform.elements[i].id).replace(/mb_digitize_form_/, "");
+						d.get(m).e.setElement(elementId, myform.elements[i].options[myform.elements[i].selectedIndex].value);
 					}
 					else {
 						errorMessage = msgObj.messageErrorFormEvaluation;

Modified: branches/dev_lenkne/http/javascripts/mod_loadwmc.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_loadwmc.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_loadwmc.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -22,70 +22,75 @@
 
 include(dirname(__FILE__) . "/../include/dyn_js.php");
 
-/*
-// this may be added at a later stage
-if ($new_wmc == 1) {
-	include(dirname(__FILE__) . "/../generate_defaultWmc.php");
-	$startup = true;
-	$e = new mb_notice("loadwmc: new wmc");
-}
-else {
-	$startup = false;
-	$e = new mb_notice("loadwmc: old wmc");
-}
-if ($gui_changed == 0) {
-	if ($_REQUEST['portal_services']) {
-		$e = new mb_notice("loadwmc: merging layers");
-		include(dirname(__FILE__) . "/../merge_layers.php");
+function createJs ($mergeWms) {
+	$jsString = "";
+	$wmc = new wmc();
+	if (!isset($_SESSION['mb_wmc'])) {
+		$e = new mb_notice("wmc not set, generating from app: " . $_SESSION["mb_user_gui"]);
+		$wmc->createFromApplication($_SESSION["mb_user_gui"]);		
+		$_SESSION["mb_wmc"] = $wmc->toXml();
+		$e = new mb_exception("initial WMC: " . $_SESSION["mb_wmc"]);
 	}
-	if ($_SESSION['GML']) {
-		$e = new mb_notice("loadwmc: merging bbox");
-		include(dirname(__FILE__) . "/../merge_bbox.php");
+
+	if (isset($_SESSION['mb_wmc'])) {
+		$e = new mb_notice("merging with WMC.");
+
+		if ($wmc->createFromXml($_SESSION['mb_wmc'])) {
+	
+			if ($mergeWms) {
+				$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();
+			}
+	
+			$javaScriptArray = array();
+			$javaScriptArray = $wmc->toJavaScript();
+
+			$jsString .= implode("", $javaScriptArray);
+		}
+		else {
+			$jsString .= "var e = new Mb_notice('mod_loadwmc: load_wmc_session: error parsing wmc');";
+		}
 	}
+	else {
+		$e = new mb_notice("not merging WMC");
+		$jsString .= "var e = new Mb_warning('mod_loadwmc: load_wmc_session: no wmc set!');";
+	}
+	return $jsString;
 }
-*/
 
 //
 // Creates the function load_wmc_session.
 // This function loads a WMC from the session, if the element var
 // "loadFromSession" is set to true.
 //
-echo "function load_wmc_session() {";
-if (isset($_SESSION['mb_wmc'])) {
-	$wmc = new wmc();
-	if ($wmc->createFromXml($_SESSION['mb_wmc'])) {
-		$jsArray = array();
-//		if ($_SESSION['layer_preview']) {
-//			$js = $wmc->createJsObjFromWMC("", $e_target, "load");
-//		}
-//		else if ($startup == true) {
-//			$js = $wmc->createJsObjFromWMC("", $e_target, "merge");
-//			$startup = false;
-//		}		
-//		else {
-			$jsArray = $wmc->toJavaScript();
-//		}
-		echo implode("", $jsArray);
-		
-		// test wmc from app
-		$newWmc = new wmc();
-		$newWmc->createFromApplication($_SESSION["mb_user_gui"]);
-		
-		
-	}
-	else {
-		echo "var e = new Mb_notice('mod_loadwmc: load_wmc_session: error parsing wmc');";
-	}
+?>
+function load_wmc_session() {
+<?php
+if ($_SESSION["command"] && $_SESSION["command"] == "ADDWMS") {
+	$e = new mb_notice("merging with WMS in Session...");
+	echo createJs(true);
 }
 else {
-	echo "var e = new Mb_warning('mod_loadwmc: load_wmc_session: no wmc set!');";
+	$e = new mb_notice("NOT merging with WMS in Session...");
+	echo createJs(false);
 }
-echo "}";
+?>
+}
 
+<?php 
+if ($e_src) {
+	sprintf("var mod_loadwmc_img = new Image(); 
+			mod_loadwmc_img.src = '%s'", $e_src);
+	
+}
 
-echo "var mod_loadwmc_img = new Image(); mod_loadwmc_img.src = '" . $e_src . "';";
-
-
 //
 // Creates a pop up with a dialogue to load, view or delete WMC documents
 //

Modified: branches/dev_lenkne/http/javascripts/mod_log.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_log.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_log.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,5 +1,5 @@
 <?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require(dirname(__FILE__)."/../php/mb_validatePermission.php");
 ?>
 mb_registerInitFunctions("mb_log_init()");
 function mb_log_init(){
@@ -7,7 +7,7 @@
 }
 try{if(logtype){}}catch(e){logtype="";}
 function mb_log_set(req, time_client){
-	var url = '<?php echo $self; ?>&req=" + escape(req) + "&time_client=" + time_client;
+	var url = "../php/mod_log.php?<?php echo $urlParameters;?>&req=" + escape(req) + "&time_client=" + time_client;
 	mb_ajax_post(url, {req:req, time:time_client});
 	return true;
 }
\ No newline at end of file

Modified: branches/dev_lenkne/http/javascripts/mod_savewmc.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_savewmc.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_savewmc.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -22,9 +22,12 @@
 
 echo "mod_savewmc_target = '".$e_target[0]."';";
 ?>
+
 function setOnUnload() {
 	if (ie) {
-		document.getElementsByTagName('body')[0].onunload = function() {var x = new Function ("", "mod_savewmc_session()"); x(); };
+		document.getElementsByTagName('body')[0].onunload = function() {
+			var x = new Function ("", "mod_savewmc_session()"); x(); 
+		};
 	}
 	else {
 		document.getElementsByTagName('body')[0].setAttribute("onUnload", "mod_savewmc_session();");
@@ -37,8 +40,12 @@
 	mb_registerInitFunctions('setOnUnload()');
 }
 
-var mod_savewmc_img = new Image(); 
-mod_savewmc_img.src = "<?php  echo $e_src;  ?>";
+<?php 
+if ($e_src) {
+	sprintf("var mod_savewmc_img = new Image(); 
+			mod_savewmc_img.src = '%s';", $e_src);
+}
+?>
 //var mod_savewmc_img_over = new Image(); mod_savewmc_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
 function mod_savewmc_session(){
@@ -60,9 +67,8 @@
 	if (currentWmcExtensionData != null) {
 		extensionDataString = $.toJSON(currentWmcExtensionData);
 	}
-
 	if (storeInSession) {
 		$.ajaxSetup({async:false}); //TODO: find out why async doesn't work onunload
 	}
 	$.post("../php/mod_savewmc_server.php", {"saveInSession":storeInSession, "generalTitle":generalTitle, "extensionData":extensionDataString, "mapObject":$.toJSON(mb_mapObj)}, callbackFunction);
-}
\ No newline at end of file
+}

Modified: branches/dev_lenkne/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_wfs_SpatialRequest.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_wfs_SpatialRequest.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,7 +1,7 @@
 <?php
 #$Id$
 #$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_wfs_spatialRequest.php,v 1.4 2006/03/08 15:26:26 c_baudson Exp $
-# 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
@@ -118,9 +118,9 @@
 
 function wfsInitFunction (j) {
 	var functionCall = "mb_regButton_frame('initWfsButton', null, "+j+")";
-	var x = new Function ("", functionCall); 
+	var x = new Function ("", functionCall);
 	x();
-} 
+}
 
 function displayButtons() {
 	for (var i = 0 ; i < buttonWfs_id.length ; i ++) {
@@ -131,14 +131,14 @@
 			currentDiv.style.left = buttonWfs_x[i]
 			currentDiv.style.top = buttonWfs_y[i];
 			currentDiv.style.zIndex = buttonWfs_zIndex;
-			
+
 			var currentImg = document.createElement("img");
 			currentImg.id = buttonWfs_id[i];
 			currentImg.name = buttonWfs_id[i];
 			currentImg.title = buttonWfs_title_off[i];
 			currentImg.src = buttonWfs_imgdir+buttonWfs_src[i];
 			currentImg.onmouseover = new Function("wfsInitFunction("+i+")");
-			
+
 			currentDiv.appendChild(currentImg);
 			document.getElementsByTagName('body')[0].appendChild(currentDiv);
 		}
@@ -161,7 +161,7 @@
 	mod_wfs_spatialRequest_epsg = mb_mapObj[ind].epsg;
 	mb_registerSubFunctions("drawDashedLineExt()");
 	mb_registerPanSubElement("measuring");
-}	
+}
 
 function wfsEnable(obj) {
    	var el = window.frames[mod_wfs_spatialRequest_target].document;
@@ -169,14 +169,14 @@
    	el.onmousedown = null;
    	el.onmouseup = null;
    	el.onmousemove = null;
-   
+
 	if (obj.id == button_point) {
 		if (activeButton == null) {
 			activeButton = obj;
 		}
 		mod_wfs_spatialRequest_geometry = new Geometry(geomType.point);
 		wfsAreaType_current = wfsAreaType_point;
-		mod_wfs_spatialRequest_digitize_go(geomType.point);		
+		mod_wfs_spatialRequest_digitize_go(geomType.point);
 	}
 	if (obj.id == button_polygon) {
 		if (activeButton == null) {
@@ -184,11 +184,11 @@
 		}
 		mod_wfs_spatialRequest_geometry = new Geometry(geomType.polygon);
 		wfsAreaType_current = wfsAreaType_polygon;
-		mod_wfs_spatialRequest_digitize_go(geomType.polygon);		
+		mod_wfs_spatialRequest_digitize_go(geomType.polygon);
 		var measureSub = "";
 		for(var i=0; i<mod_wfs_spatialRequestSubFunctions.length; i++){
 			measureSub += eval(mod_wfs_spatialRequestSubFunctions[i]);
-		}   
+		}
 		writeTag(mod_wfs_spatialRequest_target,"measure_sub",measureSub);
 	}
 	else if (obj.id == button_rectangle){
@@ -197,7 +197,7 @@
 		}
 		mod_wfs_spatialRequest_geometry = new Geometry(geomType.line);
 		wfsAreaType_current = wfsAreaType_rectangle;
-		mod_selAreaExt_click();	
+		mod_selAreaExt_click();
 	}
 	else if (obj.id == button_extent){
 		if (activeButton == null) {
@@ -207,7 +207,7 @@
 		wfsAreaType_current = wfsAreaType_extent;
 		var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
 		var p0 = mapToReal(mod_wfs_spatialRequest_target, new Point(0,0));
-		var p1 = mapToReal(mod_wfs_spatialRequest_target, new Point(mb_mapObj[ind].width,mb_mapObj[ind].height)); 
+		var p1 = mapToReal(mod_wfs_spatialRequest_target, new Point(mb_mapObj[ind].width,mb_mapObj[ind].height));
 		mod_wfs_spatialRequest_geometry.addPoint(p0);
 		mod_wfs_spatialRequest_geometry.addPoint(p1);
 		mod_getAreaExt_send();
@@ -219,7 +219,7 @@
 }
 
 function wfsDisable(obj) {
-	var el = window.frames[mod_wfs_spatialRequest_target].document; 
+	var el = window.frames[mod_wfs_spatialRequest_target].document;
 	el.onmousedown = null;
 	el.ondblclick = null;
 	el.onmousemove = null;
@@ -253,7 +253,7 @@
 	if (mod_wfs_spatialRequest_geometry != null) {
 		mod_wfs_spatialRequest_geometry.addPoint(new Point(coords[0],coords[1]));
 		mod_wfs_spatialRequest_geometry.addPoint(new Point(coords[2],coords[3]));
-		
+
 		if(mod_wfs_spatialRequest_geometry.count() == 2){
 			mod_getAreaExt_send();
 		}
@@ -281,7 +281,7 @@
 	var measureSub = "";
 	for(var i=0; i<mod_wfs_spatialRequestSubFunctions.length; i++){
 		measureSub += eval(mod_wfs_spatialRequestSubFunctions[i]);
-	}   
+	}
 	writeTag(mod_wfs_spatialRequest_target,"measure_sub",measureSub);
 }
 
@@ -298,7 +298,7 @@
 function mod_wfs_spatialRequest_start(e){
 	var realWorldPos;
 	if (s.isSnapped() == true) {
-		realWorldPos = s.getSnappedPoint(); 
+		realWorldPos = s.getSnappedPoint();
 		s.clean();
 	}
 	else {
@@ -316,7 +316,7 @@
 		mod_getAreaExt_send();
 		return;
 	}
-	
+
 	if(wfsAreaType_current == wfsAreaType_point){
 		mod_getAreaExt_send();
 		return;
@@ -347,7 +347,7 @@
 	var n = Math.round(d);
 	var s =  p0.minus(p1).dividedBy(n);
 	for(var i=1; i<n; i++){
-		var currPoint = p1.plus(s.times(i)).minus(new Point(2,2)).round(0); 
+		var currPoint = p1.plus(s.times(i)).minus(new Point(2,2)).round(0);
 		if(currPoint.x >= 0 && currPoint.x <= mod_wfs_spatialRequest_width && currPoint.y >= 0 && currPoint.y <= mod_wfs_spatialRequest_height){
 			str_dashedLine += "<div style='font-size:1px;position:absolute;top:"+currPoint.y+"px;left:"+currPoint.x+"px;width:3px;height:3px;background-color:#ff0000'></div>";
 		}
@@ -367,7 +367,7 @@
 	mod_wfs_spatialRequestSubFunctions[mod_wfs_spatialRequestSubFunctions.length] = stringFunction;
 }
 
-function mod_getAreaExt_send(){	
+function mod_getAreaExt_send(){
 	mb_setwfsrequest(mod_wfs_spatialRequest_target,mod_wfs_spatialRequest_geometry);
 	mod_wfs_spatialRequest_delete();
 	mb_disableThisButton(activeButton.id);
@@ -380,7 +380,7 @@
 }
 
 function mod_wfs_spatialRequest_timeout(){
-	var el = window.frames[mod_wfs_spatialRequest_target].document; 
+	var el = window.frames[mod_wfs_spatialRequest_target].document;
 	el.onmousedown = null;
 	el.ondblclick = null;
 	el.onmousemove = null;
@@ -396,16 +396,16 @@
 	return false;
 }
 
-function mod_wfs_SpatialRequest_dialog(){	
+function mod_wfs_SpatialRequest_dialog(){
 	if(!mod_wfs_spatialRequest_win || mod_wfs_spatialRequest_win == null || mod_wfs_spatialRequest_win.closed == true){
 		mod_wfs_spatialRequest_win = window.open("","mod_wfs_spatialRequest_win","width=200,height=150,resizable=yes");
 		mod_wfs_spatialRequest_win.document.open("text/html");
-		
-		mod_wfs_spatialRequest_win.document.writeln('<script language="JavaScript" type="text/javascript">');	
+
+		mod_wfs_spatialRequest_win.document.writeln('<script language="JavaScript" type="text/javascript">');
 		mod_wfs_spatialRequest_win.document.writeln('function set(obj){');
 		mod_wfs_spatialRequest_win.document.writeln('for(var i=0; i< document.getElementsByName("geom").length; i++){');
 		mod_wfs_spatialRequest_win.document.writeln('if(document.getElementsByName("geom")[i].checked){');
-		mod_wfs_spatialRequest_win.document.writeln('window.opener.mod_setExtRequest_geom = document.getElementsByName("geom")[i].value;'); 
+		mod_wfs_spatialRequest_win.document.writeln('window.opener.mod_setExtRequest_geom = document.getElementsByName("geom")[i].value;');
 		mod_wfs_spatialRequest_win.document.writeln('}');
 		mod_wfs_spatialRequest_win.document.writeln('}');
 		mod_wfs_spatialRequest_win.document.writeln('window.opener.wfsEnable(obj);');
@@ -413,7 +413,7 @@
 		mod_wfs_spatialRequest_win.document.writeln('return false;	');
 		mod_wfs_spatialRequest_win.document.writeln('}');
 		mod_wfs_spatialRequest_win.document.writeln('</script>');
-		
+
 		mod_wfs_spatialRequest_win.document.writeln("<form>");
 		mod_wfs_spatialRequest_win.document.writeln("<input id='point' name='geom' type='radio' value='"+button_point+"' onclick='set(this)'> Punkt<br>");
 		mod_wfs_spatialRequest_win.document.writeln("<input id='rectangle' name='geom' type='radio' value='"+button_rectangle+"' onclick='set(this)'> Rechteck<br>");
@@ -425,56 +425,58 @@
 	}
 	else{
 		mod_wfs_spatialRequest_win.focus();
-	}	
+	}
 }
 
 function mb_setwfsrequest(target,queryGeom){
 	if (typeof(wfsPopup) != "undefined") {
 		wfsPopup.hide();
-	}	
+	}
 	//mb_wfs_reset();
 	var ind = getMapObjIndexByName(target);
 	var db_wfs_conf_id = [];
 	js_wfs_conf_id = [];
 	_geomArray = new GeometryArray();
-	
+
 	if (typeof(resultGeometryPopup) != "undefined") {
 		resultGeometryPopup.hide();
 	}
-	
+
 	wfs_config = window.frames["wfs_conf"].get_wfs_conf();
 	for (var i=0; i<mb_mapObj[ind].wms.length; i++){
 		for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
 			var o = mb_mapObj[ind].wms[i].objLayer[ii];
-			if(o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1'){
+			if(o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1' && o.gui_layer_visible == '1'){
 				db_wfs_conf_id[db_wfs_conf_id.length] = o.gui_layer_wfs_featuretype;
-			}	
+			}
 		}
 	}
 	for(var i=0; i<db_wfs_conf_id.length; i++){
-		for(var ii=0; ii<wfs_config.length; ii++){			
+		for(var ii=0; ii<wfs_config.length; ii++){
 			if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i])  js_wfs_conf_id[js_wfs_conf_id.length] = ii;
 		}
 	}
-	
+
 	numberOfAjaxCalls =  js_wfs_conf_id.length;
-	
+
 	if(queryGeom.geomType==geomType.polygon){
 		for(var i=0; i<js_wfs_conf_id.length; i++){
+			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
 			var url = wfs_config[js_wfs_conf_id[i]]['wfs_getfeature'];
+			url += mb_getConjunctionCharacter(wfs_config[js_wfs_conf_id[i]]['wfs_getfeature']);
 			url += "service=wfs&request=getFeature&version=1.0.0";
 			url += "&typename="+ wfs_config[js_wfs_conf_id[i]]['featuretype_name'];
 			url += "&filter=";
 			var filter = "<ogc:Filter xmlns:ogc=\"http://ogc.org\" xmlns:gml=\"http://www.opengis.net/gml\">";
-			
-			if(buttonPolygon.filteroption=='within'){	
+
+			if(buttonPolygon.filteroption=='within'){
 				filter += "<Within><ogc:PropertyName>";
 				for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 					if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
 						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
-				filter += "</ogc:PropertyName><gml:Polygon srsName=\"EPSG:4326\">";
+				filter += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
 				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
 				for(var k=0; k<queryGeom.count(); k++){
 					if(k>0)	filter += " ";
@@ -490,8 +492,8 @@
 						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
-				filter += "</ogc:PropertyName><gml:Polygon srsName='4326'>";
-				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
+				filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'>";
+				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
 				for(var k=0; k<queryGeom.count(); k++){
 					if(k>0)	filter += " ";
 					filter += queryGeom.get(k).x+","+queryGeom.get(k).y;
@@ -499,7 +501,7 @@
 				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
 				filter += "</gml:Polygon></Intersects>";
 			}
-			
+
 			filter += '</ogc:Filter>';
 			mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
 		}
@@ -510,18 +512,20 @@
 			var rectangle = queryGeom.getBBox();
 		}
 		for(var i=0; i<js_wfs_conf_id.length; i++){
+			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
 			var url = wfs_config[js_wfs_conf_id[i]]['wfs_getfeature'];
+			url += mb_getConjunctionCharacter(wfs_config[js_wfs_conf_id[i]]['wfs_getfeature']);
 			param = "service=wfs&request=getFeature&version=1.0.0&typename="+ wfs_config[js_wfs_conf_id[i]]['featuretype_name']+"&filter=";
 			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
-			
-			if(buttonRectangle.filteroption=='within'){	
+
+			if(buttonRectangle.filteroption=='within'){
 				filter += "<Within><ogc:PropertyName>";
 				for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 					if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
 						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
-				filter += "</ogc:PropertyName><gml:Polygon srsName='4326'>";
+				filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'>";
 				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
 				filter += rectangle[0].x+","+rectangle[0].y;
 				filter += " ";
@@ -542,8 +546,8 @@
 						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
-				filter += "</ogc:PropertyName><gml:Polygon srsName='4326'>";
-				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
+				filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'>";
+				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
 				filter += rectangle[0].x+","+rectangle[0].y;
 				filter += " ";
 				filter += rectangle[0].x+","+rectangle[1].y;
@@ -555,8 +559,8 @@
 				filter += rectangle[0].x+","+rectangle[0].y;
 				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
 				filter += "</gml:Polygon></Intersects>";
-			}			
-			
+			}
+
 			filter += "</ogc:Filter>";
 			url += param;
 			mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
@@ -566,7 +570,7 @@
 		var tmp = queryGeom.get(0);
 		var mapPos = makeRealWorld2mapPos("mapframe1",tmp.x, tmp.y);
 		var buffer = mb_wfs_tolerance/2;
-		var mapPosXAddPix = mapPos[0] + buffer; 
+		var mapPosXAddPix = mapPos[0] + buffer;
 		var mapPosYAddPix = mapPos[1] +buffer;
 		var mapPosXRemovePix = mapPos[0] - buffer;
 		var mapPosYRemovePix = mapPos[1] - buffer;
@@ -575,7 +579,9 @@
 		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
 		var realWorld4 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
 		for(var i=0; i<js_wfs_conf_id.length; i++){
+			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
 			var url = wfs_config[js_wfs_conf_id[i]]['wfs_getfeature'];
+			url += mb_getConjunctionCharacter(wfs_config[js_wfs_conf_id[i]]['wfs_getfeature']);
 			param = "service=wfs&request=getFeature&version=1.0.0&typename="+ wfs_config[js_wfs_conf_id[i]]['featuretype_name']+"&filter=";
 			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
 			filter += "<Intersects><ogc:PropertyName>";
@@ -584,9 +590,9 @@
 					filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 				}
 			}
-			filter += "</ogc:PropertyName><gml:Polygon srsName='4326'><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
+			filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
 			filter += realWorld1[0] + "," + realWorld1[1] + " " + realWorld2[0] + "," + realWorld2[1] +  " ";
-			filter += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1]; 
+			filter += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1];
 			filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></ogc:Filter>";
 			url += param;
 			mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
@@ -597,7 +603,7 @@
 }
 
 function mb_get_geom(url, filter, index, typename, js_wfs_conf_id, db_wfs_conf_id) {
-	
+
 	mb_ajax_post("../" + wfsResultModulePath + wfsResultModuleFilename,{'url':url,'filter':filter,'typename':typename,'js_wfs_conf_id':js_wfs_conf_id, 'db_wfs_conf_id':db_wfs_conf_id},function(js_code,status){
 		if (js_code) {
 			eval(js_code);
@@ -618,7 +624,7 @@
 	if (numberOfFinishedAjaxCalls == numberOfAjaxCalls) {
 		numberOfFinishedAjaxCalls = 0;
 		mb_execWfsReadSubFunctions(_geomArray);
-		
+
 	}
 }
 
@@ -648,7 +654,7 @@
 				}
 				else {
 					resultArray[pos] = geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']);
-				} 
+				}
 				resultName += geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']) + " ";
 			}
 		}
@@ -683,7 +689,7 @@
 			listOfGeom += "<tr><td style='color:black;font-size:12px;'>edit all</td>\n";
 			listOfGeom += "<td><img title='edit all' src='"+buttonWfs_toDigitize_src+"'  style='cursor:pointer' onclick='appendGeometryArrayToDigitize(_geomArray);'></img>";
 			listOfGeom += "</td>\n</tr>\n";
-			listOfGeom += "<tr>\n<td>&nbsp;</td>\n</tr>\n"; 
+			listOfGeom += "<tr>\n<td>&nbsp;</td>\n</tr>\n";
 		}
 		for (var i = 0 ; i < _geomArray.count(); i ++) {
 			if (_geomArray.get(i).get(-1).isComplete()) {
@@ -691,7 +697,7 @@
 				listOfGeom += "\t\t\t onmouseover='mb_wfs_perform(\"over\",_geomArray.get("+i+"));' ";
 				listOfGeom += " onmouseout='mb_wfs_perform(\"out\",_geomArray.get("+i+"))' ";
 				listOfGeom += " onclick='mb_wfs_perform(\"click\",_geomArray.get("+i+")); showWfs("+i+");' ";
-				var geomName = getListTitle(_geomArray.get(i)); 
+				var geomName = getListTitle(_geomArray.get(i));
 				//if (_geomArray.get(i).geomType == geomType.polygon) {geomName += "(polygon)";}
 				//else if (_geomArray.get(i).geomType == geomType.line) {geomName += "(line)";}
 				//else if (_geomArray.get(i).geomType == geomType.point) {geomName += "(point)";}
@@ -699,12 +705,12 @@
 				if(buttonWfs_toDigitize_on==1){
 					listOfGeom += "<td><img title='edit geometry object' src='"+buttonWfs_toDigitize_src+"'  style='cursor:pointer' onclick='appendGeometryToDigitize("+i+");'></img></td>";
 				}
-				listOfGeom += "\t\t</tr>\n"; 
+				listOfGeom += "\t\t</tr>\n";
 			}
 		}
 	}
 	listOfGeom += "</table>\n";
-	return listOfGeom; 
+	return listOfGeom;
 }
 
 function displayPopup(geom){
@@ -722,18 +728,18 @@
 function showWfs(geometryIndex) {
 	var wfsConfIndex = _geomArray.get(geometryIndex).wfs_conf;
 	var currentWfsConf = wfsConf[wfsConfIndex];
-	
+
 	var resultHtml = "";
 	resultHtml += "<table style='background-color:#EEEEEE;'>\n";
 	for (var i = 0 ; i <currentWfsConf.element.length; i ++) {
 	    if(currentWfsConf.element[i].f_show_detail==1){
 	    	if( _geomArray.get(geometryIndex).e.getElementValueByName(currentWfsConf.element[i].element_name)!=false){
 				//console.log(currentWfsConf.element[i].element_name+"---"+currentWfsConf.element[i].f_respos);
-				resultHtml +="<tr><td>\n"; 
+				resultHtml +="<tr><td>\n";
 				resultHtml += currentWfsConf.element[i].f_label;
-				resultHtml +="</td>\n"; 
+				resultHtml +="</td>\n";
 				resultHtml += "<td>\n";
-				var elementVal = _geomArray.get(geometryIndex).e.getElementValueByName(currentWfsConf.element[i].element_name); 
+				var elementVal = _geomArray.get(geometryIndex).e.getElementValueByName(currentWfsConf.element[i].element_name);
 				if(currentWfsConf.element[i].f_form_element_html.indexOf("href")!=-1){
 					var setUrl = currentWfsConf.element[i].f_form_element_html.replace(/href\s*=\s*['|"]\s*['|"]/, "href='"+elementVal+"' target='_blank'");
 					if(setUrl.match(/><\/a>/)){
@@ -744,18 +750,18 @@
 					}
 					if(openLinkFromSearch=='1'){
 						window.open(elementVal, elementVal,"width=500, height=400,left=100,top=100,scrollbars=yes");
-					}			
+					}
 					resultHtml +=  newLink;
 				}
 				else{
 					resultHtml += elementVal;
 				}
-				resultHtml += "</td></tr>\n";		
+				resultHtml += "</td></tr>\n";
 			}
 		}
 	}
 	resultHtml += "</table>\n";
-	
+
 	var getCenter =  _geomArray.get(geometryIndex).getCenter();
 	// getMapPos for positioning of new PopupDiv near object in mapframe1
 	//var getMapPos = makeRealWorld2mapPos("mapframe1",getCenter.x, getCenter.y);
@@ -776,4 +782,4 @@
 }
 if(wfsResultToPopupDiv==1){
 	mb_registerWfsReadSubFunctions(function(geom){displayPopup(geom);});
-}
+}
\ No newline at end of file

Modified: branches/dev_lenkne/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- branches/dev_lenkne/http/javascripts/mod_wfs_gazetteer_client.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/mod_wfs_gazetteer_client.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -19,8 +19,8 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+$gui_id = $_SESSION["mb_user_gui"];
 
-$gui_id = $_SESSION["mb_user_gui"];
 $target = $_REQUEST["e_target"];
 $isLoaded = $_REQUEST["isLoaded"];
 
@@ -38,7 +38,8 @@
 <?php 
 	include '../include/dyn_js.php';
 	include '../include/dyn_php.php';
-	
+	include(dirname(__FILE__) . "/../../conf/" . $wfs_spatial_request_conf_filename);
+
 	echo "var targetString = '" . $target . "';";
 	echo "var wfsConfIdString = '" . $wfsConfIdString . "';";
 	echo "var e_id_css = '" . $e_id_css . "';";
@@ -58,21 +59,235 @@
 	maxHighlightedPoints = 0;
 //	var e = new parent.Mb_warning("mod_wfs_gazetteer_client.php: Element var maxHighlightedPoints is not set, see 'edit element vars'.");
 }
+// Element var showResultInPopup
+try {if(showResultInPopup){}}catch(e) {showResultInPopup = 1;}
 
+//element var openLinkFromSearch for opening attribute link directly onclick of searchResult entry
+try{
+	if (openLinkFromSearch){}
+}
+catch(e){
+	openLinkFromSearch =0;
+}
+
 var targetArray = targetString.split(",");
 var global_wfsConfObj;
 var global_selectedWfsConfId;
 var point_px = 10;
 var resultGeom = null;
 var cw_fillcolor = "#cc33cc";
+var frameName = e_id_css;
+var inputNotEnough = [];
 
+//start button management spatialRequest ////////
+var button_point = "point";
+var button_polygon = "polygon";
+var button_rectangle = "rectangle";
+var button_extent = "extent";
+var mb_wfs_tolerance = 8;
 
+var activeButton = null;
+var mod_wfs_spatialRequest_geometry = null;
+var mod_wfs_spatialRequest_frameName = "";
+var mod_wfs_spatialRequest_epsg;
+var mod_wfs_spatialRequest_width;
+var mod_wfs_spatialRequest_height;
+
+/**
+ * This Geometry contains the geometry of the optinal spatial constraint
+ */
+var spatialRequestGeom = null;
+
+/**
+ * Something like box, polygon, point, extent
+ */
+var spatialRequestType = null;
+
+/**
+ * This Geometry contains the result from the WFS request
+ */
+var geomArray;
+
+var buttonWfs_id = [];
+var buttonWfs_on = [];
+var buttonWfs_src = [];
+var buttonWfs_title_off = [];
+var buttonWfs_title_on = [];
+var buttonWfs_x = [];
+var buttonWfs_y = [];
+
+function addButtonWfs(id, isOn, src, title, x, y) {
+	buttonWfs_id.push(id);
+	buttonWfs_on.push(isOn);
+	buttonWfs_src.push(src);
+	buttonWfs_title_off.push(title);
+	buttonWfs_title_on.push(title);
+	buttonWfs_x.push(x);
+	buttonWfs_y.push(y);
+}
+// end of button management spatialRequest ///////////
+
 parent.mb_registerInitFunctions("window.frames['"+this.name+"'].initModWfsGazetteer()");
+parent.mb_registerInitFunctions("window.frames['"+this.name+"'].init_wfsSpatialRequest()");
 
-function openwindow(Adresse) {
-	Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
-	Fenster1.focus();
+function init_wfsSpatialRequest() {
+	//parent.mb_ajax_json("../php/mod_wfsSpatialRequest_messages.php", function(obj, status) {
+	//	msgObj = obj;
+		buttonWfs_id = [];
+		buttonWfs_on = [];
+		buttonWfs_src = [];
+		buttonWfs_title_off = [];
+		buttonWfs_title_on = [];
+		buttonWfs_x = [];
+		buttonWfs_y = [];
+		addButtonWfs("rectangle", buttonRectangle.status, buttonRectangle.img, buttonRectangle.title, buttonRectangle.x, buttonRectangle.y);
+		addButtonWfs("polygon", buttonPolygon.status, buttonPolygon.img, buttonPolygon.title, buttonPolygon.x, buttonPolygon.y);
+		addButtonWfs("point", buttonPoint.status, buttonPoint.img, buttonPoint.title, buttonPoint.x, buttonPoint.y);
+		addButtonWfs("extent", buttonExtent.status, buttonExtent.img, buttonExtent.title, buttonExtent.x, buttonExtent.y);
+		displayButtons();
+	//});
 }
+
+function wfsInitFunction (j) {
+	var functionCall = "parent.mb_regButton_frame('initWfsButton', '"+frameName+"', "+j+")";
+	var x = new Function ("", functionCall); 
+	x();
+} 
+
+function initWfsButton(ind, pos) {
+	parent.mb_button[ind] = document.getElementById(buttonWfs_id[pos]);
+	parent.mb_button[ind].img_over = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_over");
+	parent.mb_button[ind].img_on = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_on");
+	parent.mb_button[ind].img_off = buttonWfs_imgdir + buttonWfs_src[pos];
+	parent.mb_button[ind].img_out = buttonWfs_imgdir + buttonWfs_src[pos];
+	parent.mb_button[ind].status = 0;
+	parent.mb_button[ind].elName = buttonWfs_id[pos];
+	parent.mb_button[ind].frameName = frameName;
+	parent.mb_button[ind].go = new Function ("requestGeometryHighlight.clean(); wfsEnable(parent.mb_button["+ind+"], " + pos + ")");
+	parent.mb_button[ind].stop = new Function ("wfsDisable(parent.mb_button["+ind+"], " + pos + ")");
+	var ind = parent.getMapObjIndexByName("mapframe1");
+	mod_wfs_spatialRequest_width = parent.mb_mapObj[ind].width;
+	mod_wfs_spatialRequest_height = parent.mb_mapObj[ind].height;
+	mod_wfs_spatialRequest_epsg = parent.mb_mapObj[ind].epsg;
+	parent.mb_registerPanSubElement("measuring");
+}	
+
+function displayButtons() {
+	for (var i = 0 ; i < buttonWfs_id.length ; i ++) {
+		if (parseInt(buttonWfs_on[i])==1) {
+			var currentImg = document.createElement("img");
+			currentImg.id = buttonWfs_id[i];
+			currentImg.name = buttonWfs_id[i];
+			currentImg.title = buttonWfs_title_off[i];
+			currentImg.src = buttonWfs_imgdir+buttonWfs_src[i];
+			currentImg.style.marginRight = "5px";
+			currentImg.onmouseover = new Function("wfsInitFunction("+i+")");
+			
+			document.getElementById("displaySpatialButtons").appendChild(currentImg);
+		}
+	}
+}
+
+function disableButtons() {
+	removeChildNodes(document.getElementById("displaySpatialButtons"));
+}
+
+function wfsEnable(obj) {
+   	var el = parent.window.frames["mapframe1"].document;
+   	el.onmouseover = null;
+   	el.onmousedown = null;
+   	el.onmouseup = null;
+   	el.onmousemove = null;
+   	
+	if (obj.id == button_point) {
+		if (activeButton == null) {
+			activeButton = obj;
+		}
+	}
+	if (obj.id == button_polygon) {
+		if (activeButton == null) {
+			activeButton = obj;
+		}
+	}
+	else if (obj.id == button_rectangle){
+		if (activeButton == null) {
+			activeButton = obj;
+		}
+	}
+	else if (obj.id == button_extent){
+		if (activeButton == null) {
+			activeButton = obj;
+		}
+	}
+	callRequestGeometryConstructor(obj.id,"mapframe1");
+}
+
+function callRequestGeometryConstructor(selectedType,target){
+		if(document.getElementById("res")){
+			document.getElementById("res").innerHTML ="";
+			spatialRequestGeom = null;
+		}
+		if(document.getElementById("spatialResHint")){
+			document.getElementById("spatialResHint").innerHTML = "";
+		}
+		spatialRequestType = selectedType;
+		var geometryConstructor = new parent.RequestGeometryConstructor(target);
+		geometryConstructor.getGeometry(selectedType,function(target,queryGeom){
+			if(queryGeom !=''){
+				var spatialRes = document.createElement("span");
+				spatialRes.id = "spatialResHint";
+				spatialRes.name = "spatialResHint";
+				document.getElementById("displaySpatialButtons").appendChild(spatialRes);
+				document.getElementById("spatialResHint").innerHTML = spatialRequestIsSetMessage;
+				spatialRequestGeom = queryGeom;
+			}
+			parent.mb_disableThisButton(selectedType);
+			
+			// spatialRequestGeom is a Geometry, but for the highlight
+			// a MultiGeometry is needed.
+			var multiGeom;
+			// a line represents a bbox...but highlight must be a polyon
+			// (extent or box selection)
+			if (spatialRequestGeom.geomType == parent.geomType.line) {
+				multiGeom = new parent.MultiGeometry(parent.geomType.polygon);
+				newGeom = new parent.Geometry(parent.geomType.polygon);
+				var p1 = spatialRequestGeom.get(0);
+				var p2 = spatialRequestGeom.get(1);
+				newGeom.addPoint(p1);
+				newGeom.addPointByCoordinates(p1.x, p2.y);
+				newGeom.addPoint(p2);
+				newGeom.addPointByCoordinates(p2.x, p1.y);
+				newGeom.close();
+				multiGeom.add(newGeom);
+			}
+			// standard case
+			// (polygon and point selection)
+			else {
+				multiGeom = new parent.MultiGeometry(spatialRequestGeom.geomType);
+				multiGeom.add(spatialRequestGeom);
+			}
+			
+			// add highlight of geometry
+			requestGeometryHighlight.add(multiGeom);
+			requestGeometryHighlight.paint();
+		
+		});
+}
+
+function wfsDisable(obj) {
+	var el = parent.window.frames["mapframe1"].document; 
+	el.onmousedown = null;
+	el.ondblclick = null;
+	el.onmousemove = null;
+	parent.writeTag("mapframe1","measure_display","");
+	parent.writeTag("mapframe1","measure_sub","");
+	activeButton = null;
+}
+
+function openwindow(url) {
+	window1 = window.open(url, "Information", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+	window1.focus();
+}
 //----------------------------------------------------------------------------------
 
 function appendWfsConf(newWfsConfIdString) {
@@ -146,7 +361,9 @@
 	}
 	document.getElementById("wfsGeomType").style.visibility = "hidden";
 	document.getElementById("wfsRemove").style.visibility = "hidden";
-	
+		
+	geomArray = new parent.GeometryArray();
+
 	parent.mb_ajax_json("../php/mod_wfs_gazetteer_server.php", {command:"getWfsConf",wfsConfIdString:wfsConfIdString}, function(json, status) {
 		global_wfsConfObj = json;
 		var wfsCount = 0;
@@ -170,6 +387,12 @@
 		}
 		parent.mb_setWmcExtensionData({"wfsConfIdString":wfsConfIdString});
 	});
+	
+	// creates a Highlight object for the request geometry
+	var styleProperties = {"position":"absolute", "top":"0px", "left":"0px", "z-index":100};
+	requestGeometryHighlight = new parent.Highlight(targetArray, "requestGeometryHighlight", styleProperties, 2);
+	parent.mb_registerSubFunctions("window.frames['" + frameName +"'].requestGeometryHighlight.paint()");
+	
 }
 
 function setWfsInfo() {
@@ -207,7 +430,7 @@
 		wfsGeomTypeNode.style.visibility = 'visible';
 	}
 	else {
-		var e = new parent.Mb_exception("WFS gazetteer: geometry type unknown.");		
+		var e = new parent.Mb_exception("WFS gazetteer: geometry type unknown.");
 	}
 	
 	// set image: remove this WFS
@@ -230,7 +453,7 @@
 			initModWfsGazetteer();			
 			parent.mb_setWmcExtensionData({"wfsConfIdString":wfsConfIdString});
 		}
-	}
+	}  
 }
 
 function setWfsConfIdString() {
@@ -248,12 +471,23 @@
 	var selectNode = document.createElement("select");
 	selectNode.name = "wfs_conf_sel";
 	var wfsFormNode = document.getElementById("selectWfsConfForm");
-	selectNode.onchange = function() {
+	if (parent.ie) {
+		selectNode.onchange = function() {
 		global_selectedWfsConfId = this.value;
-		setWfsInfo();
+     	if(typeof(resultGeometryPopup)!="undefined"){
+	 		resultGeometryPopup.destroy();
+	 	}
+	 	if(typeof(wfsPopup)!="undefined"){
+	 		wfsPopup.destroy();
+	 	}
+    	setWfsInfo();
 		appendStyles();
 		appendWfsForm();
-	};
+		};
+	}
+	else{
+	   selectNode.setAttribute("onchange", "if(typeof(resultGeometryPopup)!='undefined'){resultGeometryPopup.destroy();}if(typeof(wfsPopup)!='undefined'){wfsPopup.destroy();};global_selectedWfsConfId = this.value;setWfsInfo();appendStyles();appendWfsForm();");
+	}
 	var isSelected = false;
 	for (var wfsConfId in global_wfsConfObj) {
 		var optionNode = document.createElement("option");
@@ -294,150 +528,711 @@
 	for (var i = 0; i < wfsConfElementArray.length; i++){
 		if (parseInt(wfsConfElementArray[i].f_search)) {
 			var spanNode = document.createElement("span");
-			spanNode.setAttribute("id", "ttttt");
+			spanNode.setAttribute("id", wfsConfElementArray[i].element_name+"Span");
 			spanNode.className = wfsConfElementArray[i].f_label_id;
 			spanNode.innerHTML = wfsConfElementArray[i].f_label;
-			var inputNode = document.createElement("input");
-			inputNode.type = "text";
-			inputNode.className = wfsConfElementArray[i].f_style_id;
-			inputNode.id = wfsConfElementArray[i].element_name;
-			
+			if(wfsConfElementArray[i].f_form_element_html.match(/\<select/)){
+				var inputNode = document.createElement("span");
+				inputNode.id = wfsConfElementArray[i].element_name+"Select";
+				inputNode.innerHTML = wfsConfElementArray[i].f_form_element_html;
+			}
+			else if(wfsConfElementArray[i].f_form_element_html.match(/checkbox/)){
+				var inputNode = document.createElement("span");
+				inputNode.id = wfsConfElementArray[i].element_name+"Checkbox";
+				inputNode.innerHTML = wfsConfElementArray[i].f_form_element_html;
+			}
+			else{ 
+				var inputNode = document.createElement("input");
+				inputNode.type = "text";
+				inputNode.className = wfsConfElementArray[i].f_style_id;
+				inputNode.id = wfsConfElementArray[i].element_name;
+				if(wfsConfElementArray[i].f_form_element_html.match(/datepicker/)){
+					inputNode.readOnly=true;
+					inputNode.style.backgroundColor = "#D3D3D3";
+					inputNode.title = "Use datepicker for selection of date";
+				}
+			}
 			form.appendChild(spanNode);
 			form.appendChild(inputNode);
+			
+			//build imgNode for datepicker image
+			if(wfsConfElementArray[i].f_form_element_html.match(/datepicker/)){
+				var imgNode = document.createElement("span");
+				imgNode.id = wfsConfElementArray[i].element_name+"Img";
+				imgNode.title = "Click here to open datepicker";
+				imgNode.innerHTML = wfsConfElementArray[i].f_form_element_html;
+				form.appendChild(imgNode);
+			}
 			form.appendChild(document.createElement("br"));
 		}
 	}
 	var submitButton = document.createElement("input");
 	submitButton.type = "submit";
+	submitButton.id = "submitButton";
 	submitButton.className = global_wfsConfObj[global_selectedWfsConfId].g_button_id;
 	submitButton.value = global_wfsConfObj[global_selectedWfsConfId].g_button;
 	
 	form.appendChild(submitButton);
+	
+	var delFilterButton = document.createElement("input");
+	delFilterButton.type = "button";
+	delFilterButton.style.marginLeft = "5px";
+	delFilterButton.className = global_wfsConfObj[global_selectedWfsConfId].g_button_id;
+	delFilterButton.value = clearFilterButtonLabel;
+	// Internet explorer
+	if (parent.ie) {$_REQUEST['pdfPathString']
+		delFilterButton.onclick = function() {
+			var x = new Function ("", "clearFilter();"); 
+			x(); 
+		};
+	}
+	// Firefox
+	else {
+		delFilterButton.onclick = function () {
+			clearFilter();
+		}
+	}  
+	form.appendChild(delFilterButton);
+	
+	checkSrs();
 }
 
+function checkSrs(){
+	//check SRS
+	var ind = parent.getMapObjIndexByName("mapframe1");
+	var submit = document.getElementById("submitButton");
+	if(global_wfsConfObj[global_selectedWfsConfId].featuretype_srs.toUpperCase()!=parent.mb_mapObj[ind].getSRS().toUpperCase()){
+		var msg = "Different EPSG of map and wfs featuretype, no spatial request possible!\n";
+		msg += parent.mb_mapObj[ind].getSRS()+" und "+global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
+		alert(msg);
+			
+		//disable Submit Button
+		if(submit)submit.disabled = true;
+	}
+	else{
+		//disable Submit Button
+		if(submit)submit.disabled = false;
+	}
+}
+
+function clearFilter(){
+	var wfsConfElementArray = global_wfsConfObj[global_selectedWfsConfId].element;
+	for (var i = 0; i < wfsConfElementArray.length; i++){
+		if (parseInt(wfsConfElementArray[i].f_search)) {
+			if(wfsConfElementArray[i].f_form_element_html.match(/checkbox/)){
+				var elementArray = document.getElementsByName(wfsConfElementArray[i].element_name);
+				for (var j = 0; j < elementArray.length; j++){ 
+					elementArray[j].checked = "";
+				}
+				document.getElementById('checkAll').checked = "";
+			}
+			else{
+				document.getElementById(wfsConfElementArray[i].element_name).value = "";	
+			}
+		}	
+	}
+	
+	//remove geometry from spatialrequest, remove drawn rectangle or polygon and hint
+	spatialRequestGeom = null;
+	requestGeometryHighlight.clean();
+	requestGeometryHighlight.paint();
+	if(document.getElementById('spatialResHint')){
+ 		document.getElementById("spatialResHint").innerHTML = "";
+ 	}
+		
+	//remove result popup
+	if(typeof(resultGeometryPopup)!="undefined"){
+ 		resultGeometryPopup.destroy();
+ 	}
+ 	//remove detail popup
+ 	if(typeof(wfsPopup)!="undefined"){
+ 		wfsPopup.destroy();
+ 	}
+	
+ 	if(document.getElementById('spatialResHint')){
+ 		document.getElementById("spatialResHint").innerHTML = "";
+ 	}
+ 	document.getElementById("res").innerHTML = "";
+}
+
+function getNumberOfFilterParameters(){
+	var cnt = 0;
+	var el = global_wfsConfObj[global_selectedWfsConfId].element;
+	inputNotEnough = [];
+	for (var i = 0; i < el.length; i++){
+	
+		if( el[i]['f_search'] == 1){
+			if(el[i]['f_form_element_html'].match(/\<select/)){
+				var elementValue = document.getElementById(el[i]['element_name']).options[document.getElementById(el[i]['element_name']).selectedIndex].value;
+    		}
+    		else if(el[i]['f_form_element_html'].match(/checkbox/)){
+				var elementArray = document.getElementsByName(el[i]['element_name']);
+				var selectedVal = [];
+				for (var j = 0; j < elementArray.length; j++){ 
+					if (elementArray[j].checked == true){ 
+						selectedVal.push(elementArray[j].value);
+					}
+				}
+				var elementValue = selectedVal.join(",");
+			}
+			else{
+				var elementValue = document.getElementById(el[i]['element_name']).value;
+			}
+	
+			if (elementValue != '') {
+				cnt++;
+			}
+			if(elementValue.length < el[i]['f_min_input']){
+				inputNotEnough.push(el[i]['element_name']+"("+el[i]['f_min_input']+")");
+			}
+		}
+	}
+	
+	if(inputNotEnough.length>0){
+		alert("Mandatory fields: "+inputNotEnough.join(', '));
+		return false;
+	}
+	
+//	if(spatialRequestGeom == null){
+//		alert("Bitte räumliche Eingrenzung vornehmen.");
+//		return false;
+//	}
+	
+	return cnt;
+}
 function validate(){
+	if(geomArray.count()>0){
+ 		geomArray.empty();
+ 	}
+ 	if(typeof(resultGeometryPopup)!="undefined"){
+ 		resultGeometryPopup.destroy();
+ 	}
+ 	if(typeof(wfsPopup)!="undefined"){
+ 		wfsPopup.destroy();
+ 	}
 	global_resultHighlight = new parent.Highlight(targetArray, "wfs_gazetteer_highlight", {"position":"absolute", "top":"0px", "left":"0px", "z-index":100}, 2);
 
 	var filterParameterCount = getNumberOfFilterParameters();
 	
-	if(filterParameterCount == 0){
+	if(filterParameterCount == 0 && spatialRequestGeom == null){
+	//if(filterParameterCount == 0){
+		//alert("Please specify at least one filter attribute.");
 		return false;
 	}
 	else{
-		var andConditions = "";
+		if(inputNotEnough.length==0){
+			var andConditions = "";
+			
+			var el = global_wfsConfObj[global_selectedWfsConfId].element;
+			var srs = global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
 		
-		var el = global_wfsConfObj[global_selectedWfsConfId].element;
-
-		for (var i = 0; i < el.length; i++) {
-			if (el[i]['f_search'] == 1 && document.getElementById(el[i]['element_name']).value != '') {
-		
-				var a = new Array();
-				a = document.getElementById(el[i]['element_name']).value.split(",");
-				var orConditions = "";
-				for (var j=0; j < a.length; j++) {
-					
-					orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
-					orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
-					orConditions += "<ogc:Literal>*";
-					if(el[i]['f_toupper'] == 1){
-						orConditions += a[j].toUpperCase();
+			for (var i = 0; i < el.length; i++) {
+				if (el[i]['f_search'] == 1){
+					if(el[i]['f_form_element_html'].match(/\<select/)){
+						var elementValue = document.getElementById(el[i]['element_name']).options[document.getElementById(el[i]['element_name']).selectedIndex].value;
+	    			}
+	    			else if(el[i]['f_form_element_html'].match(/checkbox/)){
+						var elementArray = document.getElementsByName(el[i]['element_name']);
+						var selectedVal = [];
+						for (var j = 0; j < elementArray.length; j++){ 
+							if (elementArray[j].checked == true){ 
+								selectedVal.push(elementArray[j].value);
+							}
+						}
+						var elementValue = selectedVal.join(",");
 					}
 					else{
-						orConditions += a[j];
+						var elementValue = document.getElementById(el[i]['element_name']).value;
 					}
-					orConditions += "*</ogc:Literal>";
-					orConditions += "</ogc:PropertyIsLike>";
 				}
-				if(a.length > 1){
-					andConditions += "<Or>" + orConditions + "</Or>";
+				
+				if (el[i]['f_search'] == 1 && elementValue != '') {
+					var a = new Array();
+					a = elementValue.split(",");
+					var orConditions = "";
+					for (var j=0; j < a.length; j++) {
+						if(el[i]['f_operator']=='bothside'){
+							orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>*";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "*</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsLike>";
+					}
+						else if(el[i]['f_operator']=='rightside'){
+							orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "*</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsLike>";
+						}
+						else if(el[i]['f_operator']=='greater_than'){
+							orConditions += "<ogc:PropertyIsGreaterThan>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsGreaterThan>";
+						}
+						else if(el[i]['f_operator']=='less_than'){
+							orConditions += "<ogc:PropertyIsLessThan>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsLessThan>";
+						}
+						else if(el[i]['f_operator']=='less_equal_than'){
+							orConditions += "<ogc:PropertyIsLessThanOrEqualTo>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsLessThanOrEqualTo>";
+						}
+						else if(el[i]['f_operator']=='greater_equal_than'){
+							orConditions += "<ogc:PropertyIsGreaterThanOrEqualTo>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsGreaterThanOrEqualTo>";
+						}
+						else if(el[i]['f_operator']=='equal'){
+							orConditions += "<ogc:PropertyIsEqualTo>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsEqualTo>";
+						}
+						else{
+							orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
+							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:Literal>*";
+							if(el[i]['f_toupper'] == 1){
+								orConditions += a[j].toUpperCase();
+							}
+							else{
+								orConditions += a[j];
+							}
+							orConditions += "*</ogc:Literal>";
+							orConditions += "</ogc:PropertyIsLike>";
+						}
+					}
+					if(a.length > 1){
+						andConditions += "<Or>" + orConditions + "</Or>";
+					}
+					else {
+						andConditions += orConditions;
+					}
 				}
-				else {
-					andConditions += orConditions;
-				}
 			}
-		}
-
-		var u = global_wfsConfObj[global_selectedWfsConfId].wfs_getfeature + parent.mb_getConjunctionCharacter(global_wfsConfObj[global_selectedWfsConfId].wfs_getfeature);
-		u += "REQUEST=getFeature&Typename="+global_wfsConfObj[global_selectedWfsConfId].featuretype_name+"&Version=1.0.0&service=WFS";
-		u += "&filter=";
-
-		if (filterParameterCount > 1) {
-			andConditions = "<And>" + andConditions + "</And>";
-		}
-
-		var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>"+andConditions+"</ogc:Filter>";
-
-		document.getElementById("res").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
-		var parameters = {command:"getSearchResults", "wfs_conf_id":global_selectedWfsConfId, "frame":this.name, "url":u, "filter":filter, "backlink":""};
-		parent.mb_ajax_get("../php/mod_wfs_gazetteer_server.php", parameters, function (jsCode, status) {
-			document.getElementById("res").innerHTML = "<table><tr><td>Arranging search results...</td></tr></table>";
 			
-			eval(jsCode);
-			
-			for (var i=0; i < parent.wms.length; i++) {
-				for (var j=0; j < parent.wms[i].objLayer.length; j++) {
-	
-					var currentLayer = parent.wms[i].objLayer[j];
-					var wms_id = parent.wms[i].wms_id; 
-	
-					if (currentLayer.gui_layer_wfs_featuretype == global_selectedWfsConfId) {
-						var layer_name = currentLayer.layer_name; 
-						parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'querylayer',1); 
-						parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'visible',1);
+			if(spatialRequestGeom!=null){
+				if(spatialRequestGeom.geomType == "polygon"){
+					if(buttonPolygon.filteroption=='within'){	
+						andConditions += "<Within><ogc:PropertyName>";
+						for (var j=0; j < el.length; j++) {
+							if(el[j]['f_geom']==1){
+								var elementName = el[j]['element_name'];
+								andConditions += el[j]['element_name'];
+							}
+						}
+						andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+						andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+						for(var k=0; k<spatialRequestGeom.count(); k++){
+							if(k>0)	andConditions += " ";
+							andConditions += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
+						}
+						andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+						andConditions += "</gml:Polygon></Within>";
 					}
+					else if(buttonPolygon.filteroption=='intersects'){
+						andConditions += "<Intersects><ogc:PropertyName>";
+						for (var j=0; j < el.length; j++) {
+							if(el[j]['f_geom']==1){
+								var elementName = el[j]['element_name'];
+								andConditions += el[j]['element_name'];
+							}
+						}
+						andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+						andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
+						for(var k=0; k<spatialRequestGeom.count(); k++){
+							if(k>0)	andConditions += " ";
+							andConditions += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
+						}
+						andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+						andConditions += "</gml:Polygon></Intersects>";
+					}
+				}	
+				else if(spatialRequestGeom.geomType == "line"){
+					var rectangle = [];
+					rectangle = spatialRequestGeom.getBBox();
+					
+					if(buttonRectangle.filteroption=='within'){	
+						andConditions += "<Within><ogc:PropertyName>";
+						for (var j=0; j < el.length; j++) {
+							if(el[j]['f_geom']==1){
+								var elementName = el[j]['element_name'];
+								andConditions += el[j]['element_name'];
+							}
+						}
+						andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+						andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+						andConditions += rectangle[0].x+","+rectangle[0].y;
+						andConditions += " ";
+						andConditions += rectangle[0].x+","+rectangle[1].y;
+						andConditions += " ";
+						andConditions += rectangle[1].x+","+rectangle[1].y;
+						andConditions += " ";
+						andConditions += rectangle[1].x+","+rectangle[0].y;
+						andConditions += " ";
+						andConditions += rectangle[0].x+","+rectangle[0].y;
+						andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+						andConditions += "</gml:Polygon></Within>";
+					}
+					else if(buttonRectangle.filteroption=='intersects'){
+						andConditions += "<Intersects><ogc:PropertyName>";
+						for (var j=0; j < el.length; j++) {
+							if(el[j]['f_geom']==1){
+								var elementName = el[j]['element_name'];
+								andConditions += el[j]['element_name'];
+							}
+						}
+						andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+						andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
+						andConditions += rectangle[0].x+","+rectangle[0].y;
+						andConditions += " ";
+						andConditions += rectangle[0].x+","+rectangle[1].y;
+						andConditions += " ";
+						andConditions += rectangle[1].x+","+rectangle[1].y;
+						andConditions += " ";
+						andConditions += rectangle[1].x+","+rectangle[0].y;
+						andConditions += " ";
+						andConditions += rectangle[0].x+","+rectangle[0].y;
+						andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+						andConditions += "</gml:Polygon></Intersects>";
+					}			
 				}
+				else if(spatialRequestGeom.geomType == "point"){
+					var tmp = spatialRequestGeom.get(0);
+					var mapPos = parent.makeRealWorld2mapPos("mapframe1",tmp.x, tmp.y);
+					var buffer = mb_wfs_tolerance/2;
+					var mapPosXAddPix = mapPos[0] + buffer; 
+					var mapPosYAddPix = mapPos[1] +buffer;
+					var mapPosXRemovePix = mapPos[0] - buffer;
+					var mapPosYRemovePix = mapPos[1] - buffer;
+					var realWorld1 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
+					var realWorld2 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+					var realWorld3 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+					var realWorld4 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
+					andConditions += "<Intersects><ogc:PropertyName>";
+					for (var j=0; j < el.length; j++) {
+						if(el[j]['f_geom']==1){
+							var elementName = el[j]['element_name'];
+							andConditions += el[j]['element_name'];
+						}
+					}
+					andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
+					andConditions += realWorld1[0] + "," + realWorld1[1] + " " + realWorld2[0] + "," + realWorld2[1] +  " ";
+					andConditions += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1]; 
+					andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects>";
+				}
+				//andConditions += "<ogc:Not><ogc:PropertyIsNull>";
+	            //andConditions += "<ogc:PropertyName>" + elementName + "</ogc:PropertyName>";
+	       		//andConditions += "</ogc:PropertyIsNull></ogc:Not>";
 			}
 			
-			var body = "";
-			if (typeof(geom) == 'object') {
-				resultGeom = geom; // set the global variable
-				for (var i=0; i < geom.count(); i++) {
-					body += "<div id='geom"+i+"'style='cursor:pointer;' ";
-					if ((i % 2) === 0) {
-						body += "class='even'";
+			var u = global_wfsConfObj[global_selectedWfsConfId].wfs_getfeature + parent.mb_getConjunctionCharacter(global_wfsConfObj[global_selectedWfsConfId].wfs_getfeature);
+			u += "REQUEST=getFeature&Typename="+global_wfsConfObj[global_selectedWfsConfId].featuretype_name+"&Version=1.0.0&service=WFS";
+			u += "&filter=";
+	
+			if (filterParameterCount > 1 || spatialRequestGeom != null) {
+				andConditions = "<And>" + andConditions + "</And>";
+			}
+	
+			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>"+andConditions+"</ogc:Filter>";
+	
+			document.getElementById("res").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
+			var parameters = {command:"getSearchResults", "wfs_conf_id":global_selectedWfsConfId, "frame":this.name, "url":u, "filter":filter, "backlink":""};
+			parent.mb_ajax_get("../php/mod_wfs_gazetteer_server.php", parameters, function (jsCode, status) {
+				document.getElementById("res").innerHTML = "<table><tr><td>Arranging search results...</td></tr></table>";
+				
+				if(status=='success'){
+					for (var i=0; i < parent.wms.length; i++) {
+						for (var j=0; j < parent.wms[i].objLayer.length; j++) {
+							var currentLayer = parent.wms[i].objLayer[j];
+							var wms_id = parent.wms[i].wms_id; 
+							if (currentLayer.gui_layer_wfs_featuretype == global_selectedWfsConfId) {
+								var layer_name = currentLayer.layer_name; 
+								parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'querylayer',1); 
+								parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'visible',1);					
+							}
+						}
 					}
-					else {
-						body += "class='uneven'";
+					var geoObj = eval('(' + jsCode + ')');	
+		       		if (jsCode) {
+			        	if (typeof(geoObj) == 'object') {
+			        		geomArray.importGeoJSON(geoObj);
+			        		document.getElementById("res").innerHTML = '';
+							displayResult(geomArray);
+						}
+						else {
+							document.getElementById("res").innerHTML = '';
+							displayResult();
+						}
 					}
-					body += " onmouseover=\"setResult('over', this.id)\" ";
-					body += " onmouseout=\"setResult('out', this.id)\" ";
-					body += " onclick=\"setResult('click', this.id)\">";
-					for (var j=0; j < geom.get(i).e.count(); j++) {
-						body += geom.get(i).e.getValue(j) + " ";
+		       		else {
+						document.getElementById("res").innerHTML = '';
+						alert("No results.");
 					}
-					body += "</div>";
-				}
+		       	}
+			});
+		}
+		else{
+			return false;
+		}
+	}	
+	//spatialRequestGeom = null;
+	return false;
+}
+
+function displayResult(geom){
+	geomArray = geom;
+	if(geomArray!=null && geomArray.count()>0){
+		var contentHtml = createListOfGeometries();
+	}
+	else{
+		var contentHtml = "No results.";
+	}
+	
+	if(showResultInPopup==1){
+		if (typeof(resultGeometryPopup) == "undefined") {
+			resultGeometryPopup = new parent.mb_popup(searchPopupTitle,contentHtml,searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
+		}
+		else {
+			resultGeometryPopup.destroy();
+			resultGeometryPopup = new parent.mb_popup(searchPopupTitle,contentHtml,searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
+		}
+		resultGeometryPopup.show();
+	
+	}
+	else{
+		document.getElementById("res").innerHTML = contentHtml;
+	}
+	
+} 
+
+function createListOfGeometries(){
+	if(showResultInPopup==1){
+		var domPath = "window.frames['"+frameName+"'].";
+	}
+	else{
+		var domPath = "";
+	}
+	var listOfGeom = "<form name='resultListForm'><table style='background-color:#EEEEEE;'>\n";
+	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
+	var labelArray = [];
+	if (geomArray.count() > 0) {
+				
+		if(showResultInPopup==1){
+			listOfGeom += "<tr>";
+			var labelObj = getListTitle();
+			for (var k = 1 ; k < labelObj.length; k ++) {
+				listOfGeom += "<td>";
+				listOfGeom += labelObj[k];
+				listOfGeom += "</td>";
 			}
-			else {
-				body = "Kein Ergebnis.";
+			listOfGeom += "</tr>";
+		}
+						
+		for (var i = 0 ; i < geomArray.count(); i ++) {
+			if (geomArray.get(i).get(-1).isComplete()) {
+				listOfGeom += "<tr>\n";
+				var resultElObj = getListValues(geomArray.get(i));
+				for (var l = 1 ; l < resultElObj.length; l ++) {
+					if(resultElObj[l]!=''){
+						listOfGeom += "<td style='cursor:pointer;\n";
+						if(showResultInPopup==1){
+							if ((i % 2) === 0) {
+								listOfGeom += "color:blue'";
+							}
+							else {
+								listOfGeom += "color:red'";
+							}
+						}
+						else{
+							if ((i % 2) === 0) {
+								listOfGeom += "' class='even'";
+							}
+							else {
+								listOfGeom += "' class='uneven'";
+							}
+						}
+						listOfGeom += " onmouseover=\""+domPath+"setResult('over',"+i+")\" ";
+						listOfGeom += " onmouseout=\""+domPath+"setResult('out',"+i+")\" ";
+						listOfGeom += " onclick=\""+domPath+"setResult('click',"+i+"); "+domPath+"showWfs("+i+");\" ";
+						listOfGeom += ">"+ resultElObj[l] +"</td>";
+					}
+				}	
+				listOfGeom += "\t</tr>\n"; 
 			}
-			document.getElementById('res').innerHTML = body;
-		});
+		}
 	}
-	return false;
+	listOfGeom += "</table></form>\n";
+	return listOfGeom; 
 }
 
-function getNumberOfFilterParameters(){
-	var cnt = 0;
-	var el = global_wfsConfObj[global_selectedWfsConfId].element;
+function getListTitle(){
+	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
+	var labelArray = [];
+	for (var j = 0 ; j < wfsConf.element.length ; j++) {
+		if(wfsConf.element[j].f_show == 1 && wfsConf.element[j].f_label!=''){
+			var labelPos = wfsConf.element[j].f_respos;
+			labelArray[labelPos] = wfsConf.element[j].f_label;
+		}
+	}
+	return labelArray;
+}
+		
+function getListValues(geom){
+	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
+	var resultArray = [];
+	for (var i = 0 ; i < wfsConf.element.length ; i++) {
+		if (wfsConf.element[i].f_show == 1 && geom.e.getElementValueByName(wfsConf.element[i].element_name) !=false) {
+			var pos = wfsConf.element[i].f_respos;
+			if(pos>0){
+				resultArray[pos] = geom.e.getElementValueByName(wfsConf.element[i].element_name);
+			}
+		}
+	}
+	return resultArray;
+}
 
-	for (var i = 0; i < el.length; i++){
-		if( el[i]['f_search'] == 1){
-			if (document.getElementById(el[i]['element_name']).value != '') {
-				cnt++;
+function showWfs(geometryIndex) {
+	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
+	var wfsElement = geomArray.get(geometryIndex).e;
+	var showDetailsObj = [];
+	var details = 0;
+	for (var i = 0 ; i <wfsConf.element.length; i ++) {
+		if(wfsConf.element[i].f_show_detail == 1 && wfsElement.getElementValueByName(wfsConf.element[i].element_name)!=''){
+			var elPos = wfsConf.element[i].f_detailpos;
+			if(elPos>0){
+				var currentObj = {};
+//				showDetailsObj[elPos] = {};
+				currentObj.elPos = elPos;
+				currentObj.data = {};
+				//var elementVal = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
+				//showDetailsObj[elPos][wfsConf.element[i].f_label] = elementVal;
+				if(wfsConf.element[i].f_form_element_html.indexOf("href")!=-1){
+					var newPath = wfsElement.getElementValueByName(wfsConf.element[i].element_name).replace(/%computername%/,"Rechnername");
+					var setUrl = wfsConf.element[i].f_form_element_html.replace(/href\s*=\s*['|"]\s*['|"]/, "href='"+newPath+"' target='_blank'");
+					if(setUrl.match(/><\/a>/)){
+						var newLink	=	setUrl.replace(/><\/a>/, ">"+wfsElement.getElementValueByName(wfsConf.element[i].element_name)+"</a>");
+					}
+					else{
+						var newLink = setUrl;
+					}
+					if(openLinkFromSearch=='1'){
+						window.open(elementVal, elementVal,"width=500, height=400,left=100,top=100,scrollbars=yes");
+					}
+//					showDetailsObj[elPos][wfsConf.element[i].f_label] =  newLink;
+					currentObj.data[wfsConf.element[i].f_label] = newLink;
+				}
+				else{
+//					showDetailsObj[elPos][wfsConf.element[i].f_label] = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
+					currentObj.data[wfsConf.element[i].f_label] = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
+				}
+				showDetailsObj.push(currentObj);
 			}
+			details = 1;
 		}
+		else{
+			details = 0;
+		}
 	}
-	return cnt;
+	var resultHtml = "";
+	resultHtml += "<table style='background-color:#EEEEEE;'>\n";
+//	for (var elPos in showDetailsObj) {
+
+	showDetailsObj.sort(showDetailObjSort);
+	for (var i=0; i < showDetailsObj.length; i++) {
+//		var currentDetail = showDetailsObj[elPos];
+		var currentDetail = showDetailsObj[i].data;
+		for(var key in currentDetail){
+			var currentDetailName = key;
+			var currentDetailValue = currentDetail[key];
+			resultHtml +="<tr><td>\n"; 
+			resultHtml += currentDetailName;
+			resultHtml +="</td>\n"; 
+			resultHtml += "<td>\n";
+			resultHtml += currentDetailValue;
+			resultHtml += "</td></tr>\n";
+		}
+	}
+	if(details != 1){
+		resultHtml +="<tr><td>No detail information</td></tr>\n";
+	}
+	resultHtml += "</table>\n";
+	if(showResultInPopup==1){
+		if (typeof(wfsPopup) == "undefined") {
+			wfsPopup = new parent.mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
+		}
+		else {
+			wfsPopup.destroy();
+			wfsPopup = new parent.mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
+		}
+		wfsPopup.show();
+	}
 }
+
+function showDetailObjSort (a, b) {
+	return (parseInt(a.elPos) - parseInt(b.elPos));
+}
+
 /*
 * event -> {over || out || click}
 * geom -> commaseparated coordinates x1,y1,x2,y2 ...
 */
-function setResult(event, id){
-	var index = parseInt(id.slice(4));
-
-	var currentGeom = resultGeom.get(index);
+function setResult(event, index){
+	var currentGeom = geomArray.get(index);
 	if (maxHighlightedPoints > 0 && currentGeom.getTotalPointCount() > maxHighlightedPoints) {
 		currentGeom = currentGeom.getBBox4();
 	}
@@ -463,14 +1258,22 @@
 	}
 	return true;
 }
+function callPick(obj){
+	dTarget = obj;
+	var dp = window.open('../tools/datepicker/datepicker.php?m=Jan_Feb_Mar_Apr_May_June_July_Aug_Sept_Oct_Nov_Dec&d=Mon_Tue_Wed_Thu_Fri_Sat_Sun&t=today','dp','left=200,top=200,width=230,height=210,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0');
+	dp.focus();
+	return false;
+}
+
 </script>
 </head>
 <body leftmargin='0' topmargin='10'  bgcolor='#ffffff'>
 <form name='selectWfsConfForm' id='selectWfsConfForm'></form>
+<div name='displaySpatialButtons' id='displaySpatialButtons' style='width:180px'></div>
+<a name='wfsInfo' id='wfsInfo'></a>
+<img src = "" name='wfsRemove' id='wfsRemove'>
 <img src = "" name='wfsGeomType' id='wfsGeomType'>
-<img src = "" name='wfsRemove' id='wfsRemove'>
-<a name='wfsInfo' id='wfsInfo'></a>
 <form name='wfsForm' id='wfsForm' onsubmit='return validate()'></form>
 <div name='res' id='res' style='width:180px'></div>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: branches/dev_lenkne/http/javascripts/popup.js
===================================================================
--- branches/dev_lenkne/http/javascripts/popup.js	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/popup.js	2008-08-05 15:35:27 UTC (rev 2741)
@@ -18,22 +18,25 @@
  *  width: popup width
  *  height: popup height
  *  title: popup title
- *  frameName: name of the popups iframe if it loads a frame
- *  opacity: opacity of the frame
- *  moveOpacity: opacity while the user moves or resizes the frame
+ *  frameName: name of the popups iframe if it loads a frame  (recommended to set destroy to false)
+ *  opacity: opacity of the frame default:1
+ *  moveOpacity: opacity while the user moves or resizes the frame default:0.8
  *  html:content html of the frame (not parsed if url not false)
  *  url:content url of the frame
  *  minWidth: minimum width of the popup if the user resizes it
  *  maxWidth: maximum width of the popup if the user resizes it
  *  minHeight: minimum height of the popup if the user resizes it
  *  maxHeight: maximum height of the popup if the user resizes it
- *  minTop: minimum top position if the user moves the popup
- *  minLeft: minimum left position if the user moves the popup 
+ *  minTop: minimum top position if the user moves the popup default:"document"
+ *  minLeft: minimum left position if the user moves the popup default:"document"
  *  maxRight: maximum right position if the user moves/resizes the popup
  *  maxBottom: maximum bottom position if the user moves/resized the popup
- * 	style: additional styles for the popup
- *  destroy: remove dom of popup if user closes it (don't use it for iframes with framename)
+ * 	style: additional styles for the popup window
+ *  destroy: remove dom of popup if user closes it (don't use it for iframes with framename) default:true
  *  closeCallback: function that is called if the user closes the window
+ *  resizeable: allow user to change the size default:true
+ *  dragable: allow user to move the window default:true
+ *  balloon: balloon popup from top, left (disables resizeable and dragable)
  * 
  * @param {String} html the "body" of the popup, can also be "url:http://foo.de" to display a website
  * @param {Number} width width of the popup
@@ -46,13 +49,13 @@
 	//get first free place
 	var create_pos=popup_count;
 	for(var i = 0; i < popup_count;i++)
-		if(!document.getElementById("popup"+String(i))){
-			create_pos=i;
-			break;
-		}
+//		if(!document.getElementById("popup"+String(i))){
+//			create_pos=i;
+//			break;
+//		}
 
-//	this.id="popup"+String(create_pos);
-	this.id="popup"+String(++popup_top);
+	this.id="popup"+String(create_pos);
+//	this.id="popup"+String(popup_top);
 	
 	//Set defaults
 	defaults = {
@@ -60,8 +63,9 @@
 		top:25*create_pos,
 		width:300,height:250,
 		title:"Title",
-		frameName:this.id
-	}
+		frameName:this.id,
+		id:this.id
+	};
 		
 	if(typeof(title)!='object'){
 		this.options = defaults;
@@ -109,6 +113,7 @@
  */
 mb_popup.prototype.hide = function(){	
 	$("#"+this.id).hide();
+	$("#balloon_"+this.id).hide();
 }
 
 /**
@@ -116,6 +121,7 @@
  */
 mb_popup.prototype.destroy = function(){	
 	$("#"+this.id).remove();
+	$("#balloon_"+this.id).remove();
 }
 
 /**
@@ -238,14 +244,14 @@
 	$.fn.mbPopup = function(options){
 		//default settings
 		defaults = {
-			left:0,top:0,
-			width:300,height:250,
+			left:0,top:0,width:300,height:250,
 			title:"",frameName:"",
 			opacity:1.0,moveOpacity:0.8,html:false,url:false,
 			minWidth:false,maxWidth:false,
 			minHeight:false,maxHeight:false,
 			minTop:"document",minLeft:"document",
 			maxRight:false,maxBottom:false,
+			dragable:true,resizeable:true,balloon:false,
 			style:null,destroy:true,
 			closeCallback:null
 		};
@@ -255,10 +261,47 @@
 		//add Styles
 		this.addClass("jqmNotice");
 		
-		this.css({top:settings.top,
-			left:settings.left,
-			width:settings.width,
-			height:settings.height,
+		//automated settings for balloon popup
+		if(settings.balloon){
+			var dim = getScrollPos();
+			
+			bubble_height = 80;
+			bubble_width = 100;
+			settings.resizeable = false;
+			settings.dragable = false;
+			settings.hotSpotY=settings.top;
+			settings.hotSpotX=settings.left;
+			position = 0;
+			
+			console ={};
+			console.log = function(){};
+			
+			if(settings.hotSpotY-settings.height-bubble_height-parseInt(this.css("border-top-width"))<dim.Y){
+				//bubble on top
+				settings.top = settings.hotSpotY+bubble_height-parseInt(this.css("border-top-width"));
+			}
+			else{
+				//bubble on bottom
+				settings.top = settings.hotSpotY-settings.height-bubble_height+(top.ie?parseInt(this.css("border-bottom-width")):-parseInt(this.css("border-top-width")));
+				position+=2;
+			}
+			if(settings.hotSpotX+settings.width+parseInt(this.css("border-left-width"))+parseInt(this.css("border-right-width"))>(dim.X+dim.wW)){
+				//bubble on right
+				settings.left = settings.hotSpotX-parseInt(this.css("border-left-width"))-parseInt(this.css("border-right-width"))-settings.width;
+				position++;
+			}
+			else{
+				//bubble on left
+				settings.left = settings.hotSpotX-parseInt(this.css("border-left-width"));
+			}
+
+			$("body").append("<div id='balloon_"+settings.id+"' class='balloon"+(position>=2?"B":"T")+(position%2?"R":"L")+"' style='z-index:"+(popup_top++)+";left:"+(settings.hotSpotX-(position%2?bubble_width:0))+"px;top:"+(settings.hotSpotY-(position>=2?bubble_height:0))+"px'>");
+		}
+		
+		this.css({top:settings.top+"px",
+			left:settings.left+"px",
+			width:settings.width+"px",
+			height:settings.height+"px",
 			opacity:settings.opacity
 			});
 		
@@ -271,13 +314,14 @@
 		else
 			html = ('<div class="scrollDiv">'+settings.html+'</div>');
 	
-		this.html('<div class="jqmnTitle jqDrag"><h1>'+settings.title+'</h1></div><div class="jqmnContent">'+html+'</div><img src="../img/close_icon.png" class="jqmClose" alt="close" /><div class="jqResize" />');
+		this.html('<div class="jqmnTitle jqDrag"><h1>'+settings.title+'</h1></div><div class="jqmnContent">'+html+'</div><img src="../img/close_icon.png" class="jqmClose" alt="close" />'+(settings.resizeable?'<div class="jqResize" />':''));
 	
 		var data = {El:this,fY:settings.minTop,fX:settings.minLeft,tX:settings.maxRight,tY:settings.maxBottom,
 			fW:settings.minWidth,tW:settings.maxWidth,fH:settings.minHeight,tH:settings.maxHeight,
 			destroy:settings.destroy,opacity:settings.opacity,moveOpacity:settings.moveOpacity,close:settings.closeCallback}
 
 		//Make window Dragable
+		if(settings.dragable)
 		$(".jqDrag", this).bind('mousedown',data,function(event){
 			//set to top
 			event.data.El.css("z-index",popup_top++);
@@ -290,10 +334,11 @@
 			var data = $.mbPopupFn.parseDimensions(event);
 			
 			//bind mouse events to popup
-			$().bind("mousemove",data,$.mbPopupFn.drag).bind('mouseup',event.data,$.mbPopupFn.stopdrag);
+				$().bind("mousemove",$.extend(data,{drag:true}),$.mbPopupFn.move).bind('mouseup',event.data,$.mbPopupFn.stop);
 		});
 		
 		//Make Window resizable
+		if(settings.resizeable)
 		$(".jqResize", this).bind('mousedown',data,function(event){
 			//set to top
 			event.data.El.css("z-index",popup_top++);
@@ -306,27 +351,36 @@
 			var data = $.mbPopupFn.parseDimensions(event);
 			
 			//bind mouse events to popup
-			$().bind("mousemove",data,$.mbPopupFn.resize).bind('mouseup',event.data,$.mbPopupFn.stopresize);
+				$().bind("mousemove",$.extend(data,{drag:false}),$.mbPopupFn.move).bind('mouseup',event.data,$.mbPopupFn.stop);
 		});
 		
 		//closeButton
 		$(".jqmClose", this).bind('click',data, function(event){
 			if(event.data.close)
 				event.data.close();
-			if(event.data.destroy)
+			if(event.data.destroy){
 				event.data.El.slideUp('slow', function(){$(this).remove();});
-			else
+				$("#balloon_"+event.data.El.attr("id")).remove();
+			}
+			else{
 				event.data.El.slideUp('slow');
+				$("#balloon_"+event.data.El.attr("id")).fadeOut();
+			}
 		});
 		
 		//raise on click
-		this.click(function(){this.style.zIndex=popup_top++});
+		this.click(function(){this.style.zIndex=popup_top++;$("#balloon_"+this.id).css("z-index", popup_top++);});
+		$("#balloon_"+settings.id).click(function(){$("#"+this.id.substr(8)).css("z-index", popup_top++);this.style.zIndex=popup_top++;});
+		
+		//raise top postition
+		popup_top++;
 	};
 	//helper functions
 	$.mbPopupFn = {
-		//on drag
-		drag:function(event){
-			//console.log("tesddt");			
+		//on mouse action
+		move:function(event){
+			//drag
+			if(event.data.drag){
 			var newPos = {X:event.data.X+event.pageX-event.data.pX,
 				Y:event.data.Y+event.pageY-event.data.pY};
 			if(event.data.fX!==false&&newPos.X<event.data.fX)
@@ -339,9 +393,9 @@
 				newPos.Y=event.data.tY-event.data.H;
 			
 			event.data.El.css({left:newPos.X,top:newPos.Y});
-		},
-		//on resize
-		resize:function(event){
+				return;
+			}
+			//resize
 			var newDim = {W:Math.max(event.pageX-event.data.pX+event.data.W,0),
 				H:Math.max(event.pageY-event.data.pY+event.data.H,0)};
 			if(event.data.fW!==false&&newDim.W<event.data.fW)
@@ -359,10 +413,10 @@
 						
 			event.data.El.css({width:newDim.W,height:newDim.H});
 		},
-		stopdrag:function(event){
+		stop:function(event){
 			event.data.El.css('opacity',event.data.opacity)
 			$("iframe", event.data.El).show();
-			$().unbind('mousemove',$.mbPopupFn.drag).unbind('mouseup',$.mbPopupFn.stopdrag);
+			$().unbind('mousemove',$.mbPopupFn.move).unbind('mouseup',$.mbPopupFn.stop);
 			$("#mouse_catcher").remove();
 		},
 		stopresize:function(event){
@@ -374,7 +428,9 @@
 		//parse move and resize dimensions
 		parseDimensions:function(d){
 			var dim = getScrollPos();
-			return {El:d.data.El,
+			var bd = {X:parseInt($(d.data.El).css("border-left-width"))+parseInt($(d.data.El).css("border-right-width")),
+				Y:parseInt($(d.data.El).css("border-top-width"))+parseInt($(d.data.El).css("border-bottom-width"))};
+			ret = {El:d.data.El,
 				fX:(d.data.fX=="window"?dim.X:(d.data.fX=="document"?0:(d.data.fX<0?dim.dW-d.data.fX:d.data.fX))),
 				fY:(d.data.fX=="window"?dim.Y:(d.data.fY=="document"?0:(d.data.fY<0?dim.dH-d.data.fY:d.data.fY))),
 				tX:(d.data.tX=="window"?dim.X+dim.wW:(d.data.tX=="document"?dim.dW:(d.data.tX<0?dim.dW-d.data.tX:d.data.tX))),
@@ -389,6 +445,9 @@
 				H:parseInt(d.data.El.css("height")),
 				pX:d.pageX,pY:d.pageY
 			};
+			if(ret.tX)ret.tX-=bd.X;
+			if(ret.tY)ret.tY-=bd.Y;
+			return ret;	
 		}
 	};
 	})

Modified: branches/dev_lenkne/http/javascripts/wfs.js
===================================================================
--- branches/dev_lenkne/http/javascripts/wfs.js	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/javascripts/wfs.js	2008-08-05 15:35:27 UTC (rev 2741)
@@ -43,7 +43,7 @@
 var usemap = "";
 var mod_usemap_radius = 10;
 var mod_usemap_line_tolerance = 5;
-var useCheckboxForHighlighting = true;
+var useCheckboxForHighlighting = false;
 
 var mb_wfs_fetch = new GeometryArray();
 
@@ -70,8 +70,10 @@
 	mb_registerSubFunctions('mod_usemap("")');
 }
 
-if (useCheckboxForHighlighting) { 
-	mb_registerSubFunctions('highlight.paint()');
+if (useCheckboxForHighlighting) {
+	eventInit.register(function() {
+		mb_registerSubFunctions('highlight.paint()');
+	});
 }
 
 /*
@@ -227,8 +229,9 @@
 			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
 		} else if (myconf['namespaces'][q]['name'] == featureNS) {
 			ns_featureNS = true;
-			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
-		}		
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" '
+			strForSchemaLocation = myconf['namespaces'][q]['location'];
+		}
 	}
 	
 	if (ns_gml == false) str += 'xmlns:gml="http://www.opengis.net/gml" ';
@@ -237,9 +240,14 @@
 	if (ns_featureNS == false) str += 'xmlns:"+featureNS+"="http://www.someserver.com/"+featureNS+"" ';
 	if (ns_wfs == false) str += 'xmlns:wfs="http://www.opengis.net/wfs" ';
 	
-	str += 'xsi:schemaLocation="http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">';
+	str += 'xsi:schemaLocation="http://www.opengis.net/wfs';
+	str += ' http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd';
+	str += ' ' + strForSchemaLocation;
+	str += ' '+ myconf['wfs_describefeaturetype'];
+	//str += mb_getConjunctionCharacter(myconf['wfs_describefeaturetype']);
+	//str += 'typename=' + myconf['featuretype_name'];
+	str += '">';
 
-	
 	//
 	// ---------------------------------------- SAVE -------------------------------------------------
 	//

Deleted: branches/dev_lenkne/http/php/database-mysql.php
===================================================================
--- branches/dev_lenkne/http/php/database-mysql.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/database-mysql.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,409 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/database-mysql.php
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/**
- * \file
- * \brief MySQL database connection/querying layer
- * 
- * MySQL database connection/querying layer
- *
- * example:
- * \code
- * include_once(dirname(__FILE__)."/afwphp/database-mysql.php");  
- * $sys_dbhost=...                            
- * $sys_dbuser=...                            
- * $sys_dbpasswd=...                           
- * $sys_dbname=...                            
- *                                             
- * db_connect();                               
- * ...                                         
- * $rs = db_query("select * from table");      
- * while($row = db_fetch_array($rs));
- *  ...
- * \endcode
- */
-
-/**
- * System-wide database type
- *
- * @var	constant		$sys_database_type
- */
-$sys_database_type='mysql';
-
-/**
- *  Connect to the database
- *
- *  Notice the global vars that must be set up
- *  Notice the global vars $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname that must be set up 
- *  in other functions in this library
- */
-include_once(dirname(__FILE__)."/../../http/classes/class_mb_exception.php");
-include_once(dirname(__FILE__)."/../../http/classes/class_checkInput.php");
-function db_escapestring($unescaped_string){
-	return @mysql_escape_string($unescaped_string);
-}
-function db_escape_string($unescaped_string){
-	return @mysql_escape_string($unescaped_string);
-}
-
-
-function db_connect($DBSERVER="",$OWNER="",$PW="") {
-	global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,
-		$conn,$conn_update,$sys_db_use_replication,$sys_dbreadhost;
-
-	
-	if ($DBSERVER)
-		$sys_dbhost = $DBSERVER; 
-	if ($OWNER)
-		$sys_dbuser = $OWNER; 
-	if ($PW)
-		$sys_dbpasswd = $PW; 
-	if (PORT!=''){
-		$sys_dbport = ':'.PORT;
-	}
-	else{
-		$sys_dbport = '';
-	} 
-		
-	if ($sys_db_use_replication) {
-		//
-		//  if configured for replication, $conn is the read-only host
-		//  we do not connect to update server until needed
-		//
-		$conn = @mysql_pconnect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
-		$conn_update=@mysql_pconnect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
-	} else {
-		$conn = @mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd);
-		#echo "@mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd)";
-	}
-	if ($sys_dbname)
-		@mysql_select_db($sys_dbname);
-	return $conn;
-}
-
-function db_select_db($DB,$con="") {
-	global $conn,$sys_dbname; 
-	$sys_dbname = $DB;	
-	$_con = $con ? $con : $conn;
-	$ret = @mysql_select_db($sys_dbname,$_con);
-	if ($ret){
-		return true;
-	}
-	else {
-		return false;
-	}
-//	echo "$ret=@mysql_select_db($sys_dbname,$_con);";
-}
-
-/**
- *  Query the database
- *
- *  @param		$qstring (string)	SQL statement
- *  @param		$limit (int)		How many rows do you want returned
- *  @param		$offset (int)		Of matching rows, return only rows starting here
- */
-function db_query($qstring,$limit='-1',$offset=0) {
-	global $QUERY_COUNT,$sys_db_use_replication,$sys_db_is_dirty,$DB,
-		$sys_dbname,$conn,$conn_update,$sys_dbhost,$sys_dbuser,$sys_dbpasswd;
-
-	$QUERY_COUNT++;
-	if(!$sys_dbname && $DB)
-	$sys_dbname = $DB;
-	db_select_db($sys_dbname,$conn);
-	
-	if ($limit > 0) {
-		if (!$offset || $offset < 0) {
-			$offset=0;
-		}
-		$qstring=$qstring." LIMIT $offset,$limit";
-	}
-//	if ($GLOBALS['IS_DEBUG'])
-		$GLOBALS['G_DEBUGQUERY'] .= $qstring . "<P><BR>\n";
-
-	//
-	//are we configured to try to use replication?
-	//
-	if ($sys_db_use_replication) {
-		//
-		//if we haven't yet done an insert/update, 
-		//read from the read-only db
-		//
-		if (!$sys_db_is_dirty && mb_eregi("^( )*(select)",$qstring)) {
-			if ($QUERY_COUNT%3==0) {
-				// 1/3rd of read queries go to master for now
-				return @mysql_db_query($sys_dbname,$qstring,$conn_update);
-			} else {
-				return @mysql_db_query($sys_dbname,$qstring,$conn);
-			}
-		} else {
-			//must be an update/insert/delete query - go to master server
-			$sys_db_is_dirty=true;
-			return @mysql_db_query($sys_dbname,$qstring,$conn_update);
-		}
-	} else {
-		$ret = @mysql_db_query($sys_dbname,$qstring,$conn);
-//		echo "@mysql_db_query($sys_dbname,$qstring,$conn); ret=$ret<br>";
-		if(!$ret){
-			$e = new mb_exception("db_query($qstring)=$ret db_error=".db_error());
-		}
-		return $ret;
-	}
-	//echo "SQL__".$qstring;
-}
-/**
- *  prepare and query the database
- *
- *  @param		$qstring (string)	SQL statement
- *  @param		$params (array string params)		
- *  @param		$types (array string types)		
- */
-function db_prep_query($qstring, $params, $types){
-	$ci = new checkInput($qstring,$params,$types);
-	$params = $ci->v; 
-	for ($i=0; $i<count($params); $i++){
-		$needle = "$".strval($i+1);
-		$tmp = '';
-		if($params[$i] !== NULL){
-			if($types[$i] == 's'){ $tmp .= "'"; }
-			$tmp .= $params[$i];
-			if($types[$i] == 's'){ $tmp .= "'"; }
-		}
-		else{
-			$tmp .= "NULL";
-		}
-		$posa = mb_strpos($qstring, $needle);
-		$posb = mb_strlen($needle);
-		$qstring = mb_substr($qstring,0,$posa).$tmp.mb_substr($qstring,($posa + $posb));	
-	}
-	$r = db_query($qstring);
-	return $r;
-}
-/**
- *	Begin a transaction
- *
- *	Begin a transaction for databases that support them
- *	may cause unexpected behavior in databases that don't
- */
-function db_begin() {
-	return db_query("BEGIN WORK");
-}
-
-/**
- * Commit a transaction
- *
- * Commit a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_commit() {
-	return db_query("COMMIT");
-}
-
-/**
- * Roll back a transaction
- *
- * Rollback a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_rollback() {
-	$str = db_error();
-	db_query("ROLLBACK");
-	die('sql error: ' . $str . " ROLLBACK performed....");
-}
-
-/**
- * Returns the number of rows in this result set
- *
- *  @param		$qhandle (string)	Query result set handle
- */
-function db_numrows($qhandle) {
-	// return only if qhandle exists, otherwise 0
-	if ($qhandle) {
-		return @mysql_numrows($qhandle);
-	} else {
-		return 0;
-	}
-}
-/**
- * Returns the number of rows in this result set
- *
- *  @param		$qhandle (string)	Query result set handle
- * php 3,4,5
- */
-function db_num_rows($qhandle) {
-	// return only if qhandle exists, otherwise 0
-	if ($qhandle) {
-		return @mysql_num_rows($qhandle);
-	} else {
-		return 0;
-	}
-}
-
-/**
- *  Frees a database result properly 
- *
- *  @param	$qhandle (string)	Query result set handle
- */
-function db_free_result($qhandle) {
-	return @mysql_free_result($qhandle);
-}
-
-/**
- *  Reset a result set.
- *
- *  Reset is useful for db_fetch_array sometimes you need to start over
- *
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$row (int)		Row number
- */
-function db_reset_result($qhandle,$row=0) {
-	return mysql_data_seek($qhandle,$row);
-}
-
-/**
- *  Returns a field from a result set
- *
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$row (int)		Row number
- *  @param		$field (string)	Field name
- */
-function db_result($qhandle,$row,$field) {
-	return @mysql_result($qhandle,$row,$field);
-}
-
-/**
- *  Returns the number of fields in this result set
- *
- *  @param		$lhandle (string)	Query result set handle
- */
-function db_numfields($lhandle) {
-	return @mysql_numfields($lhandle);
-}
-
-/**
- *  Returns the number of fields in this result set
- *
- *  @param		$lhandle (string)	Query result set handle
- * php 3,4,5
- */
-function db_num_fields($lhandle) {
-	return @mysql_num_fields($lhandle);
-}
-
-/**
- *  Returns the number of rows changed in the last query
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- */
-function db_fieldname($lhandle,$fnumber) {
-	   return @mysql_fieldname($lhandle,$fnumber);
-}
-
-/**
- *  Returns the number of rows changed in the last query
- *
- *  @param		$qhandle (string)	Query result set handle
- */
-function db_affected_rows($qhandle) {
-	return @mysql_affected_rows();
-}
-
-/**
- *  Fetch an array
- *
- *  Returns an associative array from 
- *  the current row of this database result
- *  Use db_reset_result to seek a particular row
- *
- *  @param		$qhandle (string)	Query result set handle
- */
-function db_fetch_array($qhandle) {
-	return @mysql_fetch_array($qhandle);
-}
-
-/**                                                       
- * fetch a row into an array 
- * 
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$fnumber (int)	Column number
- */
-function db_fetch_row($qhandle,$fnumber=0) {
-	  return @mysql_fetch_row($qhandle);
-}
-
-/**
- *  Returns the last primary key from an insert
- *
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$table_name (string)	Is the name of the table you inserted into
- *  @param		$pkey_field_name (string)	Is the field name of the primary key
- */
-function db_insertid($qhandle="",$table_name="",$pkey_field_name="") {
-	return @mysql_insert_id();
-}
-
-function db_insert_id($qhandle="",$table_name="",$pkey_field_name="") {
-	return @mysql_insert_id();
-}
-
-/**
- * Returns the last error from the database
- */
-function db_error() {
-	return @mysql_error();
-}
-
-/**
- * Get the flags associated with the specified field in a result 
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- *
- * 					Examples: "not_null", "primary_key", "unique_key", "multiple_key",					 
- *                    "blob", "unsigned", "zerofill","binary", "enum",                  
- *                    "auto_increment", "timestamp"                                     
- */
-
-function db_field_flags($lhandle,$fnumber) {
-	   return @mysql_field_flags($lhandle,$fnumber);
-}
-
-/**                                                       
- * Get the type of the specified field  
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- */                                                       
-                                                          
-function db_field_type($lhandle,$fnumber) {               
-	   return @mysql_field_type($lhandle,$fnumber);         
-}                                                         
-
-/**                                                       
- * Get the length of the specified field                                                            
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- */                                                       
-                                                          
-function db_field_len($lhandle,$fnumber) {               
-	   return @mysql_field_len($lhandle,$fnumber);         
-} 
-
-?>
\ No newline at end of file

Deleted: branches/dev_lenkne/http/php/database-pgsql.php
===================================================================
--- branches/dev_lenkne/http/php/database-pgsql.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/database-pgsql.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,436 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/database-pgsql.php
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/**
- * \file
- * \brief MySQL database connection/querying layer
- * 
- * MySQL database connection/querying layer
- *
- * example:
- * \code
- * include_once(dirname(__FILE__)."/afwphp/database-mysql.php");  
- * $sys_dbhost=...                            
- * $sys_dbuser=...                            
- * $sys_dbpasswd=...                           
- * $sys_dbname=...                            
- *                                             
- * db_connect();                               
- * ...                                         
- * $rs = db_query("select * from table");      
- * while($row = db_fetch_array($rs));
- *  ...
- * \endcode
- */
-
-/**
- * System-wide database type
- *
- * @var	constant		$sys_database_type
- */
-$sys_database_type='pgsql';
-
-/**
- *  Connect to the database
- *
- *  Notice the global vars that must be set up
- *  Notice the global vars $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname that must be set up 
- *  in other functions in this library
- */
-include_once(dirname(__FILE__)."/../../http/classes/class_mb_exception.php");
-include_once(dirname(__FILE__)."/../../http/classes/class_checkInput.php");
-function db_escape_string($unescaped_string){
-	return @pg_escape_string(stripslashes($unescaped_string));
-}
-$DB = DB;
-
-
-function db_connect($DBSERVER="",$OWNER="",$PW="") {
-	global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug;
-	global $conn,$conn_update,$DB;	
-
-	
-	$db_debug=0;
-	if ($DBSERVER)
-		$sys_dbhost = $DBSERVER; 
-	if ($OWNER)
-		$sys_dbuser = $OWNER; 
-	if ($PW && $PW != null)
-		$sys_dbpasswd = $PW; 
-	
-	$sys_dbport = PORT; 	
-		
-	if($GLOBALS['DB'])
-		$sys_dbname = $DB;
-			
-	$connstring = "";
-	if ($sys_dbuser)		
-		$connstring.=" user=$sys_dbuser";
-	if ($sys_dbname)		
-		$connstring.=" dbname=$sys_dbname";		
-	if ($sys_dbhost)		
-		$connstring.=" host=$sys_dbhost";	
-	if ($sys_dbport)		
-		$connstring.=" port=$sys_dbport";		
-	if ($sys_dbpasswd)		
-		$connstring.=" password=$sys_dbpasswd";		
-	
-	if ($db_debug)
-		echo $connstring." ";		
-
-	$conn = pg_connect($connstring);		
-
-		#if(isset($sys_db_clientencoding) && $sys_db_clientencoding > "")
-		#{
-		#pg_set_client_encoding ( $conn, $sys_db_clientencoding);
-		#}
-	#return $conn;
-	if ($db_debug)
-		echo "conn=".$conn;
-#echo $connstring;
-#if(!$conn)
-#{echo "FEHLER in Connection";
-#pg_error($conn);}	
-	
-	return $conn;
-}
-
-function db_select_db($DB,$con="") {
-	global $conn,$sys_dbname; 
-#	$sys_dbname = DB;	
-#	$_con = $con ? $con : $conn;
-#	$ret = @mysql_select_db($sys_dbname,$_con);
-//	echo "$ret=@mysql_select_db($sys_dbname,$_con);";
-}
-
-/**
- *  Query the database
- *
- *  @param		$qstring (string)	SQL statement
- *  @param		$limit (int)		How many rows do you want returned
- *  @param		$offset (int)		Of matching rows, return only rows starting here
- */
-function db_query($qstring) {
-	global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug,
-		$conn,$conn_update,$QUERY_COUNT,$DBSERVER,$OWNER,$PW,$DB;
-	$QUERY_COUNT++;
-	$ret = pg_exec($qstring);
-//	$e = new mb_exception("not ps:  ".$_SERVER['SCRIPT_FILENAME']." : ".$qstring);
-	if(!$ret){
-		$e = new mb_exception("db_query($qstring)=$ret db_error=".db_error());
-	}
-	return $ret;	
-}
-/**
- *  prepare and query the database
- *
- *  @param		$qstring (string)	SQL statement
- *  @param		$params (array params as strings)		
- *  @param		$types (array types as strings)		
- */
-function db_prep_query($qstring, $params, $types){
-	$ci = new checkInput($qstring,$params,$types);
-	$params = $ci->v; 
-	if(PREPAREDSTATEMENTS == false){
-		for ($i=0; $i<count($params); $i++){
-			$needle = "$".strval($i+1);
-			$tmp = '';
-			if($params[$i] !== NULL){
-				if($types[$i] == 's'){ $tmp .= "'"; }
-				$tmp .= $params[$i];
-				if($types[$i] == 's'){ $tmp .= "'"; }
-			}
-			else{
-				$tmp .= "NULL";
-			}
-			$posa = mb_strpos($qstring, $needle);
-			$posb = mb_strlen($needle);
-			$qstring = mb_substr($qstring,0,$posa).$tmp.mb_substr($qstring,($posa + $posb));	
-		}
-		$r = db_query($qstring);
-		if(!$r){
-			$e = new mb_exception("Error while executing sql statement in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$qstring.", Error: ".db_error());
-		}
-	}
-	else{
-		$result = pg_prepare("", $qstring);
-		if(!$result){
-			$e = new mb_exception("Error while preparing statement in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$qstring.", Error: ".db_error());
-		}
-		$r = pg_execute("", $params);
-		if(!$r){
-			$e = new mb_exception("Error while executing prepared statement in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$qstring.", Error: ".db_error());
-		}
-	}	
-	return $r;
-}
-/**
- *	Begin a transaction
- *
- *	Begin a transaction for databases that support them
- *	may cause unexpected behavior in databases that don't
- */
-function db_begin() {
-	return db_query("BEGIN WORK");
-}
-
-/**
- * Commit a transaction
- *
- * Commit a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_commit() {
-	return db_query("COMMIT");
-}
-
-/**
- * Roll back a transaction
- *
- * Rollback a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_rollback() {
-	$str = db_error();
-	db_query("ROLLBACK");
-	die('sql error: ' . $str . " ROLLBACK performed....");
-}
-
-/**
- * Returns the number of rows in this result set
- *
- *  @param		$qhandle (string)	Query result set handle
- */
-function db_numrows($qhandle) {
-	// return only if qhandle exists, otherwise 0
-	if ($qhandle) {
-		return @pg_numrows($qhandle);
-	} else {
-		return 0;
-	}
-}
-/**
- * Returns the number of rows in this result set
- *
- *  @param		$qhandle (string)	Query result set handle
- *	php > 4.2
- */ 
-function db_num_rows($qhandle) {
-	// return only if qhandle exists, otherwise 0
-	if ($qhandle) {
-		return @pg_num_rows($qhandle);
-	} else {
-		return 0;
-	}
-}
-
-/**
- *  Frees a database result properly 
- *
- *  @param	$qhandle (string)	Query result set handle
- */
-function db_free_result($qhandle) {
-	return @pg_freeresult($qhandle);
-}
-
-/**
- *  Reset a result set.
- *
- *  Reset is useful for db_fetch_array sometimes you need to start over
- *
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$row (int)		Row number
- */
-function db_reset_result($qhandle,$row=0) {
-#dummy
-	return 0;#mysql_data_seek($qhandle,$row);
-	
-}
-
-/**
- *  Returns a field from a result set
- *
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$row (int)		Row number
- *  @param		$field (string)	Field name
- */
-function db_result($qhandle,$row,$field) {
-	return @pg_result($qhandle,$row,$field);
-}
-
-/**
- *  Returns the number of fields in this result set
- *
- *  @param		$lhandle (string)	Query result set handle
- */
-function db_numfields($lhandle) {
-	return @pg_numfields($lhandle);
-}
-
-/**
- *  Returns the number of fields in this result set
- *
- *  @param		$lhandle (string)	Query result set handle
- *	php >4.2
- */
-function db_num_fields($lhandle) {
-	return @pg_num_fields($lhandle);
-}
-
-/**
- *  Returns the number of rows changed in the last query
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- */
-function db_fieldname($lhandle,$fnumber) {
-	   return @pg_fieldname($lhandle,$fnumber);
-}
-
-/**
- *  Returns the number of rows changed in the last query
- *
- *  @param		$qhandle (string)	Query result set handle
- */
-function db_affected_rows($qhandle) {
-	
-	return @pg_cmdtuples($qhandle);
-}
-
-/**
- *  Fetch an array
- *
- *  Returns an associative array from 
- *  the current row of this database result
- *  Use db_reset_result to seek a particular row
- *
- *  @param		$qhandle (string)	Query result set handle
- */
-function db_fetch_array($qhandle) {
-	return @pg_fetch_array($qhandle);
-}
-
-function db_fetch_all($qhandle){
-		return @pg_fetch_all($qhandle);
-}
-/**                                                       
- * fetch a row into an array 
- * 
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$fnumber (int)	Column number
- */
-function db_fetch_row($qhandle,$fnumber=0) {
-	  return pg_fetch_row($qhandle);
-}
-
-/**
- *  Returns the last primary key from an insert
- *
- *  @param		$qhandle (string)	Query result set handle
- *  @param		$table_name (string)	Is the name of the table you inserted into
- *  @param		$pkey_field_name (string)	Is the field name of the primary key
- */
-function db_insertid($qhandle="",$table_name="",$pkey_field_name="") {
-	$res=db_query("SELECT max($pkey_field_name) AS id FROM $table_name");
-    if ($res && db_numrows($res) > 0) {
-        return @db_result($res,0,'id');
-    } else {
-        return 0;
-    }
-}
-
-
-
-
-function db_insert_id($qhandle="",$table_name="",$pkey_field_name="") {
-		global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug,
-		$conn,$conn_update,$QUERY_COUNT,$DBSERVER,$OWNER,$PW,$DB;
-	/*	
-	$oid =pg_last_oid($qhandle);
-	echo $oid;
-	
-	$res=db_query("SELECT ".$pkey_field_name." FROM ".$table_name." WHERE oid =".$oid );
-    if ($res && db_numrows($res) > 0) {
-        return @db_result($res,0,0);
-    } else {
-        return 0;
-    }*/
-    $res=db_query("SELECT max($pkey_field_name) AS id FROM $table_name");
-    if ($res && db_numrows($res) > 0) {
-        return db_result($res,0,'id');
-    } else {
-        return 0;
-    }
-}
-
-function db_last_oid()
-      {
-      	global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug,
-		$conn,$conn_update,$QUERY_COUNT;
-        global $DBSERVER,$OWNER,$PW,$DB	;
-             return pg_getlastoid($conn);
-      }
-
-
-/**
- * Returns the last error from the database
- */
-function db_error() {
-	return @pg_last_error();
-}
-
-/**
- * Get the flags associated with the specified field in a result 
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- *
- * 					Examples: "not_null", "primary_key", "unique_key", "multiple_key",					 
- *                    "blob", "unsigned", "zerofill","binary", "enum",                  
- *                    "auto_increment", "timestamp"                                     
- */
-
-function db_field_flags($lhandle,$fnumber) {
-	   print "db_field_flags()	isn't implemented";
-	   
-}
-
-/**                                                       
- * Get the type of the specified field  
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- */                                                       
-                                                          
-function db_field_type($lhandle,$fnumber) {               
-	   return @pg_fieldtype($lhandle,$fnumber);         
-}                                                         
-
-/**                                                       
- * Get the length of the specified field                                                            
- *
- *  @param		$lhandle	(string) Query result set handle
- *  @param		$fnumber (int)	Column number
- */                                                       
-                                                          
-function db_field_len($lhandle,$fnumber) {               
-	   return @pg_fieldlen($lhandle,$fnumber);         
-} 
-
-?>
\ No newline at end of file

Modified: branches/dev_lenkne/http/php/mb_validateSession.php
===================================================================
--- branches/dev_lenkne/http/php/mb_validateSession.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mb_validateSession.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -17,18 +17,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-session_start();
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 
-require_once(dirname(__FILE__)."/../php/system.php");
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
 
-//
-// establish database connection
-//
-$con = db_connect($DBSERVER, $OWNER, $PW);
-db_select_db(DB, $con);
-
 $e = new mb_notice("mb_validateSession.php: checking file " . $_SERVER["PHP_SELF"]);
 
 //

Modified: branches/dev_lenkne/http/php/mod_editGuiWms.php
===================================================================
--- branches/dev_lenkne/http/php/mod_editGuiWms.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_editGuiWms.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,748 +1,737 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_editGuiWms.php
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import_request_variables("PG");
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Edit GUI WMS</title>
-<?php
-include_once '../include/dyn_css.php';
-
-
-function toImage($text) {
-	$angle = 90;
-	if (extension_loaded("gd2")) {
-		return "<img src='../php/createImageFromText.php?text=" . urlencode($text) . "&angle=" . $angle . "'>";
-	}
-	return $text;
-}
-?>
-
-<script language="JavaScript">
-
-
-function edit_gaz(gui,wms,layer){
-	window.open("../php/mod_wfsLayerObj_conf.php?gui="+gui+"&wms="+wms+"&layer="+layer);
-}
-function validate(wert){
-	if(wert == 'delete_wms'){
-		if(document.form1.wmsList.selectedIndex == -1){
-			document.form1.wmsList.style.background = '#ff0000';
-		}else{
-
-			var secure = confirm("Remove WMS in this GUI ?");
-			if(secure == true){
-				document.form1.del.value='true';
-				document.form1.submit();
-			}
-		}
-	}
-
-	if(wert == 'up_wms'){
-		if(document.form1.wmsList.selectedIndex == -1){
-			document.form1.wmsList.style.background = '#ff0000';
-		}else{
-			if (document.form1.wmsList.selectedIndex>0){
-				document.form1.up.value='true';
-				document.form1.submit();
-			}
-		}
-	}
-
-	if(wert == 'down_wms'){
-		if(document.form1.wmsList.selectedIndex == -1){
-			document.form1.wmsList.style.background = '#ff0000';
-		}else{
-			if (document.form1.wmsList.selectedIndex<document.form1.wmsList.length-1){
-				document.form1.down.value='true';
-				document.form1.submit();
-			}
-		}
-	}
-	
-}
-function checkBoxValue(){
-   for(var i=0; i<document.forms[0].elements.length; i++){
-      if(document.forms[0].elements[i].type == 'checkbox'){
-         if(document.forms[0].elements[i].checked == true){
-            document.forms[0].elements[i].value = '1';
-         }
-         else{
-            document.forms[0].elements[i].value = '0';
-            document.forms[0].elements[i].checked = true;
-         }
-      }
-      if(document.forms[0].elements[i].type == 'text' && ( document.forms[0].elements[i].name.indexOf("minscale") > -1 || document.forms[0].elements[i].name.indexOf("maxscale") > -1 )){
-         var nr = parseInt(document.forms[0].elements[i].value);
-         if(isNaN(nr) == true){document.forms[0].elements[i].value = 0;}
-         else{document.forms[0].elements[i].value = nr;}
-      }
-   }
-   document.forms[0].update_content.value=1;
-   document.forms[0].submit();
-}
-function getAllLayer(){
-   var arrayLayer = new Array();
-   var cntLayer = 0;
-   for(var i=0; i<document.forms[0].elements.length; i++){
-      if(document.forms[0].elements[i].name.indexOf("layer_id") > -1){
-         arrayLayer[cntLayer] = document.forms[0].elements[i].value;
-         cntLayer++;
-      }
-   }
-   return arrayLayer;
-}
-function setSubs(){
-   var arrayLayer = getAllLayer();
-   for(var i=0; i<arrayLayer.length; i++){
-      if(parseInt(eval("document.forms[0].L_" + arrayLayer[i] + "___layer_parent.value")) > 0){
-         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_status.checked = false");
-      }
-   }
-}
-function setLayer(def,status){
-   var arrayLayer = getAllLayer();
-   if(def == 'querylayer'){
-      for(var i=1; i<arrayLayer.length; i++){
-         if(eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.disabled == false")){
-            eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.checked = " + status);
-         }
-      }
-   }
-   if(def == 'visible'){
-      for(var i=1; i<arrayLayer.length; i++){
-         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_visible.checked = " + status);
-      }
-   }
-}
-function showSld(origUrl){
-	var url = document.getElementById("this_gui_wms_sldurl").value;
-	if(url==""){
-		if(origUrl=="")
-			return;
-		url=origUrl;
-	}
-	window.open(url);
-}
-</script>
-
-</head>
-<body>
-<?php
-
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-$con = db_connect($DBSERVER,$OWNER,$PW);
-db_select_db(DB,$con);
-
-$mb_user_id=$_SESSION["mb_user_id"];
-
-#delete gui_wms from gui
-if($del && $del == 'true'){
-	$sql="SELECT DISTINCT gui_wms_position from gui_wms WHERE fkey_gui_id = $1 and fkey_wms_id = $2";
-	$v = array($guiList,$wmsList);
-	$t = array('s','i');
-	$res = db_prep_query($sql,$v,$t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$wms_position = $row["gui_wms_position"];
-		$cnt++;
-	}
-	#if($cnt > 1){die("Error: WMS (ID) not unique!");}
-	
-		$sql = "Delete from gui_wms where fkey_gui_id = $1 and fkey_wms_id = $2 ";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		
-		$sql = "Delete from gui_layer where fkey_gui_id = $1 and gui_layer_wms_id = $2";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		
-		$del='false';
-	
-		$sql = "UPDATE gui_wms SET gui_wms_position = (gui_wms_position - 1) WHERE gui_wms_position > $1";
-		$sql .= " AND fkey_gui_id = $2 ";
-		$v = array($wms_position,$guiList);
-		$t = array('i','s');
-		$res = db_prep_query($sql,$v,$t);
-
-	unset($wmsList);
-}
-
-#update gui_wms_position
-if($up && $up == 'true'){
-	if ($wmsList!=""){
-		$sql = "SELECT gui_wms_position ";
-		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			$wms_position = $row["gui_wms_position"];
-		}
-	}
-	if($wms_position > 0){
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
-		$v = array(($wms_position - 1),$guiList,$wmsList);
-		$t = array('i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4 ";
-		$v = array($wms_position,($wms_position - 1),$guiList,$wmsList);
-		$t = array('i','i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-	}
-}
-
-if($down && $down == 'true'){
-	$max = 0; 
-	if ($wmsList!=""){
-		$sql = "SELECT gui_wms_position ";
-		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			$wms_position = $row["gui_wms_position"];
-		}
-		$sql = "SELECT MAX(gui_wms_position) as max FROM gui_wms WHERE fkey_gui_id = $1 ";
-		$v = array($guiList);
-		$t = array('s');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			$max = $row["max"];
-		}
-	}
-	if($wms_position < $max){
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
-		$v = array(($wms_position + 1),$guiList,$wmsList);
-		$t = array('i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4";
-		$v = array($wms_position,($wms_position + 1),$guiList,$wmsList);
-		$t = array('i','i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-	}
-}
-
-/*handle Updates*/
-if(isset($update_content) && $update_content == "1"){
-   if(isset($this_gui_wms_epsg)){
-      $sql = "UPDATE gui_wms set gui_wms_epsg = $1, gui_wms_mapformat = $2, ";
-      $sql .= "gui_wms_featureinfoformat = $3, gui_wms_exceptionformat = $4, ";
-      $sql .= "gui_wms_visible = $5, gui_wms_opacity = $6, gui_wms_sldurl = $7 ";
-      $sql .= "WHERE fkey_gui_id = $8 AND fkey_wms_id = $9";
-		$v = array($this_gui_wms_epsg,$this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
-		$t = array('s','s','s','s','i','i','s','s','i');
-		$res = db_prep_query($sql,$v,$t);
-   }
-   else{
-		$sql = "UPDATE gui_wms set gui_wms_mapformat = $1, ";
-		$sql .= "gui_wms_featureinfoformat = $2, gui_wms_exceptionformat = $3, ";
-		$sql .= "gui_wms_visible = $4, gui_wms_opacity = $5, gui_wms_sldurl = $6 ";
-		$sql .= "WHERE fkey_gui_id = $7 AND fkey_wms_id = $8";
-		$v = array($this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
-		$t = array('s','s','s','i','i','s','s','i');
-		$res = db_prep_query($sql,$v,$t);
-   }
-
-   /**/
-
-   $cnt = 0;
-   while(list($key,$val) = each($_REQUEST)){
-		if(preg_match("/___/", $key)){
-			$myKey = explode("___", $key);
-			if($myKey[1]!="layer_parent" && $myKey[1]!='layer_id' ){
-				$sql = "UPDATE gui_layer SET ".$myKey[1]." = $1 WHERE fkey_gui_id = $2 AND fkey_layer_id = $3";
-				$v = array($val,$this_gui,preg_replace("/L_/","",$myKey[0]));
-				if($myKey[1]=='gui_layer_style'){
-					$t = array('s','s','i');
-				}
-				else{
-					$t = array('i','s','i');
-				}
-				if(!$res = db_prep_query($sql,$v,$t)){
-					echo "FEHLER in ZEILE 288";
-				}
-			}
-		}
-	}
-}
-
-echo "<form name='form1' action='" . $self ."' method='post'>";
-echo "<table cellpadding='3' cellspacing='3' border='0' class='table_top'>";
-
-echo "<tr>";
-echo "<td>";
-echo "GUI";
-echo "</td>";
-echo "<td>";
-echo "WMS-TITLE";
-echo "</td>";
-echo "<td>";
-echo "</td>";
-echo "<tr>";
-
-echo "<td>";
-
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-$admin = new administration();
-$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
-
-$gui_id =array();
-if (count($ownguis)>0){
-	for($i=0; $i<count($ownguis); $i++){
-		$gui_id[$i]=$ownguis[$i];
-	}
-}
-
-echo"<select size='8' name='guiList' onchange='document.form1.wmsList.selectedIndex = -1;submit()'>";
-$selected_gui_id="";
-
-for ($i=0; $i<count($ownguis);$i++){
-   echo "<option value='".$gui_id[$i]."' ";
-   if($guiList && $guiList == $gui_id[$i]){
-      echo "selected";
-      $selected_gui_id=$gui_id[$i];
-   }
-   else{
-      if ($i==0){
-         echo "selected";
-         $selected_gui_id=$gui_id[$i];
-		}
-   }
-   echo ">".$gui_id[$i]."</option>";
-}
-
-echo "</select>";
-echo "</td>";
-echo "<td>";
-
-$sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
-$sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
-$v = array($selected_gui_id);
-$t = array('s');
-$res = db_prep_query($sql,$v,$t);
-$count_wms = 0;
-echo "<select size='8' name='wmsList' style='width:200px' onchange='submit()'>";
-
-while($row = db_fetch_array($res)){
-	echo "<option value='".$row["wms_id"]."' ";
-	if(isset($wmsList) && $wmsList == $row["wms_id"]){
-		echo "selected";
-	}
-	echo ">".$row["gui_wms_position"]." - ".$row["wms_title"]."</option>";
-	$count_wms++;
-}
-echo "</select>";
-echo "</td><td>";
-echo "<input class='myButton' type='button' name='up_wms' value=' up ' onClick='validate(\"up_wms\")'>";
-echo "<input type='hidden' name='up' value=''><br><br>";
-
-echo "<input class='myButton' type='button' name='down_wms' value='down'  onClick='validate(\"down_wms\")'>";
-echo "<input type='hidden' name='down' value=''><br><br>";
-
-echo "<input class='myButton' type='button' name='delete_wms' value='remove'  onClick='validate(\"delete_wms\")'>";
-echo "<input type='hidden' name='del' value=''>";
-
-echo "</td>";
-echo "</tr>";
-echo "</table>";
-
-
-if(isset($wmsList)){
-#gui_wms
-$sql_gw = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-$v = array($guiList,$wmsList);
-$t = array('s','i');
-$res_gw = db_prep_query($sql_gw,$v,$t);
-$cnt_gw = 0;
-while($row = db_fetch_array($res_gw)){
-   $gui_wms_position[$cnt_gw] = $row["gui_wms_position"];
-   $gui_wms_mapformat[$cnt_gw] = $row["gui_wms_mapformat"];
-   $gui_wms_featureinfoformat[$cnt_gw] = $row["gui_wms_featureinfoformat"];
-   $gui_wms_exceptionformat[$cnt_gw] = $row["gui_wms_exceptionformat"];
-   $gui_wms_epsg[$cnt_gw] = $row["gui_wms_epsg"];
-   $gui_wms_visible[$cnt_gw] = $row["gui_wms_visible"];
-   $gui_wms_opacity[$cnt_gw] = $row["gui_wms_opacity"];
-   $gui_wms_sldurl[$cnt_gw] = $row["gui_wms_sldurl"]; # sld url 
-   $cnt_gw++;
-}
-#wms
-$sql_w = "SELECT * FROM wms WHERE wms_id = $1";
-$v = array($wmsList);
-$t = array('i');
-$res_w = db_prep_query($sql_w,$v,$t);
-$cnt_w = 0;
-while($row = db_fetch_array($res_w)){
-   $wms_id[$cnt_w] = $row["wms_id"];
-   $wms_version[$cnt_w] = $row["wms_version"];
-   $wms_title[$cnt_w] = $row["wms_title"];
-   $wms_abstract[$cnt_w] = $row["wms_abstract"];
-   $wms_getcapabilities[$cnt_w] = $row["wms_getcapabilities"];
-   $wms_supportsld[$cnt_w] = $row["wms_supportsld"];  # Buttons zum sld support anzeigen?
-   $cnt_w++;
- }
-#wms_format
-$sql_wf = "SELECT * FROM  wms_format WHERE  fkey_wms_id = $1";
-$v = array($wmsList);
-$t = array('i');
-$res_wf = db_prep_query($sql_wf,$v,$t);
-$cnt_wf = 0;
-while($row = db_fetch_array($res_wf)){
-   $data_type[$cnt_wf] = $row["data_type"];
-   $data_format[$cnt_wf] = $row["data_format"];
-   $cnt_wf++;
- }
-#gui_layer
-$sql_gl = "SELECT l.*, gl.*, sld.sld_user_layer_id, sld.use_sld FROM layer AS l, gui_layer AS gl left outer join sld_user_layer AS sld on sld.fkey_layer_id = gl.fkey_layer_id WHERE l.layer_id = gl.fkey_layer_id AND gl.gui_layer_wms_id = $1 AND gl.fkey_gui_id = $2 AND (sld.fkey_gui_id = $3 or sld.fkey_gui_id is NULL) AND (sld.fkey_mb_user_id = $4 or sld.fkey_mb_user_id is NULL) ORDER BY l.layer_pos";
-$v = array($wmsList,$guiList,$guiList,$mb_user_id);
-$t = array('i','s','s','i');
-
-$res_gl = db_prep_query($sql_gl,$v,$t);
-$gui_layer_status = array();
-$gui_layer_selectable = array();
-$gui_layer_visible = array();
-$gui_layer_queryable = array();
-$gui_layer_querylayer = array();
-$gui_layer_minscale = array();
-$gui_layer_maxscale = array();
-$gui_layer_priority = array();
-$gui_layer_style = array();
-$gui_layer_wfs_featuretype = array();
-$layer_maxscale = array();
-$layer_id = array();
-$layer_parent = array();
-$layer_name = array();
-$layer_title = array();
-$layer_queryable = array();
-$layer_minscale = array();
-$layer_maxscale = array();
-$sld_user_layer_id = array();
-$use_sld = array();
-while($row = db_fetch_array($res_gl)){
-	array_push($gui_layer_status, $row["gui_layer_status"]);
-	array_push($gui_layer_selectable, $row["gui_layer_selectable"]);
-	array_push($gui_layer_visible, $row["gui_layer_visible"]);
-	array_push($gui_layer_queryable, $row["gui_layer_queryable"]);
-	array_push($gui_layer_querylayer, $row["gui_layer_querylayer"]);
-	array_push($gui_layer_minscale, $row["gui_layer_minscale"]);
-	array_push($gui_layer_maxscale, $row["gui_layer_maxscale"]);
-	array_push($gui_layer_priority, $row["gui_layer_priority"]);
-	array_push($gui_layer_style, $row["gui_layer_style"]);
-	array_push($gui_layer_wfs_featuretype, $row["gui_layer_wfs_featuretype"]);
-	array_push($layer_id, $row["layer_id"]);
-	array_push($layer_parent, $row["layer_parent"]);
-	array_push($layer_name, $row["layer_name"]);
-	array_push($layer_title, $row["layer_title"]);
-	array_push($layer_queryable, $row["layer_queryable"]);
-	array_push($layer_minscale, $row["layer_minscale"]);
-	array_push($layer_maxscale, $row["layer_maxscale"]);
-	array_push($sld_user_layer_id, $row["sld_user_layer_id"]);
-	array_push($use_sld, $row["use_sld"]);
-}
-
-#layer_epsg
-$sql_le = "SELECT * FROM layer_epsg WHERE  fkey_layer_id = $1";
-$v = array($layer_id[0]);
-$t = array('i');
-$res_le = db_prep_query($sql_le,$v,$t);
-$cnt_le = 0;
-while($row = db_fetch_array($res_le)){
-   $epsg[$cnt_le] = $row["epsg"];
-   $cnt_le++;
-}
- 
-
-echo "<div style='position:absolute;left:590px; top:180px;' ><input type='button' style='width:100px;height:100px;background-color:#0066cc' value='save' onclick='checkBoxValue()'></div>";
-echo "<table class='table_top'>";
-echo "<tr>";
-echo "<td colspan='2'>";
-echo "<a href='".$wms_getcapabilities[0];
-if( $wms_version[0] == "1.0.0"){ echo "&WMTVER=". $wms_version[0]."&REQUEST=capabilities";}
-else{echo "&VERSION=". $wms_version[0]."&REQUEST=GetCapabilities&SERVICE=WMS";}
-echo "' style='font-size:14px' target='_blank'>LINK: Capabilities</a>";
-echo "</td>";
-echo "<td align = right>WMS ID: " . $wms_id[0] . "</td>";
-echo "<tr>";
-#epsg
-if($gui_wms_position[0] == 0){
-  echo "<tr>";
-     echo "<td>EPSG: </td><td>";
-     echo "<select class='mySelect'  name='this_gui_wms_epsg'>";
-        for($i=0; $i<count($epsg); $i++){
-           echo "<option value='".$epsg[$i]."' ";
-           if($epsg[$i] == $gui_wms_epsg[0]){ echo "selected";}
-           echo ">".$epsg[$i]."</option>";
-        }
-     echo "</select>";
-     echo "</td>";
-  echo "</tr>";
-}
-#format
-echo "<tr>";
-   echo "<td>Mapformat: </td><td>";
-        echo "<select class='mySelect'  name='this_gui_wms_mapformat'>";
-        for($i=0; $i<count($data_format); $i++){
-           if($data_type[$i] == 'map'){
-              echo "<option value='".$data_format[$i]."' ";
-              if($data_format[$i] == $gui_wms_mapformat[0]){ echo "selected";}
-              echo ">".$data_format[$i]."</option>";
-           }
-        }
-     echo "</select>";
-   echo "</td>";
-
-echo "</tr>";
-
-echo "<tr>";
-   echo "<td>Infoformat: </td><td>";
-        echo "<select class='mySelect'  name='this_gui_wms_featureinfoformat'>";
-        echo "<option value='text/html'>text/html</option>";
-        for($i=0; $i<count($data_format); $i++){
-           if($data_type[$i] == 'featureinfo'){
-              echo "<option value='".$data_format[$i]."' ";
-              if($data_format[$i] == $gui_wms_featureinfoformat[0]){ echo "selected";}
-              echo ">".$data_format[$i]."</option>";
-           }
-        }
-     echo "</select>";
-   echo "</td>";
-echo "</tr>";
-
-echo "<tr>";
-   echo "<td>Exceptionformat: </td><td>";
-        echo "<select class='mySelect' name='this_gui_wms_exceptionformat'>";
-        for($i=0; $i<count($data_format); $i++){
-           if($data_type[$i] == 'exception'){
-              echo "<option value='".$data_format[$i]."' ";
-              if($data_format[$i] == $gui_wms_exceptionformat[0]){ echo "selected";}
-              echo ">".$data_format[$i]."</option>";
-           }
-        }
-     echo "</select>";
-   echo "</td>";
-echo "</tr><br>";
-
-# visibility
-echo "<tr>";
-	echo "<td>Visibility: </td><td>";
-	echo "<select class='mySelect' name='this_gui_wms_visible'>";
-	for($i=0; $i<3; $i++){
-		echo "<option value='".$i."' ";
-		if($i == $gui_wms_visible[0]){ echo "selected";}
-		echo ">";
-		if($i == '0'){
-			echo "hidden";
-		}
-		if($i == '1'){
-			echo "visible";
-		}
-		echo "</option>";           
-	}
-	echo "</select>";
-	echo "</td>";
-	
-echo "</tr>";
-
-# opacity
-echo "<tr>";
-	echo "<td>Opacity: </td><td>";
-	echo "<select class='mySelect' name='this_gui_wms_opacity'>";
-	for($i=0; $i<=100; $i+=10){
-		echo "<option value='".$i."' ";
-		if($i - $gui_wms_opacity[0]<=5&&$i - $gui_wms_opacity[0]>=-4){ echo "selected";}
-		echo ">";
-		echo $i."%";
-		echo "</option>";           
-	}
-	echo "</select>";
-	echo "</td>";
-	
-echo "</tr>";
-
-# sld support
-if($wms_supportsld[0]) { 
-		echo "<tr>";
-		echo "<td>SLD-URL: </td><td>";
-		echo "<input type='text' class='myText' name='this_gui_wms_sldurl' id='this_gui_wms_sldurl' title='".$gui_wms_sldurl[0]."' value='".$gui_wms_sldurl[0]."'>";
-		#echo "<a href='' onclick='return window.open(\"editor-start.php\");'><img src='sld_editor.png' border=0></a>";
-		#$layer_names = implode(",", $layer_name);
-        echo " <a href='javascript:showSld(\"".$gui_wms_sldurl[0]."\");'>SLD laden/anzeigen</a>";
-		echo "</td>";	
-	echo "</tr>";
-} else {
-	echo "<input type='hidden' value='' name='this_gui_wms_sldurl'>";
-}
-
-echo "</table><br>";
-
-echo "<table border='1' cellpadding='1'>";
-		echo "<tr>";
-
-                echo "<td>Nr.</td>";
-                echo "<td>ID</td>";
-                echo "<td>" . toImage('Parent') . "</td>";
-                echo "<td>Name</td>";
-                echo "<td>Title</td>";
-                echo "<td>" . toImage('on/off') . "</td>";
-                echo "<td>" . toImage('sel') . "</td>";
-                echo "<td>" . toImage('sel_default') . "</td>";
-                echo "<td>" . toImage('info') . "</td>";
-                echo "<td>" . toImage('info_default') . "</td>";
-                echo "<td>" . toImage('minScale 1:') . "</td>";
-                echo "<td>" . toImage('maxScale 1:') . "</td>";
-                echo "<td>" . toImage('Style') . "</td>";
-                echo "<td>" . toImage('Prio') . "</td>";
-                echo "<td>" . toImage('setWFS') . "</td>";
-                if($wms_supportsld[0]) {echo "<td>" . toImage('SLD') . "</td>";}
-        echo "</tr>";
-
-#echo "<tr><td>Nr.</td><td>ID</td><td>Parent</td><td>Name</td><td>Title</td><td>on/off</td><td>sel</td><td>sel_default</td><td>info</td><td>info_default</td><td>minScale 1:</td><td>maxScale 1:</td><td>Prio</td><td>setWFS</td></tr>";
-echo "<tr><td></td><td></td><td></td><td></td><td></td><td>";
-echo "<input type='button' class='LButton' value='Sublayer\noff' onclick='setSubs()'>";
-echo "</td><td></td><td>";
-echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"visible\",false)'>&nbsp;";
-echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"visible\",true)'></nobr>";
-echo"</td><td></td><td>";
-echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"querylayer\",false)'>&nbsp;";
-echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"querylayer\",true)'></nobr>";
-echo "</td><td></td><td></td><td></td></tr>";
-
-for($i=0; $i<count($layer_id); $i++){
-	
-#layer_styles
-$sql_styles = "SELECT * FROM layer_style WHERE  fkey_layer_id = $1";
-$v = array($layer_id[$i]);
-$t = array('i');
-$res_styles = db_prep_query($sql_styles,$v,$t);
-$cnt_styles= 0;
-$style = array();
-while($row = db_fetch_array($res_styles)){
-   $style[$cnt_styles] = $row["name"];
-   $cnt_styles++;
-}
-
- echo "<tr align='center'>";
-  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_nr' disabled value='".$i."'></td>";
-  echo "<td style='background:lightgrey'><input type='text' size='2' name='L_".$layer_id[$i]."___layer_id' value='".$layer_id[$i]."' readonly></td>";
-  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_parent' value='".$layer_parent[$i]."' readonly></td>";
-  echo "<td style='background:lightgrey'><input type='text' size='7' value='".$layer_name[$i]."' readonly></td>";
-  echo "<td><input type='text' name='".$layer_title[$i]."' size='12' value='".$layer_title[$i]."' ></td>";
-
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_status' type='checkbox' ";
-  if($gui_layer_status[$i] == 1){ echo "checked";}
-  echo "></td>";
-
-  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_selectable' type='checkbox' ";
-  if($gui_layer_selectable[$i] == 1){ echo "checked";}
-  echo "></td>";
-
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_visible' type='checkbox' ";
-  if($gui_layer_visible[$i] == 1){ echo "checked";}
-  echo "></td>";
-
-  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_queryable' type='checkbox' ";
-  if($gui_layer_queryable[$i] == 1){ echo "checked";}
-  if($layer_queryable[$i] == 0){ echo "disabled";}
-  echo "></td>";
-
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_querylayer' type='checkbox' ";
-  if($gui_layer_querylayer[$i] == 1){ echo "checked";}
-  if($layer_queryable[$i] == 0){ echo "disabled";}
-  echo "></td>";
-
-  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_minscale' type='text' size='5' value='".$gui_layer_minscale[$i]."'></td>";
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_maxscale' type='text' size='5' value='".$gui_layer_maxscale[$i]."'></td>";
-  
-  /**/
-  echo "<td>\n";
-  echo "<select class='mySelect' name='L_".$layer_id[$i]."___gui_layer_style'>\n";
-  	   echo "<option value=''";
-  	   if(count($style) ==0){ echo "selected";}
-  	   echo ">---</option>\n";
-  for($j=0;$j<count($style); $j++){
-       echo "<option value='".$style[$j]."'";
-       if($style[$j] == $gui_layer_style[$i]){ echo "selected";}
-       echo ">".$style[$j]."</option>\n";
- }
-  echo "</select></td>\n";
-  
-  /**/
-  echo "<td><select class='select_short' name='L_".$layer_id[$i]."___gui_layer_priority'>";
-  for($j=0; $j<count($gui_layer_priority); $j++){
-     echo "<option value='".$j."'";
-     if($j == $gui_layer_priority[$i]){echo "selected";}
-     echo ">".$j;
-     echo "</option>";
-  }
-  echo "</select></td>\n";
-  /* wfs configuration */
-	echo "<td>";
-	if ($i > 0) {
-		echo "<input class='button_wfs'name='gui_layer_gaz' type='button' onclick='edit_gaz(\"".$guiList."\",".$wmsList.",".$layer_id[$i].")' value='";
-		if($gui_layer_wfs_featuretype[$i] == ""){
-			echo "setWFS";
-		}
-		else{
-			echo "wfs ".$gui_layer_wfs_featuretype[$i];	
-		}
-		echo "'>";	
-	}
-	echo "</td>";
-	if($wms_supportsld[0]) {
-		echo "<td>";
-		if ($i > 0) {
-			echo "<input class='button3' name='gui_layer_sld' type='button' onclick='window.open(\"../sld/sld_main.php?".$urlParameters."&sld_gui_id=".$guiList."&sld_wms_id=".$wms_id[0]."&sld_layer_name=".$layer_name[$i]."\");' value='";
-			if ($sld_user_layer_id[$i] != "")
-				echo "sld:".$sld_user_layer_id[$i]."(".$use_sld[$i].")";
-			else
-				echo "SLD";
-			echo "'>";	
-		}
-		echo "</td>";	
-	}	
- echo "</tr>\n";
- if($i == 0){ echo "<tr><td colspan='14'><hr></td></tr>";}
-}
-echo "</table>\n";
-echo "<input type='hidden' name='this_gui' value='".$guiList."'>\n";
-echo "<input type='hidden' name='this_wms' value='".$wmsList."'>\n";
-echo "<input type='hidden' name='this_layer_count' value='".$cnt_l."'>\n";
-echo "<input type='hidden' name='update_content' value=''>\n";
-echo "</form>\n";
-}
-?>
-</body>
-</html>
\ No newline at end of file
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_editGuiWms.php
+# 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import_request_variables("PG");
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+<title>Edit GUI WMS</title>
+<?php
+include_once '../include/dyn_css.php';
+
+
+function toImage($text) {
+	$angle = 90;
+	if (extension_loaded("gd2")) {
+		return "<img src='../php/createImageFromText.php?text=" . urlencode($text) . "&angle=" . $angle . "'>";
+	}
+	return $text;
+}
+?>
+
+<script language="JavaScript">
+
+
+function edit_gaz(gui,wms,layer){
+	window.open("../php/mod_wfsLayerObj_conf.php?gui="+gui+"&wms="+wms+"&layer="+layer);
+}
+function validate(wert){
+	if(wert == 'delete_wms'){
+		if(document.form1.wmsList.selectedIndex == -1){
+			document.form1.wmsList.style.background = '#ff0000';
+		}else{
+
+			var secure = confirm("Remove WMS in this GUI ?");
+			if(secure == true){
+				document.form1.del.value='true';
+				document.form1.submit();
+			}
+		}
+	}
+
+	if(wert == 'up_wms'){
+		if(document.form1.wmsList.selectedIndex == -1){
+			document.form1.wmsList.style.background = '#ff0000';
+		}else{
+			if (document.form1.wmsList.selectedIndex>0){
+				document.form1.up.value='true';
+				document.form1.submit();
+			}
+		}
+	}
+
+	if(wert == 'down_wms'){
+		if(document.form1.wmsList.selectedIndex == -1){
+			document.form1.wmsList.style.background = '#ff0000';
+		}else{
+			if (document.form1.wmsList.selectedIndex<document.form1.wmsList.length-1){
+				document.form1.down.value='true';
+				document.form1.submit();
+			}
+		}
+	}
+}
+function checkBoxValue(){
+   for(var i=0; i<document.forms[0].elements.length; i++){
+      if(document.forms[0].elements[i].type == 'checkbox'){
+         if(document.forms[0].elements[i].checked == true){
+            document.forms[0].elements[i].value = '1';
+         }
+         else{
+            document.forms[0].elements[i].value = '0';
+            document.forms[0].elements[i].checked = true;
+         }
+      }
+      if(document.forms[0].elements[i].type == 'text' && ( document.forms[0].elements[i].name.indexOf("minscale") > -1 || document.forms[0].elements[i].name.indexOf("maxscale") > -1 )){
+         var nr = parseInt(document.forms[0].elements[i].value);
+         if(isNaN(nr) == true){document.forms[0].elements[i].value = 0;}
+         else{document.forms[0].elements[i].value = nr;}
+      }
+   }
+   document.forms[0].update_content.value=1;
+   document.forms[0].submit();
+}
+function getAllLayer(){
+   var arrayLayer = new Array();
+   var cntLayer = 0;
+   for(var i=0; i<document.forms[0].elements.length; i++){
+      if(document.forms[0].elements[i].name.indexOf("layer_id") > -1){
+         arrayLayer[cntLayer] = document.forms[0].elements[i].value;
+         cntLayer++;
+      }
+   }
+   return arrayLayer;
+}
+function setSubs(){
+   var arrayLayer = getAllLayer();
+   for(var i=0; i<arrayLayer.length; i++){
+      if(parseInt(eval("document.forms[0].L_" + arrayLayer[i] + "___layer_parent.value")) > 0){
+         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_status.checked = false");
+      }
+   }
+}
+function setLayer(def,status){
+   var arrayLayer = getAllLayer();
+   if(def == 'querylayer'){
+      for(var i=1; i<arrayLayer.length; i++){
+         if(eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.disabled == false")){
+            eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.checked = " + status);
+         }
+      }
+   }
+   if(def == 'visible'){
+      for(var i=1; i<arrayLayer.length; i++){
+         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_visible.checked = " + status);
+      }
+   }
+}
+function showSld(origUrl){
+	var url = document.getElementById("this_gui_wms_sldurl").value;
+	if(url==""){
+		if(origUrl=="")
+			return;
+		url=origUrl;
+	}
+	window.open(url);
+}
+</script>
+
+</head>
+<body>
+<?php
+
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+
+$mb_user_id=$_SESSION["mb_user_id"];
+
+#delete gui_wms from gui
+if($del && $del == 'true'){
+	$sql="SELECT DISTINCT gui_wms_position from gui_wms WHERE fkey_gui_id = $1 and fkey_wms_id = $2";
+	$v = array($guiList,$wmsList);
+	$t = array('s','i');
+	$res = db_prep_query($sql,$v,$t);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		$wms_position = $row["gui_wms_position"];
+		$cnt++;
+	}
+	#if($cnt > 1){die("Error: WMS (ID) not unique!");}
+		$sql = "Delete from gui_wms where fkey_gui_id = $1 and fkey_wms_id = $2 ";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$sql = "Delete from gui_layer where fkey_gui_id = $1 and gui_layer_wms_id = $2";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$del='false';
+		$sql = "UPDATE gui_wms SET gui_wms_position = (gui_wms_position - 1) WHERE gui_wms_position > $1";
+		$sql .= " AND fkey_gui_id = $2 ";
+		$v = array($wms_position,$guiList);
+		$t = array('i','s');
+		$res = db_prep_query($sql,$v,$t);
+
+	unset($wmsList);
+}
+
+#update gui_wms_position
+if($up && $up == 'true'){
+	if ($wmsList!=""){
+		$sql = "SELECT gui_wms_position ";
+		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			$wms_position = $row["gui_wms_position"];
+		}
+	}
+	if($wms_position > 0){
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
+		$v = array(($wms_position - 1),$guiList,$wmsList);
+		$t = array('i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4 ";
+		$v = array($wms_position,($wms_position - 1),$guiList,$wmsList);
+		$t = array('i','i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+	}
+}
+
+if($down && $down == 'true'){
+	$max = 0;
+	if ($wmsList!=""){
+		$sql = "SELECT gui_wms_position ";
+		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			$wms_position = $row["gui_wms_position"];
+		}
+		$sql = "SELECT MAX(gui_wms_position) as max FROM gui_wms WHERE fkey_gui_id = $1 ";
+		$v = array($guiList);
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			$max = $row["max"];
+		}
+	}
+	if($wms_position < $max){
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
+		$v = array(($wms_position + 1),$guiList,$wmsList);
+		$t = array('i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4";
+		$v = array($wms_position,($wms_position + 1),$guiList,$wmsList);
+		$t = array('i','i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+	}
+}
+
+/*handle Updates*/
+if(isset($update_content) && $update_content == "1"){
+   if(isset($this_gui_wms_epsg)){
+      $sql = "UPDATE gui_wms set gui_wms_epsg = $1, gui_wms_mapformat = $2, ";
+      $sql .= "gui_wms_featureinfoformat = $3, gui_wms_exceptionformat = $4, ";
+      $sql .= "gui_wms_visible = $5, gui_wms_opacity = $6, gui_wms_sldurl = $7 ";
+      $sql .= "WHERE fkey_gui_id = $8 AND fkey_wms_id = $9";
+		$v = array($this_gui_wms_epsg,$this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
+		$t = array('s','s','s','s','i','i','s','s','i');
+		$res = db_prep_query($sql,$v,$t);
+   }
+   else{
+		$sql = "UPDATE gui_wms set gui_wms_mapformat = $1, ";
+		$sql .= "gui_wms_featureinfoformat = $2, gui_wms_exceptionformat = $3, ";
+		$sql .= "gui_wms_visible = $4, gui_wms_opacity = $5, gui_wms_sldurl = $6 ";
+		$sql .= "WHERE fkey_gui_id = $7 AND fkey_wms_id = $8";
+		$v = array($this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
+		$t = array('s','s','s','i','i','s','s','i');
+		$res = db_prep_query($sql,$v,$t);
+   }
+
+   /**/
+
+   $cnt = 0;
+   while(list($key,$val) = each($_REQUEST)){
+		if(preg_match("/___/", $key)){
+			$myKey = explode("___", $key);
+			if($myKey[1]!="layer_parent" && $myKey[1]!='layer_id' ){
+				$sql = "UPDATE gui_layer SET ".$myKey[1]." = $1 WHERE fkey_gui_id = $2 AND fkey_layer_id = $3";
+				$v = array($val,$this_gui,preg_replace("/L_/","",$myKey[0]));
+				if($myKey[1]=='gui_layer_style'){
+					$t = array('s','s','i');
+				}
+				else{
+					$t = array('i','s','i');
+				}
+				if(!$res = db_prep_query($sql,$v,$t)){
+					echo "FEHLER in ZEILE 288";
+				}
+			}
+		}
+	}
+}
+
+echo "<form name='form1' action='" . $self ."' method='post'>";
+echo "<table cellpadding='3' cellspacing='3' border='0' class='table_top'>";
+
+echo "<tr>";
+echo "<td>";
+echo "GUI";
+echo "</td>";
+echo "<td>";
+echo "WMS-TITLE";
+echo "</td>";
+echo "<td>";
+echo "</td>";
+echo "<tr>";
+
+echo "<td>";
+
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$admin = new administration();
+$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
+
+$gui_id =array();
+if (count($ownguis)>0){
+	for($i=0; $i<count($ownguis); $i++){
+		$gui_id[$i]=$ownguis[$i];
+	}
+}
+
+echo"<select size='8' name='guiList' onchange='document.form1.wmsList.selectedIndex = -1;submit()'>";
+$selected_gui_id="";
+
+for ($i=0; $i<count($ownguis);$i++){
+   echo "<option value='".$gui_id[$i]."' ";
+   if($guiList && $guiList == $gui_id[$i]){
+      echo "selected";
+      $selected_gui_id=$gui_id[$i];
+   }
+   else{
+      if ($i==0){
+         echo "selected";
+         $selected_gui_id=$gui_id[$i];
+		}
+   }
+   echo ">".$gui_id[$i]."</option>";
+}
+
+echo "</select>";
+echo "</td>";
+echo "<td>";
+
+$sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
+$sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
+$v = array($selected_gui_id);
+$t = array('s');
+$res = db_prep_query($sql,$v,$t);
+$count_wms = 0;
+echo "<select size='8' name='wmsList' style='width:200px' onchange='submit()'>";
+
+while($row = db_fetch_array($res)){
+	echo "<option value='".$row["wms_id"]."' ";
+	if(isset($wmsList) && $wmsList == $row["wms_id"]){
+		echo "selected";
+	}
+	echo ">".$row["gui_wms_position"]." - ".$row["wms_title"]."</option>";
+	$count_wms++;
+}
+echo "</select>";
+echo "</td><td>";
+echo "<input class='myButton' type='button' name='up_wms' value=' up ' onClick='validate(\"up_wms\")'>";
+echo "<input type='hidden' name='up' value=''><br><br>";
+
+echo "<input class='myButton' type='button' name='down_wms' value='down'  onClick='validate(\"down_wms\")'>";
+echo "<input type='hidden' name='down' value=''><br><br>";
+
+echo "<input class='myButton' type='button' name='delete_wms' value='remove'  onClick='validate(\"delete_wms\")'>";
+echo "<input type='hidden' name='del' value=''>";
+
+echo "</td>";
+echo "</tr>";
+echo "</table>";
+
+
+if(isset($wmsList)){
+#gui_wms
+$sql_gw = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+$v = array($guiList,$wmsList);
+$t = array('s','i');
+$res_gw = db_prep_query($sql_gw,$v,$t);
+$cnt_gw = 0;
+while($row = db_fetch_array($res_gw)){
+   $gui_wms_position[$cnt_gw] = $row["gui_wms_position"];
+   $gui_wms_mapformat[$cnt_gw] = $row["gui_wms_mapformat"];
+   $gui_wms_featureinfoformat[$cnt_gw] = $row["gui_wms_featureinfoformat"];
+   $gui_wms_exceptionformat[$cnt_gw] = $row["gui_wms_exceptionformat"];
+   $gui_wms_epsg[$cnt_gw] = $row["gui_wms_epsg"];
+   $gui_wms_visible[$cnt_gw] = $row["gui_wms_visible"];
+   $gui_wms_opacity[$cnt_gw] = $row["gui_wms_opacity"];
+   $gui_wms_sldurl[$cnt_gw] = $row["gui_wms_sldurl"]; # sld url
+   $cnt_gw++;
+}
+#wms
+$sql_w = "SELECT * FROM wms WHERE wms_id = $1";
+$v = array($wmsList);
+$t = array('i');
+$res_w = db_prep_query($sql_w,$v,$t);
+$cnt_w = 0;
+while($row = db_fetch_array($res_w)){
+   $wms_id[$cnt_w] = $row["wms_id"];
+   $wms_version[$cnt_w] = $row["wms_version"];
+   $wms_title[$cnt_w] = $row["wms_title"];
+   $wms_abstract[$cnt_w] = $row["wms_abstract"];
+   $wms_getcapabilities[$cnt_w] = $row["wms_getcapabilities"];
+   $wms_supportsld[$cnt_w] = $row["wms_supportsld"];  # Buttons zum sld support anzeigen?
+   $cnt_w++;
+ }
+#wms_format
+$sql_wf = "SELECT * FROM  wms_format WHERE  fkey_wms_id = $1";
+$v = array($wmsList);
+$t = array('i');
+$res_wf = db_prep_query($sql_wf,$v,$t);
+$cnt_wf = 0;
+while($row = db_fetch_array($res_wf)){
+   $data_type[$cnt_wf] = $row["data_type"];
+   $data_format[$cnt_wf] = $row["data_format"];
+   $cnt_wf++;
+ }
+#gui_layer
+$sql_gl = "SELECT l.*, gl.*, sld.sld_user_layer_id, sld.use_sld FROM layer AS l, gui_layer AS gl left outer join sld_user_layer AS sld on sld.fkey_layer_id = gl.fkey_layer_id WHERE l.layer_id = gl.fkey_layer_id AND gl.gui_layer_wms_id = $1 AND gl.fkey_gui_id = $2 AND (sld.fkey_gui_id = $3 or sld.fkey_gui_id is NULL) AND (sld.fkey_mb_user_id = $4 or sld.fkey_mb_user_id is NULL) ORDER BY l.layer_pos";
+$v = array($wmsList,$guiList,$guiList,$mb_user_id);
+$t = array('i','s','s','i');
+
+$res_gl = db_prep_query($sql_gl,$v,$t);
+$gui_layer_status = array();
+$gui_layer_selectable = array();
+$gui_layer_visible = array();
+$gui_layer_queryable = array();
+$gui_layer_querylayer = array();
+$gui_layer_minscale = array();
+$gui_layer_maxscale = array();
+$gui_layer_priority = array();
+$gui_layer_style = array();
+$gui_layer_wfs_featuretype = array();
+$layer_maxscale = array();
+$layer_id = array();
+$layer_parent = array();
+$layer_name = array();
+$layer_title = array();
+$layer_queryable = array();
+$layer_minscale = array();
+$layer_maxscale = array();
+$sld_user_layer_id = array();
+$use_sld = array();
+while($row = db_fetch_array($res_gl)){
+	array_push($gui_layer_status, $row["gui_layer_status"]);
+	array_push($gui_layer_selectable, $row["gui_layer_selectable"]);
+	array_push($gui_layer_visible, $row["gui_layer_visible"]);
+	array_push($gui_layer_queryable, $row["gui_layer_queryable"]);
+	array_push($gui_layer_querylayer, $row["gui_layer_querylayer"]);
+	array_push($gui_layer_minscale, $row["gui_layer_minscale"]);
+	array_push($gui_layer_maxscale, $row["gui_layer_maxscale"]);
+	array_push($gui_layer_priority, $row["gui_layer_priority"]);
+	array_push($gui_layer_style, $row["gui_layer_style"]);
+	array_push($gui_layer_wfs_featuretype, $row["gui_layer_wfs_featuretype"]);
+	array_push($layer_id, $row["layer_id"]);
+	array_push($layer_parent, $row["layer_parent"]);
+	array_push($layer_name, $row["layer_name"]);
+	array_push($layer_title, $row["layer_title"]);
+	array_push($layer_queryable, $row["layer_queryable"]);
+	array_push($layer_minscale, $row["layer_minscale"]);
+	array_push($layer_maxscale, $row["layer_maxscale"]);
+	array_push($sld_user_layer_id, $row["sld_user_layer_id"]);
+	array_push($use_sld, $row["use_sld"]);
+}
+
+#layer_epsg
+$sql_le = "SELECT * FROM layer_epsg WHERE  fkey_layer_id = $1";
+$v = array($layer_id[0]);
+$t = array('i');
+$res_le = db_prep_query($sql_le,$v,$t);
+$cnt_le = 0;
+while($row = db_fetch_array($res_le)){
+   $epsg[$cnt_le] = $row["epsg"];
+   $cnt_le++;
+}
+
+echo "<div style='position:absolute;left:590px; top:180px;' ><input type='button' style='width:100px;height:100px;background-color:#0066cc' value='save' onclick='checkBoxValue()'></div>";
+echo "<table class='table_top'>";
+echo "<tr>";
+echo "<td colspan='2'>";
+echo "<a href='".$wms_getcapabilities[0];
+if( $wms_version[0] == "1.0.0"){ echo "&WMTVER=". $wms_version[0]."&REQUEST=capabilities";}
+else{echo "&VERSION=". $wms_version[0]."&REQUEST=GetCapabilities&SERVICE=WMS";}
+echo "' style='font-size:14px' target='_blank'>LINK: Capabilities</a>";
+echo "</td>";
+echo "<td align = right>WMS ID: " . $wms_id[0] . "</td>";
+echo "<tr>";
+#epsg
+if($gui_wms_position[0] == 0){
+  echo "<tr>";
+     echo "<td>EPSG: </td><td>";
+     echo "<select class='mySelect'  name='this_gui_wms_epsg'>";
+        for($i=0; $i<count($epsg); $i++){
+           echo "<option value='".$epsg[$i]."' ";
+           if($epsg[$i] == $gui_wms_epsg[0]){ echo "selected";}
+           echo ">".$epsg[$i]."</option>";
+        }
+     echo "</select>";
+     echo "</td>";
+  echo "</tr>";
+}
+#format
+echo "<tr>";
+   echo "<td>Mapformat: </td><td>";
+        echo "<select class='mySelect'  name='this_gui_wms_mapformat'>";
+        for($i=0; $i<count($data_format); $i++){
+           if($data_type[$i] == 'map'){
+              echo "<option value='".$data_format[$i]."' ";
+              if($data_format[$i] == $gui_wms_mapformat[0]){ echo "selected";}
+              echo ">".$data_format[$i]."</option>";
+           }
+        }
+     echo "</select>";
+   echo "</td>";
+
+echo "</tr>";
+
+echo "<tr>";
+   echo "<td>Infoformat: </td><td>";
+        echo "<select class='mySelect'  name='this_gui_wms_featureinfoformat'>";
+        echo "<option value='text/html'>text/html</option>";
+        for($i=0; $i<count($data_format); $i++){
+           if($data_type[$i] == 'featureinfo'){
+              echo "<option value='".$data_format[$i]."' ";
+              if($data_format[$i] == $gui_wms_featureinfoformat[0]){ echo "selected";}
+              echo ">".$data_format[$i]."</option>";
+           }
+        }
+     echo "</select>";
+   echo "</td>";
+echo "</tr>";
+
+echo "<tr>";
+   echo "<td>Exceptionformat: </td><td>";
+        echo "<select class='mySelect' name='this_gui_wms_exceptionformat'>";
+        for($i=0; $i<count($data_format); $i++){
+           if($data_type[$i] == 'exception'){
+              echo "<option value='".$data_format[$i]."' ";
+              if($data_format[$i] == $gui_wms_exceptionformat[0]){ echo "selected";}
+              echo ">".$data_format[$i]."</option>";
+           }
+        }
+     echo "</select>";
+   echo "</td>";
+echo "</tr><br>";
+
+# visibility
+echo "<tr>";
+	echo "<td>Visibility: </td><td>";
+	echo "<select class='mySelect' name='this_gui_wms_visible'>";
+	for($i=0; $i<3; $i++){
+		echo "<option value='".$i."' ";
+		if($i == $gui_wms_visible[0]){ echo "selected";}
+		echo ">";
+		if($i == '0'){
+			echo "hidden";
+		}
+		if($i == '1'){
+			echo "visible";
+		}
+		echo "</option>";
+	}
+	echo "</select>";
+	echo "</td>";
+echo "</tr>";
+
+# opacity
+echo "<tr>";
+	echo "<td>Opacity: </td><td>";
+	echo "<select class='mySelect' name='this_gui_wms_opacity'>";
+	for($i=0; $i<=100; $i+=10){
+		echo "<option value='".$i."' ";
+		if($i - $gui_wms_opacity[0]<=5&&$i - $gui_wms_opacity[0]>=-4){ echo "selected";}
+		echo ">";
+		echo $i."%";
+		echo "</option>";
+	}
+	echo "</select>";
+	echo "</td>";
+echo "</tr>";
+
+# sld support
+if($wms_supportsld[0]) {
+		echo "<tr>";
+		echo "<td>SLD-URL: </td><td>";
+		echo "<input type='text' class='myText' name='this_gui_wms_sldurl' id='this_gui_wms_sldurl' title='".$gui_wms_sldurl[0]."' value='".$gui_wms_sldurl[0]."'>";
+		#echo "<a href='' onclick='return window.open(\"editor-start.php\");'><img src='sld_editor.png' border=0></a>";
+		#$layer_names = implode(",", $layer_name);
+        echo " <a href='javascript:showSld(\"".$gui_wms_sldurl[0]."\");'>SLD laden/anzeigen</a>";
+		echo "</td>";
+	echo "</tr>";
+} else {
+	echo "<input type='hidden' value='' name='this_gui_wms_sldurl'>";
+}
+
+echo "</table><br>";
+
+echo "<table border='1' cellpadding='1'>";
+		echo "<tr>";
+
+                echo "<td>Nr.</td>";
+                echo "<td>ID</td>";
+                echo "<td>" . toImage('Parent') . "</td>";
+                echo "<td>Name</td>";
+                echo "<td>Title</td>";
+                echo "<td>" . toImage('on/off') . "</td>";
+                echo "<td>" . toImage('sel') . "</td>";
+                echo "<td>" . toImage('sel_default') . "</td>";
+                echo "<td>" . toImage('info') . "</td>";
+                echo "<td>" . toImage('info_default') . "</td>";
+                echo "<td>" . toImage('minScale 1:') . "</td>";
+                echo "<td>" . toImage('maxScale 1:') . "</td>";
+                echo "<td>" . toImage('Style') . "</td>";
+                echo "<td>" . toImage('Prio') . "</td>";
+                echo "<td>" . toImage('setWFS') . "</td>";
+                if($wms_supportsld[0]) {echo "<td>" . toImage('SLD') . "</td>";}
+        echo "</tr>";
+
+#echo "<tr><td>Nr.</td><td>ID</td><td>Parent</td><td>Name</td><td>Title</td><td>on/off</td><td>sel</td><td>sel_default</td><td>info</td><td>info_default</td><td>minScale 1:</td><td>maxScale 1:</td><td>Prio</td><td>setWFS</td></tr>";
+echo "<tr><td></td><td></td><td></td><td></td><td></td><td>";
+echo "<input type='button' class='LButton' value='Sublayer\noff' onclick='setSubs()'>";
+echo "</td><td></td><td>";
+echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"visible\",false)'>&nbsp;";
+echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"visible\",true)'></nobr>";
+echo"</td><td></td><td>";
+echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"querylayer\",false)'>&nbsp;";
+echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"querylayer\",true)'></nobr>";
+echo "</td><td></td><td></td><td></td></tr>";
+
+for($i=0; $i<count($layer_id); $i++){
+#layer_styles
+$sql_styles = "SELECT * FROM layer_style WHERE  fkey_layer_id = $1";
+$v = array($layer_id[$i]);
+$t = array('i');
+$res_styles = db_prep_query($sql_styles,$v,$t);
+$cnt_styles= 0;
+$style = array();
+while($row = db_fetch_array($res_styles)){
+   $style[$cnt_styles] = $row["name"];
+   $cnt_styles++;
+}
+
+ echo "<tr align='center'>";
+  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_nr' disabled value='".$i."'></td>";
+  echo "<td style='background:lightgrey'><input type='text' size='2' name='L_".$layer_id[$i]."___layer_id' value='".$layer_id[$i]."' readonly></td>";
+  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_parent' value='".$layer_parent[$i]."' readonly></td>";
+  echo "<td style='background:lightgrey'><input type='text' size='7' value='".$layer_name[$i]."' readonly></td>";
+  echo "<td><input type='text' name='".$layer_title[$i]."' size='12' value='".$layer_title[$i]."' ></td>";
+
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_status' type='checkbox' ";
+  if($gui_layer_status[$i] == 1){ echo "checked";}
+  echo "></td>";
+
+  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_selectable' type='checkbox' ";
+  if($gui_layer_selectable[$i] == 1){ echo "checked";}
+  echo "></td>";
+
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_visible' type='checkbox' ";
+  if($gui_layer_visible[$i] == 1){ echo "checked";}
+  echo "></td>";
+
+  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_queryable' type='checkbox' ";
+  if($gui_layer_queryable[$i] == 1){ echo "checked";}
+  if($layer_queryable[$i] == 0){ echo "disabled";}
+  echo "></td>";
+
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_querylayer' type='checkbox' ";
+  if($gui_layer_querylayer[$i] == 1){ echo "checked";}
+  if($layer_queryable[$i] == 0){ echo "disabled";}
+  echo "></td>";
+
+  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_minscale' type='text' size='5' value='".$gui_layer_minscale[$i]."'></td>";
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_maxscale' type='text' size='5' value='".$gui_layer_maxscale[$i]."'></td>";
+  /**/
+  echo "<td>\n";
+  echo "<select class='select_short' name='L_".$layer_id[$i]."___gui_layer_style'>\n";
+  	   echo "<option value=''";
+  	   if(count($style) ==0){ echo "selected";}
+  	   echo ">---</option>\n";
+  for($j=0;$j<count($style); $j++){
+       echo "<option value='".$style[$j]."'";
+       if($style[$j] == $gui_layer_style[$i]){ echo "selected";}
+       echo ">".$style[$j]."</option>\n";
+ }
+  echo "</select></td>\n";
+  /**/
+  echo "<td><select class='select_auto' name='L_".$layer_id[$i]."___gui_layer_priority'>";
+  for($j=0; $j<count($gui_layer_priority); $j++){
+     echo "<option value='".$j."'";
+     if($j == $gui_layer_priority[$i]){echo "selected";}
+     echo ">".$j;
+     echo "</option>";
+  }
+  echo "</select></td>\n";
+  /* wfs configuration */
+	echo "<td>";
+	if ($i > 0) {
+		echo "<input class='button_wfs'name='gui_layer_gaz' type='button' onclick='edit_gaz(\"".$guiList."\",".$wmsList.",".$layer_id[$i].")' value='";
+		if($gui_layer_wfs_featuretype[$i] == ""){
+			echo "setWFS";
+		}
+		else{
+			echo "wfs ".$gui_layer_wfs_featuretype[$i];
+		}
+		echo "'>";
+	}
+	echo "</td>";
+	if($wms_supportsld[0]) {
+		echo "<td>";
+		if ($i > 0) {
+			echo "<input class='button3' name='gui_layer_sld' type='button' onclick='window.open(\"../sld/sld_main.php?".$urlParameters."&sld_gui_id=".$guiList."&sld_wms_id=".$wms_id[0]."&sld_layer_name=".$layer_name[$i]."\");' value='";
+			if ($sld_user_layer_id[$i] != "")
+				echo "sld:".$sld_user_layer_id[$i]."(".$use_sld[$i].")";
+			else
+				echo "SLD";
+			echo "'>";
+		}
+		echo "</td>";
+	}
+ echo "</tr>\n";
+ if($i == 0){ echo "<tr><td colspan='16'><hr></td></tr>";}
+}
+echo "</table>\n";
+echo "<input type='hidden' name='this_gui' value='".$guiList."'>\n";
+echo "<input type='hidden' name='this_wms' value='".$wmsList."'>\n";
+echo "<input type='hidden' name='this_layer_count' value='".$cnt_l."'>\n";
+echo "<input type='hidden' name='update_content' value=''>\n";
+echo "</form>\n";
+}
+?>
+</body>
+</html>

Modified: branches/dev_lenkne/http/php/mod_editUser.php
===================================================================
--- branches/dev_lenkne/http/php/mod_editUser.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_editUser.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -126,7 +126,7 @@
 			if (MD5 == 'false'){
 				$pw = $password;
 			}else{
-				$pw = "md5('".$password."')";
+				$pw = md5($password);
 			}
 		}
 		return $pw;
@@ -157,7 +157,7 @@
 		$sql = "Insert INTO mb_user (mb_user_name, mb_user_password,mb_user_owner, mb_user_description, ";
 		$sql .= "mb_user_email, mb_user_phone, mb_user_department, mb_user_resolution) VALUES ";
 		$sql.= "($1,$2,$3,$4,$5,$6,$7,$8)";	
-		$v = array($name,md5($password),$owner_id,$description,$email,$phone,$department,$resolution);
+		$v = array($name,setPassword($password),$owner_id,$description,$email,$phone,$department,$resolution);
 		$t = array('s','s','i','s','s','s','s','i');
 		$res = db_prep_query($sql,$v,$t);
 		$selected_user = db_insert_id($res,"mb_user","mb_user_id");
@@ -389,4 +389,4 @@
 // -->
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: branches/dev_lenkne/http/php/mod_loadCapabilitiesList.php
===================================================================
--- branches/dev_lenkne/http/php/mod_loadCapabilitiesList.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_loadCapabilitiesList.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,292 +1,307 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import_request_variables("PG");
-require(dirname(__FILE__)."/../php/mb_validatePermission.php");
-?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Load WMS from Catalog</title>
-<?php
-include '../include/dyn_css.php';
-?>
-<style type="text/css">
-  	<!--
-  	body{
-      background-color: #ffffff;
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080
-  	}
-  	.list_guis{
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080;
-  	}
-.text1{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:190px;
-}
-.select1{
-   position:absolute;
-   top:210px;
-   width:270px;
-}
-.text2{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:190px;
-   left:300px;
-}
-.select2{
-   position:absolute;
-   top:210px;
-   left:300px;
-}
-.getcapabilities{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:570px;
-}
-
-  	-->
-</style>
-<script language="JavaScript">
-function validate(wert){
-   if(wert == 'guiList'){
-      var listIndex = document.form1.guiList.selectedIndex;
-      if(listIndex<0){
-		   alert("Please select a GUI.");
-			return false;
-      }
-      else{
-         var gui_id=document.form1.guiList.options[listIndex].value;
-			document.form1.action='../php/mod_loadwms.php<?php echo SID;?>';
-			document.form1.submit();
-      }
-   }
-}
-function load(){
-      if(document.form1.guiList.selectedIndex<0){
-		   alert("Please select a GUI.");
-			return false;
-      }
-      var gui_ind = document.form1.guiList.selectedIndex;
-      var ind = document.form1.wmsID.selectedIndex;
-      var ind2 = document.form1.guiID_.selectedIndex;
-      var permission = confirm("Load " + document.form1.wmsID.options[ind].text + " FROM " + document.form1.guiID_.options[ind2].value + " INTO "+document.form1.guiList.options[gui_ind].value+" ?");
-      if(permission == true){
-         document.form1.submit();
-      }
-      else{
-         document.form1.guiID_.selectedIndex = -1;
-      }
-}
-</script>
-</head>
-<body>
-
-<?php
-
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-$admin = new administration();
-$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
-
-
-
-###INSERT
-if(isset($wmsID) && isset($guiID_)){
-	$sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = $1";
-	$v = array($guiList);
-	$t = array('s');
-	$res_pos = db_prep_query($sql_pos,$v,$t);
-	if(db_result($res_pos,0,"my_gui_wms_position") > -1){
-		$gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
-	}
-	else{
-		$gui_wms_position = 0;
-	}
-
-	$sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-	$v = array($guiID_,$wmsID);
-	$t = array('s','i');
-	$res = db_prep_query($sql,$v,$t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,";
-		$sql_ins .= "gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible,gui_wms_opacity,gui_wms_sldurl) ";
-		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)";
-		$v = array($guiList,$wmsID,$gui_wms_position,$row["gui_wms_mapformat"],$row["gui_wms_featureinfoformat"],
-		$row["gui_wms_exceptionformat"],$row["gui_wms_epsg"],$row["gui_wms_visible"],$row["gui_wms_opacity"],$row["gui_wms_sldurl"]);
-		$t = array('s','i','i','s','s','s','s','i','i','s');
-		db_prep_query($sql_ins,$v,$t);
-		$cnt++;
-	}
-
-	$sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = $1 AND gui_layer_wms_id = $2";
-	$v = array($guiID_, $wmsID);
-	$t = array("s", "i");
-	$res = db_prep_query($sql, $v, $t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
-		$sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority,gui_layer_style,gui_layer_wfs_featuretype) ";
-		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)";
-		$v = array($guiList,$row["fkey_layer_id"],$wmsID,$row["gui_layer_status"],$row["gui_layer_selectable"],
-		$row["gui_layer_visible"],$row["gui_layer_queryable"],$row["gui_layer_querylayer"],$row["gui_layer_minscale"],
-		$row["gui_layer_maxscale"],$row["gui_layer_priority"],$row["gui_layer_style"],$row["gui_layer_wfs_featuretype"]);
-		$t = array('s','i','i','i','i','i','i','i','i','i','i','s','s');
-		db_prep_query($sql_ins,$v,$t);
-		$cnt++;
-	}
-}
-
-echo "<form name='form1' action='" . $self."' method='post'>";
-
-echo "<table cellpadding='0' cellspacing='0' border='0'>";
-echo "<tr>";
-echo "<td>";
-if (count($ownguis)>0){
-	echo"GUI";
-	echo"<br>";
-	 
-	$sql = "SELECT * FROM gui WHERE gui_id IN (";
-	$v = $ownguis;
-	$t = array();
-	for ($i = 1; $i <= count($ownguis); $i++){
-		if ($i > 1) { 
-			$sql .= ",";
-		}
-		$sql .= "$".$i;
-		array_push($t, "s");
-	}
-	$sql .= ") ORDER BY gui_name";	
-	$res = db_prep_query($sql, $v, $t);
-	$count=0;
-	echo"<select size='8' name='guiList' style='width:200px' onClick='submit()'>";
-	while($row = db_fetch_array($res)){
-		$gui_name[$count]=$row["gui_name"];
-		$gui_description[$count]=$row["gui_description"];
-		$count++;
-		echo "<option value='".$row["gui_id"]."' ";
-		if($guiList && $guiList == $row["gui_name"]){
-			echo "selected";
-		}
-		echo ">".$row["gui_name"]."</option>";
-	}
-	
-	$arrayGUIs=$_SESSION["mb_user_guis"];
-	echo count($arrayGUIs);
-	echo "</select><br><br>";
-	
-	echo "</td>";
-	echo "<td>";
-	echo"WMS";
-	echo"<br>";
-	if(isset($guiList) && $guiList!=""){
-		$sql = "SELECT DISTINCT wms.wms_title, gui_wms_position FROM gui_wms ";
-		$sql .= "JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON gui_wms.fkey_wms_id=wms.wms_id ";
-		$sql .= "AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_name = $1 ORDER BY gui_wms_position";
-		$v = array($guiList);
-		$t = array('s');
-		$res = db_prep_query($sql,$v,$t);	
-		$count=0;
-		echo"<select size='8' name='wmsList' style='width:200px'>";
-	
-		while($row = db_fetch_array($res)){
-			if ($row["wms_title"]!=""){
-				echo "<option value='' ";
-				echo ">".$row["wms_title"]."</option>";
-			}
-			$count++;
-		}
-		echo "</select><br><br>";
-	}else{
-		echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
-		echo "</select><br><br>";
-	}
-	echo "</td>";
-	echo "<tr></table><br>";
-	
-	echo"<div class='text1'>Load WMS</div>";
-	$sql = "SELECT DISTINCT wms.wms_id,wms.wms_title,wms.wms_abstract,wms.wms_owner FROM gui_wms JOIN wms ON ";
-	$sql .= "wms.wms_id = gui_wms.fkey_wms_id WHERE gui_wms.fkey_gui_id IN(";
-	$v = $arrayGUIs;
-	$t = array();
-	for ($i = 1; $i <= count($arrayGUIs); $i++){
-		if ($i > 1) {
-			$sql .= ",";
-		}
-		$sql .= "$" . $i;
-		array_push($t, "s");
-	}
-	$sql .= ") ORDER BY wms.wms_title";
-	$res = db_prep_query($sql, $v, $t);
-	echo "<select class='select1' name='wmsID' size='20' onchange='submit()'>";
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		echo "<option value='".$row["wms_id"]."' ";
-		if($row["wms_owner"] == $_SESSION["mb_user_id"]){
-			echo "style='color:green' ";	
-		}
-		else{
-			echo "style='color:red' ";
-		}
-		if(isset($wmsID) && $wmsID == $row["wms_id"]){
-			echo "selected";
-			$wms_getcapabilities = $row["wms_getcapabilities"];
-		}
-		echo ">".$row["wms_title"]."</option>";
-		$cnt++;
-	}
-	echo "</select>";
-	
-	if(isset($wmsID)){
-		echo "<div class='text2'>FROM:</div>";
-		$sql = "SELECT * from gui_wms WHERE fkey_wms_id = $1 ORDER BY fkey_gui_id";
-		$v = array($wmsID);
-		$t = array("s");
-		$res = db_prep_query($sql, $v, $t);
-		echo "<select class='select2' name='guiID_' size='20' onchange='load()'>";
-		$cnt = 0;
-		while($row = db_fetch_array($res)){
-			echo "<option value='".$row["fkey_gui_id"]."' ";
-			echo ">".$row["fkey_gui_id"]."</option>";
-			$cnt++;
-		}
-	echo "</select>";
-}
-echo "</form>";
-}else{
-	echo "There are no guis available for this user. Please create a gui first.";
-}
-echo "<div class='getcapabilities'>" . $wms_getcapabilities . "</div>";
-?>
-</body>
-</html>
\ No newline at end of file
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Administration
+# 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import_request_variables("PG");
+require(dirname(__FILE__)."/../php/mb_validatePermission.php");
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>Load WMS from Catalog</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<style type="text/css">
+  	<!--
+  	body{
+      background-color: #ffffff;
+  		font-family: Arial, Helvetica, sans-serif;
+  		font-size : 12px;
+  		color: #808080
+  	}
+  	.list_guis{
+  		font-family: Arial, Helvetica, sans-serif;
+  		font-size : 12px;
+  		color: #808080;
+  	}
+.text1{
+   font-family: Arial, Helvetica, sans-serif;
+   font-size : 15px;
+   position:absolute;
+   top:190px;
+}
+.select1{
+   position:absolute;
+   top:210px;
+   width:270px;
+}
+.text2{
+   font-family: Arial, Helvetica, sans-serif;
+   font-size : 15px;
+   position:absolute;
+   top:190px;
+   left:300px;
+}
+.select2{
+   position:absolute;
+   top:210px;
+   left:300px;
+}
+.getcapabilities{
+   font-family: Arial, Helvetica, sans-serif;
+   font-size : 15px;
+   position:absolute;
+   top:570px;
+}
+
+  	-->
+</style>
+<script language="JavaScript">
+function validate(wert){
+   if(wert == 'guiList'){
+      var listIndex = document.form1.guiList.selectedIndex;
+      if(listIndex<0){
+		   alert("Please select a GUI.");
+			return false;
+      }
+      else{
+         var gui_id=document.form1.guiList.options[listIndex].value;
+			document.form1.action='../php/mod_loadwms.php<?php echo SID;?>';
+			document.form1.submit();
+      }
+   }
+}
+function load(){
+      if(document.form1.guiList.selectedIndex<0){
+		   alert("Please select a GUI.");
+			return false;
+      }
+      var gui_ind = document.form1.guiList.selectedIndex;
+      var ind = document.form1.wmsID.selectedIndex;
+      var ind2 = document.form1.guiID_.selectedIndex;
+			var indexWMSList = document.form1.wmsID.selectedIndex;
+			var permission = true;
+
+			var selectedWmsId = document.form1.wmsID.options[document.form1.wmsID.selectedIndex].value;
+			for (i = 0; i < document.form1.wmsList.length; i++) {
+						if (document.form1.wmsList.options[i].value == selectedWmsId){
+							 permission = false;							 
+							 alert ('The WMS (' + selectedWmsId + ') is already loaded in this application.');
+							 break;
+						}
+			}			 
+			
+  			if (permission) { // only check if permission is not false 
+        	var loadConfirmed = confirm("Load " + document.form1.wmsID.options[ind].text + " FROM " + document.form1.guiID_.options[ind2].value + " INTO "+document.form1.guiList.options[gui_ind].value+" ?");
+          if(loadConfirmed){
+             document.form1.submit();
+          }
+          else{
+             document.form1.guiID_.selectedIndex = -1;
+          }
+			}	
+			
+}
+</script>
+</head>
+<body>
+
+<?php
+
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$admin = new administration();
+$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
+
+
+
+###INSERT
+if(isset($wmsID) && isset($guiID_)){
+	$sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = $1";
+	$v = array($guiList);
+	$t = array('s');
+	$res_pos = db_prep_query($sql_pos,$v,$t);
+	if(db_result($res_pos,0,"my_gui_wms_position") > -1){
+		$gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
+	}
+	else{
+		$gui_wms_position = 0;
+	}
+
+	$sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+	$v = array($guiID_,$wmsID);
+	$t = array('s','i');
+	$res = db_prep_query($sql,$v,$t);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		$sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,";
+		$sql_ins .= "gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible,gui_wms_opacity,gui_wms_sldurl) ";
+		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)";
+		$v = array($guiList,$wmsID,$gui_wms_position,$row["gui_wms_mapformat"],$row["gui_wms_featureinfoformat"],
+		$row["gui_wms_exceptionformat"],$row["gui_wms_epsg"],$row["gui_wms_visible"],$row["gui_wms_opacity"],$row["gui_wms_sldurl"]);
+		$t = array('s','i','i','s','s','s','s','i','i','s');
+		db_prep_query($sql_ins,$v,$t);
+		$cnt++;
+	}
+
+	$sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = $1 AND gui_layer_wms_id = $2";
+	$v = array($guiID_, $wmsID);
+	$t = array("s", "i");
+	$res = db_prep_query($sql, $v, $t);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		$sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
+		$sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority,gui_layer_style,gui_layer_wfs_featuretype) ";
+		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)";
+		$v = array($guiList,$row["fkey_layer_id"],$wmsID,$row["gui_layer_status"],$row["gui_layer_selectable"],
+		$row["gui_layer_visible"],$row["gui_layer_queryable"],$row["gui_layer_querylayer"],$row["gui_layer_minscale"],
+		$row["gui_layer_maxscale"],$row["gui_layer_priority"],$row["gui_layer_style"],$row["gui_layer_wfs_featuretype"]);
+		$t = array('s','i','i','i','i','i','i','i','i','i','i','s','s');
+		db_prep_query($sql_ins,$v,$t);
+		$cnt++;
+	}
+}
+
+echo "<form name='form1' action='" . $self."' method='post'>";
+
+echo "<table cellpadding='0' cellspacing='0' border='0'>";
+echo "<tr>";
+echo "<td>";
+if (count($ownguis)>0){
+	echo"GUI";
+	echo"<br>";
+	 
+	$sql = "SELECT * FROM gui WHERE gui_id IN (";
+	$v = $ownguis;
+	$t = array();
+	for ($i = 1; $i <= count($ownguis); $i++){
+		if ($i > 1) { 
+			$sql .= ",";
+		}
+		$sql .= "$".$i;
+		array_push($t, "s");
+	}
+	$sql .= ") ORDER BY gui_name";	
+	$res = db_prep_query($sql, $v, $t);
+	$count=0;
+	echo"<select size='8' name='guiList' style='width:200px' onClick='submit()'>";
+	while($row = db_fetch_array($res)){
+		$gui_name[$count]=$row["gui_name"];
+		$gui_description[$count]=$row["gui_description"];
+		$count++;
+		echo "<option value='".$row["gui_id"]."' ";
+		if($guiList && $guiList == $row["gui_name"]){
+			echo "selected";
+		}
+		echo ">".$row["gui_name"]."</option>";
+	}
+	
+	$arrayGUIs=$_SESSION["mb_user_guis"];
+	echo count($arrayGUIs);
+	echo "</select><br><br>";
+	
+	echo "</td>";
+	echo "<td>";
+	echo"WMS";
+	echo"<br>";
+	if(isset($guiList) && $guiList!=""){
+		$sql = "SELECT DISTINCT wms_id, wms.wms_title, gui_wms_position FROM gui_wms ";
+		$sql .= "JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON gui_wms.fkey_wms_id=wms.wms_id ";
+		$sql .= "AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_name = $1 ORDER BY gui_wms_position";
+		$v = array($guiList);
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);	
+		$count=0;
+		echo"<select size='8' name='wmsList' style='width:200px'>";
+	
+		while($row = db_fetch_array($res)){
+			if ($row["wms_title"]!=""){
+				echo "<option value='".$row["wms_id"]."' ";
+				echo ">".$row["wms_title"]."</option>";
+			}
+			$count++;
+		}
+		echo "</select><br><br>";
+	}else{
+		echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
+		echo "</select><br><br>";
+	}
+	echo "</td>";
+	echo "<tr></table><br>";
+	
+	echo"<div class='text1'>Load WMS</div>";
+	$sql = "SELECT DISTINCT wms.wms_id,wms.wms_title,wms.wms_abstract,wms.wms_owner FROM gui_wms JOIN wms ON ";
+	$sql .= "wms.wms_id = gui_wms.fkey_wms_id WHERE gui_wms.fkey_gui_id IN(";
+	$v = $arrayGUIs;
+	$t = array();
+	for ($i = 1; $i <= count($arrayGUIs); $i++){
+		if ($i > 1) {
+			$sql .= ",";
+		}
+		$sql .= "$" . $i;
+		array_push($t, "s");
+	}
+	$sql .= ") ORDER BY wms.wms_title";
+	$res = db_prep_query($sql, $v, $t);
+	echo "<select class='select1' name='wmsID' size='20' onchange='submit()'>";
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		echo "<option value='".$row["wms_id"]."' ";
+		if($row["wms_owner"] == $_SESSION["mb_user_id"]){
+			echo "style='color:green' ";	
+		}
+		else{
+			echo "style='color:red' ";
+		}
+		if(isset($wmsID) && $wmsID == $row["wms_id"]){
+			echo "selected";
+			$wms_getcapabilities = $row["wms_getcapabilities"];
+		}
+		echo ">".$row["wms_title"]."</option>";
+		$cnt++;
+	}
+	echo "</select>";
+	
+	if(isset($wmsID)){
+		echo "<div class='text2'>FROM:</div>";
+		$sql = "SELECT * from gui_wms WHERE fkey_wms_id = $1 ORDER BY fkey_gui_id";
+		$v = array($wmsID);
+		$t = array("s");
+		$res = db_prep_query($sql, $v, $t);
+		echo "<select class='select2' name='guiID_' size='20' onchange='load()'>";
+		$cnt = 0;
+		while($row = db_fetch_array($res)){
+			echo "<option value='".$row["fkey_gui_id"]."' ";
+			echo ">".$row["fkey_gui_id"]."</option>";
+			$cnt++;
+		}
+	echo "</select>";
+}
+echo "</form>";
+}else{
+	echo "There are no guis available for this user. Please create a gui first.";
+}
+echo "<div class='getcapabilities'>" . $wms_getcapabilities . "</div>";
+?>
+</body>
+</html>

Modified: branches/dev_lenkne/http/php/mod_map1.php
===================================================================
--- branches/dev_lenkne/http/php/mod_map1.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_map1.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -41,6 +41,7 @@
    $e_height = $row["e_height"];
    $cnt++;
 }
+session_write_close();
 if($cnt > 1){ echo "alert('mapframe1: ID not unique!');";}
 echo '<script type="text/javascript">';
 echo "\n";
@@ -122,7 +123,6 @@
 <body leftmargin='0' topmargin='0' onload="init()" bgcolor='#ffffff'>
 <div id='markResult' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:26'> </div>
 <div id='maps' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'> </div>
-
 <div id='highlight' style="position:absolute;top:-10px;left:-10px;width:14px;height:14px;z-index:3;visibility:visible"><img src="../img/redball.gif"/></div>
 <div id='l_right' name='l_right' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:10;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
 <div id='l_bottom'  name='l_bottom' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:11;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>

Modified: branches/dev_lenkne/http/php/mod_mapOV.php
===================================================================
--- branches/dev_lenkne/http/php/mod_mapOV.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_mapOV.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -71,8 +71,6 @@
 		
 		var ind = parent.getMapObjIndexByName('overview');
 		var ov_extent = parent.mb_mapObj[ind].getExtentInfos();
-//		parent.mb_setWmcExtensionData({"ov_minx":ov_extent.minx,"ov_miny":ov_extent.miny,"ov_maxx":ov_extent.maxx,"ov_maxy":ov_extent.maxy});
-	
 		parent.mb_mapObj[ind].isOverview = true;
 	});
 }

Modified: branches/dev_lenkne/http/php/mod_setLocale.php
===================================================================
--- branches/dev_lenkne/http/php/mod_setLocale.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_setLocale.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -24,6 +24,6 @@
 $localeObj = new Mb_locale($_SESSION["mb_lang"]);
 session_write_close();
 
-header("Content-type='text/plain';Charset='utf-8'");
+header("Content-type='text/plain';Charset=utf-8");
 echo $localeObj->name;
 ?>

Modified: branches/dev_lenkne/http/php/mod_wfs.php
===================================================================
--- branches/dev_lenkne/http/php/mod_wfs.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_wfs.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -67,7 +67,7 @@
 </script>
 <?php
 echo "<script language='JavaScript' type='text/javascript'>";
-if(isset($_REQUEST['id'])){
+if(isset($_REQUEST['id']) && $_REQUEST['id']!=""){
 	$wfs = mb_split(",",$_REQUEST['id']);
 	
 	$con = db_connect($DBSERVER,$OWNER,$PW);
@@ -101,7 +101,9 @@
 			echo "wfs_conf[".$i."]['g_use_wzgraphics']  = '".$row["g_use_wzgraphics"]."';";
 			echo "wfs_conf[".$i."]['fkey_featuretype_id']  = '".$row["fkey_featuretype_id"]."';";
 			echo "wfs_conf[".$i."]['wfs_getfeature']  = '".$row["wfs_getfeature"]."';";
+			echo "wfs_conf[".$i."]['wfs_describefeaturetype']  = '".$row["wfs_describefeaturetype"]."';";
 			echo "wfs_conf[".$i."]['wfs_transaction']  = '".$row["wfs_transaction"]."';";
+			#wfs_describefeaturetype - wfs_describefeaturetype
 			
 		}else{die("wfs_conf data not available");}
 		
@@ -175,4 +177,4 @@
 </head>
 <body leftmargin='0' topmargin='10'  bgcolor='#ffffff' onload='register()'>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: branches/dev_lenkne/http/php/mod_wfs_conf.php
===================================================================
--- branches/dev_lenkne/http/php/mod_wfs_conf.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_wfs_conf.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -60,6 +60,40 @@
 function validate(){
 	return true;
 }
+
+function removeChildNodes(node) {
+	while (node.childNodes.length > 0) {
+		var childNode = node.firstChild;
+		node.removeChild(childNode);
+	}
+}
+
+function controlOperators(checkVal,operatorField,valType){
+	var opSelect = document.getElementById(operatorField);
+	removeChildNodes(opSelect);
+	option1 = new Option("-----","0");
+	opSelect.options[opSelect.length] = option1;
+	if(checkVal==true){
+		opSelect.disabled = '';
+		option2 = new Option("%...%","bothside");
+		opSelect.options[opSelect.length] = option2;
+		option3 = new Option("...%","rightside");
+		opSelect.options[opSelect.length] = option3;
+		option4 = new Option("equal","equal");
+		opSelect.options[opSelect.length] = option4;
+		option5 = new Option(">","greater_than");
+		opSelect.options[opSelect.length] = option5;
+		option6 = new Option("<","less_than");
+		opSelect.options[opSelect.length] = option6;
+		option7 = new Option(">=","greater_equal_than");
+		opSelect.options[opSelect.length] = option7;
+		option8 = new Option("<=","less_equal_than");
+		opSelect.options[opSelect.length] = option8;
+	}
+	else{
+		opSelect.disabled = 'disabled';
+	}
+}
 </script>
 
 </head>
@@ -110,7 +144,7 @@
         $wfsID = db_insert_id($con,'wfs_conf','wfs_conf_id');
 
         for ($i = 0; $i < $_REQUEST["num"]; $i++){
-                $sql = "INSERT INTO wfs_conf_element (fkey_wfs_conf_id,f_id,f_search,f_pos,f_style_id,f_toupper,f_label,f_label_id,f_show,f_respos,f_edit,f_form_element_html,f_mandatory,f_auth_varname) VALUES(";
+                $sql = "INSERT INTO wfs_conf_element (fkey_wfs_conf_id,f_id,f_search,f_pos,f_min_input,f_style_id,f_toupper,f_label,f_label_id,f_show,f_respos,f_edit,f_form_element_html,f_mandatory,f_auth_varname,f_show_detail,f_detailpos,f_operator) VALUES(";
                 $sql .= "$1, $2, ";
                 if (!empty($_REQUEST["f_search".$i])) {
                 	$sql .= "'1'";
@@ -118,39 +152,46 @@
                 else {
                 	$sql .= "'0'";
                 }
-                $sql .= ", $3, $4, ";
+                $sql .= ", $3, $4, $5, ";
 				if (!empty($_REQUEST["f_toupper".$i])) {
                 	$sql .= "'1'";
                 }
                 else {
                 	$sql .= "'0'";
                 }				
-                $sql .= ",$5, $6, ";
+                $sql .= ",$6, $7, ";
                 if (!empty($_REQUEST["f_show".$i])) {
                 	$sql .= "'1'";
                 }
                 else {
                 	$sql .= "'0'";
                 }
-                $sql .= ", $7, ";
+                $sql .= ", $8, ";
                 if (!empty($_REQUEST["f_edit".$i])) {
                 	$sql .= "'1'";
                 } 
                 else {
                 	$sql .= "'0'";
                 }
-                $sql .= ",$8, ";
+                $sql .= ",$9, ";
                 if (!empty($_REQUEST["f_mandatory".$i])) {
                 	$sql .= "'1'";
                 }
                 else {
                 	$sql .= "'0'";
                 }
-                $sql .= ",$9";
+                $sql .= ",$10,";
+                if(!empty($_REQUEST["f_show_detail".$i])){
+                	$sql .= "'1'";
+                }
+                else {
+                	$sql .= "'0'";
+                }
+                $sql .= ",$11,$12";
  				$sql .= "); ";
 
-				$v = array($wfsID, $_REQUEST["f_id".$i], $_REQUEST["f_pos".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i]);
-				$t = array("i", "s", "s", "s", "s", "s", "i", "s", "s");
+				$v = array($wfsID, $_REQUEST["f_id".$i], $_REQUEST["f_pos".$i], $_REQUEST["f_min_input".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["f_detailpos".$i], $_REQUEST["f_operator".$i]);
+				$t = array("i", "s", "s", "i", "s", "s", "s", "i", "s", "s", "i", "s");
                 $res = db_prep_query($sql, $v, $t);
         }
         if (isset($_REQUEST["f_geom"])) {
@@ -245,7 +286,7 @@
         echo "<tr><td>Style:</td><td><textarea cols=50 rows=5 name='g_style'></textarea></td></tr>" ;
         echo "<tr><td>Buffer:</td><td><input type='text' size='4' name='g_buffer' value='1'></td></tr>" ;
         echo "<tr><td>ResultStyle:</td><td><textarea cols=50 rows=5 name='g_res_style'></textarea></td></tr>" ;
-        echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'></td></tr>";
+//        echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'></td></tr>";
         echo "</table>";
 
 
@@ -258,16 +299,21 @@
                 echo "<td>" . toImage('geom') . "</td>";
                 echo "<td>" . toImage('search') . "</td>";
                 echo "<td>" . toImage('pos') . "</td>";
+                echo "<td>" . toImage('minimum_input') . "</td>";
                 echo "<td>" . toImage('style_id') . "</td>";
                 echo "<td>" . toImage('upper') . "</td>";
                 echo "<td>" . toImage('label') . "</td>";
                 echo "<td>" . toImage('label_id') . "</td>";
                 echo "<td>" . toImage('show') . "</td>";
                 echo "<td>" . toImage('position') . "</td>";
+                echo "<td>" . toImage('show_detail') . "</td>";
+                echo "<td>" . toImage('detail_position') . "</td>";
                 echo "<td>" . toImage('mandatory') . "</td>";
                 echo "<td>" . toImage('edit') . "</td>";
                 echo "<td>" . toImage('html') . "</td>";
-//                echo "<td>" . toImage('auth') . "</td>";
+                echo "<td>" . toImage('auth') . "</td>";
+                echo "<td>" . toImage('operator') . "</td>";
+                
         echo "</tr>";
 
         for($i=0; $i<count($aWFS->elements->element_id); $i++){
@@ -275,17 +321,31 @@
                 echo "<td>".$aWFS->elements->element_id[$i]."<input type='hidden' name='f_id".$i."' value='".$aWFS->elements->element_id[$i]."'></td>";
                 echo "<td>".$aWFS->elements->element_name[$i]."<br><div style='font-size:10'>".$aWFS->elements->element_type[$i]."</div></td>";
                 echo "<td><input name='f_geom' type='radio' value='".$aWFS->elements->element_id[$i]."'></td>";
-                echo "<td><input name='f_search".$i."' type='checkbox'></td>";
+                echo "<td><input name='f_search".$i."' type='checkbox' onclick='controlOperators(document.forms[0].f_search".$i.".checked,\"f_operator".$i."\",\"".$aWFS->elements->element_type[$i]."\");'></td>";
                 echo "<td><input name='f_pos".$i."' type='text' size='1' value='0'></td>";
+                echo "<td><select name='f_min_input".$i."' id='f_min_input".$i."'>";
+                echo "<option value='0'>-----</option>";
+                echo "<option value='1'>1</option>";
+                echo "<option value='2'>2</option>";
+                echo "<option value='3'>3</option>";
+                echo "<option value='4'>4</option>";
+                echo "<option value='5'>5</option>";
+                echo "</select></td>";
                 echo "<td><input name='f_style_id".$i."' type='text' size='2' value='0'></td>";
                 echo "<td><input name='f_toupper".$i."' type='checkbox'></td>";
                 echo "<td><input name='f_label".$i."' type='text' size='4'></td>";
                 echo "<td><input name='f_label_id".$i."' type='text' size='2'  value='0'></td>";
                 echo "<td><input name='f_show".$i."' type='checkbox'></td>";
                 echo "<td><input name='f_respos".$i."' type='text' size='1' value='0'></td>";
+                echo "<td><input name='f_show_detail".$i."' type='checkbox'></td>";
+                echo "<td><input name='f_detailpos".$i."' type='text' size='1' value='0'></td>";
                 echo "<td><input name='f_mandatory".$i."' type='checkbox'></td>";
                 echo "<td><input name='f_edit".$i."' type='checkbox'></td>";
                 echo "<td><textarea name='f_form_element_html".$i."' cols='15' rows='1' ></textarea></td>";
+                echo "<td><input name='f_auth_varname".$i."' type='text' size='8' value=''></td>";
+                echo "<td><select name='f_operator".$i."' id='f_operator".$i."' disabled>";
+                echo "<option value='0'>-----</option>";
+                echo "</select></td>";
                 echo "</tr>";
         }
         echo "</table>";

Modified: branches/dev_lenkne/http/php/mod_wfs_edit.php
===================================================================
--- branches/dev_lenkne/http/php/mod_wfs_edit.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_wfs_edit.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -40,6 +40,44 @@
 function validate(){	
 	return true;
 }
+function openwindow(Adresse) {
+	Fenster1 = window.open(Adresse, "Metadaten", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+	Fenster1.focus();
+}
+
+function removeChildNodes(node) {
+	while (node.childNodes.length > 0) {
+		var childNode = node.firstChild;
+		node.removeChild(childNode);
+	}
+}
+
+function controlOperators(checkVal,operator,valType,opValue){
+	var opSelect = document.getElementById(operator);
+	removeChildNodes(opSelect);
+	if(checkVal==true){
+		opSelect.disabled = '';
+		option1 = new Option("-----","0");
+		opSelect.options[opSelect.length] = option1;
+		option2 = new Option("%...%","bothside");
+		opSelect.options[opSelect.length] = option2;
+		option3 = new Option("...%","rightside");
+		opSelect.options[opSelect.length] = option3;
+		option4 = new Option("equal","equal");
+		opSelect.options[opSelect.length] = option4;
+		option5 = new Option(">","greater_than");
+		opSelect.options[opSelect.length] = option5;
+		option6 = new Option("<","less_than");
+		opSelect.options[opSelect.length] = option6;
+		option7 = new Option(">=","greater_equal_than");
+		opSelect.options[opSelect.length] = option7;
+		option8 = new Option("<=","less_equal_than");
+		opSelect.options[opSelect.length] = option8;
+	}
+	else{
+		opSelect.disabled = 'disabled';
+	}
+}
 </script>
 
 </head>
@@ -68,7 +106,7 @@
         $sql .= " WHERE wfs_conf_id = $9;";
         
         $v = array($_REQUEST["wfs_conf_abstract"], $_REQUEST["g_label"], $_REQUEST["g_label_id"], $_REQUEST["g_button"], $_REQUEST["g_button_id"], $_REQUEST["g_style"], $_REQUEST["g_buffer"], $_REQUEST["g_res_style"], $_REQUEST["gaz"]);
-        $t = array("s", "s", "s", "s", "s", "s", "s", "i", "s");
+        $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s");
         $res = db_prep_query($sql, $v, $t);
 		        
 		if (isset($_REQUEST["f_geom"])) {
@@ -101,7 +139,7 @@
                 else {
                 	$sql .= "0";
                 }
-                $sql .= "', f_pos = $1, f_style_id = $2,";
+                $sql .= "', f_pos = $1, f_min_input = $2, f_style_id = $3,";
                 $sql .= "f_toupper = '" ;
                 if (!empty($_REQUEST["f_toupper".$i])) {
                 	$sql .= "1";
@@ -109,7 +147,7 @@
                 else { 
                 	$sql .= "0";
                 }
-                $sql .= "',f_label = $3, f_label_id = $4,";
+                $sql .= "',f_label = $4, f_label_id = $5,";
                 $sql .= "f_show = '";
                 if (!empty($_REQUEST["f_show".$i])) {
                 	$sql .= "1";
@@ -117,7 +155,7 @@
                 else {
                 	$sql .= "0";
                 }
-				$sql .= "',f_respos = $5,";
+				$sql .= "',f_respos = $6,";
                 $sql .= "f_edit = '";
                 if (!empty($_REQUEST["f_edit".$i])) {
                 	$sql .= "1";
@@ -125,7 +163,7 @@
                 else {
                 	$sql .= "0";
                 }
-				$sql .= "', f_form_element_html = $6,";
+				$sql .= "', f_form_element_html = $7,";
                 $sql .= "f_mandatory = '";
                 if (!empty($_REQUEST["f_mandatory".$i])) {
                 	$sql .= "1";
@@ -133,11 +171,20 @@
                 else {
                 	$sql .= "0";
                 }
-				$sql .= "', f_auth_varname = $7";
-				$sql .= " WHERE fkey_wfs_conf_id = $8 AND f_id = $9;";
+				$sql .= "', f_auth_varname = $8";
+			   	$sql .= ", f_show_detail = '";
+                if(!empty($_REQUEST["f_show_detail".$i])){
+                	$sql .= "1";
+                }
+                else {
+                	$sql .= "0";
+                }
+                $sql .= "', f_detailpos = $9";
+                $sql .= ", f_operator = $10";
+				$sql .= " WHERE fkey_wfs_conf_id = $11 AND f_id = $12;";
 
-				$v = array($_REQUEST["f_pos".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["gaz"], $_REQUEST["f_id".$i]);
-				$t = array("s", "s", "s", "s", "s", "s", "s", "i", "s");
+				$v = array($_REQUEST["f_pos".$i], $_REQUEST["f_min_input".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["f_detailpos".$i], $_REQUEST["f_operator".$i], $_REQUEST["gaz"], $_REQUEST["f_id".$i]);
+				$t = array("s", "i", "s", "s", "s", "s", "s", "s", "i", "s", "i", "s");
                 $res = db_prep_query($sql, $v, $t);
         }
 }
@@ -146,7 +193,7 @@
 
 /* select wfs */
 
-$sql = "SELECT * FROM wfs_conf";
+$sql = "SELECT * FROM wfs_conf ORDER BY wfs_conf_id";
 $res = db_query($sql);
 echo "<select size='10' name='gaz' onchange='submit()'>";
 $cnt = 0;
@@ -189,9 +236,9 @@
                 echo "<tr><td>Style:</td><td><textarea cols=50 rows=5 name='g_style'>".$row["g_style"]."</textarea></td></tr>" ;
                 echo "<tr><td>Buffer:</td><td><input type='text' size='4' name='g_buffer' value='".$row["g_buffer"]."'></td></tr>" ;
                 echo "<tr><td>ResultStyle:</td><td><textarea cols=50 rows=5 name='g_res_style'>".$row["g_res_style"]."</textarea></td></tr>" ;
-                echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'";
-                if($row["g_use_wzgraphics"] == 1){ echo " checked"; }
-                echo "></td></tr>";
+//                echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'";
+//                if($row["g_use_wzgraphics"] == 1){ echo " checked"; }
+//                echo "></td></tr>";
                 echo "</table>";
         }
 
@@ -210,15 +257,20 @@
                 echo "<td>" . toImage('geom') . "</td>";
                 echo "<td>" . toImage('search') . "</td>";
                 echo "<td>" . toImage('pos') . "</td>";
+                echo "<td>" . toImage('minimum_input') . "</td>";
                 echo "<td>" . toImage('style_id') . "</td>";
                 echo "<td>" . toImage('upper') . "</td>";
                 echo "<td>" . toImage('label') . "</td>";
                 echo "<td>" . toImage('label_id') . "</td>";
                 echo "<td>" . toImage('show') . "</td>";
                 echo "<td>" . toImage('position') . "</td>";
+                echo "<td>" . toImage('show_detail') . "</td>";
+                echo "<td>" . toImage('detail_position') . "</td>";
                 echo "<td>" . toImage('mandatory') . "</td>";
                 echo "<td>" . toImage('edit') . "</td>";
                 echo "<td>" . toImage('html') . "</td>";
+                echo "<td>" . toImage('auth') . "</td>";
+                echo "<td>" . toImage('operator') . "</td>";
         echo "</tr>";
         $cnt = 0;
         while($row = db_fetch_array($res)){
@@ -234,8 +286,23 @@
 				echo "></td>";
                 echo "<td><input name='f_search".$cnt."' type='checkbox'";
                 if($row["f_search"] == 1){ echo " checked"; }
-                echo "></td>";
+                echo " onclick='controlOperators(document.forms[0].f_search".$cnt.".checked,\"f_operator".$cnt."\",\"".$row["element_type"]."\",\"".$row["f_operator"]."\");'></td>";
                 echo "<td><input name='f_pos".$cnt."' type='text' size='1' value='".$row["f_pos"]."'></td>";
+                echo "<td><select name='f_min_input".$cnt."' id='f_min_input".$cnt."' ";
+                echo ">";
+                echo "<option value='0' ";
+                if($row["f_min_input"] == 0){ echo " selected"; } echo ">-----</option>";
+                echo "<option value='1' ";
+                if($row["f_min_input"] == 1){ echo " selected"; } echo ">1</option>";
+                echo "<option value='2' ";
+                if($row["f_min_input"] == 2){ echo " selected"; } echo ">2</option>";
+                echo "<option value='3' ";
+                if($row["f_min_input"] == 3){ echo " selected"; } echo ">3</option>";
+                echo "<option value='4' ";
+                if($row["f_min_input"] == 4){ echo " selected"; } echo ">4</option>";
+                echo "<option value='5' ";
+                if($row["f_min_input"] == 5){ echo " selected"; } echo ">5</option>";
+                echo "</select></td>";				
                 echo "<td><input name='f_style_id".$cnt."' type='text' size='2' value='".$row["f_style_id"]."'></td>";
                 echo "<td><input name='f_toupper".$cnt."' type='checkbox'";
                 if($row["f_toupper"] == 1){ echo " checked"; }
@@ -246,6 +313,10 @@
                 if($row["f_show"] == 1){ echo " checked"; }
                 echo "></td>";
                 echo "<td><input name='f_respos".$cnt."' type='text' size='1' value='".$row["f_respos"]."'></td>";
+                echo "<td><input name='f_show_detail".$cnt."' type='checkbox'";
+                if($row["f_show_detail"] == 1){ echo " checked"; }
+                echo "></td>";
+                echo "<td><input name='f_detailpos".$cnt."' type='text' size='1' value='".$row["f_detailpos"]."'></td>";
                 echo "<td><input name='f_mandatory".$cnt."' type='checkbox'";
                 if($row["f_mandatory"] == 1){ echo " checked"; }
                 echo "></td>";
@@ -253,6 +324,38 @@
                 if($row["f_edit"] == 1){ echo " checked"; }
                 echo "></td>";
                 echo "<td><textarea name='f_form_element_html".$cnt."' cols='15' rows='1' >".$row["f_form_element_html"]."</textarea></td>";
+                echo "<td><input name='f_auth_varname".$cnt."' type='text' size='8' value='".$row["f_auth_varname"]."'></td>";
+                echo "<td><select name='f_operator".$cnt."' id='f_operator".$cnt."' ";
+                if($row["f_search"] != 1){
+                	echo "disabled";
+                }
+                echo ">";
+                echo "<option value='0' ";
+                if($row["f_operator"] == 0){ echo " selected"; }
+				echo ">-----</option>";
+				echo "<option value='bothside' ";
+                if($row["f_operator"] == 'bothside'){ echo " selected"; }
+				echo ">%...%</option>";
+				echo "<option value='rightside' ";
+                if($row["f_operator"] == 'rightside'){ echo " selected"; }
+				echo ">...%</option>";
+				echo "<option value='equal' ";
+                if($row["f_operator"] == 'equal'){ echo " selected"; }
+				echo ">equal</option>";
+				echo "<option value='greater_than' ";
+                if($row["f_operator"] == 'greater_than'){ echo " selected"; }
+				echo ">></option>";
+				echo "<option value='less_than' ";
+                if($row["f_operator"] == 'less_than'){ echo " selected"; }
+				echo "><</option>";
+				echo "<option value='less_equal_than' ";
+                if($row["f_operator"] == 'less_equal_than'){ echo " selected"; }
+				echo "><=</option>";
+				echo "<option value='greater_equal_than' ";
+                if($row["f_operator"] == 'greater_equal_than'){ echo " selected"; }
+				echo ">>=</option>";
+				
+     			echo "</select></td>";
                 echo "</tr>";
                 $cnt++;
         }

Modified: branches/dev_lenkne/http/php/mod_wfs_gazetteer_server.php
===================================================================
--- branches/dev_lenkne/http/php/mod_wfs_gazetteer_server.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_wfs_gazetteer_server.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -94,7 +94,9 @@
 	
 	$obj = new WfsConf();
 	$obj->load($wfsConfIdArray);
-	echo $obj;
+	$json = new Mapbender_JSON();
+	$output = $json->encode($obj->confArray);
+	echo $output;
 }
 else if ($command == "getSearchResults") {
 	$wfs_conf_id = $_REQUEST["wfs_conf_id"];
@@ -141,24 +143,12 @@
 	
 	$req = urldecode($url).urlencode($admin->char_decode(stripslashes($filter)));
 	$mygml = new gml2();
-	$mygml->parsegml($req);
+	$mygml->parseFile($req);
 	
-	// generates JavaScript code that will add a geometry array containing
-	// all the result geometries and their attributes (wfs_conf_elements)
-	
-	$js = "";
-	if ($mygml->getMemberCount() > 0) { 
-		$js .= $mygml->exportGeometriesToJS(true);
-	
-		for ($i = 0; $i < $mygml->getMemberCount(); $i++) {
-			for ($j = 0; $j < count($col); $j++){
-				$js .= "geom.get(".$i.").e.setElement('".$j."', '".$mygml->getValueBySeparatedKey($i, $col[$j]) . "');\n";
-			}
-		}
-	}
-	echo $js;
+	header("Content-type:application/x-json; charset=utf-8");
+	echo $mygml->toGeoJSON();
 }
 else {
 	echo "please enter a valid command.";
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/php/mod_wfs_server.php
===================================================================
--- branches/dev_lenkne/http/php/mod_wfs_server.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/php/mod_wfs_server.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -24,27 +24,27 @@
 	case 'getAssignedConfs':
 		$obj->assignedConfs = getAssignedConfs($obj);
 		sendOutput($obj);
-	break;
-	case 'getUpdateUrl':
-		$obj->url = getUpdateUrl($obj);
-		sendOutput($obj);	
-	break;
+	break;
+	case 'getUpdateUrl':
+		$obj->url = getUpdateUrl($obj);
+		sendOutput($obj);
+	break;
 		case 'add':
 		addConfsToGui($obj);
 		sendOutput($obj);
 	break;
 	case 'remove':
 		removeConfsFromGui($obj);
-		sendOutput($obj);
-	break;
-	case 'updateWfs':
-		updateWfs($obj);
 		sendOutput($obj);
-	break;
-	case 'deleteWfs':
-		deleteWfs($obj);
-		sendOutput($obj);
 	break;
+	case 'updateWfs':
+		updateWfs($obj);
+		sendOutput($obj);
+	break;
+	case 'deleteWfs':
+		deleteWfs($obj);
+		sendOutput($obj);
+	break;
 	case 'setOwsproxy':
 		$ows = array();
 		$ows['string'] = setOwsproxy($obj);
@@ -70,7 +70,7 @@
 
 /*
  * Get all services (ids and titles) where the current user is owner
- * 
+ *
  * @return mixed[] services the ids and titles of the services
  */
 function getServices(){
@@ -81,11 +81,11 @@
 	$adm = new administration();
 	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
 	if(count($serviceList) == 0){
-		return false;	
+		return false;
 	}
 	$sql = "SELECT * FROM wfs WHERE wfs_id IN (";
 	$v = $serviceList;
-	$t = array(); 
+	$t = array();
 	for ($i = 1; $i <= count($serviceList); $i++) {
 		if ($i > 1) {
 			$sql .= ", ";
@@ -103,13 +103,13 @@
 }
 
 /*
- * Get all configurations of the selcted wfs if the current user is owner 
- * 
- * @return mixed[] 
+ * Get all configurations of the selcted wfs if the current user is owner
+ *
+ * @return mixed[]
  */
 function getWfsConfData($wfsID){
 	global $con;
-	// re-check permission 
+	// re-check permission
 	$adm = new administration();
 	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
 	if(in_array($wfsID, $serviceList)){
@@ -127,41 +127,41 @@
 			$cnt++;
 		}
 		if($cnt == 0){
-			return false;	
+			return false;
 		}
 		else{
 			return $wfsConf;
 		}
-	}
-	else if($wfsID==="gui_confs"){
-		$wfsConf = array();
-		$wfsConf['id'] = array();
-		$wfsConf['abstract'] = array();
-		$wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
-		$cnt = 0;
-		foreach($wfsConf['id'] as $wfscid){
-			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
-			$v = array($wfscid);
-			$t = array('i');
-			$res = db_prep_query($sql,$v,$t);
-			while($row = db_fetch_array($res)){
-				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
-			}	
-			$cnt++;
-		}
-		if($cnt == 0){
-			return false;	
-		}
-		else{
-			return $wfsConf;
-		}
 	}
+	else if($wfsID==="gui_confs"){
+		$wfsConf = array();
+		$wfsConf['id'] = array();
+		$wfsConf['abstract'] = array();
+		$wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
+		$cnt = 0;
+		foreach($wfsConf['id'] as $wfscid){
+			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
+			$v = array($wfscid);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			while($row = db_fetch_array($res)){
+				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
+			}
+			$cnt++;
+		}
+		if($cnt == 0){
+			return false;
+		}
+		else{
+			return $wfsConf;
+		}
+	}
 }
 /*
  * Get all GUIs where the current user is owner. This are the GUIs where the user could publish his
  * wfs configurations
- * 
- * @return mixed[] 
+ *
+ * @return mixed[]
  */
 function getGuis(){
 	$adm = new administration();
@@ -175,19 +175,19 @@
 
 /*
  * get all wfs_confs of the selected WFS which are assigned to the selected gui
- * @param 
- * @return mixed[] 
+ * @param
+ * @return mixed[]
  */
 function getAssignedConfs($obj){
 	global $con;
 	$assignedConfs = array();
 	$confs = getWfsConfData($obj->selectedWfs);
 	if($confs === false){
-		return false;	
+		return false;
 	}
 	$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id IN (".join(",",$confs['id']).")";
 	$v = array($obj->selectedGui);
-	$t = array('s');	
+	$t = array('s');
 	$res = db_prep_query($sql,$v,$t);
 	if(!$res){
 		$e = new mb_exception("Error: SQL: " . $sql . " -> Gui: " .$obj->selectedGui);
@@ -205,7 +205,7 @@
 		$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
 		$v = array($obj->gui,$obj->confs->$i);
 		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);		
+		$res = db_prep_query($sql,$v,$t);
 		if(!$row = db_fetch_array($res)){
 			$sql1 = "INSERT INTO gui_wfs_conf (fkey_gui_id,fkey_wfs_conf_id) VALUES ($1,$2)";
 			$v1 = array($obj->gui, $obj->confs->$i);
@@ -224,82 +224,90 @@
 		$res = db_prep_query($sql,$v,$t);
 	}
 }
-/*
- * updates an WFS
- * 
- * @param object the un-encoded object 
- * @return boolean success
- */
-function updateWfs($obj){
-	$obj->success = false;
-	$mywfs = new wfs();
-	$mywfs->createObjFromDB($obj->wfs);
-	if(!$mywfs->updateObjFromXML($obj->url)){
-		return false;
-	}
-	if(!$mywfs->wfs2db("")){
-		return false;
-	}		
-	$obj->success = true;
-	return true;
-}
-/*
- * deletes an WFS
- * 
- * @param object the un-encoded object 
- * @return boolean success
- */
-function deleteWfs($obj){
-	//$obj->success = false;
-	$sql = "DELETE FROM wfs WHERE wfs_id = $1";
-	$v = array($obj->wfs);
-	$t = array('i');	
-	$res = db_prep_query($sql,$v,$t);
-	$obj->success = true;
-	return true;
-}
-
-/*
- * gets the specified url column from db
- * 
- * @param object the un-encoded object
- * @return string requested url
- */
-
-function getUpdateUrl($obj){
-	global $con;
-	$sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
-	$v = array($obj->wfs);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	while($row = db_fetch_array($res)){
-		return $row[$obj->column];
-	}
-	return "";
-}
+/*
+ * updates an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function updateWfs($obj){
+	$obj->success = false;
+	$mywfs = new wfs();
+	$mywfs->createObjFromDB($obj->wfs);
+	if(!$mywfs->updateObjFromXML($obj->url)){
+		return false;
+	}
+	if(!$mywfs->wfs2db("")){
+		return false;
+	}
+	$obj->success = true;
+	return true;
+}
+/*
+ * deletes an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function deleteWfs($obj){
+	//$obj->success = false;
+	$sql = "DELETE FROM wfs WHERE wfs_id = $1";
+	$v = array($obj->wfs);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	$obj->success = true;
+	return true;
+}
 
+/*
+ * gets the specified url column from db
+ *
+ * @param object the un-encoded object
+ * @return string requested url
+ */
+
+function getUpdateUrl($obj){
+	global $con;
+	$sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
+	$v = array($obj->wfs);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	while($row = db_fetch_array($res)){
+		$ContentOfColumn = $row[$obj->column];
+		if($obj->column == 'wfs_getcapabilities'){
+										$n = new administration();
+										$updateUrl = $n->checkURL($ContentOfColumn)."Version=".$row['wfs_version']."&Request=getCapabilities&SERVICE=WFS";
+		}else{
+					$updateUrl = $ContentOfColumn;
+		}
+			
+		return $updateUrl;
+	}
+	return "";
+}
+
 function getOwsproxy($obj){
-	$n = new administration();
-	if($obj->wfs=="gui_confs")
+	$n = new administration();
+	if($obj->wfs=="gui_confs")
 		return false;
-	return $n->getWfsOwsproxyString($obj->wfs); 
+	return $n->getWfsOwsproxyString($obj->wfs);
 }
 function setOwsproxy($obj){
 	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
+	if($obj->wfs=="gui_confs")
+		return false;
 	return $n->setWfsOwsproxyString($obj->wfs,true);
 }
 function removeOwsproxy($obj){
 	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
+	if($obj->wfs=="gui_confs")
+		return false;
 	return $n->setWfsOwsproxyString($obj->wfs,false);
 }
 /*
  * encodes and delivers the data
- * 
- * @param object the un-encoded object 
+ *
+ * @param object the un-encoded object
  */
 function sendOutput($out){
 	global $json;
@@ -307,4 +315,4 @@
 	header("Content-Type: text/x-json");
 	echo $output;
 }
-?>
\ No newline at end of file
+?>

Modified: branches/dev_lenkne/http/print/mod_printPDF_pdf.php
===================================================================
--- branches/dev_lenkne/http/print/mod_printPDF_pdf.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/print/mod_printPDF_pdf.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -17,11 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-#require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-ob_start();
-session_start();
-ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 
 include (dirname(__FILE__)."/../classes/class.ezpdf.php");
 include (dirname(__FILE__)."/../classes/class_stripRequest.php");
@@ -30,7 +26,6 @@
 include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
 include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
 include (dirname(__FILE__)."/../print/print_functions.php");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 
 if($log == true){
 	include (dirname(__FILE__)."/../classes/class_log.php");
@@ -157,75 +152,77 @@
 }
 $coord = mb_split(",",$map_extent);
 
-// analyse overview url and draw rectangle with position
-$o_url = new stripRequest($overview_url);
-$overview_width = round($o_url->get("width"));
-$overview_height = round($o_url->get("height"));
-
-if($factor>1){
-	$o_url->set('width',(intval($o_url->get('width'))*4));
-	$o_url->set('height',(intval($o_url->get('height'))*4));
-	if(in_array($o_url->get('map'),$highqualitymapfiles)){	
-			$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
-			$overview_url = $o_url->url;	
+if($overview === true){
+	// analyse overview url and draw rectangle with position
+	$o_url = new stripRequest($overview_url);
+	$overview_width = round($o_url->get("width"));
+	$overview_height = round($o_url->get("height"));
+	
+	if($factor>1){
+		$o_url->set('width',(intval($o_url->get('width'))*4));
+		$o_url->set('height',(intval($o_url->get('height'))*4));
+		if(in_array($o_url->get('map'),$highqualitymapfiles)){	
+				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
+				$overview_url = $o_url->url;	
+		}
 	}
-}
+	
+	if($matching == true){
+		$overview_url = preg_replace($pattern,$replacement,$overview_url);  
+	}
+	
+	
+	if ($size == "A4" && $format == "portrait"){
+		$overview_left = $a4p_overviewOffset_left;
+		$overview_bottom =$a4p_overviewOffset_bottom;
+	}elseif ($size == "A4" && $format == "landscape"){
+		$overview_left = $a4l_overviewOffset_left;
+		$overview_bottom =$a4l_overviewOffset_bottom;
+	}elseif ($size == "A3" && $format == "portrait"){
+		$overview_left = $a3p_overviewOffset_left;
+		$overview_bottom =$a3p_overviewOffset_bottom;
+	}elseif ($size == "A3" && $format == "landscape"){
+		$overview_left = $a3l_overviewOffset_left;
+		$overview_bottom = $a3l_overviewOffset_bottom;
+	}elseif ($size == "A2" && $format == "portrait"){
+		$overview_left = $a2p_overviewOffset_left;
+		$overview_bottom =$a2p_overviewOffset_bottom;
+	}elseif ($size == "A2" && $format == "landscape"){
+		$overview_left = $a2l_overviewOffset_left;
+		$overview_bottom = $a2l_overviewOffset_bottom;
+	}elseif ($size == "A1" && $format == "portrait"){
+		$overview_left = $a1p_overviewOffset_left;
+		$overview_bottom =$a1p_overviewOffset_bottom;
+	}elseif ($size == "A1" && $format == "landscape"){
+		$overview_left = $a1l_overviewOffset_left;
+		$overview_bottom = $a1l_overviewOffset_bottom;
+	}elseif ($size == "A0" && $format == "portrait"){
+		$overview_left = $a0p_overviewOffset_left;
+		$overview_bottom =$a0p_overviewOffset_bottom;
+	}elseif ($size == "A0" && $format == "landscape"){
+		$overview_left = $a0l_overviewOffset_left;
+		$overview_bottom = $a0l_overviewOffset_bottom;
+	}
+	
+	$o_extent = $o_url->get("BBOX");
+	
+	$array_overview_url[0] = $overview_url;
+	if($log == true){
+		$l = new log("printPDF_overview",$array_overview_url);
+	}
+	
+	/*
+	$o_new = new stripRequest($overview_url);
+	$o_new->set('width',50);
+	$o_new->set('height',50);
+	//$o->set('BBOX',$overview_extent);
+	$o_url_new =$o_new->url;
+	$array_overview[0] = $overview_url;
+	$array_overview[1] = $o_url;
+	*/
+}	
 
-if($matching == true){
-	$overview_url = preg_replace($pattern,$replacement,$overview_url);  
-}
-
-
-if ($size == "A4" && $format == "portrait"){
-	$overview_left = $a4p_overviewOffset_left;
-	$overview_bottom =$a4p_overviewOffset_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
-	$overview_left = $a4l_overviewOffset_left;
-	$overview_bottom =$a4l_overviewOffset_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
-	$overview_left = $a3p_overviewOffset_left;
-	$overview_bottom =$a3p_overviewOffset_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
-	$overview_left = $a3l_overviewOffset_left;
-	$overview_bottom = $a3l_overviewOffset_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
-	$overview_left = $a2p_overviewOffset_left;
-	$overview_bottom =$a2p_overviewOffset_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
-	$overview_left = $a2l_overviewOffset_left;
-	$overview_bottom = $a2l_overviewOffset_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
-	$overview_left = $a1p_overviewOffset_left;
-	$overview_bottom =$a1p_overviewOffset_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
-	$overview_left = $a1l_overviewOffset_left;
-	$overview_bottom = $a1l_overviewOffset_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
-	$overview_left = $a0p_overviewOffset_left;
-	$overview_bottom =$a0p_overviewOffset_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
-	$overview_left = $a0l_overviewOffset_left;
-	$overview_bottom = $a0l_overviewOffset_bottom;
-}
-
-$o_extent = $o_url->get("BBOX");
-
-$array_overview_url[0] = $overview_url;
-if($log == true){
-	$l = new log("printPDF_overview",$array_overview_url);
-}
-
 /*
-$o_new = new stripRequest($overview_url);
-$o_new->set('width',50);
-$o_new->set('height',50);
-//$o->set('BBOX',$overview_extent);
-$o_url_new =$o_new->url;
-$array_overview[0] = $overview_url;
-$array_overview[1] = $o_url;
-*/
-
-/*
  * north arrow
  */
 if($size == "A4" && $format == "portrait"){

Modified: branches/dev_lenkne/http/print/printPDF.conf
===================================================================
--- branches/dev_lenkne/http/print/printPDF.conf	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/print/printPDF.conf	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,6 +1,6 @@
 <?php
 
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+include_once(dirname(__FILE__)."/../../core/globalSettings.php");
 # filename for temporary imagefiles
 $filename = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".png";
 
@@ -9,7 +9,7 @@
 */
 $download = true;
 $downloadFile = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".pdf";
-$downloadText = _("Download: Map as PDF...");
+$downloadText = _mb("Download: Map as PDF...");
 
 /*
 *run print as iframe or window
@@ -22,11 +22,11 @@
 * Legend
 */
 $legend=true;
-$label_legend = _('print legend');
+$label_legend = _mb('Print legend');
 $legendFilename = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
 $legendFilenameUserPolygon = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
-$legendText = _("Legend");
-$legendFooter = _("powered by Mapbender");
+$legendText = _mb("Legend");
+$legendFooter = _mb("powered by Mapbender");
 $legendImage = "./img/mapbender_logo.png";
 $legendImage_width = 90;
 $legendImage_height = 13;
@@ -48,50 +48,53 @@
 	$new_comment2 = $_REQUEST["comment2"];
 }
 
-$text1 = _("Print preview");
+$text1 = _mb("Print preview");
 $text2 = "- Mapbender -";
 $text3 = "";
-$text4 = _("Scale 1:"). " ".$_REQUEST["map_scale"];
-$text5 = _("Date:") . " ".date("d.m.Y",strtotime("now"));
+$text4 = _mb("Scale 1:"). " ".$_REQUEST["map_scale"];
+$text5 = _mb("Date:") . " ".date("d.m.Y",strtotime("now"));
 
-$text6 = _("Notes:");
+$text6 = _mb("Notes:");
 $text7 = "";
 $text8 = $new_comment1;
 $text9 = $new_comment2;
 $text10 = "";
 
 
-$text11 = _("This copy has been automatically generated and is thus not valid without signature.");
-$text12 = _("This copy is protected by law (Par. 3 Abs. 1 VermKatG NW). It can be duplicaedted, modified, published or be passed to third parties only in agreement with");
-$text13 = _("the publisher, except duplicates and modifications aimed at internal use of government agencies or private use.");
+$text11 = _mb("This copy has been automatically generated and is thus not valid without signature.");
+$text12 = _mb("This copy is protected by law (Par. 3 Abs. 1 VermKatG NW). It can be duplicaedted, modified, published or be passed to third parties only in agreement with");
+$text13 = _mb("the publisher, except duplicates and modifications aimed at internal use of government agencies or private use.");
 
-$text14 = _("This copy is protected,");
-$text15 = _("ask me!!!!");
-$text16 = _("or the publisher");
-$text17 = _("or use is internally.");
+$text14 = _mb("This copy is protected,");
+$text15 = _mb("ask me!!!!");
+$text16 = _mb("or the publisher");
+$text17 = _mb("or use is internally.");
 
 /*
 * Labeling for buttons, textfields ...
 */
 
-$label_format = _("Format:");
+$label_format = _mb("Format");
 $label_format_a4 = "A4";
 $label_format_a3 = "A3";
 $label_format_a2 = "A2";
 $label_format_a1 = "A1";
 $label_format_a0 = "A0";
 
-$label_orientation = _("Orientation:");
-$label_portrait = _("portrait");
-$label_landscape = _("landscape");
+$label_orientation = _mb("Orientation");
+$label_portrait = _mb("portrait");
+$label_landscape = _mb("landscape");
 
-$label_72dpi = sprintf(_("Quality: %d dpi"), 72);
-$label_288dpi = sprintf(_("Quality: %d dpi"), 288);
+$label_quality = _mb("Quality");
+$label_72dpi = "72 dpi";
+$label_288dpi = "288 dpi";
 
-$label_comment = _("Comment (max. 30)");
-$comment_length = 30;
+$label_comment1 = _mb("Comment 1:");
+$label_comment2 = _mb("Comment 2:");
+$comment1_length = 30;
+$comment2_length = 30;
 
-$label_button = _('print');
+$label_button = _mb("print");
 
 /*
 * default
@@ -122,8 +125,8 @@
 $a4 = true;
 $a3 = true;
 $a2 = true;
-$a1 = false;
-$a0 = false;
+$a1 = true;
+$a0 = true;
 
 # dimensions of the map:
 

Modified: branches/dev_lenkne/http/print/printPDF_b.conf
===================================================================
--- branches/dev_lenkne/http/print/printPDF_b.conf	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/print/printPDF_b.conf	2008-08-05 15:35:27 UTC (rev 2741)
@@ -1,6 +1,6 @@
 <?php
 
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+include_once(dirname(__FILE__)."/../../core/globalSettings.php");
 # filename for temporary imagefiles
 $filename = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".png";
 
@@ -9,7 +9,7 @@
 */
 $download = true;
 $downloadFile = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".pdf";
-$downloadText = "Download: Karte als PDF...";
+$downloadText = _mb("Download: Map as PDF...");
 
 /*
 *run print as iframe or window
@@ -22,11 +22,11 @@
 * Legend
 */
 $legend=true;
-$label_legend = 'print legend';
+$label_legend = _mb('Print legend');
 $legendFilename = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
 $legendFilenameUserPolygon = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
-$legendText = "Legende";
-$legendFooter = "powered by Mapbender";
+$legendText = _mb("Legend");
+$legendFooter = _mb("powered by Mapbender");
 $legendImage = "./img/mapbender_logo.png";
 $legendImage_width = 90;
 $legendImage_height = 13;
@@ -48,50 +48,50 @@
 	$new_comment2 = $_REQUEST["comment2"];
 }
 
-$text1 = "Druckansicht";
+$text1 = _mb("Print preview");
 $text2 = "- Mapbender -";
 $text3 = "";
-$text4 = "Maßstab 1 : " . $_REQUEST["map_scale"];
-$text5 = "Datum: " . date("d.m.Y",strtotime("now"));;
+$text4 = _mb("Scale 1:"). " ".$_REQUEST["map_scale"];
+$text5 = _mb("Date:") . " ".date("d.m.Y",strtotime("now"));
 
-$text6 = "Notizen:";
+$text6 = _mb("Notes:");
 $text7 = "";
 $text8 = $new_comment1;
 $text9 = $new_comment2;
 $text10 = "";
 
 
-$text11 = "Der Auszug ist maschinell erzeugt, er ist ohne Unterschrift gültig.";
-$text12 = "Dieser Auszug ist gesetzlich geschützt (§ 3 Abs. 1 VermKatG NW). Vervielfältigungen, Umarbeitungen, Veröffentlichungen oder die Weitergabe an Dritte nur mit Zustimmung des";
-$text13 = "Herausgebers, ausgenommen Vervielfältigungen und Umarbeitungen zur innerdienstlichen Verwendung bei Behörden oder zum eigenen Gebrauch.";
+$text11 = _mb("This copy has been automatically generated and is thus not valid without signature.");
+$text12 = _mb("This copy is protected by law (Par. 3 Abs. 1 VermKatG NW). It can be duplicaedted, modified, published or be passed to third parties only in agreement with");
+$text13 = _mb("the publisher, except duplicates and modifications aimed at internal use of government agencies or private use.");
 
-$text14 = "Dieser Auszug ist gesetzlich geschützt (§ 3 Abs. 1 VermKatG NW). Vervielfältigungen,";
-$text15 = "Umarbeitungen, Veröffentlichungen oder die Weitergabe an Dritte nur mit Zustimmung";
-$text16 = "des Herausgebers, ausgenommen Vervielfältigungen und Umarbeitungen zur inner-";
-$text17 = "dienstlichen Verwendung bei Behörden oder zum eigenen Gebrauch.";
+$text14 = _mb("This copy is protected,");
+$text15 = _mb("ask me!!!!");
+$text16 = _mb("or the publisher");
+$text17 = _mb("or use is internally.");
 
 /*
 * Labeling for buttons, textfields ...
 */
 
-$label_format = "Format:";
+$label_format = _mb("Format");
 $label_format_a4 = "A4";
 $label_format_a3 = "A3";
 $label_format_a2 = "A2";
 $label_format_a1 = "A1";
 $label_format_a0 = "A0";
 
-$label_orientation = "Orientation: ";
-$label_portrait = "portrait";
-$label_landscape = "landscape";
+$label_orientation = _mb("Orientation");
+$label_portrait = _mb("portrait");
+$label_landscape = _mb("landscape");
 
-$label_72dpi = "Quality: 72 dpi";
-$label_288dpi = "Quality: 288 dpi";
+$label_72dpi = sprintf(_mb("Quality: %d dpi"), 72);
+$label_288dpi = sprintf(_mb("Quality: %d dpi"), 288);
 
-$label_comment = "Comment (max. 30)";
+$label_comment = _mb("Comment (max. 30)");
 $comment_length = 30;
 
-$label_button = 'print';
+$label_button = _mb("print");
 
 /*
 * default
@@ -122,8 +122,8 @@
 $a4 = true;
 $a3 = true;
 $a2 = true;
-$a1 = true;
-$a0 = true;
+$a1 = false;
+$a0 = false;
 
 # dimensions of the map:
 

Modified: branches/dev_lenkne/http/tools/mapbender_setup.php
===================================================================
--- branches/dev_lenkne/http/tools/mapbender_setup.php	2008-08-05 15:35:03 UTC (rev 2740)
+++ branches/dev_lenkne/http/tools/mapbender_setup.php	2008-08-05 15:35:27 UTC (rev 2741)
@@ -21,9 +21,7 @@
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
-include_once(dirname(__FILE__)."/../php/system.php");
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-include_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
  
 ?>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
@@ -290,4 +288,4 @@
 	</td></tr>
 </table>
 </body> 
-</html>
\ No newline at end of file
+</html>



More information about the Mapbender_commits mailing list