[Mapbender-commits] r3648 - in branches/print_dev: conf core http/classes http/css http/extensions http/img/button_digitize http/javascripts http/php lib resources/db resources/db/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Mar 9 05:01:26 EDT 2009


Author: mschulz
Date: 2009-03-09 05:01:26 -0400 (Mon, 09 Mar 2009)
New Revision: 3648

Modified:
   branches/print_dev/conf/digitize_default.conf
   branches/print_dev/conf/mapbender.conf-dist
   branches/print_dev/conf/wfs_additional_spatial_search.conf
   branches/print_dev/conf/wfs_default.conf
   branches/print_dev/core/system.php
   branches/print_dev/http/classes/class_administration.php
   branches/print_dev/http/classes/class_element.php
   branches/print_dev/http/classes/class_gml.php
   branches/print_dev/http/classes/class_gml_2_factory.php
   branches/print_dev/http/classes/class_gml_3.php
   branches/print_dev/http/classes/class_gml_3_factory.php
   branches/print_dev/http/classes/class_gml_factory.php
   branches/print_dev/http/classes/class_gml_feature.php
   branches/print_dev/http/classes/class_gml_line.php
   branches/print_dev/http/classes/class_gml_multiline.php
   branches/print_dev/http/classes/class_gml_multipolygon.php
   branches/print_dev/http/classes/class_gml_point.php
   branches/print_dev/http/classes/class_gml_polygon.php
   branches/print_dev/http/classes/class_locale.php
   branches/print_dev/http/classes/class_monitor.php
   branches/print_dev/http/classes/class_ows.php
   branches/print_dev/http/classes/class_universal_gml_factory.php
   branches/print_dev/http/classes/class_wfs.php
   branches/print_dev/http/classes/class_wfsToDb.php
   branches/print_dev/http/classes/class_wfs_1_0.php
   branches/print_dev/http/classes/class_wfs_1_1.php
   branches/print_dev/http/classes/class_wfs_configuration.php
   branches/print_dev/http/css/addwms.css
   branches/print_dev/http/css/login.css
   branches/print_dev/http/extensions/geom2wfst.php
   branches/print_dev/http/extensions/jquery.form.js
   branches/print_dev/http/img/button_digitize/geomInfo.png
   branches/print_dev/http/img/button_digitize/geomRemove.png
   branches/print_dev/http/img/button_digitize/mergePolygons_off.png
   branches/print_dev/http/img/button_digitize/mergePolygons_on.png
   branches/print_dev/http/img/button_digitize/mergePolygons_over.png
   branches/print_dev/http/javascripts/geometry.js
   branches/print_dev/http/javascripts/map.php
   branches/print_dev/http/javascripts/map_obj.js
   branches/print_dev/http/javascripts/mapnf.php
   branches/print_dev/http/javascripts/mod_copyright.php
   branches/print_dev/http/javascripts/mod_digitize_tab.php
   branches/print_dev/http/javascripts/mod_featureInfoTunnel.php
   branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php
   branches/print_dev/http/javascripts/mod_wfs_gazetteer_client.php
   branches/print_dev/http/javascripts/ovnf.php
   branches/print_dev/http/javascripts/requestGeometryConstructor.js
   branches/print_dev/http/javascripts/wms.js
   branches/print_dev/http/php/mb_listGUIs.php
   branches/print_dev/http/php/mod_WMSpreferences.php
   branches/print_dev/http/php/mod_gazetteerMetadata.php
   branches/print_dev/http/php/mod_gazetteerMetadata_search.php
   branches/print_dev/http/php/mod_wfs.php
   branches/print_dev/http/php/mod_wfs_gazetteer_server.php
   branches/print_dev/http/php/mod_wfs_result.php
   branches/print_dev/http/php/mod_wfs_server.php
   branches/print_dev/lib/point.js
   branches/print_dev/resources/db/schema_2.5.dia
   branches/print_dev/resources/db/update/update_2.6.sql
Log:
merged from trunk

Modified: branches/print_dev/conf/digitize_default.conf
===================================================================
--- branches/print_dev/conf/digitize_default.conf	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/conf/digitize_default.conf	2009-03-09 09:01:26 UTC (rev 3648)
@@ -10,9 +10,9 @@
 addButtonDig("setBasePoint", 1, "new_node_off.png", "", "", 112, 0);
 addButtonDig("delBasePoint", 1, "delete_node_off.png", "", "", 140, 0);
 addButtonDig("clear", 1, "del_off.png", "", "", 168, 0);
-addButtonDig("digitizeDifference", 0, "splitPolygon_off.png", "", "", 0, 28);
-addButtonDig("digitizeSplit", 0, "splitPolygon_off.png", "", "", 28, 28);
-addButtonDig("digitizeMerge", 0, "mergePolygons_off.png", "", "", 56, 28);
+addButtonDig("digitizeSplit", 1, "splitPolygon_off.png", "", "", 0, 28);
+addButtonDig("digitizeDifference", 1, "punchPolygon_off.png", "", "", 28, 28);
+addButtonDig("digitizeMerge", 1, "mergePolygons_off.png", "", "", 56, 28);
 
 //definition of directory of digitize buttons
 buttonDig_imgdir = "../img/button_digitize/";
@@ -58,4 +58,5 @@
 var wfsWindowWidth = 400;
 var wfsWindowHeight = 300;
 
-var spatialRequestResultToDigitize = 1;
\ No newline at end of file
+// deprecated! check wfs_default.conf to configure this behaviour
+//var spatialRequestResultToDigitize = 1;
\ No newline at end of file

Modified: branches/print_dev/conf/mapbender.conf-dist
===================================================================
--- branches/print_dev/conf/mapbender.conf-dist	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/conf/mapbender.conf-dist	2009-03-09 09:01:26 UTC (rev 3648)
@@ -150,7 +150,7 @@
 define("USE_I18N", false);  // requires gettext for PHP. 
 							// If "false", LANGUAGE is set to english
 define("LANGUAGE", "en");   // only available if USE_I18N is "true". 
-							// "en", "de", "bg", "gr", "nl", "it", es"
+							// "en", "de", "bg", "gr", "nl", "it", "es","fr","pt"
 
 ###HACK for GLOBALS
 $DBSERVER=DBSERVER;

Modified: branches/print_dev/conf/wfs_additional_spatial_search.conf
===================================================================
--- branches/print_dev/conf/wfs_additional_spatial_search.conf	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/conf/wfs_additional_spatial_search.conf	2009-03-09 09:01:26 UTC (rev 3648)
@@ -7,17 +7,17 @@
  * [@param {string} filteroption type of filter for search (values: "intersects" or "within"), used for buttons buttonRectangle and buttonPolygon 
  */
  
-var buttonRectangle = {"status":1,"img":"select_rectangle_off.png","title":"Rechteckauswahl","filteroption":"intersects"};
-var buttonPolygon = {"status":1,"img":"select_polygon_off.png","title":"Vieleckauswahl","filteroption":"intersects"};
-var buttonPoint = {"status":1, "img":"select_point_off.png","title":"Punktauswahl"};
-var buttonExtent = {"status":1,"img":"select_extent_off.png","title":"Auswahl Kartenrahmen"};
+var buttonRectangle = {"status":1,"img":"select_rectangle_off.png","title":"select by rectangle","filteroption":"intersects"};
+var buttonPolygon = {"status":1,"img":"select_polygon_off.png","title":"select by polygon","filteroption":"intersects"};
+var buttonPoint = {"status":1, "img":"select_point_off.png","title":"select by point"};
+var buttonExtent = {"status":1,"img":"select_extent_off.png","title":"select by extent"};
 
 var mb_wfs_tolerance = 8;
 
-var spatialRequestIsSetMessage = "Gebiet eingegrenzt, bitte OK klicken!";
-var clearFilterButtonLabel = "Neu";
+var spatialRequestIsSetMessage = "Spatial filter is set.";
+var clearFilterButtonLabel = "New";
 
-var noResultMsg = "Kein Ergebnis";
+var noResultMsg = "No result";
 
 var buttonWfs_imgdir = "../img/button_gray/";
 var buttonWfs_zIndex = 10;
@@ -28,14 +28,14 @@
 var wfsResultModulePath = "php/";
 var wfsResultModuleFilename = "mod_wfs_result.php";
 
-var searchPopupTitle = "Suchergebnisse";
-var searchPopupWidth = 985;
-var searchPopupHeight =300;
-var searchPopupX = 220; 
-var searchPopupY = 575; 
+var searchPopupTitle = "Search results";
+var searchPopupWidth = 400;
+var searchPopupHeight =250;
+var searchPopupX = 750; 
+var searchPopupY = 80; 
 
 var detailPopupTitle = "Details";
-var detailPopupWidth = 350;
+var detailPopupWidth = 400;
 var detailPopupHeight = 200;
-var detailPopupX = 840; 
-var detailPopupY = 575;
+var detailPopupX = 750; 
+var detailPopupY = 410;

Modified: branches/print_dev/conf/wfs_default.conf
===================================================================
--- branches/print_dev/conf/wfs_default.conf	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/conf/wfs_default.conf	2009-03-09 09:01:26 UTC (rev 3648)
@@ -19,7 +19,9 @@
 var buttonWfs_imgdir = "../img/button_gray/";
 var buttonWfs_zIndex = 10;
 
-var buttonWfs_toDigitize_on = 1;
+// if wfsResultToPopupDiv is 0, this is automatically 1
+var buttonWfs_toDigitize_on = 1; 
+var buttonWfs_toDigitize_target = "digitize";
 var buttonWfs_toDigitize_src = "../img/pencil.png";
 
 var generalHighlightZIndex = 90;

Modified: branches/print_dev/core/system.php
===================================================================
--- branches/print_dev/core/system.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/core/system.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -36,4 +36,4 @@
 
 define("ZOOM_MOUSEWHEEL", "1.1");
 
-define("MODULES_NOT_RELYING_ON_GLOBALS", "back,forward,zoomIn1,copyright,dependentDiv,dragMapSize,FeatureInfoRedirect,highlightPOI,navFrame,sandclock,scaleBar,scaleSel,setBackground,setBBOX,setPOI2Scale");
+define("MODULES_NOT_RELYING_ON_GLOBALS", "back,forward,zoomIn1,copyright,dependentDiv,dragMapSize,FeatureInfoRedirect,highlightPOI,navFrame,sandclock,scaleBar,scaleSel,setBBOX,setPOI2Scale");

Modified: branches/print_dev/http/classes/class_administration.php
===================================================================
--- branches/print_dev/http/classes/class_administration.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_administration.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -1198,5 +1198,61 @@
 		$user = new User($userid); 	
 		return $user->getWfsConfByPermission();
 	 }
+	 
+    /**
+     * selects the gui_categories 
+     *
+     * @param none			
+     * @return integer[]    the IDs of the gui_categories
+     */
+	function getGuiCategories(){
+		$sql = "SELECT * FROM gui_category order by category_id;";
+		$res = db_query($sql);
+		$row = db_fetch_array($res);
+		if ($row) {
+			$r = array();	
+			while($row = db_fetch_array($res)){
+				array_push($r,$row["category_id"]);
+			}
+			return $r;
+		}
+
+		else {
+			return false;
+		}
+	}
+	
+	
+	function getGuisByOwnerByGuiCategory($userid,$guicategoryid){
+		$gui_list= array();
+		$gui_list = $this->getGuisByOwner($userid,false);
+		$v = array();
+	   	$t = array();
+		
+			$sql = "SELECT fkey_gui_id FROM gui_gui_category ";
+			$sql .= "WHERE gui_gui_category.fkey_gui_category_id = $1 ";
+			$sql .= "AND gui_gui_category.fkey_gui_id IN (";
+					array_push($v, $guicategoryid);
+					array_push($t, "i");
+			
+				for($i=0; $i<count($gui_list); $i++){
+					if($i>0){ $sql .= ",";}
+					$sql .= "$".strval($i+2);
+					array_push($v, $gui_list[$i]);
+					array_push($t, "i");
+				}
+			$sql .= ");";
+			
+			$e = new mb_notice("getGuisByOwnerByGuiCategories: ".$sql);	
+			$e = new mb_notice("v - t: ".count($v)." -- ".count($t));	
+			$res = db_prep_query($sql,$v,$t);
+			$r = array();
+			while($row = db_fetch_array($res)){
+				array_push($r,$row["fkey_gui_id"]);
+			}
+			
+			return $r;		
+	}
+	 
 }
 ?>

Modified: branches/print_dev/http/classes/class_element.php
===================================================================
--- branches/print_dev/http/classes/class_element.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_element.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -209,10 +209,10 @@
 							"loading application '" . $this->guiId . "'";
 					}
 				}	
-				$openTag .= "<div id='loading_mapbender' " .
+				$openTag .= "<p id='loading_mapbender' " .
 								"style='margin:0px;padding:0px;width:100%;height:100%;'>" . 
-								$splashScreen . "</div>" . 
-								"<div id='complete_mapbender' " .
+								$splashScreen . "</p>" . 
+								"<p id='complete_mapbender' " .
 								"style='display:none'>";
 				unset ($e_id, $gui_id);
 			}
@@ -230,7 +230,7 @@
 	
 	private function getHtmlCloseTag () {
 		if ($this->element == "body" && $this->isBodyAndUsesSplashScreen) {
-			return "</div></body>";
+			return "</p></body>";
 		}
 		if ($this->closeTag != "") {
 			return "</" . $this->closeTag . ">";

Modified: branches/print_dev/http/classes/class_gml.php
===================================================================
--- branches/print_dev/http/classes/class_gml.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -24,7 +24,6 @@
 
 abstract class Gml {
 	var $featureCollection = null;
-	var $geomFeaturetypeElement;
 	var $doc;
 	
 	abstract public function toGml ();

Modified: branches/print_dev/http/classes/class_gml_2_factory.php
===================================================================
--- branches/print_dev/http/classes/class_gml_2_factory.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_2_factory.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -69,7 +69,7 @@
 		}
 	}
 
-	public function parsePolygon ($domNode, $gmlPolygon) {
+	private function parsePolygon ($domNode, $gmlPolygon) {
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
@@ -80,10 +80,6 @@
 		foreach ($allCoords as $Coords) {
 			$coordsDom = dom_import_simplexml($Coords);
 				
-//			$name = $coordsDom->nodeName;
-//			$value = $coordsDom->nodeValue;				
-//			echo "===> name: ".$name. ", Value: ".$value."<br>";
-			
 			foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
 
 				list($x,$y,$z) = explode(',',$pointCoords);
@@ -112,7 +108,7 @@
 		}
 	}
 
-	public function parseMultiLine ($domNode, $gmlMultiLine) {
+	private function parseMultiLine ($domNode, $gmlMultiLine) {
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
@@ -139,7 +135,7 @@
 		}
 	}		
 	
-	public function parseMultiPolygon ($domNode, $gmlMultiPolygon) {
+	private function parseMultiPolygon ($domNode, $gmlMultiPolygon) {
 //		echo $domNode->nodeName."<br>";
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
@@ -232,13 +228,11 @@
 	 * @param $domNode DOMNodeObject the feature tag of the GML 
 	 * 								(<gml:featureMember> in the above example)
 	 */
-	protected function parseFeature($domNode, $feature) {
-		if (func_num_args() == 3) {
-			$feature->geomFeaturetypeElement = func_get_arg(2);
-		}
+	protected function parseFeature($domNode, $feature, $wfsConf) {
+		$geomFeaturetypeElement = $wfsConf->getGeometryColumnName();
 
-		$currentSibling = $domNode->firstChild;
-
+		$currentSibling = $domNode;
+		
 		$feature->fid = $currentSibling->getAttribute("fid");
 		
 		$currentSibling = $currentSibling->firstChild;
@@ -251,7 +245,7 @@
 			$namespace = $this->findNameSpace($name);
 			$ns = $namespace['ns'];
 			$columnName = $namespace['value'];
-			$isGeomColumn = ($feature->geomFeaturetypeElement == null || $columnName == $feature->geomFeaturetypeElement);
+			$isGeomColumn = ($geomFeaturetypeElement == null || $columnName == $geomFeaturetypeElement);
 			
 			// check if this node is a geometry node.
 			// however, even if it is a property node, 
@@ -260,35 +254,45 @@
 			// sophisticated here...
 			if ($currentSibling->hasChildNodes() && $isGeomColumn){
 				$geomNode = $currentSibling->firstChild; 
-					$geomType = $geomNode->nodeName;
-					switch ($geomType) {
-						case "gml:Polygon" :
-							$feature->geometry = new GMLPolygon();
-							$this->parsePolygon($geomNode, $feature->geometry);
-							break;
-						case "gml:LineString" :
-							$feature->geometry = new GMLLine();
-							$this->parseLine($geomNode, $feature->geometry);
-							break;
-						case "gml:Point" :
-							$feature->geometry = new GMLPoint();
-							$this->parsePoint($geomNode, $feature->geometry);
-							break;
-						case "gml:MultiLineString" :
-							$feature->geometry = new GMLMultiLine();
-							$this->parseMultiLine($geomNode, $feature->geometry);
-							break;
-						case "gml:MultiPolygon" :
-							$feature->geometry = new GMLMultiPolygon();
-							$this->parseMultiPolygon($geomNode, $feature->geometry);
-							break;
-						default:
-							$feature->properties[$columnName] = $value;
-							break;
-					}
+				if ($geomNode->hasAttribute("srsName")) {
+					$srs = $geomNode->getAttribute("srsName");
+				}
+				$geomType = $geomNode->nodeName;
+				switch ($geomType) {
+					case "gml:Polygon" :
+						$feature->geometry = new GMLPolygon();
+						$feature->geometry->srs = $srs;
+						$this->parsePolygon($geomNode, $feature->geometry);
+						break;
+					case "gml:LineString" :
+						$feature->geometry = new GMLLine();
+						$feature->geometry->srs = $srs;
+						$this->parseLine($geomNode, $feature->geometry);
+						break;
+					case "gml:Point" :
+						$feature->geometry = new GMLPoint();
+						$feature->geometry->srs = $srs;
+						$this->parsePoint($geomNode, $feature->geometry);
+						break;
+					case "gml:MultiLineString" :
+						$feature->geometry = new GMLMultiLine();
+						$feature->geometry->srs = $srs;
+						$this->parseMultiLine($geomNode, $feature->geometry);
+						break;
+					case "gml:MultiPolygon" :
+						$feature->geometry = new GMLMultiPolygon();
+						$feature->geometry->srs = $srs;
+						$this->parseMultiPolygon($geomNode, $feature->geometry);
+						break;
+					default:
+						$feature->properties[$columnName] = $value;
+						break;
+				}
 			} 
 			else {
+				if ($currentSibling->hasChildNodes() && $currentSibling->firstChild instanceof DOMText) {
 					$feature->properties[$columnName] = $value;
+				}
 			}
 			
 			$currentSibling = $currentSibling->nextSibling;
@@ -302,13 +306,9 @@
 	 * @return Gml_2
 	 * @param $xml String
 	 */
-	public function createFromXml ($xml) {
+	public function createFromXml ($xml, $wfsConf) {
 		$gml2 = new Gml_2();
-		
-		if (func_num_args() == 2) {
-			$gml2->geomFeaturetypeElement = func_get_arg(1);
-		}
-		return parent::createFromXml($xml, $gml2);
+		return parent::createFromXml($xml, $wfsConf, $gml2);
 	}	
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_gml_3.php
===================================================================
--- branches/print_dev/http/classes/class_gml_3.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_3.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -26,6 +26,16 @@
 
 	public function toGml () {
 		
+		$str = "";
+		foreach ($this->featureCollection->featureArray as $feature) {
+			if (!$feature->geometry) {
+				$e = new mb_exception("Feature doesn't have a geometry.");
+				return null;
+			}
+			$geometry = $feature->geometry;
+			$str .= $geometry->toGml3();
+		}
+		return $str;
 	}
 
 }

Modified: branches/print_dev/http/classes/class_gml_3_factory.php
===================================================================
--- branches/print_dev/http/classes/class_gml_3_factory.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_3_factory.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -48,13 +48,9 @@
 	 * @return Gml_3
 	 * @param $xml String
 	 */
-	public function createFromXml ($xml) {
+	public function createFromXml ($xml, $wfsConf) {
 		$gml3 = new Gml_3();
-		
-		if (func_num_args() == 2) {
-			$gml3->geomFeaturetypeElement = func_get_arg(1);
-		}
-		return parent::createFromXml($xml, $gml3);
+		return parent::createFromXml($xml, $wfsConf, $gml3);
 	}	
 
 	protected function getDimensionFromNode ($domNode) {
@@ -98,7 +94,7 @@
 		}
 	}
 
-	public function parsePolygon ($domNode, $gmlPolygon) {
+	private function parsePolygon ($domNode, $gmlPolygon) {
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
@@ -140,12 +136,12 @@
 		}
 	}
 
-	public function parseMultiLine ($domNode, $gmlMultiLine) {
+	private function parseMultiLine ($domNode, $gmlMultiLine) {
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 		
-		$allCoords = $simpleXMLNode->xpath("gml:curveMembers/gml:LineString/gml:posList");
+		$allCoords = $simpleXMLNode->xpath("gml:curveMember/gml:LineString/gml:posList");
 			
 		$cnt=0;
 		foreach ($allCoords as $Coords) {
@@ -165,13 +161,12 @@
 		}
 	}		
 	
-	public function parseMultiPolygon ($domNode, $gmlMultiPolygon) {
-//		echo $domNode->nodeName."<br>";
+	private function parseMultiPolygon ($domNode, $gmlMultiPolygon) {
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 
-		$allPolygons = $simpleXMLNode->xpath("gml:surfaceMembers/gml:Polygon");
+		$allPolygons = $simpleXMLNode->xpath("gml:surfaceMember/gml:Polygon");
 		
 		$cnt=0;
 		foreach ($allPolygons as $polygon) {
@@ -268,17 +263,13 @@
 	 * @param $domNode DOMNodeObject the feature tag of the GML 
 	 * 								(<gml:featureMember> in the above example)
 	 */
-	protected function parseFeature($domNode, $feature) {
-		if (func_num_args() == 3) {
-			$feature->geomFeaturetypeElement = func_get_arg(2);
-		}
+	protected function parseFeature($domNode, $feature, $wfsConf) {
+		$geomFeaturetypeElement = $wfsConf->getGeometryColumnName();
 
+		$feature->fid = $domNode->getAttribute("gml:id");
+		
 		$currentSibling = $domNode->firstChild;
-
-		$feature->fid = $currentSibling->getAttribute("gml:id");
 		
-		$currentSibling = $currentSibling->firstChild;
-		
 		while ($currentSibling) {
 		
 			$name = $currentSibling->nodeName;
@@ -287,7 +278,7 @@
 			$namespace = $this->findNameSpace($name);
 			$ns = $namespace['ns'];
 			$columnName = $namespace['value'];
-			$isGeomColumn = ($feature->geomFeaturetypeElement == null || $columnName == $feature->geomFeaturetypeElement);
+			$isGeomColumn = ($geomFeaturetypeElement == null || $columnName == $geomFeaturetypeElement);
 			
 			// check if this node is a geometry node.
 			// however, even if it is a property node, 
@@ -296,35 +287,45 @@
 			// sophisticated here...
 			if ($currentSibling->hasChildNodes() && $isGeomColumn){
 				$geomNode = $currentSibling->firstChild; 
-					$geomType = $geomNode->nodeName;
-					switch ($geomType) {
-						case "gml:Polygon" :// untested!
-							$feature->geometry = new GMLPolygon();
-							$this->parsePolygon($geomNode, $feature->geometry);
-							break;
-						case "gml:LineString" :// untested!
-							$feature->geometry = new GMLLine();
-							$this->parseLine($geomNode, $feature->geometry);
-							break;
-						case "gml:Point" :
-							$feature->geometry = new GMLPoint();
-							$this->parsePoint($geomNode, $feature->geometry);
-							break;
-						case "gml:MultiCurve" :
-							$feature->geometry = new GMLMultiLine();
-							$this->parseMultiLine($geomNode, $feature->geometry);
-							break;
-						case "gml:MultiSurface" : 
-							$feature->geometry = new GMLMultiPolygon();
-							$this->parseMultiPolygon($geomNode, $feature->geometry);
-							break;
-						default:
-							$feature->properties[$columnName] = $value;
-							break;
-					}
+				$geomType = $geomNode->nodeName;
+				if ($geomNode->hasAttribute("srsName")) {
+					$srs = $geomNode->getAttribute("srsName");
+				}
+				switch ($geomType) {
+					case "gml:Polygon" :// untested!
+						$feature->geometry = new GMLPolygon();
+						$feature->geometry->srs = $srs;
+						$this->parsePolygon($geomNode, $feature->geometry);
+						break;
+					case "gml:LineString" :// untested!
+						$feature->geometry = new GMLLine();
+						$feature->geometry->srs = $srs;
+						$this->parseLine($geomNode, $feature->geometry);
+						break;
+					case "gml:Point" :
+						$feature->geometry = new GMLPoint();
+						$feature->geometry->srs = $srs;
+						$this->parsePoint($geomNode, $feature->geometry);
+						break;
+					case "gml:MultiCurve" :
+						$feature->geometry = new GMLMultiLine();
+						$feature->geometry->srs = $srs;
+						$this->parseMultiLine($geomNode, $feature->geometry);
+						break;
+					case "gml:MultiSurface" : 
+						$feature->geometry = new GMLMultiPolygon();
+						$feature->geometry->srs = $srs;
+						$this->parseMultiPolygon($geomNode, $feature->geometry);
+						break;
+					default:
+						$feature->properties[$columnName] = $value;
+						break;
+				}
 			} 
 			else {
+				if ($currentSibling->hasChildNodes() && $currentSibling->firstChild instanceof DOMText) {
 					$feature->properties[$columnName] = $value;
+				}
 			}
 			
 			$currentSibling = $currentSibling->nextSibling;

Modified: branches/print_dev/http/classes/class_gml_factory.php
===================================================================
--- branches/print_dev/http/classes/class_gml_factory.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_factory.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -175,11 +175,28 @@
 	 * @return Gml
 	 * @param $xml String
 	 */
-	public function createFromXml ($xml, $gml) {
+	public function createFromXml ($xml, $wfsConf, $gml) {
 		try {
 			$xml = $this->removeWhiteSpace($xml);
 			$gmlDoc = new SimpleXMLElement($xml);
 			
+			// we need to find the name and namespaces of the featuretype 
+			// used in this WFS configuration
+			$wfsFactory = new UniversalWfsFactory();
+			$myWfs = $wfsFactory->createFromDb($wfsConf->wfsId);
+			if (is_null($myWfs)) {
+				return null;
+			}
+			$featureType = $myWfs->findFeatureTypeById($wfsConf->featureTypeId);
+			
+			// register namespace of feature type
+			$pos = strpos($featureType->name, ":");
+			if ($pos !== false) {
+				$ns = substr($featureType->name, 0, $pos);
+				$url = $featureType->getNamespace($ns);
+				$gmlDoc->registerXPathNamespace($ns, $url);
+			}
+			
 			$gmlDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls');
 			$gmlDoc->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs');
 			$gmlDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
@@ -188,24 +205,19 @@
 			$gml->featureCollection = new FeatureCollection();
 			
 			// segments of the featureCollection
-			$gmlFeatureMembers = $gmlDoc->xpath("//gml:featureMember");
+			$gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
 			
-			if(count($gmlFeatureMembers)>0){
-				$cnt=0;
+			if (count($gmlFeatureMembers) > 0) {
 				foreach ($gmlFeatureMembers as $gmlFeatureMember) {
+					
+//					$e = new mb_exception($gmlFeatureMember->asXML());
 					$featureMember_dom = dom_import_simplexml($gmlFeatureMember);
 					
 					$feature = new Feature();
-					if ($this->geomFeaturetypeElement != null) {
-						$this->parseFeature($featureMember_dom, $feature, $this->geomFeaturetypeElement);
-					}
-					else {
-						$this->parseFeature($featureMember_dom, $feature);
-					}
+					$this->parseFeature($featureMember_dom, $feature, $wfsConf);
 					if (isset($feature->geometry)) {
 						$gml->featureCollection->addFeature($feature);
 					}
-					$cnt++;
 				}
 			}
 			return $gml;

Modified: branches/print_dev/http/classes/class_gml_feature.php
===================================================================
--- branches/print_dev/http/classes/class_gml_feature.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_feature.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -32,7 +32,6 @@
 	var $fid;
 	var $geometry = false;
 	var $properties = array();
-	var $geomFeaturetypeElement = null;
 	
 	public function __construct() {
 	}
@@ -40,7 +39,16 @@
 
 	public function toGeoJSON () {
 		$str = "";
-		$str .= "{\"type\":\"Feature\", \"id\":\"".$this->fid."\", \"geometry\": ";
+		$str .= "{\"type\":\"Feature\", \"id\":\"".$this->fid."\", \"crs\":";
+		
+		if (!$this->geometry || !$this->geometry->srs) {
+			$str .= "null, ";
+		}
+		else {
+			$str .= "{\"type\":\"name\", \"properties\":{\"name\":\"" . $this->geometry->srs . "\"}}, ";
+		}
+		
+		$str .= "\"geometry\": ";
 		if ($this->geometry) {
 			$str .= $this->geometry->toGeoJSON();
 		}

Modified: branches/print_dev/http/classes/class_gml_line.php
===================================================================
--- branches/print_dev/http/classes/class_gml_line.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_line.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -50,7 +50,18 @@
 	}
 	
 	public function toGml3 () {
-		
+		$str = "<gml:MultiCurve srsName=\"$this->srs\">" . 
+			"<gml:curveMember><gml:LineString>";
+
+		$ptArray = array();
+		foreach ($this->pointArray as $point) {
+			$ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+		}
+		$str .= implode("", $ptArray);
+
+		$str .= "</gml:LineString></gml:curveMember>";
+		$str .= "</gml:MultiCurve>";		
+		return $str;
 	}
 
 	public function toGeoJSON () {

Modified: branches/print_dev/http/classes/class_gml_multiline.php
===================================================================
--- branches/print_dev/http/classes/class_gml_multiline.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_multiline.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -50,6 +50,18 @@
 	}
 	
 	public function toGml3 () {
+		$str = "<gml:MultiCurve srsName='$srsName'>";
+		foreach ($this->lineArray as $line) {
+			$str .=	"<gml:curveMember><gml:LineString>";
+			$ptArray = array();
+			foreach ($line as $point) {
+				$ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+			}
+			$str .= implode("", $ptArray);
+			$str .= "</gml:LineString><gml:curveMember>";
+		}
+		$str .=	"<gml:MultiCurve>";
+		return $str;		
 		
 	}
 

Modified: branches/print_dev/http/classes/class_gml_multipolygon.php
===================================================================
--- branches/print_dev/http/classes/class_gml_multipolygon.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_multipolygon.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -48,7 +48,7 @@
 	}
 
 	public function toGml2 () {
-		$str .= "<gml:MultiPolygon srsName='$srsName'>";
+		$str = "<gml:MultiPolygon srsName='$this->srs'>";
 		for ($i = 0; $i < count($this->polygonArray); $i++) {
 			$str .= "<gml:polygonMember><gml:Polygon>" . 
 				"<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
@@ -87,6 +87,42 @@
 	}
 	
 	public function toGml3 () {
+		$str = "<gml:MultiSurface srsName='$this->srs'>";
+		for ($i = 0; $i < count($this->polygonArray); $i++) {
+			$str .= "<gml:surfaceMember><gml:Polygon>" . 
+				"<gml:exterior><gml:LinearRing>";
+
+			$currentExteriorRing = $this->polygonArray[$i];
+			
+			$ptArray = array();
+			for ($j = 0; $j < count($currentExteriorRing); $j++) {
+				$point = $currentExteriorRing[$j];
+				$ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+			}
+			$str .= implode("", $ptArray);
+			$str .= "</gml:LinearRing></gml:exterior>";
+			
+			// interior rings exist
+			if (count($this->innerRingArray) > $i && count($this->innerRingArray[$i]) > 0) {
+
+				for ($j = 0; $j < count($this->innerRingArray[$i]); $j++) {
+					$currentInteriorRing = $this->innerRingArray[$i][$j];
+					$str .= "<gml:interior><gml:LinearRing>";
+					$ptArray = array();
+					for ($k = 0; $k < count($currentInteriorRing); $k++) {
+						$point = $currentInteriorRing[$k];
+						$ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+					}
+					$str .= implode("", $ptArray);
+					$str .= "</gml:LinearRing></gml:interior>";
+				}
+
+			}
+			$str .= "</gml:Polygon></gml:surfaceMember>";
+		}
+		$str .= "</gml:MultiSurface>";
+
+		return $str;		
 		
 	}
 	

Modified: branches/print_dev/http/classes/class_gml_point.php
===================================================================
--- branches/print_dev/http/classes/class_gml_point.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_point.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -42,7 +42,10 @@
 	}
 	
 	public function toGml3 () {
-		
+		$str = "<gml:Point srsName='$this->srs'><gml:pos>";
+		$str .= $this->point["x"] . " " . $this->point["y"];
+		$str .= "</gml:pos></gml:Point>";
+		return $str;		
 	}
 
 	public function toGeoJSON () {

Modified: branches/print_dev/http/classes/class_gml_polygon.php
===================================================================
--- branches/print_dev/http/classes/class_gml_polygon.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_gml_polygon.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -73,7 +73,30 @@
 	}
 	
 	public function toGml3 () {
-		
+		$str = "<gml:MultiSurface srsName=\"$this->srs\">" . 
+			"<gml:surfaceMember><gml:Polygon><gml:exterior>" . 
+			"<gml:LinearRing>";
+
+		$ptArray = array();
+		foreach ($this->pointArray as $point) {
+			$ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+		}
+		$str .= implode(" ", $ptArray);
+
+		$str .= '</gml:LinearRing></gml:exterior>';
+				
+		foreach ($this->innerRingArray as $ring) {
+			$str .= "<gml:interior><gml:LinearRing>";
+			$ptArray = array();
+			foreach ($ring as $point) {
+				$ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+			}
+			$str .= implode("", $ptArray);
+			
+			$str .= "</gml:LinearRing></gml:interior>";
+		}
+		$str .= "</gml:Polygon></gml:surfaceMember></gml:MultiSurface>";
+		return $str;
 	}
 	
 	public function toGeoJSON () {

Modified: branches/print_dev/http/classes/class_locale.php
===================================================================
--- branches/print_dev/http/classes/class_locale.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_locale.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -37,12 +37,12 @@
 
 	function Mb_locale($languageId) {
 		if (!$languageId) {
-		        $languageId = LANGUAGE;
+			$languageId = LANGUAGE;
 		}
 		$e = new Mb_notice("class_locale: setting locale to " . $languageId);
 		if (USE_I18N) {
 			if (!$this->setCurrentLocale($languageId)) {
-	    	    $e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
+				$e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
 			}
 		}
 		else {
@@ -51,12 +51,12 @@
 	}
 
     /**
-     * Get the current locale, evaluating GET/POST variables, browser languages
+	 * Get the current locale, evaluating GET/POST variables, browser languages
      * and a default locale (in that preference)
-     *
-     * @returns current locale
-     */
-    function setCurrentLocale($languageId) {
+	 *
+	 * @returns current locale
+	 */
+	function setCurrentLocale($languageId) {
 
 		// try to set the locale to $languageId
 		if ($this->checkAndSetLocale($languageId)) {
@@ -65,28 +65,28 @@
 		else {
 			$e = new Mb_notice("class_locale: no input parameter specified.");
 		}
-		
+
 		// determine the browser setting and try to set locale according to that
 		if ($this->browserLanguage == null) {
-	        $this->setBrowserLanguages();
+			$this->setBrowserLanguages();
 		}
 		foreach ($this->browserLanguages as $lang) {
-	        $e = new Mb_notice("trying browser setting " . $lang);
-	        if ($this->checkAndSetLocale($lang)) {
-                return true;
-	        }
+			$e = new Mb_notice("trying browser setting " . $lang);
+			if ($this->checkAndSetLocale($lang)) {
+				return true;
+			}
 		}
-		
+
 		// set to default language
 		$e = new Mb_notice("trying default language " . $this->defaultLanguage);
 		return $this->checkAndSetLocale($this->defaultLanguage);
 	}
 
 	/**
-	* checks if a locale is available; if yes, it is set via setlocale
-	*
-	* @returns true if the the locale is set successfully; otherwise false
-	*/
+	 * checks if a locale is available; if yes, it is set via setlocale
+	 *
+	 * @returns true if the the locale is set successfully; otherwise false
+	 */
 	function checkAndSetLocale($languageId) {
 		if ($this->os == null) {
 			$this->os = $this->guessHostOS();
@@ -168,43 +168,54 @@
          * determines the available Locales on this system
          */
         function setSystemLocales() {
-                $this->systemLocales['pt_PT'] = array('linux' => 'pt_PT.utf8',
-                                        'windows' => 'Portuguese_Portugal.1252',
-                                        'bsd' => 'pt_PT',
-                                        'posix' => 'pt_PT');
-                $this->systemLocales['fr_FR'] = array('linux' => 'fr_FR.utf8',
-                                        'windows' => 'French_France.1252',
-                                        'bsd' => 'fr_FR',
-                                        'posix' => 'fr_FR');
-                $this->systemLocales['es_ES'] = array('linux' => 'es_ES.utf8',
-                                        'windows' => 'Spanish_Spain.1252',
-                                        'bsd' => 'es_ES',
-                                        'posix' => 'es_ES');
-                $this->systemLocales['it_IT'] = array(
-										'linux' => 'it_IT.utf8',
-                                        'windows' => 'Italian_Italy.1252',
-                                        'bsd' => 'it_IT',
-                                        'posix' => 'it_IT');
-                $this->systemLocales['de_DE'] = array(
-										'linux' => 'de_DE.utf8',
-                                        'windows' => 'German_Germany.1252',
-                                        'bsd' => 'de_DE',
-                                        'posix' => 'de_DE');
-                $this->systemLocales['en_US'] = array(
-										'linux' => 'en_US.utf8',
-                                        'windows' => 'English_United States.1252',
-                                        'bsd' => 'en_US',
-                                        'posix' => 'en_US');
-                $this->systemLocales['bg_BG'] = array(
-										'linux' => 'bg_BG.utf8',
-                                        'windows' => 'Bulgarian_Bulgaria.1251',
-                                        'bsd' => 'bg_BG',
-                                        'posix' => 'bg_BG');
-                $this->systemLocales['el_GR'] = array(
-										'linux' => 'el_GR.utf8',
-                                        'windows' => 'Greek_Greece.1253',
-                                        'bsd' => 'el_GR',
-                                        'posix' => 'el_GR');
+			$this->systemLocales['pt_PT'] = array(
+				'linux' => 'pt_PT.utf8',
+				'windows' => 'Portuguese_Portugal.1252',
+				'bsd' => 'pt_PT',
+				'posix' => 'pt_PT'
+			);
+			$this->systemLocales['fr_FR'] = array(
+				'linux' => 'fr_FR.utf8',
+				'windows' => 'French_France.1252',
+				'bsd' => 'fr_FR',
+				'posix' => 'fr_FR'
+			);
+			$this->systemLocales['es_ES'] = array(
+				'linux' => 'es_ES.utf8',
+				'windows' => 'Spanish_Spain.1252',
+				'bsd' => 'es_ES',
+				'posix' => 'es_ES'
+			);
+			$this->systemLocales['it_IT'] = array(
+				'linux' => 'it_IT.utf8',
+				'windows' => 'Italian_Italy.1252',
+				'bsd' => 'it_IT',
+				'posix' => 'it_IT'
+			);
+			$this->systemLocales['de_DE'] = array(
+				'linux' => 'de_DE.utf8',
+				'windows' => 'German_Germany.1252',
+				'bsd' => 'de_DE',
+				'posix' => 'de_DE'
+			);
+			$this->systemLocales['en_US'] = array(
+				'linux' => 'en_US.utf8',
+				'windows' => 'English_United States.1252',
+				'bsd' => 'en_US',
+				'posix' => 'en_US'
+			);
+			$this->systemLocales['bg_BG'] = array(
+				'linux' => 'bg_BG.utf8',
+				'windows' => 'Bulgarian_Bulgaria.1251',
+				'bsd' => 'bg_BG',
+				'posix' => 'bg_BG'
+			);
+			$this->systemLocales['el_GR'] = array(
+				'linux' => 'el_GR.utf8',
+				'windows' => 'Greek_Greece.1253',
+				'bsd' => 'el_GR',
+				'posix' => 'el_GR'
+			);
         }
 
         /**

Modified: branches/print_dev/http/classes/class_monitor.php
===================================================================
--- branches/print_dev/http/classes/class_monitor.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_monitor.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -22,6 +22,8 @@
 require_once(dirname(__FILE__)."/../classes/class_wms.php");
 require_once(dirname(__FILE__)."/../classes/class_bbox.php");
 
+require_once(dirname(__FILE__)."/../extensions/DifferenceEngine.php");
+
 define("MONITOR_DEFAULT_SCALE", 500000);
 define("MONITOR_IMG_WIDTH", 20);
 define("MONITOR_IMG_HEIGHT", 20);
@@ -54,6 +56,7 @@
 	
 	var $remoteXML;
 	var $localXML;
+	var $capabilitiesDiff;
 	
 	function __construct($wmsId, $uploadId, $autoUpdate) {
 		$this->wmsId = $wmsId;
@@ -104,6 +107,9 @@
 				// capabilities files don't match
 				else {
 					$this->result = 0;
+					$localXMLArray = explode("\n", htmlentities($this->localXML));
+					$remoteXMLArray = explode("\n", htmlentities($this->remoteXML));
+					$this->capabilitiesDiff = $this->outputDiffHtml($localXMLArray,$remoteXMLArray);
 				}
 			}
 			/*
@@ -176,6 +182,8 @@
 		$str .= "-------------------------------------------------------------------\n";
 		$str .= "local XML:\n\n" . $this->localXML . "\n\n";
 		$str .= "-------------------------------------------------------------------\n";
+		$str .= "diff:\n\n" . $this->capabilitiesDiff . "\n\n";
+		$str .= "-------------------------------------------------------------------\n";		
 		return (string) $str;
 	}
 
@@ -183,9 +191,9 @@
 	 * Update database
 	 */
 	function updateInDB() {
-		$sql = "UPDATE mb_monitor SET updated = $1, status = $2, image = $3, status_comment = $4, upload_url = $5, timestamp_end = $6, map_url = $7 WHERE upload_id = $8 AND fkey_wms_id = $9";
-		$v = array($this->updated, $this->result, $this->returnsImage, $this->comment, $this->capabilitiesURL, $this->timestamp, $this->mapURL, $this->uploadId, $this->wmsId);
-		$t = array('s', 'i', 'i', 's', 's', 's', 's', 's', 'i');
+		$sql = "UPDATE mb_monitor SET updated = $1, status = $2, image = $3, status_comment = $4, upload_url = $5, timestamp_end = $6, map_url = $7, timestamp_begin = $8, caps_diff = $9 WHERE upload_id = $10 AND fkey_wms_id = $11";
+		$v = array($this->updated, $this->result, $this->returnsImage, $this->comment, $this->capabilitiesURL, time(), $this->mapURL, $this->timestamp, $this->capabilitiesDiff, $this->uploadId, $this->wmsId);
+		$t = array('s', 'i', 'i', 's', 's', 's', 's', 's', 's', 's', 'i');
 		$res = db_prep_query($sql,$v,$t);		
 	}
 
@@ -474,6 +482,14 @@
 		$someArray = db_fetch_array($res);
 		return $someArray["wms_getcapabilities_doc"];
 	}
+	/*
+	* creates a html diff of the xml documents
+	*/
+	private function outputDiffHtml($localXMLArray,$remoteXMLArray) {
+		$diffObj = new Diff($localXMLArray,$remoteXMLArray);
+		$dft = new TableDiffFormatter();
+		return $dft->format($diffObj);
+	}		
 	
 }
 ?>

Modified: branches/print_dev/http/classes/class_ows.php
===================================================================
--- branches/print_dev/http/classes/class_ows.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_ows.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -47,6 +47,22 @@
 	
 	
 	/**
+	 * Removes the namespace from a tag name.
+	 * 
+	 * Example: input is "topp:the_geom" will return "the_geom".
+	 * 
+	 * @return String
+	 * @param $s String
+	 */
+	final protected function sepNameSpace($s) {
+		$c = strpos($s, ":"); 
+		if ($c > 0) {
+			return substr($s, $c + 1);
+		}
+		return $s;
+	}
+	
+	/**
 	 * Get namespace from a tag name.
 	 * 
 	 * Example: input is "topp:the_geom" will return "topp".
@@ -88,5 +104,33 @@
 		// "?" doesn't exist, so the conunction character must be "?"
 		return "?";
 	}
+	
+	final protected function get ($url) {
+		$connection = new connector($url);
+		$e = new mb_notice("OWS REQUEST: " . $url);
+		$data = $connection->file;
+		if (!$data) {
+			$e = new mb_exception("OWS request returned no result: " . $url);
+			return null;
+		}
+		return $data;
+	}
+	
+	final protected function post ($url, $postData) {
+		$connection = new connector();
+		$connection->set("httpType", "post");
+		$connection->set("httpContentType", "xml");
+		$connection->set("httpPostData", $postData);
+		
+		$e = new mb_notice("OWS REQUEST: " . $url . "\n\n" . $postData);
+		$data = $connection->load($url);
+		if (!$data) {
+			$e = new mb_exception("OWS request returned no result: " . $url . "\n" . $postData);
+			return null;
+		}
+		return $data;
+	}
+	
+	
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_universal_gml_factory.php
===================================================================
--- branches/print_dev/http/classes/class_universal_gml_factory.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_universal_gml_factory.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -41,12 +41,12 @@
 		$simpleXml = simplexml_load_string($xml);
 		$simpleXml->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 		
-		$nodeArray = $simpleXml->xpath("gml:featureMember//gml:posList");
+		$nodeArray = $simpleXml->xpath("//gml:posList");
 		if (count($nodeArray) > 0 ) {
 			return "3";
 		}
 
-		$nodeArray = $simpleXml->xpath("gml:featureMember//gml:pos");
+		$nodeArray = $simpleXml->xpath("//gml:pos");
 		if (count($nodeArray) > 0 ) {
 			return "3";
 		}
@@ -75,22 +75,24 @@
 	 * @return Wfs
 	 * @param $xml String
 	 */
-	public function createFromXml ($xml) {
+	public function createFromXml ($xml, $wfsConf) {
 		try {
 			$version = $this->getVersionFromXml($xml);
 
 			switch ($version) {
 				case "2":
+					$e = new mb_warning("Using GML2 Factory...");
 					$factory = new Gml_2_Factory();
 					break;
 				case "3":
+					$e = new mb_warning("Using GML3 Factory...");
 					$factory = new Gml_3_Factory();
 					break;
 				default:
 					throw new Exception("Unknown GML version " . $version);
 					break;
 			}
-			return $factory->createFromXml($xml);
+			return $factory->createFromXml($xml, $wfsConf);
 		}
 		catch (Exception $e) {
 			new mb_exception($e);

Modified: branches/print_dev/http/classes/class_wfs.php
===================================================================
--- branches/print_dev/http/classes/class_wfs.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_wfs.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -58,7 +58,7 @@
 		return null;
 	}
 	
-	protected function findFeatureTypeById ($id) {
+	public function findFeatureTypeById ($id) {
 		foreach ($this->featureTypeArray as $ft) {
 			if ($ft->id == $id) {
 				return $ft;
@@ -75,30 +75,9 @@
 				$this->getVersion() . "&typename=" . $featureTypeName . 
 				"&filter=" . urlencode($filter);
 
-		$connection = new connector($url);
-		$data = $connection->file;
-		if (!$data) {
-			$e = new mb_exception("WFS request returned no result: " . $url);
-			return null;
-		}
-		new mb_exception("Reply from WFS: " . $url . "\n\n" . $data);
-		return $data;
+		return $this->get($url);
 	}
 	
-	protected function post ($url, $postData) {
-		$connection = new connector();
-		$connection->set("httpType", "post");
-		$connection->set("httpContentType", "xml");
-		$connection->set("httpPostData", $postData);
-		
-		$data = $connection->load($url);
-		if (!$data) {
-			$e = new mb_exception("WFS request returned no result: " . $url . "\n" . $postData);
-			return null;
-		}
-		return $data;
-	}
-	
 	protected function getFeaturePost ($featureTypeName, $filter) {
 		$postData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . 
 			"<wfs:GetFeature version=\"" . $this->getVersion() . "\" " . 
@@ -146,6 +125,7 @@
 		$featureType = $this->findFeatureTypeById($wfsConf->featureTypeId);
 		$featureTypeName = $featureType->name;
 		$geomColumnName = $wfsConf->getGeometryColumnName();
+		$authWfsConfElement = $wfsConf->getAuthElement();
 
 		//
 		// GML string
@@ -164,16 +144,15 @@
 		// so I just take the first from the collection.
 		$feature = $gmlObj->featureCollection->featureArray[0];
 
-
-		switch ($method) {
+		switch (strtolower($method)) {
 			case "delete":
-				$requestData = $this->transactionDelete($feature, $featureTypeName);
+				$requestData = $this->transactionDelete($feature, $featureTypeName, $authWfsConfElement);
 				break;
 			case "update":
-				$requestData = $this->transactionUpdate($feature, $featureTypeName, $gml, $geomColumnName);
+				$requestData = $this->transactionUpdate($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName);
 				break;
 			case "insert":
-				$requestData = $this->transactionInsert($feature, $featureTypeName, $gml, $geomColumnName);
+				$requestData = $this->transactionInsert($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName);
 				break;
 			default:
 				$e = new mb_exception("Invalid transaction method: " . $method);
@@ -184,7 +163,14 @@
 		return $this->post($this->transaction, $postData);
 	}
 	
-	protected function transactionInsert ($feature, $featureTypeName, $gml, $geomColumnName) {
+	protected function transactionInsert ($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName) {
+		// authentication
+		$authSegment = "";
+		if (!is_null($authWfsConfElement)) {
+			$user = eval("return " . $authWfsConfElement->authVarname . ";");
+			$authSegment = "<$authWfsConfElement->name>$user</$authWfsConfElement->name>";
+		}
+
 		// add properties
 		$propertiesSegment = "";
 		foreach ($feature->properties as $key => $value) {
@@ -196,11 +182,22 @@
 		// add spatial data
 		$geomSegment = "<$geomColumnName>" . $gml . "</$geomColumnName>";
 
-		return "<wfs:Insert><$featureTypeName>" . $propertiesSegment . 
-					$geomSegment . "</$featureTypeName></wfs:Insert>";
+		return "<wfs:Insert><$featureTypeName>" . $authSegment . 
+				$propertiesSegment . $geomSegment . 
+				"</$featureTypeName></wfs:Insert>";
 	}
 	
-	protected function transactionUpdate ($feature, $featureTypeName, $gml, $geomColumnName) {
+	protected function transactionUpdate ($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName) {
+		// authentication
+		$authSegment = "";
+		if (!is_null($authWfsConfElement)) {
+			$user = eval("return " . $authWfsConfElement->authVarname . ";");
+			$authSegment = "<ogc:PropertyIsEqualTo><ogc:PropertyName>" . 
+				$authWfsConfElement->name . "</ogc:PropertyName><ogc:Literal>" . 
+				$user . "</ogc:Literal></ogc:PropertyIsEqualTo>";
+
+		}
+
 		// add properties
 		$propertiesSegment = "";
 		foreach ($feature->properties as $key => $value) {
@@ -215,7 +212,11 @@
 			$e = new mb_exception("Feature ID not set.");
 			return null;
 		}
-		$filterSegment = "<ogc:Filter><ogc:FeatureId fid=\"$feature->fid\"/></ogc:Filter>";
+		$condition = $this->getFeatureIdFilter($feature->fid);
+		if ($authSegment !== "") {
+			$condition = "<And>" . $condition . $authSegment . "</And>";
+		}
+		$filterSegment = "<ogc:Filter>" . $condition . "</ogc:Filter>";
 
 		// add geometry
 		$geomSegment = "<wfs:Property><wfs:Name>$geomColumnName</wfs:Name>" . 
@@ -229,91 +230,80 @@
 				"</wfs:Update>";
 	}
 	
-	protected function transactionDelete ($feature, $featureTypeName) {
+	protected function getFeatureIdFilter ($fid) {
+	}
+	
+	protected function transactionDelete ($feature, $featureTypeName, $authWfsConfElement) {
+		// authentication
+		$authSegment = "";
+		if (!is_null($authWfsConfElement)) {
+			$user = eval("return " . $authWfsConfElement->authVarname . ";");
+			$authSegment = "<ogc:PropertyIsEqualTo><ogc:PropertyName>" . 
+				$authWfsConfElement->name . "</ogc:PropertyName><ogc:Literal>" . 
+				$user . "</ogc:Literal></ogc:PropertyIsEqualTo>";
+
+		}
+
 		// filter
 		if (!isset($feature->fid)) {
 			$e = new mb_exception("Feature ID not set.");
 			return null;
 		}
+		$condition = $this->getFeatureIdFilter($feature->fid);
+		if ($authSegment !== "") {
+			$condition = "<And>" . $condition . $authSegment . "</And>";
+		}
 
 		return "<wfs:Delete typeName=\"$featureTypeName\">" . 
-			"<ogc:Filter><ogc:FeatureId fid=\"$feature->fid\"/></ogc:Filter>" . 
+			"<ogc:Filter>" . $condition . "</ogc:Filter>" . 
 			"</wfs:Delete>";
 	}
 	
 	protected function wrapTransaction ($featureType, $wfsRequest) {
 		$featureNS = $this->getNameSpace($featureType->name);
 		
-		$str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . 
-			"<wfs:Transaction version=\"" . $this->getVersion() . 
-			"\" service=\"WFS\" ";
-
-		$ns_gml = false;
-		$ns_ogc = false;
-		$ns_xsi = false;
-		$ns_wfs = false;
-		$ns_featureNS = false;
-
+		$ns_gml = 'xmlns:gml="http://www.opengis.net/gml" ';	
+		$ns_ogc = 'xmlns:ogc="http://www.opengis.net/ogc" ';	
+		$ns_xsi = 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
+		$ns_featureNS = "xmlns:$featureNS=\"http://www.someserver.com/$featureNS\" ";	
+		$ns_wfs = "xmlns:wfs=\"http://www.opengis.net/wfs\" ";	
+		$strForSchemaLocation = "";
+		
 		foreach ($featureType->namespaceArray as $namespace) {
+			$n = $namespace->name;
+			$v = $namespace->value;
 
-			if ($namespace->name == "gml"){
-				 $ns_gml = true;
-				 $str .= "xmlns:" . $namespace->name . 
-				 	"=\"" . $namespace->value . "\" ";
+			if ($n === "gml") {
+				 $ns_gml = "xmlns:$n=\"$v\" ";
 			} 
-			else if ($namespace->name == "ogc") {
-				$ns_ogc = true;
-				$str .= "xmlns:" . $namespace->name . 
-					"=\"" . $namespace->value . "\" ";
+			else if ($n === "ogc") {
+				$ns_ogc = "xmlns:$n=\"$v\" ";
 			} 
-			else if ($namespace->name == "xsi") {
-				$ns_xsi = true;
-				$str .= "xmlns:" . $namespace->name . 
-					"=\"" . $namespace->value . "\" ";
+			else if ($n === "xsi") {
+				$ns_xsi = "xmlns:$n=\"$v\" ";
 			} 
-			else if ($namespace->name == "wfs") {
-				$ns_wfs = true;
-				$str .= "xmlns:" . $namespace->name . 
-					"=\"" . $namespace->value . "\" ";
+			else if ($n === "wfs") {
+				$ns_wfs = "xmlns:$n=\"$v\" ";
 			} 
-			else if ($namespace->name == $featureNS) {
-				$ns_featureNS = true;
-				$str .= "xmlns:" . $namespace->name .
-					"=\"" . $namespace->value . "\" ";
-				$strForSchemaLocation = $namespace->value;
+			else if ($n === $featureNS) {
+				$ns_featureNS = "xmlns:$n=\"$v\" ";
+				$strForSchemaLocation = $v;
 			}
 		}
 
-		if (!$ns_gml) {
-			$str .= 'xmlns:gml="http://www.opengis.net/gml" ';	
-		}
-		if (!$ns_ogc) {
-			$str .= 'xmlns:ogc="http://www.opengis.net/ogc" ';	
-		}
-		if (!$ns_xsi) {
-			$str .= 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
-		} 
-		if (!ns_featureNS) {
-			$str .= "xmlns:" . $featureNS . "=\"http://www.someserver.com/" . $featureNS . "\" ";	
-		}
-		if (!$ns_wfs) {
-			$str .= "xmlns:wfs=\"http://www.opengis.net/wfs\" ";	
-		}
-
-		$str .= "xsi:schemaLocation=\"http://www.opengis.net/wfs";
-		$str .= " http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd";
-		$str .= " " . $strForSchemaLocation;
-		$str .= " " . $this->describeFeatureType;
-		//$str .= mb_getConjunctionCharacter(myconf['wfs_describefeaturetype']);
-		//$str .= 'typename=' + myconf['featuretype_name'];
-		$str .= "\">";		
-		
-		$str .= $wfsRequest;
-		
-		$str .= "</wfs:Transaction>";
-		return $str;
+		return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . 
+			"<wfs:Transaction version=\"" . $this->getVersion() . 
+			"\" service=\"WFS\" " . $ns_gml . $ns_ogc . $ns_xsi . 
+			$ns_featureNS . $ns_wfs . 
+			"xsi:schemaLocation=\"http://www.opengis.net/wfs" . 
+			" http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd " . 
+			$strForSchemaLocation . " " . $this->describeFeatureType . 
+			$this->getConjunctionCharacter($this->describeFeatureType) . 
+			"typename=" . $featureType->name . 
+			"\">" .	$wfsRequest . "</wfs:Transaction>";
 	}
 	
+	
 	// -----------------------------------------------------------------------
 	//
 	// Output formats

Modified: branches/print_dev/http/classes/class_wfsToDb.php
===================================================================
--- branches/print_dev/http/classes/class_wfsToDb.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_wfsToDb.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -53,7 +53,7 @@
 		$sql .= "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)";
 	
 		$v = array(
-			$aWfs->version, 
+			$aWfs->getVersion(), 
 			$aWfs->name, 
 			$aWfs->title, 
 			$aWfs->summary, 
@@ -106,12 +106,12 @@
 		$sql = "UPDATE wfs SET wfs_version = $1, wfs_name = $2, wfs_title = $3, ";
 		$sql .= "wfs_abstract = $4, wfs_getcapabilities = $5, wfs_getcapabilities_doc = $6, ";
 		$sql .= "wfs_upload_url = $7, wfs_describefeaturetype = $8, wfs_getfeature = $9, ";
-		$sql .= "wfs_transaction = $10, fees = $11, accessconstraints = $12, wfs_owner = $13, ";
-		$sql .= "wfs_timestamp = $14 ";
-		$sql .= "WHERE wfs_id = $15";
+		$sql .= "wfs_transaction = $10, fees = $11, accessconstraints = $12, ";
+		$sql .= "wfs_timestamp = $13 ";
+		$sql .= "WHERE wfs_id = $14";
 
 		$v = array(
-			$aWfs->version, 
+			$aWfs->getVersion(), 
 			$aWfs->name, 
 			$aWfs->title, 
 			$aWfs->summary,
@@ -123,12 +123,12 @@
 			$aWfs->transaction,
 			$aWfs->fees, 
 			$aWfs->accessconstraints, 
-			$_SESSION["mb_user_id"],
 			strtotime("now"), 
 			$aWfs->id
 		);
 			
-		$t = array('s', 's', 's', 's', 's', 's', 's', 's' ,'s' ,'s' ,'s' ,'s' ,'i' ,'i' ,'i');
+		$t = array('s', 's', 's', 's', 's', 's', 's', 's' ,'s' ,'s' ,'s' ,'s', 'i' ,'i');
+		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql, $v, $t);
 		if (!$res) {
 			$e = new mb_exception("Error while updating WFS in database.");
@@ -150,15 +150,21 @@
 		// delete obsolete WFS feature types
 		$v = array($aWfs->id);
 		$t = array("i");
-		$sql = "DELETE FROM wfs_featuretype WHERE wfs_id = $1 AND featuretype_name NOT IN (";
+		$sql = "DELETE FROM wfs_featuretype WHERE fkey_wfs_id = $1";
+		$sql_in = "";
 		for ($i = 0; $i < count($featureTypeNameArray); $i++) {
 			if ($i > 0) {
-				$sql .= ", ";
+				$sql_in .= ", ";
 			}
-			$sql .= "$" . ($i+1);
-			array_push($v, $featureTypeNameArray);
+			$sql_in .= "$" . ($i+2);
+			array_push($v, $featureTypeNameArray[$i]->name);
 			array_push($t, "s");
 		}
+		if ($sql_in !== "") {
+			$sql .=  " AND featuretype_name NOT IN (" . $sql_in . ")";
+		}
+		
+		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql,$v,$t);
 		if (!$res) {
 			$e = new mb_exception("Error while deleting obsolete WFS feature types in database.");
@@ -231,6 +237,7 @@
 			$aWfsFeatureTypeNamespace->value
 		);
 		$t = array("s", "s", "s", "s");
+		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql, $v, $t);
 
 		if (!$res) {
@@ -289,6 +296,7 @@
 		);
 		$t = array("s", "i", "i");
 
+		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql, $v, $t);
 
 		if (!$res) {
@@ -367,8 +375,10 @@
 		);
 		$t = array('s','s','s','i');
 
+		$e = new mb_exception($sql . " " . print_r($v, true));
+
 		$res = db_prep_query($sql,$v,$t);
-		if (!$res ) {
+		if (!$res) {
 			$e = new mb_exception("Error while updating WFS feature type in database.");
 			return false;
 		}
@@ -378,23 +388,29 @@
 		for ($i = 0; $i < count($aWfsFeatureType->elementArray); $i++) {
 			$currentElement = $aWfsFeatureType->elementArray[$i];
 			array_push($featureTypeElementNameArray, $currentElement);
-			if (!WfsToDb::updateFeatureTypeElement($currentElement)) {
+			if (!WfsToDb::updateFeatureTypeElement($aWfsFeatureType->id, $currentElement)) {
 				return false;
 			}
 		}		
 		
 		// delete obsolete WFS feature type elements
-		$v = array($aWfs->id);
+		$v = array($aWfsFeatureType->id);
 		$t = array("i");
-		$sql = "DELETE FROM wfs_element WHERE fkey_featuretype_id = $1 AND element_name NOT IN (";
+		$sql = "DELETE FROM wfs_element WHERE fkey_featuretype_id = $1";
+
+		$sql_in = "";
 		for ($i = 0; $i < count($featureTypeElementNameArray); $i++) {
 			if ($i > 0) {
-				$sql .= ", ";
+				$sql_in .= ", ";
 			}
-			$sql .= "$" . ($i+1);
-			array_push($v, $featureTypeElementNameArray);
+			$sql_in .= "$" . ($i+2);
+			array_push($v, $featureTypeElementNameArray[$i]->name);
 			array_push($t, "s");
 		}
+		if ($sql_in !== "")
+		$sql .= " AND element_name NOT IN (" . $sql_in . ")";
+
+		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql,$v,$t);
 		if (!$res) {
 			$e = new mb_exception("Error while deleting obsolete WFS feature type element in database.");
@@ -409,6 +425,7 @@
 			$aWfsFeatureType->id
 		);
 		$t = array("i", "i");
+		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql, $v, $t);
 		if (!$res) {
 			$e = new mb_exception("Error while deleting WFS feature type namespaces from the database.");

Modified: branches/print_dev/http/classes/class_wfs_1_0.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_1_0.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_wfs_1_0.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -28,6 +28,42 @@
 	public function getVersion () {
 		return "1.0.0";
 	}
+	
+	public function transaction ($method, $wfsConf, $geoJson) {
+		$gmlFactory = new Gml_2_Factory();
+		$gmlObj = $gmlFactory->createFromGeoJson($geoJson);
+	
+		return parent::transaction ($method, $wfsConf, $gmlObj);
+	}
+	
+	public function parseTransactionResponse ($xml) {
+		$result = new stdClass();
+		$result->success = false;
+		$result->message = "";
+		$result->xml = $xml;
+
+		$data = mb_eregi_replace("^[^<]*", "", $xml);
+		$data = mb_eregi_replace("[^>]*$", "", $data);
+		$resObj = array();
+		if (mb_strpos(mb_strtoupper($data), "SUCCESS") !== false) {
+			$result->success = true;
+			if (mb_ereg("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", $data)) {
+				$fid = mb_ereg_replace("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", "\\1", $data);
+				$result->fid = $fid;
+			}
+			$result->message = "Success.";
+		}
+		else {
+			$result->message = "An unknown error occured.";
+		}
+		return $result;
+	}
+
+	protected function getFeatureIdFilter ($fid) {
+		return "<ogc:FeatureId fid=\"$fid\"/>";
+	}
+	
+	
 }
 
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_wfs_1_1.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_1_1.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_wfs_1_1.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -28,6 +28,76 @@
 	public function getVersion () {
 		return "1.1.0";
 	}
+
+	public function transaction ($method, $wfsConf, $geoJson) {
+		$gmlFactory = new Gml_3_Factory();
+		$gmlObj = $gmlFactory->createFromGeoJson($geoJson);
+	
+		return parent::transaction ($method, $wfsConf, $gmlObj);
+	}
+	
+	public function parseTransactionResponse ($xml) {
+		$result = new stdClass();
+		$result->success = false;
+		$result->message = "";
+		$result->xml = $xml;
+		
+		$simpleXml = simplexml_load_string($xml);
+		$simpleXml->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs');
+		$simpleXml->registerXPathNamespace('ogc', 'http://www.opengis.net/ogc');
+		
+		//
+		// get error messages
+		//
+		$nodeArray = $simpleXml->xpath("//wfs:TransactionResults/wfs:Action/wfs:Message");
+		$messageArray = array();
+		foreach ($nodeArray as $node) {
+			$domNode = dom_import_simplexml($node);
+			
+			$result->success = false;
+			$messageArray[] = $domNode->nodeValue;
+		}
+		if (count($messageArray) > 0) {
+			$result->message = implode(". ", $messageArray);
+			return $result;		
+		}
+
+		//
+		// Get transaction results
+		//
+		$nodeArray = $simpleXml->xpath("//wfs:TransactionSummary/*");
+		$messageArray = array();
+		foreach ($nodeArray as $node) {
+			$domNode = dom_import_simplexml($node);
+			$tagName = $this->sepNameSpace($domNode->nodeName);
+			$result->success = true;
+			$messageArray[] = $tagName . ": " . $domNode->nodeValue;
+		}		
+		if (count($messageArray) > 0) {
+			$result->message = implode(". ", $messageArray);
+
+			// get fid
+			$nodeArray = $simpleXml->xpath("//wfs:InsertResults/wfs:Feature/ogc:FeatureId");
+			$e = new mb_exception(print_r($nodeArray, true));
+			foreach ($nodeArray as $node) {
+				$domNode = dom_import_simplexml($node);
+				if ($domNode->hasAttribute("fid")) {
+					$result->fid = $domNode->getAttribute("fid");
+				}
+			}
+			return $result;		
+		}
+		
+		//
+		// Unknown error
+		//
+		$result->message = "An unknown error has occured.";
+		return $result;
+	}
+
+	protected function getFeatureIdFilter ($fid) {
+		return "<ogc:GmlObjectId gml:id=\"$fid\"/>";
+	}
+	
 }
-
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_wfs_configuration.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_configuration.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/classes/class_wfs_configuration.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -71,6 +71,27 @@
 	}
 	
 	/**
+	 * Finds the featuretype element which stores the authentication data.
+	 * 
+	 * @return String 
+	 */
+	public function getAuthElement () {
+		foreach ($this->elementArray as $element) {
+			if (!empty($element->authVarname)) {
+				$validname = preg_match('/^\$_[a-zA-z]+(\[\"[a-zA-Z_]+\"\])?$/', $element->authVarname);
+
+				if ($validname === 1) {
+					return $element;
+				}
+				else {
+					$e = new mb_exception("Found auth element, but variable name is not valid: " . $element->authVarname);
+				}
+			}
+		}
+		return null;
+	}
+
+	/**
 	 * Checks if the user currently logged in is allowed to access
 	 * the WFS configuration
 	 * 
@@ -156,7 +177,7 @@
 			$element->respos = $row["f_respos"];
 			$element->minInput = $row["f_min_input"];
 			$element->formElementHtml = $row["f_form_element_html"];
-			$element->authVarname = $row["f_auth_varname"];
+			$element->authVarname = stripslashes($row["f_auth_varname"]);
 			$element->detailpos = $row["f_detailpos"];
 			$element->operator = $row["f_operator"];
 			$element->showDetail = $row["f_show_detail"];

Modified: branches/print_dev/http/css/addwms.css
===================================================================
--- branches/print_dev/http/css/addwms.css	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/css/addwms.css	2009-03-09 09:01:26 UTC (rev 3648)
@@ -48,20 +48,20 @@
 }
 
 table tbody tr:hover {
-	background-color: #CCC;
+	background-color: #E0FFFF;
 }
 
 table thead th {
 	padding: 10px 5px;
 	text-align: left;
-	color: #FFF;
-	background-color: #000;
+	color: #000;
+	background-color: #B5B5B5;
 	border: 1px solid #000;
-	border-top: 0;
+	font-weight: bold;
 }
 
 table tbody td {
-	padding: 5px;
+	padding: 3px;
 	border: 1px solid #000;
 	cursor: pointer;
 }

Modified: branches/print_dev/http/css/login.css
===================================================================
--- branches/print_dev/http/css/login.css	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/css/login.css	2009-03-09 09:01:26 UTC (rev 3648)
@@ -1,52 +1,145 @@
-  	body{
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080;
-  		background-color: White;
-  	}
+body{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size : 12px;
+	color: #808080;
+	background-color: White;
+}
 
-  	table{
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080;
-  	}
+table{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size : 12px;
+	color: #808080;
+}
 
 
-	input{
-		width: 180px;
-  		font-size : 12px;
-	}
+input{
+	width: 180px;
+	font-size : 12px;
+}
 
-	.myButton{
-		font-size : 12;
-		width: 100px;
-		height: 20px;
-	}
+.myButton{
+	font-size : 12;
+	width: 100px;
+	height: 20px;
+}
 
-  	.list_guis{
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080;
-  	}
-  	a:link{
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		text-decoration : none;
-  		color: #808080;
-  	}
-  	a:visited {
-  		font-family: Arial, Helvetica, sans-serif;
-  		text-decoration : none;
-  		color: #808080;
-  		font-size : 12px;
-  	}
-  	a:active {
-  		font-family: Arial, Helvetica, sans-serif;
-  		text-decoration : none;
-  		color: #808080;
-  		font-size : 12px;
-  	}
-	
-	.login_text{
-		width: 150px;
-	}
+.list_guis{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size : 12px;
+	color: #808080;
+}
+a:link{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size : 12px;
+	text-decoration : none;
+	color: #808080;
+}
+a:visited {
+	font-family: Arial, Helvetica, sans-serif;
+	text-decoration : none;
+	color: #808080;
+	font-size : 12px;
+}
+a:active {
+	font-family: Arial, Helvetica, sans-serif;
+	text-decoration : none;
+	color: #808080;
+	font-size : 12px;
+}
+
+.login_text{
+	width: 150px;
+}
+.logoutButton{
+position:relative;
+left:300px;
+top:-40px;
+}
+.logoutButton img{
+width:22px;
+height:22px;
+border:0px;
+}
+img {
+	border: 0;
+}
+/* BEGIN gui listing */
+
+
+/* defines Headings */
+h1{
+font-size:14pt;
+}
+
+h2{
+	font-size:12pt;
+}
+
+/* defines the Background of the Zebra (default=gray #eee) */
+h2.gui_category,
+p.gui_category_description,
+ul.gui_list {
+  width:75%;
+	padding: 5px;
+	padding-left:3px;
+  border: 1px solid black;
+  margin:0px;
+  background-color: #eee;
+}
+
+
+
+/* defines cathegory heading*/
+.gui_category h2{
+	font-size:1.25em;
+	margin-bottom:3px;
+	margin-top:6px;
+	text-decoration:underline;
+}
+
+/* removes list styles like circles from Zebra*/
+ul.gui_list,
+ul li ul li{
+	list-style: none;
+}
+
+/* defines inner border and normal listing background-colors*/
+ul.gui_list ul li {
+	clear: both;
+	margin-top: -1px;
+  margin-left:-20px;
+	padding: .25em .5em;
+	background-color: #ffe;
+	border: 1px solid #666;
+	cursor: pointer;
+}
+
+
+/* defines list background-colors (alternated listings)*/
+ul.gui_list li.alternate,
+ul.gui_list ul li.alternate ul li {
+	background-color: #fff;
+}
+
+/* defines hover color*/
+ul.gui_list ul li:hover,
+ul.gui_list ul li:hover ul li {
+	background-color: #ff9;
+}
+
+/* Gui descriptions*/
+ul.gui_list ul li ul li  {
+position:relative;
+font-style:italic;
+border:0px;
+cursor:pointer;
+font-size:0.9em;
+}
+
+
+/* Hides WMS Container */
+
+#Container{
+display:none;
+}
+/* END gui listing */

Modified: branches/print_dev/http/extensions/geom2wfst.php
===================================================================
--- branches/print_dev/http/extensions/geom2wfst.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/extensions/geom2wfst.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -28,77 +28,7 @@
 require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
 require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
 
-function isValidVarName ($varname) {
-	if (preg_match("/[\$]{1}_[a-z]+\[\"[a-z_]+\"\]/i", $varname) != 0) {
-		return true;
-	}
-	return false;
-}
 
-function addParameterToFilter($filter, $featuretype_name, $wfs_conf_id) {
-	
-	/* wfs_conf_element */
-	$sql = "SELECT * FROM wfs_conf_element ";
-	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
-	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
-	$sql .= "ORDER BY wfs_conf_element.f_respos";
-			
-	$v = array($wfs_conf_id);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	while($row = db_fetch_array($res)){
-		if (!empty($row["f_auth_varname"])) {
-			$auth_varname = $row["f_auth_varname"];
-			$element_name = $row["element_name"];
-		}
-	}
-	if (!empty($auth_varname)) {
-		$e = new mb_notice("geom2wfst: addParameterToFilter: auth_varname = " . $auth_varname);
-		$e = new mb_notice("geom2wfst: addParameterToFilter: element_name = " . $element_name);
-
-		if (isValidVarName($auth_varname)) {
-			$user = eval("return " . $auth_varname . ";");
-			
-			$e = new mb_notice("geom2wfst: addParameterToFilter: user should be " . $_SESSION["mb_user_id"]);
-			$e = new mb_notice("geom2wfst: addParameterToFilter: user is " . $user);
-			$patternUpdate = "(<wfs:Update[^>]*>)";
-			$patternInsert = "(<wfs:Insert[^>]*>)";
-			$patternDelete = "(<wfs:Delete[^>]*>)";
-
-			$e = new mb_notice("geom2wfst: addParameterToFilter: old filter was: " . $filter);
-
-			// insert: store authenticated user in database 
-			if (eregi($patternInsert, $filter)) {
-				$pattern = "(<" . $featuretype_name . ">)";
-				$replacement = "\\1<" . $element_name . ">" . $user . "</" . $element_name . ">";
-				$filter = eregi_replace($pattern, $replacement, $filter);
-			}
-			// update or delete: disallow access for other users
-			if (eregi($patternDelete, $filter) || eregi($patternUpdate, $filter)) {
-				$pattern = "(<ogc:Filter>)(<ogc:FeatureId[^>]*>)(</ogc:filter>)";
-				$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
-				$filter = eregi_replace($pattern, $replacement, $filter);
-			}
-			$e = new mb_notice("geom2wfst: addParameterToFilter: new filter is: " . $filter);
-		}
-		else {
-			$e = new mb_exception("geom2wfst: addParameterToFilter: invalid auth_varname (".$auth_varname.")");
-		}
-	}
-	else {
-		$e = new mb_notice("geom2wfst: addParameterToFilter: no auth_varname.");
-	}
-	return $filter;
-			
-}
-function checkVal($value){
-	$pattern = array("'",'"',"--");
-	$r = str_replace($pattern, "", $value);	
-	$r = addslashes($r);
-	return $r;
-}
-
-
 function sendErrorMessage($data) {
 	$resObj = array();
 	$response = "error";
@@ -124,34 +54,14 @@
 	sendErrorMessage("Invalid WFS: " . $wfsConf->wfsId);
 }
 
-$gmlFactory = new UniversalGmlFactory();
-$gmlObj = $gmlFactory->createFromGeoJson($geoJson);
+$data = $myWfs->transaction($method, $wfsConf, $geoJson);
 
-$data = $myWfs->transaction($method, $wfsConf, $gmlObj);
-
 if (is_null($data)) {
 	sendErrorMessage("WFS didn't return any data.");
 }
 
-$data = mb_eregi_replace("^[^<]*", "", $data);
-$data = mb_eregi_replace("[^>]*$", "", $data);
+$resObj = $myWfs->parseTransactionResponse($data);
 
-$resObj = array();
-if (mb_strpos(mb_strtoupper($data), "SUCCESS") !== false) {
-	$response = "success";
-	if (mb_ereg("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", $data)) {
-		$fid = mb_ereg_replace("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", "\\1", $data);
-		$resObj["fid"] = $fid;
-	}
-	$resObj["successConfirmation"] = $data;
-}
-else {
-	$response = "error";
-	$resObj["errorMessage"] = $data;
-}
-$resObj["response"] = $response;
-$notice = new mb_notice("response:".$response);
-
 header("Content-Type:application/x-json");
 $json = new Mapbender_JSON();
 echo $json->encode($resObj);

Modified: branches/print_dev/http/extensions/jquery.form.js
===================================================================
--- branches/print_dev/http/extensions/jquery.form.js	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/extensions/jquery.form.js	2009-03-09 09:01:26 UTC (rev 3648)
@@ -1,14 +1,12 @@
 /*
  * jQuery Form Plugin
- * version: 2.18 (06-JAN-2009)
+ * version: 2.21 (08-FEB-2009)
  * @requires jQuery v1.2.2 or later
  *
  * Examples and documentation at: http://malsup.com/jquery/form/
  * Dual licensed under the MIT and GPL licenses:
  *   http://www.opensource.org/licenses/mit-license.php
  *   http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id$
  */
 ;(function($) {
 
@@ -140,7 +138,7 @@
    if (options.iframe || found) { 
        // hack to fix Safari hang (thanks to Tim Molendijk for this)
        // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
-       if ($.browser.safari && options.closeKeepAlive)
+       if (options.closeKeepAlive)
            $.get(options.closeKeepAlive, fileUpload);
        else
            fileUpload();
@@ -166,11 +164,9 @@
 		var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
 
         var id = 'jqFormIO' + (new Date().getTime());
-        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
+        var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
         var io = $io[0];
 
-        if ($.browser.msie || $.browser.opera) 
-            io.src = 'javascript:false;document.write("");';
         $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
 
         var xhr = { // mock object
@@ -221,12 +217,14 @@
         setTimeout(function() {
             // make sure form attrs are set
             var t = $form.attr('target'), a = $form.attr('action');
-            $form.attr({
-                target:   id,
-                method:   'POST',
-                action:   opts.url
-            });
-            
+
+			// update form attrs in IE friendly way
+			form.setAttribute('target',id);
+			if (form.getAttribute('method') != 'POST')
+				form.setAttribute('method', 'POST');
+			if (form.getAttribute('action') != opts.url)
+				form.setAttribute('action', opts.url);
+							
             // ie borks in some cases when setting encoding
             if (! options.skipEncodingOverride) {
                 $form.attr({
@@ -255,18 +253,19 @@
             }
             finally {
                 // reset attrs and remove "extra" input elements
-                $form.attr('action', a);
-                t ? $form.attr('target', t) : $form.removeAttr('target');
+				form.setAttribute('action',a);
+                t ? form.setAttribute('target', t) : $form.removeAttr('target');
                 $(extraInputs).remove();
             }
         }, 10);
 
+        var nullCheckFlag = 0;
+		
         function cb() {
             if (cbInvoked++) return;
             
             io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
 
-            var operaHack = 0;
             var ok = true;
             try {
                 if (timedOut) throw 'timeout';
@@ -275,10 +274,10 @@
 
                 doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                 
-                if (doc.body == null && !operaHack && $.browser.opera) {
-                    // In Opera 9.2.x the iframe DOM is not always traversable when
-                    // the onload callback fires so we give Opera 100ms to right itself
-                    operaHack = 1;
+                if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
+                    // in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
+                    // the onload callback fires, so we give them a 2nd chance
+                    nullCheckFlag = 1;
                     cbInvoked--;
                     setTimeout(cb, 100);
                     return;
@@ -539,8 +538,9 @@
         for(var i=(one ? index : 0); i < max; i++) {
             var op = ops[i];
             if (op.selected) {
-                // extra pain for IE...
-                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
+				var v = op.value;
+				if (!v) // extra pain for IE...
+                	v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
                 if (one) return v;
                 a.push(v);
             }
@@ -629,4 +629,4 @@
         window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
 };
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);

Modified: branches/print_dev/http/img/button_digitize/geomInfo.png
===================================================================
(Binary files differ)

Modified: branches/print_dev/http/img/button_digitize/geomRemove.png
===================================================================
(Binary files differ)

Modified: branches/print_dev/http/img/button_digitize/mergePolygons_off.png
===================================================================
(Binary files differ)

Modified: branches/print_dev/http/img/button_digitize/mergePolygons_on.png
===================================================================
(Binary files differ)

Modified: branches/print_dev/http/img/button_digitize/mergePolygons_over.png
===================================================================
(Binary files differ)

Modified: branches/print_dev/http/javascripts/geometry.js
===================================================================
--- branches/print_dev/http/javascripts/geometry.js	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/geometry.js	2009-03-09 09:01:26 UTC (rev 3648)
@@ -316,9 +316,6 @@
 		var geoJSON = eval('(' + geoJSON + ')');
 	}
 
-	var featureCollectionEpsg = (geoJSON.crs && geoJSON.crs.type == "EPSG") ? geoJSON.crs.properties.code : 4326;
-	var featureEpsg = (geoJSON.crs && geoJSON.crs.type == "EPSG") ? geoJSON.crs.properties.code : 4326;
-
 	//
 	// FEATURE COLLECTION
 	//
@@ -329,12 +326,19 @@
 		//
 		var featureArray = geoJSON.features;
 		for (var j = 0; j < featureArray.length; j++) {
-			featureEpsg = featureCollectionEpsg;
 			var currentFeature = featureArray[j];
 			var isFeature = (currentFeature.type == "Feature") ? true : false;
 	
 			// add geometry ...
 			if (currentFeature.geometry && isFeature) {
+				var featureEpsg = "EPSG:4326";
+				if (!currentFeature.crs || currentFeature.crs.type !== "name" || !currentFeature.crs.properties.name) {
+					var e = new Mb_warning("SRS not set or unknown in GeoJSON. Using 'EPSG:4326'.");
+				}
+				else {
+					featureEpsg = currentFeature.crs.properties.name;
+				}
+
 				//
 				// GEOMETRY
 				//
@@ -451,14 +455,9 @@
 					this.get(-1).e.setElement("fid", currentFeature.id);
 				}
 			}
-			if (currentFeature.crs) {
-				if (currentFeature.crs.type == "EPSG") {
-					featureEpsg = currentFeature.crs.properties.code;
-				}
-				
-			}	
 		}
 	}
+	return true;
 }
 
 GeometryArray.prototype.featureToString = function (i) {

Modified: branches/print_dev/http/javascripts/map.php
===================================================================
--- branches/print_dev/http/javascripts/map.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/map.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -164,6 +164,8 @@
 			$e_src = $row_js["e_src"];
 			$e_require = $row_js["e_requires"];
 			$e_target = explode(",",$row_js["e_target"]);
+			$e_width = intval($row_js["e_width"]);
+			$e_height = intval($row_js["e_height"]);
 			$currentFile = trim($jsArray[$i]);
 			if (file_exists($currentFile)) {
 				if (in_array($e_id, $modulesNotRelyingOnGlobalsArray)) {

Modified: branches/print_dev/http/javascripts/map_obj.js
===================================================================
--- branches/print_dev/http/javascripts/map_obj.js	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/map_obj.js	2009-03-09 09:01:26 UTC (rev 3648)
@@ -74,6 +74,25 @@
 		domElement.style.height = this.height;
 	};
 	
+	this.getMousePosition = function (e) {
+		mb_getMousePos(e, this.frameName);
+		var currentPos = null;
+		if (this.type == "DIV") {
+			var mapDomElement = this.getDomElement();
+			currentPos = new Point(
+				clickX - parseInt(mapDomElement.style.left), 
+				clickY - parseInt(mapDomElement.style.top)
+			);
+		}
+		else {
+			currentPos = new Point(
+				clickX, 
+				clickY
+			);
+		}
+		return currentPos;
+	}
+	
 	/**
 	 * converts the extent of the mapobject so that the maximum	extent will be displayed
 	 */

Modified: branches/print_dev/http/javascripts/mapnf.php
===================================================================
--- branches/print_dev/http/javascripts/mapnf.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/mapnf.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -19,4 +19,4 @@
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 ?>
-mb_registerMapObj('', 'mapframe1', null,500, 500);
\ No newline at end of file
+mb_registerMapObj('', 'mapframe1', null,<?php echo $e_width; ?>, <?php echo $e_height; ?>);

Modified: branches/print_dev/http/javascripts/mod_copyright.php
===================================================================
--- branches/print_dev/http/javascripts/mod_copyright.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/mod_copyright.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -53,7 +53,7 @@
 	var map_el = myMapObj.getDomElement();
 	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_copyright")){
 		//create Box Elements
-		el_top = map_el.ownerDocument.createElement("div");
+		var el_top = map_el.ownerDocument.createElement("div");
 		el_top.style.position = "absolute";
 		el_top.style.top = "0px";
 		el_top.style.left = "0px";

Modified: branches/print_dev/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/print_dev/http/javascripts/mod_digitize_tab.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/mod_digitize_tab.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -248,6 +248,9 @@
 	else {
 		// set the calculated real world position as point of the geometry
 		d.getGeometry(-1,-1).addPoint(realWorldPos);
+		var mapIndex = parent.getMapObjIndexByName(mod_digitize_target);
+
+		d.getGeometry(-1,-1).setEpsg(parent.mb_mapObj[mapIndex].epsg);
 		
 		if(d.get(-1).geomType == parent.geomType.point){
 			d.close();
@@ -343,8 +346,9 @@
 	
 	var currentPos = getMousePosition(e);
 
-	var pos = parent.makeClickPos2RealWorldPos(mod_digitize_target,currentPos.x, currentPos.y);
-	var p = new parent.Point(pos[0], pos[1]);
+	var ind = parent.getMapObjIndexByName(mod_digitize_target);
+	var p = parent.mb_mapObj[ind].convertPixelToReal(new Point(currentPos.x, currentPos.y));
+
 	if (k == undefined) {
 		d.getGeometry(i,j).addPointAtIndex(p, l);
 	}
@@ -422,7 +426,8 @@
 	var currentPos = getMousePosition(e);
 	var basepointDragEnd = currentPos;
 	basepointObject.onmousedown = null;
-	var p = parent.makeClickPos2RealWorldPos(mod_digitize_target, basepointDragEnd.x, basepointDragEnd.y);
+	var ind = parent.getMapObjIndexByName(mod_digitize_target);
+	var p = parent.mb_mapObj[ind].convertPixelToReal(new Point(basepointDragEnd.x, basepointDragEnd.y));
 
 	var oldPoint;
 	if (k == undefined) {
@@ -442,12 +447,11 @@
 		s.clean();
 	}
 	else {
-		var newPoint = new parent.Point(p[0],p[1]);
 		if (!nonTransactionalEditable) {
-			updateAllPointsOfNonTransactionalLike(oldPoint, newPoint);
+			updateAllPointsOfNonTransactionalLike(oldPoint, p);
 		}
 		else {
-			d.updateAllPointsLike(oldPoint, newPoint);
+			d.updateAllPointsLike(oldPoint, p);
 		}
 	}
 	basepointMemberIndex = null;
@@ -510,10 +514,6 @@
 	parent.eventAfterMapRequest.register(function () {
 		updateExtent();
 	});
-	try {if(spatialRequestResultToDigitize){}}catch(e) {spatialRequestResultToDigitize = 1;}
-	if(spatialRequestResultToDigitize==1){
-		parent.mb_registerWfsReadSubFunctions(function(geom){parent.tab_open(mod_digitize_elName);parent.window.frames[mod_digitize_elName].appendGeometryArray(geom);});
-	}
 	parent.mb_registerWfsWriteSubFunctions(function(){parent.zoom(mod_digitize_target, true, 0.999);});
 }
 
@@ -852,6 +852,12 @@
 				var response = eval('(' + json + ')');
 				var polygon = response.polygon;
 				d.importGeometryFromText(polygon);
+
+				// remove the original polygons
+				var len = d.count();
+				for (var i = 0; i < len-1; i++) {
+					d.del(0);
+				}
 				parent.mb_disableThisButton(button_merge);
 			});
 		}
@@ -876,6 +882,9 @@
 					d.importGeometryFromText(polygonArray[i]);
 					d.get(-1).wfs_conf = wfsConfId;
 				}
+				// remove the original polygon and the temporary line
+				d.del(0);
+				d.del(0);
 				parent.mb_disableThisButton(button_split);
 			});
 		}
@@ -1415,10 +1424,36 @@
 			for (var elementIndex = 0; elementIndex < wfsConf[attr]['element'].length ; elementIndex++) {
 				var isGeomColumn = (parseInt(wfsConf[attr]['element'][elementIndex]['f_geom']) == 1); 
 				if (isGeomColumn) {
-					var isMultiPolygon = (geom.geomType == parent.geomType.polygon && wfsConf[attr]['element'][elementIndex]['element_type'] == 'MultiPolygonPropertyType');
-					var isPolygon = (geom.geomType == parent.geomType.polygon && geom.count() == 1 && wfsConf[attr]['element'][elementIndex]['element_type'] == 'PolygonPropertyType');
-					var isMultiLine = (geom.geomType == parent.geomType.line && wfsConf[attr]['element'][elementIndex]['element_type'] == 'MultiLineStringPropertyType');
-					var isLine = (geom.geomType == parent.geomType.line && geom.count() == 1 && wfsConf[attr]['element'][elementIndex]['element_type'] == 'LineStringPropertyType');
+					var isMultiPolygon = (
+						geom.geomType == parent.geomType.polygon && 
+						(
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'MultiPolygonPropertyType' ||
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'MultiSurfacePropertyType'
+						)
+					);
+					var isPolygon = (
+						geom.geomType == parent.geomType.polygon && 
+						geom.count() == 1 && 
+						(
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'PolygonPropertyType' ||
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'SurfacePropertyType'
+						)
+					);
+					var isMultiLine = (
+						geom.geomType == parent.geomType.line && 
+						(
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'MultiLineStringPropertyType' ||
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'MultiCurvePropertyType'
+						)
+					);
+					var isLine = (
+						geom.geomType == parent.geomType.line && 
+						geom.count() == 1 && 
+						(
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'LineStringPropertyType' ||
+						wfsConf[attr]['element'][elementIndex]['element_type'] == 'CurvePropertyType'
+						)
+					);
 					var isPoint = (geom.geomType == parent.geomType.point && wfsConf[attr]['element'][elementIndex]['element_type'] == 'PointPropertyType');
 //					alert(isMultiPolygon + " " + isPolygon + " " + isMultiLine + " " + isLine + " " + isPoint);
 					if (isMultiPolygon || isPolygon || isMultiLine || isLine || isPoint || wfsConf[attr]['element'][elementIndex]['element_type'] == 'GeometryAssociationType') {
@@ -1630,7 +1665,7 @@
 		if (isTransactional) {
 			str += "\t\t<tr>\n";
 
-			var options = ["save", "update", "delete", "abort"];
+			var options = ["insert", "update", "delete", "abort"];
 			for (var i = 0 ; i < options.length ; i++) {
 				var onClickText = "this.disabled=true;var result = window.opener.formCorrect(document, '"+featureTypeElementFormId+"');";
 				onClickText += 	"if (result.isCorrect) {";
@@ -1641,7 +1676,7 @@
 				onClickText += 		"alert(result.errorMessage);this.disabled=false;"
 				onClickText += 	"}";
 				
-				if (options[i] == "save" && hasGeometryColumn && (!fid || showSaveButtonForExistingGeometries)) {
+				if (options[i] == "insert" && hasGeometryColumn && (!fid || showSaveButtonForExistingGeometries)) {
 					str += "\t\t\t<td><input type='button' name='saveButton' value='"+msgObj.buttonLabelSaveGeometry+"' onclick=\""+onClickText+"\" /></td>\n";
 				}
 				
@@ -1682,10 +1717,11 @@
 	
 	var mapObjInd = parent.getMapObjIndexByName(mod_digitize_target);
 
+	var proceed = true;
 	if (myconf['featuretype_srs'] != parent.mb_mapObj[mapObjInd].epsg) {
-		alert(msgObj.errorMessageEpsgMismatch + parent.mb_mapObj[mapObjInd].epsg + " / "+ myconf['featuretype_srs']);
+		proceed = confirm(msgObj.errorMessageEpsgMismatch + parent.mb_mapObj[mapObjInd].epsg + " / "+ myconf['featuretype_srs'] + ". Proceed?");
 	}
-	else {
+	if (proceed) {
 		var fid = false;
 		var errorMessage = "";
 		if (typeof(wfsWindow) != 'undefined' && !wfsWindow.closed) {
@@ -1725,20 +1761,30 @@
 		else {
 			fid = d.get(m).e.getElementValueByName('fid');
 		}
-		str = parent.get_wfs_str(myconf, d, m, type, fid);
+//		str = parent.get_wfs_str(myconf, d, m, type, fid);
 		
-		parent.mb_ajax_post("../extensions/geom2wfst.php", {'filter':str,'url':myconf['wfs_transaction'],'featuretype_name':myconf['featuretype_name'],'wfs_conf_id':wfsConf[d.get(m).wfs_conf]['wfs_conf_id']}, function(json,status){
-			var result = eval('('+json+')');
-			var response = result.response;
-			var fid = result.fid;
-			wfsSubWrite(m, type, status, response, fid);
-		});
+		var geoJson = d.featureToString(m);
+		
+		parent.mb_ajax_post(
+			"../extensions/geom2wfst.php", 
+			{
+				'geoJson' : geoJson,
+				'method' : type,
+				'wfs_conf_id' : wfsConf[d.get(m).wfs_conf]['wfs_conf_id']
+			}, 
+			function(json,status){
+				var result = eval('('+json+')');
+				var success = result.success;
+				var fid = result.fid;
+				wfsSubWrite(m, type, status, success, fid);
+			}
+		);
 	}
 }
 
-function wfsSubWrite(m, type, status, response, fid) {
-	if (status == "success" && response == "success") {
-		if (type == 'save' && fid) {
+function wfsSubWrite(m, type, status, success, fid) {
+	if (status == "success" && success) {
+		if (type == 'insert' && fid) {
 			d.get(m).e.setElement("fid", fid);
 		}
 		if (type == 'delete') {

Modified: branches/print_dev/http/javascripts/mod_featureInfoTunnel.php
===================================================================
--- branches/print_dev/http/javascripts/mod_featureInfoTunnel.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/mod_featureInfoTunnel.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -57,14 +57,13 @@
 	mod_featureInfoTunnel_map.getDomElement().onclick = null;
 }
 function mod_featureInfoTunnel_event(e){
-	mod_featureInfoTunnel_map.getMousePos(e);
-
 	eventBeforeFeatureInfo.trigger({"fName":mod_featureInfoTunnel_target});
 
 	var point = mod_featureInfoTunnel_map.getMousePos(e);
 	var path = '../extensions/ext_featureInfoTunnel.php';
 	
 //TODO that code should go to featureInfo Redirect module
+	var ind = getMapObjIndexByName(mod_featureInfoTunnel_target);
 	if(document.getElementById("FeatureInfoRedirect")){
 		//fill the frames
 		for(var i=0; i<mod_featureInfoTunnel_map.wms.length; i++){
@@ -77,22 +76,33 @@
 		urls = mod_featureInfoTunnel_map.getFeatureInfoRequests(point);
 		if(urls){
 			for(var i=0;i<urls.length;i++){
-				if(featureInfoLayerPopup == 'true'){
-					var p = new mb_popup({
-						title:<?php echo _mb("Informations");?>,
-						url:path+"?url="+escape(urls[i]),
-						width:parseInt(featureInfoPopupWidth, 10),
-						height:parseInt(featureInfoPopupHeight, 10),
-						top:200,
-						left:600
+				(function () {
+					var currentRequest = escape(urls[i]);
+					mb_ajax_post(path, {'url':currentRequest},function(js_code,status){
+						if(js_code){
+							if(featureInfoLayerPopup == 'true'){
+								var p = new mb_popup({
+									title:"Information",
+									url:path+"?url="+currentRequest,
+									width:parseInt(featureInfoPopupWidth, 10),
+									height:parseInt(featureInfoPopupHeight, 10),
+									top:200 + i*25,
+									left:600 + i*25
+								});
+								p.show();
+							}
+							else{
+								window.open(path+"?url="+currentRequest, "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+							}
+						}
+						else{
+                            var e = new Mb_exception("No featureInfo results.");
+                         }
 					});
-				}
-				else
-					window.open(path+"?url="+escape(urls[i]), "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+				}());
 			}
 		}
 		else
 			alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
 	}	
-//	setFeatureInfoRequest(mod_featureInfoTunnel_target,clickX,clickY, '../extensions/ext_featureInfoTunnel.php');
 }

Modified: branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -1,865 +1,760 @@
-<?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
-#
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-$wfs_conf_filename = "wfs_default.conf";
-include '../include/dyn_php.php';
-$fname = dirname(__FILE__) . "/../../conf/" . $wfs_conf_filename;
-if (file_exists($fname)) {
-	include($fname);
-}
-else {
-	$e = new mb_exception("mod_wfs_SpatialRequest.php: Configuration file " . $wfs_conf_filename . " not found.");
-}
-
-include '../include/dyn_js.php';
-echo "var mod_wfs_spatialRequest_target = '".$e_target[0]."';\n";
-?>
-//element var openLinkFromSearch for opening attribute link directly onclick of searchResult entry
-try{
-	if (openLinkFromSearch){}
-}
-catch(e){
-	openLinkFromSearch =0;
-}
-
-var wfsAreaType_point = "point";
-var wfsAreaType_polygon = "polygon";
-var wfsAreaType_rectangle = "rectangle";
-var wfsAreaType_extent = "extent";
-var wfsAreaType_current = "";
-
-var mod_wfs_spatialRequest_frameName = "";
-var mod_wfs_spatialRequest_epsg;
-var mod_wfs_spatialRequest_width;
-var mod_wfs_spatialRequest_height;
-
-var mod_wfs_spatialRequest_bg = "";
-var mod_wfs_spatialRequest_pgsql = true;
-var mod_wfs_spatialRequest_win = null;
-var mod_wfs_spatialRequest_thema = false;
-
-var button_point = "point";
-var button_polygon = "polygon";
-var button_rectangle = "rectangle";
-var button_extent = "extent";
-var button_dialogue = "dialogue";
-
-var activeButton = null;
-var mod_wfs_spatialRequest_geometry = null;
-var mod_wfs_spatialRequestSubFunctions = [];
-
-var buttonWfs_id = [];
-var buttonWfs_on = [];
-var buttonWfs_src = [];
-var buttonWfs_title_off = [];
-var buttonWfs_title_on = [];
-var buttonWfs_x = [];
-var buttonWfs_y = [];
-
-var numberOfAjaxCalls = 0;
-var numberOfFinishedAjaxCalls = 0;
-var resultGeometryPopup;
-var _geomArray = new GeometryArray();
-try {if(mod_digitize_elName){}}catch(e) {mod_digitize_elName = "digitize";}
-
-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);
-}
-
-var msgObj;
-
-mb_registerInitFunctions("init_wfsSpatialRequest()");
-//mb_registerL10nFunctions("init_wfsSpatialRequest()");
-
-function init_wfsSpatialRequest() {
-	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, msgObj.buttonLabelRectangle, buttonRectangle.x, buttonRectangle.y);
-		addButtonWfs("polygon", buttonPolygon.status, buttonPolygon.img, msgObj.buttonLabelPolygon, buttonPolygon.x, buttonPolygon.y);
-		addButtonWfs("point", buttonPoint.status, buttonPoint.img, msgObj.buttonLabelPoint, buttonPoint.x, buttonPoint.y);
-		addButtonWfs("extent", buttonExtent.status, buttonExtent.img, msgObj.buttonLabelExtent, buttonExtent.x, buttonExtent.y);
-		addButtonWfs("dialogue", buttonDialogue.status, buttonDialogue.img, msgObj.buttonLabelDialogue, buttonDialogue.x, buttonDialogue.y);
-		displayButtons();
-	});
-}
-// ------------------------------------------------------------------------------------------
-// ------------ button handling -------------------------------------------------------------
-
-function wfsInitFunction (j) {
-	var functionCall = "mb_regButton_frame('initWfsButton', null, "+j+")";
-	var x = new Function ("", functionCall);
-	x();
-}
-
-function displayButtons() {
-	for (var i = 0 ; i < buttonWfs_id.length ; i ++) {
-		if (parseInt(buttonWfs_on[i])==1) {
-			var currentDiv = document.createElement("div");
-			currentDiv.id = buttonWfs_id[i]+"Div";
-			currentDiv.style.position = "absolute";
-			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);
-		}
-	}
-}
-
-function initWfsButton(ind, pos) {
-	mb_button[ind] = document.getElementById(buttonWfs_id[pos]);
-	mb_button[ind].img_over = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_over");
-	mb_button[ind].img_on = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_on");
-	mb_button[ind].img_off = buttonWfs_imgdir + buttonWfs_src[pos];
-	mb_button[ind].status = 0;
-	mb_button[ind].elName = buttonWfs_id[pos];
-	mb_button[ind].fName = "";
-	mb_button[ind].go = new Function ("wfsEnable(mb_button["+ind+"], " + pos + ")");
-	mb_button[ind].stop = new Function ("wfsDisable(mb_button["+ind+"], " + pos + ")");
-	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	mod_wfs_spatialRequest_width = mb_mapObj[ind].width;
-	mod_wfs_spatialRequest_height = mb_mapObj[ind].height;
-	mod_wfs_spatialRequest_epsg = mb_mapObj[ind].epsg;
-	mb_registerSubFunctions("drawDashedLineExt()");
-	mb_registerPanSubElement("measuring");
-}
-
-function wfsEnable(obj) {
-	var el = getMapDoc();
-
-   	el.onmouseover = null;
-   	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);
-	}
-	if (obj.id == button_polygon) {
-		if (activeButton == null) {
-			activeButton = obj;
-		}
-		mod_wfs_spatialRequest_geometry = new Geometry(geomType.polygon);
-		wfsAreaType_current = wfsAreaType_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]);
-		}
-		var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-		if (mb_mapObj[ind].type == "IFRAME") {
-			writeTag(mod_wfs_spatialRequest_target ,"measure_sub",measureSub);
-		}
-		else {
-			writeTag("" ,"measure_sub",measureSub);
-		}
-	}
-	else if (obj.id == button_rectangle){
-		if (activeButton == null) {
-			activeButton = obj;
-		}
-		mod_wfs_spatialRequest_geometry = new Geometry(geomType.line);
-		wfsAreaType_current = wfsAreaType_rectangle;
-		mod_selAreaExt_click();
-	}
-	else if (obj.id == button_extent){
-		if (activeButton == null) {
-			activeButton = obj;
-		}
-		mod_wfs_spatialRequest_geometry = new Geometry(geomType.line);
-		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));
-		mod_wfs_spatialRequest_geometry.addPoint(p0);
-		mod_wfs_spatialRequest_geometry.addPoint(p1);
-		mod_getAreaExt_send();
-	}
-	else if (obj.id == button_dialogue) {
-		activeButton = obj;
-		mod_wfs_SpatialRequest_dialog();
-	}
-}
-
-function getMapDoc () {
-	var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	var mapDomElement = mb_mapObj[mapIndex].getDomElement();
-	var mapType = mapDomElement.tagName.toUpperCase();
-	if (mapType == "IFRAME") {
-		return mapDomElement.window.document;
-	}
-	return window.document;
-}
-
-function wfsDisable(obj) {
-	var el = getMapDoc();
-	el.onmousedown = null;
-	el.ondblclick = null;
-	el.onmousemove = null;
-	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	if (mb_mapObj[ind].type == "IFRAME") {
-		writeTag(mod_wfs_spatialRequest_target,"measure_display","");
-		writeTag(mod_wfs_spatialRequest_target,"measure_sub","");
-	}
-	else {
-		writeTag("", "measure_display", "");
-		writeTag("", "measure_sub", "");
-	}
-	activeButton = null;
-}
-
-// ------------------------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------------------------
-// -------------------- rectangle -----------------------------------------------------------------
-
-function mod_selAreaExt_click(){
-	var el = getMapDoc();
-   el.onmouseover = mod_selAreaExt_init;
-   el.onmousedown = mod_box_start;
-   el.onmouseup = mod_selAreaExt_get;
-   el.onmousemove = mod_box_run;
-}
-function mod_selAreaExt_init(e){
-   mb_isBF = mod_wfs_spatialRequest_target;
-   mb_zF = mod_wfs_spatialRequest_target;
-}
-function mod_selAreaExt_get(e){
-	mod_selAreaExt_setValidClipping(mod_box_stop(e));
-	mb_isBF = mod_wfs_spatialRequest_target;
-	mb_zF = mod_wfs_spatialRequest_target;
-}
-function mod_selAreaExt_setValidClipping(coords){
-	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();
-		}
-		else{
-			alert(errorMessageInvalidExtent[selectedLanguage]);
-			mb_disableThisButton(activeButton.id);
-		}
-	}
-}
-// ----------------------------------------------------------------------------------------------
-
-
-// ----------------------------------------------------------------------------------------------
-// -------------------- polygon && point --------------------------------------------------------
-
-function mod_wfs_spatialRequest_digitize_go(geomType){
-	if (geomType == geomType.polygon) {
-		mod_wfs_spatialRequest_geometry = new Geometry(geomType.polygon);
-	}
-	s = new Snapping(mod_wfs_spatialRequest_target);
-
-	var el = getMapDoc();
-	el.onmousedown = mod_wfs_spatialRequest_start;
-	el.onmousemove = mod_wfs_spatialRequest_run;
-	var measureSub = "";
-	for(var i=0; i<mod_wfs_spatialRequestSubFunctions.length; i++){
-		measureSub += eval(mod_wfs_spatialRequestSubFunctions[i]);
-	}
-	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	if (mb_mapObj[ind].type == "IFRAME") {
-		writeTag(mod_wfs_spatialRequest_target,"measure_sub",measureSub);
-	}
-	else {
-		writeTag("", "measure_sub", measureSub);
-	}
-}
-
-// ---------------------------------------------------------------------------------------------
-
-function mod_wfs_getMousePosition(e) {
-	mb_getMousePos(e, mod_wfs_spatialRequest_target);
-	var currentPos = null;
-	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	if (mb_mapObj[ind].type == "DIV") {
-		var mapDomElement = mb_mapObj[ind].getDomElement();
-		currentPos = new parent.Point(
-			parent.clickX - parseInt(mapDomElement.style.left), 
-			parent.clickY - parseInt(mapDomElement.style.top)
-		);
-	}
-	else {
-		currentPos = new parent.Point(
-			parent.clickX, 
-			parent.clickY
-		);
-	}
-	return currentPos;
-}
-
-
-function mod_wfs_spatialRequest_run(e) {
-	if (mod_wfs_spatialRequest_geometry.count() >= 3) {
-		var pos = mod_wfs_getMousePosition(e);
-		s.check(pos);
-	}
-}
-
-function mod_wfs_spatialRequest_start(e){
-	var realWorldPos;
-	if (s.isSnapped() == true) {
-		realWorldPos = s.getSnappedPoint();
-		s.clean();
-	}
-	else {
-		var pt = mod_wfs_getMousePosition(e);
-		realWorldPos = mapToReal(mod_wfs_spatialRequest_target, pt);
-	}
-
-	mod_wfs_spatialRequest_geometry.addPoint(realWorldPos);
-
-	if (mod_wfs_spatialRequest_geometry.count() == 1) {
-		s.add(mod_wfs_spatialRequest_geometry.get(0));
-	}
-	if (s.isSnapped() && mod_wfs_spatialRequest_geometry.count() >= 3 && mod_wfs_spatialRequest_geometry.get(-1).equals(mod_wfs_spatialRequest_geometry.get(0))) {
-		mod_wfs_spatialRequest_geometry.close();
-		mod_getAreaExt_send();
-		return;
-	}
-
-	if(wfsAreaType_current == wfsAreaType_point){
-		mod_getAreaExt_send();
-		return;
-	}
-	drawDashedLineExt();
-}
-function drawDashedLineExt(){
-	var str_mPoints = "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='"+mod_wfs_spatialRequest_width+"' height='0'></div>";
-	str_mPoints += "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='0' height='"+mod_wfs_spatialRequest_height+"'></div>";
-	if (mod_wfs_spatialRequest_geometry != null) {
-		for(var i=0; i<mod_wfs_spatialRequest_geometry.count(); i++){
-			var pos = realToMap(mod_wfs_spatialRequest_target,mod_wfs_spatialRequest_geometry.get(i));
-			str_mPoints += "<div style='font-size:1px;position:absolute;top:"+(pos.y-2)+"px;left:"+(pos.x-2)+"px;width:3px;height:3px;background-color:#ff0000'></div>";
-		}
-		if(mod_wfs_spatialRequest_geometry.count()>1){
-			for(var k=1; k<mod_wfs_spatialRequest_geometry.count(); k++){
-				var pos0 = realToMap(mod_wfs_spatialRequest_target,mod_wfs_spatialRequest_geometry.get(k));
-				var pos1 = realToMap(mod_wfs_spatialRequest_target,mod_wfs_spatialRequest_geometry.get(k-1));
-				str_mPoints += evaluateDashesExt(pos1,pos0,k);
-			}
-		}
-	}
-	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	if (mb_mapObj[ind].type == "IFRAME") {
-		writeTag(mod_wfs_spatialRequest_target,"measuring",str_mPoints);
-	}
-	else {
-		writeTag("", "measuring", str_mPoints);
-	}
-}
-function evaluateDashesExt(p1,p0,count){
-	var str_dashedLine = "";
-	var d = p0.dist(p1);
-	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);
-		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>";
-		}
-	}
-	return str_dashedLine;
-}
-function mod_wfs_spatialRequest_close(){
-	if(mod_wfs_spatialRequest_geometry.count() < 3){
-		return;
-	}
-	mod_wfs_spatialRequest_geometry.closeGeometry();
-	drawDashedLineExt();
-	mod_getAreaExt_send();
-}
-
-function register_setExtRequestSubFunctions(stringFunction){
-	mod_wfs_spatialRequestSubFunctions[mod_wfs_spatialRequestSubFunctions.length] = stringFunction;
-}
-
-function mod_getAreaExt_send(){
-	mb_setwfsrequest(mod_wfs_spatialRequest_target,mod_wfs_spatialRequest_geometry);
-	mod_wfs_spatialRequest_delete();
-	mb_disableThisButton(activeButton.id);
-	mod_wfs_spatialRequest_geometry = null;
-}
-
-function mod_wfs_spatialRequest_delete(){
-	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-	if (mb_mapObj[ind].type == "IFRAME") {
-		writeTag(mod_wfs_spatialRequest_target,"measuring","");
-		writeTag(mod_wfs_spatialRequest_target,"measure_display","");
-	}
-	else {
-		writeTag("","measuring","");
-		writeTag("","measure_display","");
-	}
-}
-
-function mod_wfs_spatialRequest_timeout(){
-	var el = getMapDoc();
-	el.onmousedown = null;
-	el.ondblclick = null;
-	el.onmousemove = null;
-}
-
-function mod_wfs_spatialRequest_disableTimeout(){
-	var el = getMapDoc();
-	el.onmousedown = mod_wfs_spatialRequest_start;
-}
-
-function isSetWfsResultToDigitize() {
-	if (parseInt(buttonWfs_toDigitize_on)==1) return true;
-	return false;
-}
-
-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('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('}');
-		mod_wfs_spatialRequest_win.document.writeln('}');
-		mod_wfs_spatialRequest_win.document.writeln('window.opener.wfsEnable(obj);');
-		mod_wfs_spatialRequest_win.document.writeln('window.close();');
-		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>");
-		mod_wfs_spatialRequest_win.document.writeln("<input id='polygon' name='geom' type='radio' value='"+button_polygon+"'onclick='set(this)'> Polygon<br>");
-		mod_wfs_spatialRequest_win.document.writeln("<input id='extent' name='geom' type='radio' value='"+button_extent+"'onclick='set(this)'> Extent<br>");
-		var checked = "";
-		mod_wfs_spatialRequest_win.document.writeln("</form>");
-		mod_wfs_spatialRequest_win.document.close();
-	}
-	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_visible == '1'){
-				// db_wfs_conf_id entries have to be unique
-				var exists = false;
-				for (var iii = 0; iii < db_wfs_conf_id.length; iii++) {
-					if (db_wfs_conf_id[iii] == o.gui_layer_wfs_featuretype) {
-						exists = true;
-						break;
-					}
-				}	
-				if (!exists) {
-					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 in wfs_config){
-			if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i]) {
-
-				// js_wfs_conf_id entries have to be unique
-				var exists = false;
-				for (var iii = 0; iii < js_wfs_conf_id.length; iii++) {
-					var n = js_wfs_conf_id[iii];
-					if (wfs_config[ii]['wfs_conf_id'] == wfs_config[n]['wfs_conf_id']) {
-						exists = true;
-						break;
-					}
-				}	
-				if (!exists) {
-					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 filter = "<ogc:Filter xmlns:ogc=\"http://ogc.org\" xmlns:gml=\"http://www.opengis.net/gml\">";
-
-			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=\""+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;
-				}
-				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
-				filter += "</gml:Polygon></Within>";
-			}
-			else if(buttonPolygon.filteroption=='intersects'){
-				filter += "<Intersects><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='"+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;
-				}
-				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
-				filter += "</gml:Polygon></Intersects>";
-			}
-
-			filter += '</ogc:Filter>';
-			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
-		}
-	}
-	else if(queryGeom.geomType==geomType.line){
-		var rectangle = [];
-		if(queryGeom.geomType == geomType.line){
-			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 filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
-
-			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='"+srs+"'>";
-				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
-				filter += rectangle[0].x+","+rectangle[0].y;
-				filter += " ";
-				filter += rectangle[0].x+","+rectangle[1].y;
-				filter += " ";
-				filter += rectangle[1].x+","+rectangle[1].y;
-				filter += " ";
-				filter += rectangle[1].x+","+rectangle[0].y;
-				filter += " ";
-				filter += rectangle[0].x+","+rectangle[0].y;
-				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
-				filter += "</gml:Polygon></Within>";
-			}
-			else if(buttonRectangle.filteroption=='intersects'){
-				filter += "<Intersects><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='"+srs+"'>";
-				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
-				filter += rectangle[0].x+","+rectangle[0].y;
-				filter += " ";
-				filter += rectangle[0].x+","+rectangle[1].y;
-				filter += " ";
-				filter += rectangle[1].x+","+rectangle[1].y;
-				filter += " ";
-				filter += rectangle[1].x+","+rectangle[0].y;
-				filter += " ";
-				filter += rectangle[0].x+","+rectangle[0].y;
-				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
-				filter += "</gml:Polygon></Intersects>";
-			}
-
-			filter += "</ogc:Filter>";
-			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
-		}
-	}
-	else if(queryGeom.geomType == geomType.point){
-		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 mapPosYAddPix = mapPos[1] +buffer;
-		var mapPosXRemovePix = mapPos[0] - buffer;
-		var mapPosYRemovePix = mapPos[1] - buffer;
-		var realWorld1 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
-		var realWorld2 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
-		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 filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
-			filter += "<Intersects><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='"+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 += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></ogc:Filter>";
-			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
-		}
-	}
-//	highlight = new Highlight(mb_wfs_targets, highlight_tag_id, {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex}, generalHighlightLineWidth);
-	return true;
-}
-
-function mb_get_geom(filter, index, typename, js_wfs_conf_id, db_wfs_conf_id) {
-
-	mb_ajax_post(
-		"../" + wfsResultModulePath + wfsResultModuleFilename,
-		{
-			'filter' : filter,
-			'typename' : typename,
-			'js_wfs_conf_id' : js_wfs_conf_id, 
-			'db_wfs_conf_id' : db_wfs_conf_id
-		},
-		function(json,status){
-			var geom = new GeometryArray();
-			geom.importGeoJSON(json);
-			for (var i = 0; i < geom.count(); i++) {
-				geom.get(i).wfs_conf = parseInt(js_wfs_conf_id);
-			}
-	
-			checkIfAllAjaxCallsFinished(geom);
-		}
-	);
-}
-
-function checkIfAllAjaxCallsFinished (geom) {
-	numberOfFinishedAjaxCalls++;
-	if (typeof(geom) == 'object'){
-		_geomArray.union(geom);
-	}
-	if (numberOfFinishedAjaxCalls == numberOfAjaxCalls) {
-		numberOfFinishedAjaxCalls = 0;
-		mb_execWfsReadSubFunctions(_geomArray);
-	}
-}
-
-function useExtentIsSet () {
-	return mod_wfs_spatialRequest_useExtent;
-}
-
-function isValidWfsConfIndex (wfsConf, wfsConfIndex) {
-	return (typeof(wfsConfIndex) == "number" && wfsConfIndex >=0 && wfsConfIndex < wfsConf.length);
-}
-
-function Numsort (a, b) {
-  return a - b;
-}
-
-function getListTitle (geom) {
-	wfsConfId = geom.wfs_conf;
-	wfsConf = get_complete_wfs_conf();
-	if (isValidWfsConfIndex(wfsConf, wfsConfId)) {
-		var resultArray = [];
-		var resultName = "";
-		for (var i = 0 ; i < wfsConf[wfsConfId]['element'].length ; i++) {
-			if (wfsConf[wfsConfId]['element'][i]['f_show'] == 1 && geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']) !=false) {
-				var pos = wfsConf[wfsConfId]['element'][i]['f_respos'];
-				if (typeof(resultArray[pos]) != "undefined") {
-					resultArray[pos] += " " + geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']);
-				}
-				else {
-					resultArray[pos] = geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']);
-				}
-				resultName += geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']) + " ";
-			}
-		}
-		resultArray.sort(Numsort);
-		var resultName = resultArray.join(" ");
-		if (resultName == "") {
-			resultName = wfsConf[wfsConfId]['g_label'];
-		}
-		return resultName;
-	}
-	else {
-		return msgObj.digitizeDefaultGeometryName;
-	}
-}
-
-function appendGeometryArrayToDigitize(geom){
-	parent.window.frames[mod_digitize_elName].appendGeometryArray(geom);
-	parent.tab_open(mod_digitize_elName);
-}
-
-function appendGeometryToDigitize(i){
-	var digitizeArray = new GeometryArray();
-	digitizeArray.addCopy(_geomArray.get(i));
-	parent.window.frames[mod_digitize_elName].appendGeometryArray(digitizeArray);
-	parent.tab_open(mod_digitize_elName);
-}
-
-function createListOfGeometries(){
-	var listOfGeom = "<table style='background-color:#EEEEEE;'>\n";
-	if (_geomArray.count() > 0) {
-		if(buttonWfs_toDigitize_on==1){
-			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";
-		}
-		for (var i = 0 ; i < _geomArray.count(); i ++) {
-			if (_geomArray.get(i).get(-1).isComplete()) {
-				listOfGeom += "\t<tr>\n\t\t<td style = 'color:blue;font-size:12px;cursor:pointer;'\n";
-				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));
-				//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)";}
-				listOfGeom += ">" + geomName +"</td>";
-				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 += "</table>\n";
-	return listOfGeom;
-}
-
-function displayPopup(geom){
-	_geomArray = geom;
-	if (typeof(resultGeometryPopup) == "undefined") {
-		resultGeometryPopup = new mb_popup(searchPopupTitle,createListOfGeometries(),searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
-	}
-	else {
-		resultGeometryPopup.setWidth(searchPopupWidth);
-		resultGeometryPopup.setHtml(createListOfGeometries());
-	}
-	resultGeometryPopup.show();
-}
-
-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 += currentWfsConf.element[i].f_label;
-				resultHtml +="</td>\n";
-				resultHtml += "<td>\n";
-				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>/)){
-						var newLink	=	setUrl.replace(/><\/a>/, ">"+elementVal+"</a>");
-					}
-					else{
-						var newLink = setUrl;
-					}
-					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 += "</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);
-	if (typeof(wfsPopup) == "undefined") {
-		wfsPopup = new mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
-	}
-	else {
-		wfsPopup.hide();
-		wfsPopup = new mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
-	}
-	wfsPopup.show();
-}
-try{
-	if (wfsResultToPopupDiv){}
-}
-catch(e){
-	wfsResultToPopupDiv =0;
-}
-if(wfsResultToPopupDiv==1){
-	mb_registerWfsReadSubFunctions(function(geom){displayPopup(geom);});
-}
+<?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
+#
+# 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.
+ 
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+$wfs_conf_filename = "wfs_default.conf";
+include '../include/dyn_php.php';
+$fname = dirname(__FILE__) . "/../../conf/" . $wfs_conf_filename;
+if (file_exists($fname)) {
+	include($fname);
+}
+else {
+	$e = new mb_exception("mod_wfs_SpatialRequest.php: Configuration file " . $wfs_conf_filename . " not found.");
+}
+
+include '../include/dyn_js.php';
+echo "var mod_wfs_spatialRequest_target = '".$e_target[0]."';\n";
+?>
+//element var openLinkFromSearch for opening attribute link directly onclick of searchResult entry
+try{
+	if (openLinkFromSearch){}
+}
+catch(e){
+	openLinkFromSearch =0;
+}
+
+var wfsAreaType_point = "point";
+var wfsAreaType_polygon = "polygon";
+var wfsAreaType_rectangle = "rectangle";
+var wfsAreaType_extent = "extent";
+var wfsAreaType_current = "";
+
+var mod_wfs_spatialRequest_frameName = "";
+var mod_wfs_spatialRequest_epsg;
+var mod_wfs_spatialRequest_width;
+var mod_wfs_spatialRequest_height;
+
+var mod_wfs_spatialRequest_bg = "";
+var mod_wfs_spatialRequest_pgsql = true;
+var mod_wfs_spatialRequest_win = null;
+var mod_wfs_spatialRequest_thema = false;
+
+var button_point = "point";
+var button_polygon = "polygon";
+var button_rectangle = "rectangle";
+var button_extent = "extent";
+var button_dialogue = "dialogue";
+
+var activeButton = null;
+var mod_wfs_spatialRequestSubFunctions = [];
+
+var buttonWfs_id = [];
+var buttonWfs_on = [];
+var buttonWfs_src = [];
+var buttonWfs_title_off = [];
+var buttonWfs_title_on = [];
+var buttonWfs_x = [];
+var buttonWfs_y = [];
+
+var numberOfAjaxCalls = 0;
+var numberOfFinishedAjaxCalls = 0;
+var resultGeometryPopup;
+
+/**
+ * This Geometry contains the geometry of the optinal spatial constraint
+ */
+var requestGeom = null;
+
+/**
+ * Something like box, polygon, point, extent
+ */
+var spatialRequestType = null;
+
+/**
+ * This Geometry contains the result from the WFS request
+ */
+var geomArray;
+
+try {if(mod_digitize_elName){}}catch(e) {mod_digitize_elName = "digitize";}
+
+try{
+	if (wfsResultToPopupDiv){}
+}
+catch(e){
+	wfsResultToPopupDiv = 0;
+}
+try{
+	if (buttonWfs_toDigitize_on){}
+}
+catch(e){
+	buttonWfs_toDigitize_on = 0;
+}
+if (wfsResultToPopupDiv == 1) {
+	mb_registerWfsReadSubFunctions(function (geom) {
+		displayPopup(geom);
+	});
+}
+else {
+	if (buttonWfs_toDigitize_on == 1) {
+		mb_registerWfsReadSubFunctions(function(geom){
+			if (buttonWfs_toDigitize_target && window.frames[buttonWfs_toDigitize_target]) {
+				tab_open(buttonWfs_toDigitize_target);
+				appendGeometryArrayToDigitize(geom);
+			}
+			else {
+				var msg = "No digitizing module available. " + 
+					"Check you WFS spatial request configuration.";
+				var e = new Mb_warning(msg);
+			}
+		});
+	}
+}
+
+var msgObj;
+
+mb_registerInitFunctions("init_wfsSpatialRequest()");
+//mb_registerL10nFunctions("init_wfsSpatialRequest()");
+
+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);
+}
+
+function init_wfsSpatialRequest() {
+	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, msgObj.buttonLabelRectangle, buttonRectangle.x, buttonRectangle.y);
+		addButtonWfs("polygon", buttonPolygon.status, buttonPolygon.img, msgObj.buttonLabelPolygon, buttonPolygon.x, buttonPolygon.y);
+		addButtonWfs("point", buttonPoint.status, buttonPoint.img, msgObj.buttonLabelPoint, buttonPoint.x, buttonPoint.y);
+		addButtonWfs("extent", buttonExtent.status, buttonExtent.img, msgObj.buttonLabelExtent, buttonExtent.x, buttonExtent.y);
+		addButtonWfs("dialogue", buttonDialogue.status, buttonDialogue.img, msgObj.buttonLabelDialogue, buttonDialogue.x, buttonDialogue.y);
+		displayButtons();
+	});
+}
+// ------------------------------------------------------------------------------------------
+// ------------ button handling -------------------------------------------------------------
+
+function wfsInitFunction (j) {
+	var functionCall = "mb_regButton_frame('initWfsButton', null, "+j+")";
+	var x = new Function ("", functionCall);
+	x();
+}
+
+function displayButtons() {
+	for (var i = 0 ; i < buttonWfs_id.length ; i ++) {
+		if (parseInt(buttonWfs_on[i])==1) {
+			var currentDiv = document.createElement("div");
+			currentDiv.id = buttonWfs_id[i]+"Div";
+			currentDiv.style.position = "absolute";
+			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);
+		}
+	}
+}
+
+function initWfsButton(ind, pos) {
+	mb_button[ind] = document.getElementById(buttonWfs_id[pos]);
+	mb_button[ind].img_over = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_over");
+	mb_button[ind].img_on = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_on");
+	mb_button[ind].img_off = buttonWfs_imgdir + buttonWfs_src[pos];
+	mb_button[ind].status = 0;
+	mb_button[ind].elName = buttonWfs_id[pos];
+	mb_button[ind].fName = "";
+	mb_button[ind].go = new Function ("wfsEnable(mb_button["+ind+"], " + pos + ")");
+	mb_button[ind].stop = new Function ("wfsDisable(mb_button["+ind+"], " + pos + ")");
+	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	mod_wfs_spatialRequest_width = mb_mapObj[ind].width;
+	mod_wfs_spatialRequest_height = mb_mapObj[ind].height;
+	mod_wfs_spatialRequest_epsg = mb_mapObj[ind].epsg;
+	mb_registerPanSubElement("measuring");
+	
+	geomArray = new GeometryArray();
+}
+
+function wfsEnable(obj) {
+	var el = getMapDoc();
+
+   	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;
+		}
+	}
+	else if (obj.id == button_dialogue) {
+		activeButton = obj;
+		mod_wfs_SpatialRequest_dialog();
+	}
+	callRequestGeometryConstructor(obj.id,"mapframe1");
+}
+
+function callRequestGeometryConstructor(selectedType,target){
+	spatialRequestType = selectedType;
+	var geometryConstructor = new RequestGeometryConstructor(target);
+	geometryConstructor.getGeometry(selectedType,function(target,queryGeom){
+		if(queryGeom !=''){
+			requestGeom = queryGeom;
+		}
+		mb_disableThisButton(selectedType);
+		
+		// requestGeom 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 (requestGeom.geomType == geomType.line) {
+			multiGeom = new MultiGeometry(geomType.polygon);
+			newGeom = new Geometry(geomType.polygon);
+			var p1 = requestGeom.get(0);
+			var p2 = requestGeom.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 MultiGeometry(requestGeom.geomType);
+			multiGeom.add(requestGeom);
+		}
+		
+		// add highlight of geometry
+		//requestGeometryHighlight.add(multiGeom);
+		//requestGeometryHighlight.paint();
+	});
+}
+
+function getMapDoc () {
+	var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	var mapDomElement = mb_mapObj[mapIndex].getDomElement();
+	var mapType = mapDomElement.tagName.toUpperCase();
+	if (mapType == "IFRAME") {
+		return mapDomElement.window.document;
+	}
+	return window.document;
+}
+
+function wfsDisable(obj) {
+	var ind = getMapObjIndexByName("mapframe1");
+	var el = mb_mapObj[ind].getDomElement();
+	el.onmousedown = null;
+	el.ondblclick = null;
+	el.onmousemove = null;
+	activeButton = null;
+	writeTag("","measure_display","");
+	writeTag("","measure_sub","");
+	mb_setwfsrequest(mod_wfs_spatialRequest_target);
+}
+
+// ---------------------------------------------------------------------------------------------
+
+function register_setExtRequestSubFunctions(stringFunction){
+	mod_wfs_spatialRequestSubFunctions[mod_wfs_spatialRequestSubFunctions.length] = stringFunction;
+}
+
+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('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('}');
+		mod_wfs_spatialRequest_win.document.writeln('}');
+		mod_wfs_spatialRequest_win.document.writeln('window.opener.wfsEnable(obj);');
+		mod_wfs_spatialRequest_win.document.writeln('window.close();');
+		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>");
+		mod_wfs_spatialRequest_win.document.writeln("<input id='polygon' name='geom' type='radio' value='"+button_polygon+"'onclick='set(this)'> Polygon<br>");
+		mod_wfs_spatialRequest_win.document.writeln("<input id='extent' name='geom' type='radio' value='"+button_extent+"'onclick='set(this)'> Extent<br>");
+		var checked = "";
+		mod_wfs_spatialRequest_win.document.writeln("</form>");
+		mod_wfs_spatialRequest_win.document.close();
+	}
+	else{
+		mod_wfs_spatialRequest_win.focus();
+	}
+}
+
+function mb_setwfsrequest(target){
+	if(geomArray.count()>0){
+ 		geomArray.empty();
+ 	}
+	if (typeof(wfsPopup) != "undefined") {
+		wfsPopup.destroy();
+	}
+	//mb_wfs_reset();
+	var ind = getMapObjIndexByName(target);
+	var db_wfs_conf_id = [];
+	js_wfs_conf_id = [];
+
+	if (typeof(resultGeometryPopup) != "undefined") {
+		resultGeometryPopup.destroy();
+	}
+
+	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_visible == '1'){
+				// db_wfs_conf_id entries have to be unique
+				var exists = false;
+				for (var iii = 0; iii < db_wfs_conf_id.length; iii++) {
+					if (db_wfs_conf_id[iii] == o.gui_layer_wfs_featuretype) {
+						exists = true;
+						break;
+					}
+				}	
+				if (!exists) {
+					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 in wfs_config){
+			if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i]) {
+
+				// js_wfs_conf_id entries have to be unique
+				var exists = false;
+				for (var iii = 0; iii < js_wfs_conf_id.length; iii++) {
+					var n = js_wfs_conf_id[iii];
+					if (wfs_config[ii]['wfs_conf_id'] == wfs_config[n]['wfs_conf_id']) {
+						exists = true;
+						break;
+					}
+				}	
+				if (!exists) {
+					js_wfs_conf_id[js_wfs_conf_id.length] = ii;
+				}
+			}
+		}
+	}
+
+	numberOfAjaxCalls =  js_wfs_conf_id.length;
+
+	if(requestGeom.geomType==geomType.polygon){
+		for(var i=0; i<js_wfs_conf_id.length; i++){
+// I guess we should use the SRS of the map client, not the WFS? 
+// The coordinates come from the current client (?)
+//			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
+			var srs = mod_wfs_spatialRequest_epsg;
+			var filter = "<ogc:Filter xmlns:ogc=\"http://ogc.org\" xmlns:gml=\"http://www.opengis.net/gml\">";
+
+			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=\""+srs+"\">";
+				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+				for(var k=0; k<requestGeom.count(); k++){
+					if(k>0)	filter += " ";
+					filter += requestGeom.get(k).x+","+requestGeom.get(k).y;
+				}
+				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+				filter += "</gml:Polygon></Within>";
+			}
+			else if(buttonPolygon.filteroption=='intersects'){
+				filter += "<Intersects><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='"+srs+"'>";
+				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+				for(var k=0; k<requestGeom.count(); k++){
+					if(k>0)	filter += " ";
+					filter += requestGeom.get(k).x+","+requestGeom.get(k).y;
+				}
+				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+				filter += "</gml:Polygon></Intersects>";
+			}
+
+			filter += '</ogc:Filter>';
+			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
+		}
+	}
+	else if(requestGeom.geomType==geomType.line){
+		var rectangle = requestGeom.getBBox();
+		for(var i=0; i<js_wfs_conf_id.length; i++){
+// I guess we should use the SRS of the map client, not the WFS? 
+// The coordinates come from the current client (?)
+//			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
+			var srs = mod_wfs_spatialRequest_epsg;
+			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
+
+			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='"+srs+"'>";
+				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+				filter += rectangle[0].x+","+rectangle[0].y;
+				filter += " ";
+				filter += rectangle[0].x+","+rectangle[1].y;
+				filter += " ";
+				filter += rectangle[1].x+","+rectangle[1].y;
+				filter += " ";
+				filter += rectangle[1].x+","+rectangle[0].y;
+				filter += " ";
+				filter += rectangle[0].x+","+rectangle[0].y;
+				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+				filter += "</gml:Polygon></Within>";
+			}
+			else if(buttonRectangle.filteroption=='intersects'){
+				filter += "<Intersects><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='"+srs+"'>";
+				filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+				filter += rectangle[0].x+","+rectangle[0].y;
+				filter += " ";
+				filter += rectangle[0].x+","+rectangle[1].y;
+				filter += " ";
+				filter += rectangle[1].x+","+rectangle[1].y;
+				filter += " ";
+				filter += rectangle[1].x+","+rectangle[0].y;
+				filter += " ";
+				filter += rectangle[0].x+","+rectangle[0].y;
+				filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+				filter += "</gml:Polygon></Intersects>";
+			}
+
+			filter += "</ogc:Filter>";
+			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
+		}
+	}
+	else if(requestGeom.geomType == geomType.point){
+		var tmp = requestGeom.get(0);
+		var mapPos = 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 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
+		var realWorld2 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+		var realWorld4 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
+		for(var i=0; i<js_wfs_conf_id.length; i++){
+// I guess we should use the SRS of the map client, not the WFS? 
+// The coordinates come from the current client (?)
+//			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
+			var srs = mod_wfs_spatialRequest_epsg;
+			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
+			filter += "<Intersects><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='"+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 += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></ogc:Filter>";
+			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
+		}
+	}
+//	highlight = new Highlight(mb_wfs_targets, highlight_tag_id, {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex}, generalHighlightLineWidth);
+	return true;
+}
+
+function mb_get_geom(filter, index, typename, js_wfs_conf_id, db_wfs_conf_id) {
+
+	mb_ajax_post(
+		"../" + wfsResultModulePath + wfsResultModuleFilename,
+		{
+			'filter' : filter,
+			'typename' : typename,
+			'js_wfs_conf_id' : js_wfs_conf_id, 
+			'db_wfs_conf_id' : db_wfs_conf_id
+		},
+		function(json,status){
+			var geom = new GeometryArray();
+			if (geom.importGeoJSON(json)) {
+				for (var i = 0; i < geom.count(); i++) {
+					geom.get(i).wfs_conf = parseInt(js_wfs_conf_id);
+				}
+			}
+			checkIfAllAjaxCallsFinished(geom);
+		}
+	);
+}
+
+function checkIfAllAjaxCallsFinished (geom) {
+	numberOfFinishedAjaxCalls++;
+	if (typeof(geom) == 'object'){
+		var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+		if (geom.count() === 0) {
+			var e = new Mb_exception("Result set is empty.");
+			return;
+		}
+		if (geom.get(0).getEpsg() !== mb_mapObj[mapIndex].epsg) {
+			var e = new Mb_warning("SRS mismatch. Geometry is in " + geom.get(0).getEpsg() + ", map is in " + mb_mapObj[mapIndex].epsg + ".");
+		}
+		geomArray.union(geom);
+	}
+	if (numberOfFinishedAjaxCalls == numberOfAjaxCalls) {
+		numberOfFinishedAjaxCalls = 0;
+		mb_execWfsReadSubFunctions(geomArray);
+	}
+}
+
+function useExtentIsSet () {
+	return mod_wfs_spatialRequest_useExtent;
+}
+
+function isValidWfsConfIndex (wfsConf, wfsConfIndex) {
+	return (typeof(wfsConfIndex) == "number" && wfsConfIndex >=0 && wfsConfIndex < wfsConf.length);
+}
+
+function Numsort (a, b) {
+  return a - b;
+}
+
+function getListTitle (geom) {
+	wfsConfId = geom.wfs_conf;
+	wfsConf = get_complete_wfs_conf();
+	if (isValidWfsConfIndex(wfsConf, wfsConfId)) {
+		var resultArray = [];
+		var resultName = "";
+		for (var i = 0 ; i < wfsConf[wfsConfId]['element'].length ; i++) {
+			if (wfsConf[wfsConfId]['element'][i]['f_show'] == 1 && geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']) !=false) {
+				var pos = wfsConf[wfsConfId]['element'][i]['f_respos'];
+				if (typeof(resultArray[pos]) != "undefined") {
+					resultArray[pos] += " " + geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']);
+				}
+				else {
+					resultArray[pos] = geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']);
+				}
+				resultName += geom.e.getElementValueByName(wfsConf[wfsConfId]['element'][i]['element_name']) + " ";
+			}
+		}
+		resultArray.sort(Numsort);
+		var resultName = resultArray.join(" ");
+		if (resultName == "") {
+			resultName = wfsConf[wfsConfId]['g_label'];
+		}
+		return resultName;
+	}
+	else {
+		return msgObj.digitizeDefaultGeometryName;
+	}
+}
+
+function appendGeometryArrayToDigitize(geom){
+	var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+
+	var proceed = true;
+	if (geom.get(0).getEpsg() !== mb_mapObj[mapIndex].epsg) {
+		var msg = "SRS mismatch. Geometry is in " + geom.get(0).getEpsg() + 
+			", map is in " + mb_mapObj[mapIndex].epsg + ".";
+		var e = new Mb_warning(msg);
+		proceed = confirm(msg + " Proceed?");
+	}
+	if (!proceed) {
+		return;
+	}
+	try {
+		window.frames[mod_digitize_elName].appendGeometryArray(geom);
+		tab_open(mod_digitize_elName);
+	}
+	catch (e) {
+		var e = new Mb_exception("The application element 'digitize' is missing.");
+	}
+}
+
+function appendGeometryToDigitize(i){
+	var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+
+	var proceed = true;
+	if (geomArray.get(i).getEpsg() !== mb_mapObj[mapIndex].epsg) {
+		var msg = "SRS mismatch. Geometry is in " + geom.get(0).getEpsg() + 
+			", map is in " + mb_mapObj[mapIndex].epsg + ".";
+		var e = new Mb_warning(msg);
+		proceed = confirm(msg + " Proceed?");
+	}
+	if (!proceed) {
+		return;
+	}
+	var digitizeArray = new GeometryArray();
+	digitizeArray.addCopy(geomArray.get(i));
+	try {
+		window.frames[mod_digitize_elName].appendGeometryArray(digitizeArray);
+		tab_open(mod_digitize_elName);
+	}
+	catch (e) {
+		var e = new Mb_exception("The application element 'digitize' is missing.");
+	}
+}
+
+function createListOfGeometries(){
+	var listOfGeom = "<table style='background-color:#EEEEEE;'>\n";
+	if (geomArray.count() > 0) {
+		if(buttonWfs_toDigitize_on==1){
+			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";
+		}
+		for (var i = 0 ; i < geomArray.count(); i ++) {
+			if (geomArray.get(i).get(-1).isComplete()) {
+				listOfGeom += "\t<tr>\n\t\t<td style = 'color:blue;font-size:12px;cursor:pointer;'\n";
+				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));
+				//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)";}
+				listOfGeom += ">" + geomName +"</td>";
+				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 += "</table>\n";
+	return listOfGeom;
+}
+
+function displayPopup(geom){
+	geomArray = geom;
+	if (typeof(resultGeometryPopup) == "undefined") {
+		resultGeometryPopup = new mb_popup(searchPopupTitle,createListOfGeometries(),searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
+	}
+	else {
+		resultGeometryPopup.setWidth(searchPopupWidth);
+		resultGeometryPopup.setHtml(createListOfGeometries());
+	}
+	resultGeometryPopup.show();
+}
+
+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 += currentWfsConf.element[i].f_label;
+				resultHtml +="</td>\n";
+				resultHtml += "<td>\n";
+				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>/)){
+						var newLink	=	setUrl.replace(/><\/a>/, ">"+elementVal+"</a>");
+					}
+					else{
+						var newLink = setUrl;
+					}
+					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 += "</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);
+	if (typeof(wfsPopup) == "undefined") {
+		wfsPopup = new mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
+	}
+	else {
+		wfsPopup.hide();
+		wfsPopup = new mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
+	}
+	wfsPopup.show();
+}
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- branches/print_dev/http/javascripts/mod_wfs_gazetteer_client.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/mod_wfs_gazetteer_client.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -1167,7 +1167,7 @@
 				//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 newPath = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
 					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>");

Modified: branches/print_dev/http/javascripts/ovnf.php
===================================================================
--- branches/print_dev/http/javascripts/ovnf.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/ovnf.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -24,7 +24,7 @@
 if (typeof(overview_wms) === 'undefined')overview_wms = 0;
 overview_wms = parseInt(overview_wms);
 
-mb_registerMapObj('', 'overview', overview_wms ,150, 150);
+mb_registerMapObj('', 'overview', overview_wms ,<?php echo $e_width; ?>, <?php echo $e_height; ?>);
 parent.eventInitMap.register(function init_overview(){
 		var ind = getMapObjIndexByName('overview');
 		

Modified: branches/print_dev/http/javascripts/requestGeometryConstructor.js
===================================================================
--- branches/print_dev/http/javascripts/requestGeometryConstructor.js	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/requestGeometryConstructor.js	2009-03-09 09:01:26 UTC (rev 3648)
@@ -20,7 +20,34 @@
 	 */
 
 	this.geomTarget = geomTarget;
+
+	var ind = getMapObjIndexByName(this.geomTarget);
+	var myMapObj = mb_mapObj[ind];		
+	var map_el = myMapObj.getDomElement();
+	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measuring")){
+		//create Box Elements
+		var el_top = map_el.ownerDocument.createElement("div");
+		el_top.style.position = "absolute";
+		el_top.style.top = "0px";
+		el_top.style.left = "0px";
+		el_top.style.zIndex = "16";
+		el_top.style.fontSize = "10px";
+		el_top.id = myMapObj.elementName+"_measuring";
+		map_el.appendChild(el_top);
+	}
 	
+	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measure_display")){
+		//create Box Elements
+		var el_top = map_el.ownerDocument.createElement("div");
+		el_top.style.position = "absolute";
+		el_top.style.top = "0px";
+		el_top.style.left = "0px";
+		el_top.style.zIndex = "17";
+		el_top.id = myMapObj.elementName+"_measure_display";
+		map_el.appendChild(el_top);
+	}
+
+	
 	this.getGeometry = function(queryType,callbackFunction){
 		var target = this.geomTarget;
 		s = new Snapping(this.geomTarget);
@@ -36,8 +63,7 @@
 		if (queryType == "point") {
 			queryGeom = new Geometry(geomType.point);
 			el.onmousedown = function (e) {
-				mb_getMousePos(e,target);
-				realWorldPos = mapToReal(target,new Point(clickX,clickY));
+				realWorldPos = mapToReal(target,myMapObj.getMousePosition(e));
 				queryGeom.addPoint(realWorldPos);
 				callback(target, queryGeom);
 				el.onmouseover = null;
@@ -88,8 +114,7 @@
 			s.clean();
 		}
 		else {
-			mb_getMousePos(e,that.geomTarget);
-			realWorldPos = mapToReal(that.geomTarget,new Point(clickX,clickY));
+			realWorldPos = mapToReal(that.geomTarget,myMapObj.getMousePosition(e));
 		}
 		queryGeom.addPoint(realWorldPos);
 	
@@ -99,8 +124,8 @@
 		if (s.isSnapped() && queryGeom.count() >= 3 && queryGeom.get(-1).equals(queryGeom.get(0))) {
 			queryGeom.close();
 			callback(that.geomTarget,queryGeom);
-			writeTag(that.geomTarget,"measuring","");
-			writeTag(that.geomTarget,"measure_display","");
+			writeTag(myMapObj.frameName, myMapObj.elementName+"_measuring", "");
+			writeTag(myMapObj.frameName, myMapObj.elementName+"_measure_display", "");
 			var ind = getMapObjIndexByName("mapframe1");
 			var el = mb_mapObj[ind].getDomElement();
 			el.onmouseover = null;
@@ -117,8 +142,7 @@
 		this.geomTarget = geomTarget;
 		var that = this;
 		if (queryGeom.count() >= 3) {
-			mb_getMousePos(e,that.geomTarget);
-			var pos = new Point(clickX,clickY);
+			var pos = myMapObj.getMousePosition(e);
 			s.check(pos);
 		}
 	}
@@ -142,7 +166,7 @@
 				}
 			}
 		}
-		writeTag(that.geomTarget,"measuring",str_mPoints);
+		writeTag(myMapObj.frameName, myMapObj.elementName+"_measuring", str_mPoints);
 	}
 	
 	var evaluateDashesExt = function(p1,p0,count){

Modified: branches/print_dev/http/javascripts/wms.js
===================================================================
--- branches/print_dev/http/javascripts/wms.js	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/javascripts/wms.js	2009-03-09 09:01:26 UTC (rev 3648)
@@ -248,7 +248,9 @@
 			return;	
 		
 		//TODO: check if mapframe1 is the right mapframe
-		wmsImage = parent.mapframe1.document.getElementById(divId);
+		var ind = getMapObjIndexByName("mapframe1");
+		var el = mb_mapObj[ind].getDomElement();
+		wmsImage = el.ownerDocument.getElementById(divId);
 		if (wmsImage != null) {
 			wmsImage.style.opacity = this.gui_wms_mapopacity;
 			wmsImage.style.MozOpacity = this.gui_wms_mapopacity;

Modified: branches/print_dev/http/php/mb_listGUIs.php
===================================================================
--- branches/print_dev/http/php/mb_listGUIs.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mb_listGUIs.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -17,47 +17,95 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# list of user-guis after login:
 function mb_listGUIs($arrayGUIs){
-	echo "<form name='listGUIsForm' target='_blank'>";
-	echo "<table width = '50%' ><tr><td>";
-	echo "<h2><font align='left' color='#000000'>Ma</font><font color='#0000CE'>p</font><font color='#C00000'>b</font><font color='#000000'>ender GUI list </font> </h2>";
-	echo "</td><td>";
+	if(count($arrayGUIs) === 0) {
+		echo "<h1>Error</h1>";
+		echo "<p>There are no GUIs available for this user.</p>";
+		printf("<p><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_gray/logout_off.png\" onmouseover=\"this.src='../img/button_gray/logout_over.png'\" onmouseout=\"this.src='../img/button_gray/logout_off.png'\" alt=\"Logout\" title=\"Logout\"></a></p>",SID);
+		
+		return;
+	}
 	
-	if (count($arrayGUIs)>0){
-		$v = array();
-		$t = array();
-		$sql_list_guis = "SELECT DISTINCT gui_id,gui_name,gui_description FROM gui WHERE gui_id IN (";
-		for($i=0; $i<count($arrayGUIs); $i++){
-			if($i>0){$sql_list_guis .= ",";}
-			$sql_list_guis .= "$".($i+1);
-			array_push($v,$arrayGUIs[$i]);
-			array_push($t,'s');
+	$v = array();
+	$t = array();
+
+	$sql  = "SELECT DISTINCT gui_id,gui_name,gui_description, ggc.*,gc.category_name,gc.category_description, gc.category_id ";
+	$sql .= "FROM gui g ";
+	$sql .= "LEFT JOIN gui_gui_category ggc ON g.gui_id = ggc.fkey_gui_id ";
+	$sql .= "LEFT JOIN gui_category gc ON (ggc.fkey_gui_category_id = gc.category_id) ";
+	$sql .= "WHERE gui_id IN (";
+
+
+	for($i = 0; $i < count($arrayGUIs); $i++) {
+		if($i > 0) {
+			$sql .= ",";
 		}
-		$sql_list_guis .= ") ORDER BY gui_name";
-		$res_list_guis = db_prep_query($sql_list_guis,$v,$t);
-		echo "</td><td align = 'right'>";
-		echo "<a href=\"../php/mod_logout.php?".SID."\"><img src =\"../img/button_gray/logout_off.png\" border='0' onmouseover='this.src=\"../img/button_gray/logout_over.png\"' onmouseout='this.src=\"../img/button_gray/logout_off.png\"' title=\"Logout\"></a>";
-		echo "</td></tr></table>";
-		echo "<table width='50%' class='list_guis' border='1' cellpadding='3' rules='rows'><tr style='background-color:#F0F0F0;' width='80px'><td ><b>GUI name</b></td><td><b>GUI description</b></td></tr>";
-		$cnt_list_guis = 0;
-		while($row = db_fetch_array($res_list_guis)){
-			echo "<tr ";
-			if(($cnt_list_guis % 2) == 0){ echo " style='background-color:#ffffff;' ";}
-			echo ">";
-			echo "<td><b><a href='index.php?".strip_tags (SID)."&gui_id=".$row["gui_id"]."'>".$row["gui_name"]."</a><b></td>";
-			echo "<td>".$row["gui_description"]."</td>";
-			echo "</tr>";
-			$cnt_list_guis++;
-		}
+		
+		$sql .= "$".($i + 1);
+		
+		array_push($v,$arrayGUIs[$i]);
+		array_push($t,'s');
 	}
-	else{
-		echo "</td><td align = 'right'>";
-		echo "<a href=\"../php/mod_logout.php?".SID."\"><img src =\"../img/button_gray/logout_off.png\" border='0' onmouseover='this.src=\"../img/button_gray/logout_over.png\"' onmouseout='this.src=\"../img/button_gray/logout_off.png\"' title=\"Logout\"></a>";
-		echo "</td><tr>" ;
-		echo "<td><br>There are no guis available for this user</td></tr>";
-		echo "</table>";
-	}
-	echo "</form>";
+
+	$sql .= ") ORDER BY gc.category_id, gui_name";
+
+ 	$result = db_prep_query($sql,$v,$t);
+	
+	$category = NULL;
+
+	echo "<h1 class='listGuisHeader'>Available application(s)</h1>\n";
+	printf("<p class='logoutButton'><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_gray/logout_off.png\" onmouseover=\"this.src='../img/button_gray/logout_over.png'\" onmouseout=\"this.src='../img/button_gray/logout_off.png'\" title=\"Logout\" alt=\"Logout\" /></a></p>\n",SID);
+
+	echo "<div id='menu'>\n";
+	echo "<ul class=\"gui_list\">\n";
+
+
+  $num =  pg_numrows($result);
+ 
+  for ($j=0; $j<$num; $j++){
+     
+    $row = pg_fetch_array ($result, $j);  	
+     if($category !== $row["category_name"]) {
+  			$category = $row["category_name"];
+        			
+  			if(strlen($row["category_name"]) > 0) {		  
+  			
+          printf("\t<li class=\"gui_category\" id=\"%s\"><h2>%s</h2>",$row["category_name"],$row["category_name"]);			  
+        }
+        else {
+        	//$category="NULL";	  
+          printf("\t<li class=\"gui_category\" ><h2>GUI(s) without category</h2>");			  
+        }
+        
+  			if(strlen($row["category_description"]) > 0) {
+  				printf("<label for=\"%s\" class=\"gui_category_description\">%s</label>\n",$row["category_name"],$row["category_description"]);
+  			  
+          echo "\t\t<ul>\n";
+        }
+        else {
+  			  echo "\n\t\t<ul>\n";		
+  		  } 
+  		}
+  		
+  		$url = sprintf("index.php?%s&amp;gui_id=%s",strip_tags(SID),$row["gui_id"]);
+  		if(($j % 2) == 0){$class= "class='alternate' ";}
+  		else {$class="class='normal'";}
+      //printf("\t\t<li id=\"%s\" %s onclick=\"location.href='%s'\" ><a href=\"%s\">%s</a><label for=\"%s\">%s</label></li>\n",$row["gui_name"],$class,$url,$url,$row["gui_name"],$row["gui_name"],$row["gui_description"]);
+     
+      printf("\t\t<li id=\"%s\" %s onclick=\"location.href='%s'\" ><a href=\"%s\">%s</a> \n\t\t\t <ul><li>%s</li></ul></li>\n",$row["gui_name"],$class,$url,$url,$row["gui_name"],$row["gui_description"]);
+     
+     //checks next category or last category
+     $nextrow = pg_fetch_array ($result, $j+1); 
+     if(($category !== $nextrow["category_name"]) ||($num==$j+1)) {
+     echo "\t\t</ul>\n";
+     echo "\t</li>\n"; 
+     }
+   
+   
+          
+  }
+echo "</ul>\n";
+echo "</div>\n";
 }
+
 ?>

Modified: branches/print_dev/http/php/mod_WMSpreferences.php
===================================================================
--- branches/print_dev/http/php/mod_WMSpreferences.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_WMSpreferences.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -106,20 +106,21 @@
 var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);
 var my = window.opener.mb_mapObj[ind];
 
- function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
-	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
-		upper = mb_mapObj[mapObj_ind].wms[indexA];
-		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
-		mb_mapObj[mapObj_ind].wms[indexB] = upper;
-		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
-		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
-		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
-		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
-		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
-		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
-		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
-		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
-		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+ function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+ 	var myMapObj = window.opener.mb_mapObj[mapObj_ind];
+	if (indexA != indexB && indexA >= 0 && indexA < myMapObj.wms.length && indexB >= 0 && indexB < myMapObj.wms.length) {
+		upper = myMapObj.wms[indexA];
+		myMapObj.wms[indexA] = myMapObj.wms[indexB];
+		myMapObj.wms[indexB] = upper;
+		var upperLayers = myMapObj.layers[indexA];
+		var upperStyles = myMapObj.styles[indexA];
+		var upperQuerylayers = myMapObj.querylayers[indexA];
+		myMapObj.layers[indexA] = myMapObj.layers[indexB];
+		myMapObj.styles[indexA] = myMapObj.styles[indexB];
+		myMapObj.querylayers[indexA] = myMapObj.querylayers[indexB];
+		myMapObj.layers[indexB] = upperLayers;
+		myMapObj.styles[indexB] = upperStyles;
+		myMapObj.querylayers[indexB] = upperQuerylayers;
 		return true;
 	}
 	else {
@@ -159,7 +160,7 @@
 }
 
 function swap(index1, index2){
-	if (window.opener.mb_swapWmsByIndex(ind, index1, index2) == true) {
+	if (mb_swapWmsByIndex(ind, index1, index2) == true) {
 		loadWMS();
 		window.opener.zoom(mod_WMSpreferences_target1, true, 1.0);
 		window.opener.mb_execloadWmsSubFunctions();

Modified: branches/print_dev/http/php/mod_gazetteerMetadata.php
===================================================================
--- branches/print_dev/http/php/mod_gazetteerMetadata.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_gazetteerMetadata.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -99,9 +99,18 @@
    }
    else{   
 		document.getElementById("resultDivTag").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
-		parent.mb_ajax_json("../php/mod_gazetteerMetadata_search.php", {"search":document.form1.search.value}, function(jsonObj, status){
-			document.getElementById("resultDivTag").innerHTML = displayTable(jsonObj);
-		});
+		var ind = parent.getMapObjIndexByName('mapframe1');
+		
+		parent.mb_ajax_json(
+			"../php/mod_gazetteerMetadata_search.php", 
+			{
+				"search" : document.form1.search.value,
+				"srs" : parent.mb_mapObj[ind].epsg
+			}, 
+			function(jsonObj, status){
+				document.getElementById("resultDivTag").innerHTML = displayTable(jsonObj);
+			}
+		);
 		return false;
    }
 }
@@ -112,21 +121,41 @@
 		var resultObj = obj[attr];
 		if (typeof(resultObj) != 'function') {
 			text += "<tr><td valign='top'>";
+			var imgUrl = "";
+			var onclickFunction = "";
 			if (typeof(resultObj.layer_name) !== "undefined") {
-				text += "<a href='#' onClick='mod_addWMSLayerfromfilteredList(\""+resultObj.wms_getcapabilities+"\",\""+resultObj.wms_version+"\", \""+resultObj.layer_name+"\");'>";
-				text += "<img name='add_wms' src='../img/button_gray/metadata_layer.gif' border='0' title='Load'></a>";
-				text += "</td><td>";
-				text += "<a href='#' ";
-				text += "onClick='javascript:window.open(\"mod_layerMetadata.php?id="+resultObj.layer_id+"\", \"metadata\", \"width=450, height=600\");' title='Info'>"; 
-				text += resultObj.title+"</a>";	
+				imgUrl = "../img/button_gray/metadata_layer.gif";
+				onclickFunction = "mod_addWMSLayerfromfilteredList(\"" + 
+					resultObj.wms_getcapabilities + "\",\"" + 
+					resultObj.wms_version + "\", \"" + 
+					resultObj.layer_name+"\");";
 			}
 			else {
-				text += "<a href='#' onClick='mod_addWMSfromfilteredList(\""+resultObj.wms_getcapabilities+"\",\""+resultObj.wms_version+"\")'>";
-				text += "<img name='add_wms' src='../img/button_gray/metadata_wms.gif' border='0' title='Load'></a>";
-				text += "</td><td>";
-				text += "<a href='#' onClick='javascript:window.open(\"mod_layerMetadata.php?id="+resultObj.layer_id+"\", \"metadata\", \"width=450, height=600\");' title='Info'>";
-				text += resultObj.title+"</a>"
+				imgUrl = "../img/button_gray/metadata_wms.gif";
+				onclickFunction = "mod_addWMSfromfilteredList(\"" + 
+					resultObj.wms_getcapabilities + "\",\"" + 
+					resultObj.wms_version+"\");";
 			}
+			text += "<img name='add_wms' src='" + imgUrl + "' ";
+			text += "border='0' title='Load' ";
+			text += "onclick='" + onclickFunction + "'>";
+			if (resultObj.extent && resultObj.extent[0] !== null) {
+				text += "<img src='../img/tree_new/zoom.png' " + 
+					"onclick='" + 
+					"parent.mb_calculateExtent(\"mapframe1\", " + 
+					resultObj.extent[0] + "," + 
+					resultObj.extent[1] + "," + 
+					resultObj.extent[2] + "," + 
+					resultObj.extent[3] + ");" + 
+					"parent.zoom(\"mapframe1\", \"true\", 1.0);" + 
+					"'>";
+			}
+			text += "</td><td>";
+			text += "<a href='#' ";
+			text += "onclick='javascript:window.open(\"mod_layerMetadata.php?id=" + 
+				resultObj.layer_id + 
+				"\", \"metadata\", \"width=450, height=600\");' title='Info'>"; 
+			text += resultObj.title+"</a>";	
 			text += "</td></tr>";
 		}
 	}

Modified: branches/print_dev/http/php/mod_gazetteerMetadata_search.php
===================================================================
--- branches/print_dev/http/php/mod_gazetteerMetadata_search.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_gazetteerMetadata_search.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -3,9 +3,20 @@
 require_once(dirname(__FILE__)."/../classes/class_administration.php");
 require_once(dirname(__FILE__)."/../classes/class_json.php");
 
+$json = new Mapbender_JSON();
+
 $user_id = $_SESSION["mb_user_id"];
-$query = $_REQUEST["search"];
+$query = stripslashes($_REQUEST["search"]);
+$srs = stripslashes($_REQUEST["srs"]);
 
+if (!preg_match("/^[a-zA-Z_\- ]+$/", $query)) {
+	echo "[]"; die;
+}
+
+if (!preg_match("/^[a-zA-Z_\-:0-9 ]+$/", $srs)) {
+	echo "[]"; die;
+}
+
 $n = new administration();
 $myguis = $n->getGuisByPermission($user_id, true);
 $mywms = $n->getWmsByOwnGuis($myguis);
@@ -31,9 +42,13 @@
 	$v = array();   
 	$t = array();   
 
-	$sql_wms = "SELECT layer.layer_id, wms.wms_title, wms.wms_getcapabilities, wms.wms_version ";
-	$sql_wms .= "FROM wms LEFT JOIN layer ON wms.wms_id = layer.fkey_wms_id ";
-	$sql_wms .= "WHERE layer.layer_pos = 0 AND wms.wms_id IN ("; 
+	$sql_wms = "SELECT DISTINCT layer.layer_id, wms.wms_title, " . 
+		"wms.wms_getcapabilities, wms.wms_version, " . 
+		"e.minx, e.miny, e.maxx, e.maxy " . 
+		"FROM wms LEFT JOIN layer ON wms.wms_id = layer.fkey_wms_id " . 
+		"LEFT JOIN layer_epsg e ON layer.layer_id = e.fkey_layer_id " . 
+		"AND e.epsg = '$srs' " . 
+		"WHERE layer.layer_pos = 0 AND wms.wms_id IN ("; 
 	for($i=0; $i<count($mywms); $i++){
 		if ($i > 0) {$sql_wms .= ",";}
 		$sql_wms .= "$".($i+1);
@@ -44,32 +59,67 @@
 	$res_wms = db_prep_query($sql_wms,$v,$t);
 
 	while ($row = db_fetch_array($res_wms)) {
-		array_push($obj, array('wms_getcapabilities' => $row['wms_getcapabilities'], 'wms_version' => $row['wms_version'], 'layer_id' => $row['layer_id'], 'title' => $row['wms_title']));
+		array_push($obj, array(
+			'wms_getcapabilities' => $row['wms_getcapabilities'], 
+			'wms_version' => $row['wms_version'], 
+			'layer_id' => $row['layer_id'], 
+			'title' => $row['wms_title'],
+			'extent' => array(
+				$row['minx'],
+				$row['miny'],
+				$row['maxx'],
+				$row['maxy']
+			)
+		));
 	}
 }
 
 if (count($mylayer) > 0) {
 	$v = array();   
 	$t = array();   
-	$sql_layer = "SELECT l.layer_id, l.fkey_wms_id, l.layer_title, l.layer_name ,";
-	$sql_layer .= "w.wms_getcapabilities, w.wms_version ";
-	$sql_layer .= "FROM layer l LEFT JOIN layer_keyword lkw LEFT JOIN keyword kw ON kw.keyword_id = lkw.fkey_keyword_id ";
-	$sql_layer .= "ON l.layer_id = lkw.fkey_layer_id LEFT JOIN wms w ON  l.fkey_wms_id = w.wms_id WHERE l.layer_id IN (";
+	$sql_layer = "SELECT DISTINCT l.layer_id, l.fkey_wms_id, l.layer_title, " . 
+		"l.layer_name, w.wms_getcapabilities, w.wms_version, " . 
+		"e.minx, e.miny, e.maxx, e.maxy " . 
+		"FROM layer l LEFT JOIN layer_keyword lkw " . 
+		"LEFT JOIN keyword kw ON kw.keyword_id = lkw.fkey_keyword_id " . 
+		"ON l.layer_id = lkw.fkey_layer_id " . 
+		"LEFT JOIN wms w ON l.fkey_wms_id = w.wms_id " . 
+		"LEFT JOIN layer_epsg e ON l.layer_id = e.fkey_layer_id " . 
+		"AND e.epsg = '$srs' " . 
+		"WHERE l.layer_id IN (";
+
 	for($i = 0; $i < count($mylayer); $i++){
 		if ($i > 0) {$sql_layer .= ",";}
 		$sql_layer .= "$".($i+1);
 		array_push($v, $mylayer[$i]);
 		array_push($t, 'i');   
 	}
-	$sql_layer .= ") AND (layer_title ILIKE '%".$query."%' OR layer_name ILIKE '%".$query."%' OR layer_abstract ILIKE '%".$query."%' OR kw.keyword ILIKE '%".$query."%') ";
+
+	$sql_layer .= ") AND (" . 
+		"layer_title ILIKE '%".$query."%' OR " . 
+		"layer_name ILIKE '%".$query."%' OR " . 
+		"layer_abstract ILIKE '%".$query."%' OR " . 
+		"kw.keyword ILIKE '%".$query."%') ";
 	$sql_layer .= "ORDER BY l.layer_title;";
 	$res_layer = db_prep_query($sql_layer,$v,$t);
 
+
 	while ($row = db_fetch_array($res_layer)) {
-		array_push($obj, array('wms_getcapabilities' => $row['wms_getcapabilities'], 'wms_version' => $row['wms_version'], 'layer_name' => $row['layer_name'], 'layer_id' => $row['layer_id'], 'title' => $row['layer_title']));
+		array_push($obj, array(
+			'wms_getcapabilities' => $row['wms_getcapabilities'], 
+			'wms_version' => $row['wms_version'], 
+			'layer_name' => $row['layer_name'], 
+			'layer_id' => $row['layer_id'], 
+			'title' => $row['layer_title'],
+			'extent' => array(
+				$row['minx'],
+				$row['miny'],
+				$row['maxx'],
+				$row['maxy']
+			)
+		));
 	}
 }
-$json = new Mapbender_JSON();
 $output = $json->encode($obj);
 echo $output;
-?>
\ No newline at end of file
+?>

Modified: branches/print_dev/http/php/mod_wfs.php
===================================================================
--- branches/print_dev/http/php/mod_wfs.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_wfs.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -151,20 +151,20 @@
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_search'] = ".$row["f_search"].";";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_style_id'] = '".$row["f_style_id"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_toupper'] = '".$row["f_toupper"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label'] = '".$row["f_label"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label'] = '".htmlentities($row["f_label"], ENT_QUOTES)."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label_id'] = '".$row["f_label_id"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_show'] = '".$row["f_show"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_show_detail'] = '".$row["f_show_detail"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_respos'] = '".$row["f_respos"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_name'] = '".$row["element_name"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_type'] = '".$row["element_type"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_name'] = '".htmlentities($row["element_name"], ENT_QUOTES)."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_type'] = '".htmlentities($row["element_type"], ENT_QUOTES)."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_geom'] = '".$row["f_geom"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_gid'] = '".$row["f_gid"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"".(preg_replace("/\n/", "", preg_replace("/\r/", "", $row["f_form_element_html"])))."\";";
 //			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"\";";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_edit'] = '".$row["f_edit"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_mandatory'] = '".$row["f_mandatory"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_auth_varname'] = '".$row["f_auth_varname"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_auth_varname'] = '".htmlentities($row["f_auth_varname"], ENT_QUOTES)."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_operator'] = '".$row["f_operator"]."';";
 			$cnt++;
 		}

Modified: branches/print_dev/http/php/mod_wfs_gazetteer_server.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_gazetteer_server.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_wfs_gazetteer_server.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -23,6 +23,7 @@
 require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
 require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
 require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
 
 $command = $_REQUEST["command"];
 
@@ -107,60 +108,26 @@
 	$url = $_REQUEST["url"];
 	$typename = $_REQUEST["typename"];
 
-	/* wfs_conf */
-	$sql = "SELECT * FROM wfs_conf JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
-	$sql .= "WHERE wfs_conf.wfs_conf_id = $1";
-	$v = array($wfs_conf_id);
-	$t = array('i');
-	
-	$res = db_prep_query($sql,$v,$t);
-	if ($row = db_fetch_array($res)) {
-		$g_res_style  = $row["g_res_style"];
+	$wfsConf = WfsConfiguration::createFromDb($wfs_conf_id);
+	if (is_null($wfsConf)) {
+		sendErrorMessage("Invalid WFS conf: " . $wfs_conf_id);
 	}
-	else {
-		die("wfs_conf " . $wfs_conf_id . "data not available");
-	}
 	
-	/* wfs_conf_element */
-	$sql = "SELECT * FROM wfs_conf_element ";
-	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
-	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
-	$sql .= "AND wfs_conf_element.f_show = 1 ORDER BY wfs_conf_element.f_respos;";
-	$v = array($wfs_conf_id);
-	$t = array('i');
-	
-	$res = db_prep_query($sql,$v,$t);
-	$col = array();
-	while ($row = db_fetch_array($res)) {
-		array_push($col, $row["element_name"]);
-	}
-	if (count($col) == 0) {
-		die("wfs_conf_element data not available");
-	}
-	
-	// append authorisation condition to filter
-	$filter = checkAccessConstraint($filter, $wfs_conf_id);
-	
 	$admin = new administration();
 	
 	$filter = $admin->char_decode(stripslashes($filter));
 
-	$sql = "SELECT fkey_wfs_id FROM wfs_conf WHERE wfs_conf_id = $1";
-	$v = array($wfs_conf_id);
-	$t = array('i');
-	$res = db_prep_query($sql, $v, $t);
-	$row = db_fetch_array($res);
-	$wfsId = $row["fkey_wfs_id"];
+	$wfsId = $wfsConf->wfsId;
 
 	$myWfsFactory = new UniversalWfsFactory();
 	$myWfs = $myWfsFactory->createFromDb($wfsId);
 	$data = $myWfs->getFeature($typename, $filter);
 	if ($data === null) die('{}');
 	
-	$geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id);
+//	$geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id);
 
 	$gmlFactory = new UniversalGmlFactory();
-	$myGml = $gmlFactory->createFromXml($data);
+	$myGml = $gmlFactory->createFromXml($data, $wfsConf);
 	$geoJson = $myGml->toGeoJSON();
 	
 	header("Content-type:application/x-json; charset=utf-8");

Modified: branches/print_dev/http/php/mod_wfs_result.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_result.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_wfs_result.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -20,7 +20,7 @@
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 require_once(dirname(__FILE__) . "/../classes/class_stripRequest.php");
 require_once(dirname(__FILE__) . "/../classes/class_connector.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
 require_once(dirname(__FILE__)."/../classes/class_wfs.php");
 require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
 require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
@@ -61,6 +61,7 @@
 			$element_name = $row["element_name"];
 		}
 	}
+	$e = new mb_exception($auth_varname . " " . $element_name);
 	if (!empty($auth_varname)) {
 
 		if (isValidVarName($auth_varname)) {
@@ -89,12 +90,14 @@
 
 if ($data === null) die('{}');
 
-//echo $data; die;
+$myWfsConf = WfsConfiguration::createFromDb($db_wfs_conf_id);
+if (is_null($myWfsConf)) {
+	die("{}");
+}
 
-$geomColumn = WfsConf::getGeomColumnNameByConfId($db_wfs_conf_id);
+$gmlFactory = new UniversalGmlFactory();
+$myGml = $gmlFactory->createFromXml($data, $myWfsConf);
 
-$gmlFactory = new UniversalGmlFactory();
-$myGml = $gmlFactory->createFromXml($data, geomColumn);
 $geoJson = $myGml->toGeoJSON();
 
 header('Content-type: text/html');

Modified: branches/print_dev/http/php/mod_wfs_server.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_server.php	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/http/php/mod_wfs_server.php	2009-03-09 09:01:26 UTC (rev 3648)
@@ -232,16 +232,17 @@
  * @return boolean success
  */
 function updateWfs($obj){
-	$obj->success = false;
-	$mywfs = new wfs();
-	$mywfs->createObjFromDB($obj->wfs);
-	if(!$mywfs->updateObjFromXML($obj->url)){
-		return false;
+	$id = $obj->wfs;
+
+	$wfsFactory = new UniversalWfsFactory();
+	$myWfs = $wfsFactory->createFromDb($id);
+
+	if(is_null($myWfs) || !$myWfs->update()){
+		$obj->success = false;
 	}
-	if(!$mywfs->wfs2db("")){
-		return false;
+	else {
+		$obj->success = true;
 	}
-	$obj->success = true;
 	return true;
 }
 /*
@@ -251,18 +252,16 @@
  * @return boolean success
  */
 function deleteWfs($obj){
-	//$obj->success = false;
 	$id = $obj->wfs;
 	
 	$wfsFactory = new UniversalWfsFactory();
 	$myWfs = $wfsFactory->createFromDb($id);
-	if ($myWfs->delete()) {
-		$obj->success = true;
+	if (is_null($myWfs) || !$myWfs->delete()) {
+		$obj->success = false;
 	}
 	else {
-		$obj->success = false;
+		$obj->success = true;
 	}
-	
 	return true;
 }
 

Modified: branches/print_dev/lib/point.js
===================================================================
--- branches/print_dev/lib/point.js	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/lib/point.js	2009-03-09 09:01:26 UTC (rev 3648)
@@ -119,36 +119,16 @@
 /**
  * @ignore
  */
-function mapToReal(frameName, aPoint){
-	var v;
-	if (typeof(mb_mapObj) == 'object') {
-		v = makeClickPos2RealWorldPos(frameName, aPoint.x, aPoint.y);
-	}
-	else {
-		if (typeof(parent.mb_mapObj) == 'object') {
-			v = parent.makeClickPos2RealWorldPos(frameName, aPoint.x, aPoint.y);
-		}
-		else {
-			alert('where am i?');
-		}
-	}
-	return new Point(v[0], v[1]);
+function mapToReal(frameName, aPoint) {
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].convertPixelToReal(aPoint);
 }
 /**
  * @ignore
  */
 function realToMap(frameName, aPoint) {
-	var v;
-	if (typeof(mb_mapObj) == 'object') {
-		v = makeRealWorld2mapPos(frameName, aPoint.x, aPoint.y);
-	}
-	else if (typeof(parent.mb_mapObj) == 'object') {
-		v = parent.makeRealWorld2mapPos(frameName, aPoint.x, aPoint.y);
-	}
-	else {
-		var e = new Mb_exception('Point.realToMap:where am i?');
-	}
-	return new Point(v[0], v[1]);
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].convertRealToPixel(aPoint);
 }
 /**
  * @ignore

Modified: branches/print_dev/resources/db/schema_2.5.dia
===================================================================
--- branches/print_dev/resources/db/schema_2.5.dia	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/resources/db/schema_2.5.dia	2009-03-09 09:01:26 UTC (rev 3648)
@@ -7371,13 +7371,13 @@
         <dia:point val="131,-48"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="130.95,-48.05;146.95,-40.75"/>
+        <dia:rectangle val="130.95,-48.05;147.3,-40.75"/>
       </dia:attribute>
       <dia:attribute name="elem_corner">
         <dia:point val="131,-48"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
-        <dia:real val="15.9"/>
+        <dia:real val="16.25"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
         <dia:real val="7.1999999999999993"/>
@@ -7518,7 +7518,7 @@
             <dia:string>#featuretype_name#</dia:string>
           </dia:attribute>
           <dia:attribute name="type">
-            <dia:string>#varchar(50)#</dia:string>
+            <dia:string>#varchar(255)#</dia:string>
           </dia:attribute>
           <dia:attribute name="value">
             <dia:string>#'' NOT NULL#</dia:string>
@@ -7541,7 +7541,7 @@
             <dia:string>#featuretype_title#</dia:string>
           </dia:attribute>
           <dia:attribute name="type">
-            <dia:string>#varchar(50)#</dia:string>
+            <dia:string>#varchar(255)#</dia:string>
           </dia:attribute>
           <dia:attribute name="value">
             <dia:string>##</dia:string>
@@ -7610,7 +7610,7 @@
             <dia:string>#featuretype_abstract#</dia:string>
           </dia:attribute>
           <dia:attribute name="type">
-            <dia:string>#varchar(50)#</dia:string>
+            <dia:string>#text#</dia:string>
           </dia:attribute>
           <dia:attribute name="value">
             <dia:string>##</dia:string>
@@ -7989,7 +7989,7 @@
             <dia:string>#element_name#</dia:string>
           </dia:attribute>
           <dia:attribute name="type">
-            <dia:string>#varchar(50)#</dia:string>
+            <dia:string>#varchar(255)#</dia:string>
           </dia:attribute>
           <dia:attribute name="value">
             <dia:string>##</dia:string>
@@ -8012,7 +8012,7 @@
             <dia:string>#element_type#</dia:string>
           </dia:attribute>
           <dia:attribute name="type">
-            <dia:string>#varchar(50)#</dia:string>
+            <dia:string>#varchar(255)#</dia:string>
           </dia:attribute>
           <dia:attribute name="value">
             <dia:string>##</dia:string>
@@ -8105,13 +8105,13 @@
     </dia:object>
     <dia:object type="UML - Association" version="1" id="O47">
       <dia:attribute name="obj_pos">
-        <dia:point val="146.9,-44.5"/>
+        <dia:point val="147.25,-44.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
         <dia:rectangle val="146.15,-58.45;160.75,-43.985"/>
       </dia:attribute>
       <dia:attribute name="orth_points">
-        <dia:point val="146.9,-44.5"/>
+        <dia:point val="147.25,-44.5"/>
         <dia:point val="154,-44.5"/>
         <dia:point val="154,-57.7"/>
         <dia:point val="160,-57.7"/>
@@ -14941,13 +14941,13 @@
     </dia:object>
     <dia:object type="UML - Association" version="1" id="O106">
       <dia:attribute name="obj_pos">
-        <dia:point val="146.9,-46.1"/>
+        <dia:point val="147.25,-46.1"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
         <dia:rectangle val="144.75,-62.85;159.35,-45.585"/>
       </dia:attribute>
       <dia:attribute name="orth_points">
-        <dia:point val="146.9,-46.1"/>
+        <dia:point val="147.25,-46.1"/>
         <dia:point val="151,-46.1"/>
         <dia:point val="151,-62.1"/>
         <dia:point val="145.5,-62.1"/>

Modified: branches/print_dev/resources/db/update/update_2.6.sql
===================================================================
--- branches/print_dev/resources/db/update/update_2.6.sql	2009-03-09 08:14:38 UTC (rev 3647)
+++ branches/print_dev/resources/db/update/update_2.6.sql	2009-03-09 09:01:26 UTC (rev 3648)
@@ -24,10 +24,23 @@
 INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'body', 'tablesortercss', '../css/tablesorter.css', 'file css' ,'file/css');
 
 --add all used modules for gazetteerWFS
+ALTER TABLE gui_element ALTER e_mb_mod TYPE varchar(100); 
 UPDATE gui_element SET e_mb_mod = 'geometry.js,requestGeometryConstructor.js,popup.js,../extensions/jquery.tablesorter.js' WHERE e_id = 'gazetteerWFS' AND fkey_gui_id = 'gui';
 UPDATE gui_element SET e_mb_mod = 'geometry.js,requestGeometryConstructor.js,popup.js,../extensions/jquery.tablesorter.js' WHERE e_id = 'gazetteerWFS' AND fkey_gui_id = 'gui2';
 UPDATE gui_element SET e_mb_mod = 'geometry.js,requestGeometryConstructor.js,popup.js,../extensions/jquery.tablesorter.js' WHERE e_id = 'gazetteerWFS' AND fkey_gui_id = 'gui_digitize';
 
+-- update wfs configuration Mapbender User (ID: 1) to show new functionality of gazetteerWFS
+UPDATE wfs_conf_element SET f_show_detail = 1, f_detailpos = 1, f_operator = 'rightside' WHERE wfs_conf_element_id = 2 AND fkey_wfs_conf_id = 1;
+UPDATE wfs_conf_element SET f_show_detail = 1, f_detailpos = 2, f_min_input = 1, f_operator = 'bothside' WHERE wfs_conf_element_id = 3 AND fkey_wfs_conf_id = 1; 
+UPDATE wfs_conf_element SET f_show_detail = 1, f_detailpos = 3, f_label = 'Organization:', f_label_id = 'd' WHERE wfs_conf_element_id = 5 AND fkey_wfs_conf_id = 1;
+UPDATE wfs_conf_element SET f_show_detail = 1, f_detailpos = 4, f_label = 'URL:', f_label_id = 'd', f_form_element_html = '<a href=""></a>' WHERE wfs_conf_element_id = 6 AND fkey_wfs_conf_id = 1;
+UPDATE wfs_conf_element SET f_search = 1, f_pos = 3, f_style_id = 'c', f_label_id = 'd', f_show_detail = 1, f_detailpos = 5, f_label = 'Usertype:', f_form_element_html = '<select id="usertype" name="usertype">
+<option value="">...</option>
+<option value="1">1</option>
+<option value="2">2</option>
+<option value="3">3</option>
+</select>', f_operator = 'equal' WHERE wfs_conf_element_id = 4 AND fkey_wfs_conf_id = 1;
+
 --add style class to element var text css of element digitize in gui_digitize
 UPDATE gui_element_vars SET var_value = '
 .digitizeGeometryList{
@@ -59,6 +72,9 @@
 
 UPDATE gui_element SET e_attributes = 'onload="init()"' WHERE e_id = 'body' AND fkey_gui_id IN ('admin1', 'admin2_de', 'admin2_en', 'admin_de_services', 'admin_en_services');
 
+-- new capabilities diff column for monitoring
+ALTER TABLE mb_monitor ADD COLUMN caps_diff text;
+ALTER TABLE mb_monitor ALTER COLUMN caps_diff SET DEFAULT ''::text;
 
 --
 -- scope
@@ -145,4 +161,241 @@
 UPDATE gui_element SET e_mb_mod = '../extensions/wz_jsgraphics.js,geometry.js' WHERE e_id = 'wfs';
  
 INSERT INTO translations (locale, msgid, msgstr) VALUES ('de', 'Measure distance', 'Messen'); 
+
 UPDATE gui_element SET e_attributes = 'onload="init()"' WHERE e_id = 'body' AND fkey_gui_id IN ('wms_africa', 'wms_australia', 'wms_europe', 'wms_gdi_de', 'wms_germany', 'wms_north_america', 'wms_worldwide');
+
+-- gui: tab: increase the size of the frames onmouseover
+UPDATE gui_element SET e_attributes = 'frameborder = "0" onmouseover="this.style.zIndex=33;this.style.width=350;" onmouseout="this.style.zIndex=2;this.style.width=200"',
+e_more_styles = 'visibility:hidden; border: 1px solid #a19c8f;' WHERE e_id IN ('treeGDE','printPDF','legend','imprint','meetiongPoint','gazetteerWFS') AND fkey_gui_id IN ('gui');
+
+-- gui_treegde - delete entries which are not needed
+Delete from gui_treegde where fkey_gui_id IN ('gui','gui1','gui2','gui_digitize') and my_layer_title ='new';
+
+-- new translation entries for portuguese
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Zoom out', 'Zoom -');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Back', 'Zoom previo');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Forward', 'Zoom siguiente');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Coordinates', 'Mostrar coordinadas');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Zoom by rectangle', 'Zoom retángulo');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Redraw', 'Refrescar');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Query', 'Procurar dados');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Logout', 'Terminar sessão');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'WMS preferences', 'Ajuste WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Adding WMS from filtered list', 'Adicionar WMS desde lista filtrada');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Set map center', 'Centrar');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Help', 'Ajuda');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Show WMS infos', 'Mostrar informação sobre WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Save workspace as web map context document', 'Guardar vista como arquivo Web Map Context');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Resize Mapsize', 'Modificar tamanho do mapa');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Rubber', 'Apagar');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Get Area', 'Calcular area');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Close Polygon', 'Fechar polígono');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Move back to your GUI list', 'Volver a lista WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Legend', 'Legenda');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Print', 'Imprimir');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Imprint', 'Expediente');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Maps', 'Mapas');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Search', 'Procura');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Meetingpoint', 'Lugar de reunião, ');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Metadatasearch', 'Procura metadados');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Adding WMS', 'Adicionar WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Adding WMS from List', 'Adicionar WMS desde lista');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Info', 'Informação');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Change Projection', 'Trocar projeto');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Copyright', 'Copyright');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Digitize', 'Captura');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Overview', 'Mapa de vição geral');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Drag Mapsize', 'Ampliar janela do mapa');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Mapframe', 'Janela do mapa');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Navigation Frame', 'Janela do navegação');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'scaleSelect', 'Selecionar escala');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Scale Text', 'Texto da escala');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Scalebar', 'Barra de escala');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Set Background', 'Pôr fondo');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Zoom to Coordinates', 'Zoom pra coordinadas');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Change Password', 'Trocar senha');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Load a web map context document', 'Carregar documento do Web Map Context');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Logo', 'Logo');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Measure distance', 'Medir distância');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'languaje', 'Selecionar Linguajem');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'navFrame', 'Marco de navegacion');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'dragMapSize', 'Agrandar Mapa');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Pan', 'Desplazamento');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Display complete map', 'Zoom na Extensão Total');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('pt', 'Zoom in', 'Zoom +');
+
+-- new translation entries for french
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Pan', 'Déplacer la sélection');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Display complete map', 'Afficher toute la carte');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Zoom in', 'Zoomer');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Zoom out', 'Dézoomer');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Back', 'Précédent');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Forward', 'Suivant');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Coordinates', 'Afficher les coordonnées');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Zoom by rectangle', 'Zoomer sur la sélection');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Redraw', 'Actualiser [Espace]');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Query', 'Interroger la base de données');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Logout', 'Déconnexion');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'WMS preferences', 'Configuration du WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Adding WMS from filtered list', 'Ajouter un WMS de la liste filtrée');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Set map center', 'Définir le centre de la carte');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Help', 'Aide');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Show WMS infos', 'Affichage des informations du WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Save workspace as web map context document', 'Sauvegarder la vue/l''espace de travail en tant que Web Map Context');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Resize Mapsize', 'Redimensionner la taille de la carte');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Rubber', 'Gomme');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Get Area', 'Calculer la superficie');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Close Polygon', 'Fermer le polygone');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Move back to your GUI list', 'Retour à votre liste GUI');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Legend', 'Légende');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Print', 'Imprimer');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Imprint', 'Envoyer / Imprint');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Maps', 'Cartes');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Search', 'Recherche');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Meetingpoint', 'Point de rencontre');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Metadatasearch', 'Recherche des métadonnées');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Adding WMS', 'Ajouter WMS');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Adding WMS from List', 'Ajouter WMS depuis la liste');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Info', 'Info');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Change Projection', 'Changer la projection');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Copyright', 'Copyright');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Digitize', 'Numériser');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Overview', 'Carte d''aperçu');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Drag Mapsize', 'Modifier la taille de la carte');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Mapframe', 'Fenêtre de la carte');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Navigation Frame', 'Fenêtre de navigation');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Scale Select', 'Sélection de l ''échelle');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Scale Text', 'Texte de l''échelle');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Scalebar', 'Echelle graphique');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Set Background', 'Sélectionner la carte d''arrière-plan');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Zoom to Coordinates', 'Zoomer aux coordonnées');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Change Password', 'Changer le mot de passe');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Load a web map context document', 'Charger un fichier Web Map Context');
+INSERT INTO translations (locale, msgid, msgstr) VALUES ('fr', 'Logo', 'Logo');
+
+-- entries espaniol
+Update translations set msgstr='Seleccionar Idioma' where locale= 'es' and msgid = 'Set language';
+Update translations set msgstr='Agrandar Mapa' where locale= 'es' and msgid = 'dragMapSize';
+Update translations set msgstr='Marco de navegacion' where locale= 'es' and msgid = 'navFrame';
+Update translations set msgstr='Escala de texto' where locale= 'es' and msgid = 'Scale Text';
+Update translations set msgstr='Barra de escala' where locale= 'es' and msgid = 'Scalebar';
+Update translations set msgstr='Referencia' where locale= 'es' and msgid = 'Legend';
+Update translations set msgstr='Mostrar mapa completo' where locale= 'es' and msgid = 'Display complete map';
+
+UPDATE gui_element SET e_mb_mod = 'geometry.js,requestGeometryConstructor.js,popup.js' WHERE e_id = 'setSpatialRequest'; 
+
+--
+-- building categories to sort the guis in the login.php
+-- have a look at http://www.mapbender.org/GUI_Category
+--
+
+-- new tables for category handling 
+CREATE TABLE public.gui_gui_category
+(
+  fkey_gui_id character varying(50),
+  fkey_gui_category_id integer
+);
+
+
+CREATE TABLE public.gui_category
+(
+  category_id serial,
+  category_name character varying(50),
+  category_description character varying(255),
+  CONSTRAINT pk_category_id PRIMARY KEY (category_id)
+);
+
+ALTER TABLE ONLY gui_gui_category
+    ADD CONSTRAINT gui_gui_category_ibfk_2 FOREIGN KEY (fkey_gui_id) REFERENCES gui(gui_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+ALTER TABLE ONLY gui_gui_category
+    ADD CONSTRAINT gui_gui_category_ibfk_1 FOREIGN KEY (fkey_gui_category_id) REFERENCES gui_category(category_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+INSERT INTO gui_category (category_id, category_name, category_description) VALUES (1, 'Administration', 'Applications for administration');
+INSERT INTO gui_category (category_id, category_name, category_description) VALUES (3, 'WMS Container', NULL);
+INSERT INTO gui_category (category_id, category_name, category_description) VALUES (2, 'Mapbender Template Applications', 'Template Applications');
+
+INSERT INTO gui_gui_category VALUES ('admin1',1);
+INSERT INTO gui_gui_category VALUES('admin2_de',1);
+INSERT INTO gui_gui_category VALUES('admin2_en',1);
+INSERT INTO gui_gui_category VALUES('admin_de_services',1);
+INSERT INTO gui_gui_category VALUES('admin_en_services',1);
+INSERT INTO gui_gui_category VALUES ('gui',2);
+INSERT INTO gui_gui_category VALUES('gui1',2);
+INSERT INTO gui_gui_category VALUES('gui2',2);
+INSERT INTO gui_gui_category VALUES('gui_digitize',2);
+INSERT INTO gui_gui_category VALUES('wms_gdi_de',3);
+INSERT INTO gui_gui_category VALUES('wms_germany',3);
+INSERT INTO gui_gui_category VALUES('wms_europe',3);
+
+SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('gui_category', 'category_id'), (Select max(category_id) from gui_category), true);
+
+-- admin2_de - create a new category
+INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('admin2_de','createCategory',2,1,'create a gui category','Create a new category','a','','href = "../php/mod_createCategory.php?sessionID" target = "AdminFrame" ',8,680,140,20,5,'','create a gui category','a','','','','AdminFrame','http://www.mapbender.org/GUI_Category');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('admin2_de', 'createCategory', 'cssfile', '../css/administration_alloc.css', '' ,'file/css');
+
+-- admin2_de - add a gui to a category, remove it from a category
+INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('admin2_de','category_filteredGUI',2,1,'add Gui to Category','Add one user to serveral groups','a','','href = "../php/mod_category_filteredGUI.php?sessionID&e_id_css=filteredUser_filteredGroup" target = "AdminFrame" ',8,710,190,20,10,'','add Gui to Category','a','','','','AdminFrame','http://www.mapbender.org/GUI_Category');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('admin2_de', 'category_filteredGUI', 'cssfile', '../css/administration_alloc.css', 'css file for admin module' ,'file/css');
+
+-- remove module addWMSfromfilteredList_ajax from every standard gui and set it new with new parameters and new element vars
+DELETE FROM gui_element WHERE fkey_gui_id = 'gui' and e_id = 'addWMSfromfilteredList_ajax';
+INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('gui','addWMSfromfilteredList_ajax',2,1,'add a WMS to the running application from a filtered list','Adding WMS from filtered list','img','../img/button_gray/add_filtered_list_off.png','onclick=''var addWmsFromFilteredListPopup = new mb_popup({title:"Add WMS from filtered list",url:"../javascripts/mod_addWMSfromfilteredList_ajax.php?sessionID",width:720, height:600,left:20, top:20});addWmsFromFilteredListPopup.show()''  onmouseover=''this.src = this.src.replace(/_off/,"_over");''  onmouseout=''this.src = this.src.replace(/_over/, "_off");'' title="Adding WMS from filtered list"',490,10,24,24,1,'','','','','mod_addWMSgeneralFunctions.js,popup.js','treeGDE,mapframe1','loadData','http://www.mapbender.org/index.php/Add_WMS_from_filtered_list');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'addWMSfromfilteredList_ajax', 'cssfileAddWMS', '../css/addwms.css', '' ,'file/css');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'addWMSfromfilteredList_ajax', 'capabilitiesInput', '1', 'load wms by capabilities url' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'addWMSfromfilteredList_ajax', 'option_all', '1', '1 enables option "load all configured wms from db"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'addWMSfromfilteredList_ajax', 'option_group', '1', '1 enables option "load configured wms by group"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'addWMSfromfilteredList_ajax', 'option_gui', '1', '1 enables option "load configured wms by gui"' ,'var');
+
+DELETE FROM gui_element WHERE fkey_gui_id = 'gui1' and e_id = 'addWMSfromfilteredList_ajax';
+INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('gui1','addWMSfromfilteredList_ajax',2,1,'add a WMS to the running application from a filtered list','Adding WMS from filtered list','img','../img/button_gray/add_filtered_list_off.png','onclick=''var addWmsFromFilteredListPopup = new mb_popup({title:"Add WMS from filtered list",url:"../javascripts/mod_addWMSfromfilteredList_ajax.php?sessionID",width:720, height:600,left:20, top:20});addWmsFromFilteredListPopup.show()''  onmouseover=''this.src = this.src.replace(/_off/,"_over");''  onmouseout=''this.src = this.src.replace(/_over/, "_off");'' title="Adding WMS from filtered list"',620,60,24,24,1,'','','','','mod_addWMSgeneralFunctions.js,popup.js','treeGDE,mapframe1','loadData','http://www.mapbender.org/index.php/Add_WMS_from_filtered_list');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'addWMSfromfilteredList_ajax', 'cssfileAddWMS', '../css/addwms.css', '' ,'file/css');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'addWMSfromfilteredList_ajax', 'capabilitiesInput', '1', 'load wms by capabilities url' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'addWMSfromfilteredList_ajax', 'option_all', '1', '1 enables option "load all configured wms from db"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'addWMSfromfilteredList_ajax', 'option_group', '0', '1 enables option "load configured wms by group"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'addWMSfromfilteredList_ajax', 'option_gui', '0', '1 enables option "load configured wms by gui"' ,'var');
+
+DELETE FROM gui_element WHERE fkey_gui_id = 'gui_digitize' and e_id = 'addWMSfromfilteredList_ajax';
+INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('gui_digitize','addWMSfromfilteredList_ajax',2,1,'add a WMS to the running application from a filtered list','Adding WMS from filtered list','img','../img/button_gray/add_filtered_list_off.png','onclick=''var addWmsFromFilteredListPopup = new mb_popup({title:"Add WMS from filtered list",url:"../javascripts/mod_addWMSfromfilteredList_ajax.php?sessionID",width:720, height:600,left:20, top:20});addWmsFromFilteredListPopup.show()''  onmouseover=''this.src = this.src.replace(/_off/,"_over");''  onmouseout=''this.src = this.src.replace(/_over/, "_off");'' title="Adding WMS from filtered list"',490,10,24,24,1,'','','','','mod_addWMSgeneralFunctions.js,popup.js','treeGDE,mapframe1','loadData','http://www.mapbender.org/index.php/Add_WMS_from_filtered_list');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'addWMSfromfilteredList_ajax', 'cssfileAddWMS', '../css/addwms.css', '' ,'file/css');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'addWMSfromfilteredList_ajax', 'capabilitiesInput', '1', 'load wms by capabilities url' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'addWMSfromfilteredList_ajax', 'option_all', '1', '1 enables option "load all configured wms from db"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'addWMSfromfilteredList_ajax', 'option_group', '0', '1 enables option "load configured wms by group"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'addWMSfromfilteredList_ajax', 'option_gui', '0', '1 enables option "load configured wms by gui"' ,'var');
+
+DELETE FROM gui_element WHERE fkey_gui_id = 'gui2' and e_id = 'addWMSfromfilteredList_ajax';
+INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('gui2','addWMSfromfilteredList_ajax',2,1,'add a WMS to the running application from a filtered list','Adding WMS from filtered list','img','../img/button_blue/add_filtered_list_off.png','onclick=''var addWmsFromFilteredListPopup = new mb_popup({title:"Add WMS from filtered list",url:"../javascripts/mod_addWMSfromfilteredList_ajax.php?sessionID",width:720, height:600,left:20, top:20});addWmsFromFilteredListPopup.show()''  onmouseover=''this.src = this.src.replace(/_off/,"_over");''  onmouseout=''this.src = this.src.replace(/_over/, "_off");'' title="Adding WMS from filtered list"',556,40,28,28,1,'','','','','mod_addWMSgeneralFunctions.js,popup.js','treeGDE,mapframe1','loadData','http://www.mapbender.org/index.php/Add_WMS_from_filtered_list');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'addWMSfromfilteredList_ajax', 'cssfileAddWMS', '../css/addwms.css', '' ,'file/css');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'addWMSfromfilteredList_ajax', 'capabilitiesInput', '1', 'load wms by capabilities url' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'addWMSfromfilteredList_ajax', 'option_all', '1', '1 enables option "load all configured wms from db"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'addWMSfromfilteredList_ajax', 'option_group', '0', '1 enables option "load configured wms by group"' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'addWMSfromfilteredList_ajax', 'option_gui', '0', '1 enables option "load configured wms by gui"' ,'var');
+
+-- set popup.js as required module for gui element loadwmc
+UPDATE gui_element SET e_mb_mod = 'popup.js' WHERE e_id = 'loadwmc';
+
+-- set popup.js as required module for gui element featureInfoTunnel
+UPDATE gui_element SET e_mb_mod = 'popup.js' WHERE e_id = 'featureInfoTunnel';
+
+-- set standard element vars for possibility to use popup in featureInfoTunnel; activated for gui_digitize
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'featureInfoTunnel', 'featureInfoLayerPopup', 'false', '' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'featureInfoTunnel', 'featureInfoPopupHeight', '200', '' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'featureInfoTunnel', 'featureInfoPopupWidth', '270', '' ,'var');
+
+-- featureInfoTunnel is not part of gui1
+--INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'featureInfoTunnel', 'featureInfoLayerPopup', 'false', '' ,'var');--INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'featureInfoTunnel', 'featureInfoPopupHeight', '200', '' ,'var');
+--INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'featureInfoTunnel', 'featureInfoPopupWidth', '270', '' ,'var');
+
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'featureInfoTunnel', 'featureInfoLayerPopup', 'true', '' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'featureInfoTunnel', 'featureInfoPopupHeight', '200', '' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui2', 'featureInfoTunnel', 'featureInfoPopupWidth', '270', '' ,'var');
+
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'featureInfoTunnel', 'featureInfoLayerPopup', 'false', '' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'featureInfoTunnel', 'featureInfoPopupHeight', '200', '' ,'var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui_digitize', 'featureInfoTunnel', 'featureInfoPopupWidth', '270', '' ,'var');
+
+
+-- increase size 
+ALTER TABLE gui_element ALTER e_js_file TYPE varchar(255);
+ALTER TABLE gui_element ALTER  e_mb_mod  TYPE varchar(255);
+ALTER TABLE gui_element ALTER  e_requires  TYPE varchar(255);



More information about the Mapbender_commits mailing list