[Mapbender-commits] r3436 - in branches/print_dev: core http http/classes http/css http/html http/include http/javascripts http/php http/print http/sld http/tools lib resources/db/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jan 13 08:32:46 EST 2009


Author: mschulz
Date: 2009-01-13 08:32:45 -0500 (Tue, 13 Jan 2009)
New Revision: 3436

Added:
   branches/print_dev/http/html/mod_treefolderPlain.php
   branches/print_dev/http/include/gui1_splash.php
   branches/print_dev/http/javascripts/mapnf.php
   branches/print_dev/http/javascripts/mod_changeEPSG.php
   branches/print_dev/http/javascripts/ovnf.php
   branches/print_dev/http/javascripts/wfs.php
   branches/print_dev/http/php/mod_changeEPSG_server.php
   branches/print_dev/lib/ajax.php
Modified:
   branches/print_dev/core/globalSettings.php
   branches/print_dev/core/system.php
   branches/print_dev/http/classes/class_administration.php
   branches/print_dev/http/classes/class_bbox.php
   branches/print_dev/http/classes/class_element.php
   branches/print_dev/http/classes/class_gml2.php
   branches/print_dev/http/classes/class_json.php
   branches/print_dev/http/classes/class_locale.php
   branches/print_dev/http/classes/class_map.php
   branches/print_dev/http/classes/class_point.php
   branches/print_dev/http/classes/class_stripRequest.php
   branches/print_dev/http/classes/class_wfs_conf.php
   branches/print_dev/http/classes/class_wmc.php
   branches/print_dev/http/classes/class_wmcToXml.php
   branches/print_dev/http/classes/class_wms.php
   branches/print_dev/http/css/treeGDE2.css
   branches/print_dev/http/html/mod_treefolder2.php
   branches/print_dev/http/include/dyn_js.php
   branches/print_dev/http/index.php
   branches/print_dev/http/javascripts/geometry.js
   branches/print_dev/http/javascripts/jsTree.js
   branches/print_dev/http/javascripts/map.js
   branches/print_dev/http/javascripts/map.php
   branches/print_dev/http/javascripts/map_obj.js
   branches/print_dev/http/javascripts/mod_adminNavigation.js
   branches/print_dev/http/javascripts/mod_back.php
   branches/print_dev/http/javascripts/mod_box1.js
   branches/print_dev/http/javascripts/mod_center1.php
   branches/print_dev/http/javascripts/mod_coords.php
   branches/print_dev/http/javascripts/mod_coords_div.php
   branches/print_dev/http/javascripts/mod_copyright.php
   branches/print_dev/http/javascripts/mod_dependentDiv.php
   branches/print_dev/http/javascripts/mod_digitize_tab.php
   branches/print_dev/http/javascripts/mod_dragMapSize.php
   branches/print_dev/http/javascripts/mod_featureInfo.php
   branches/print_dev/http/javascripts/mod_featureInfoRedirect.php
   branches/print_dev/http/javascripts/mod_featureInfoTunnel.php
   branches/print_dev/http/javascripts/mod_forward.php
   branches/print_dev/http/javascripts/mod_help.php
   branches/print_dev/http/javascripts/mod_highlightPOI.php
   branches/print_dev/http/javascripts/mod_initWmc.php
   branches/print_dev/http/javascripts/mod_loadwmc.js
   branches/print_dev/http/javascripts/mod_loadwmc.php
   branches/print_dev/http/javascripts/mod_measure.php
   branches/print_dev/http/javascripts/mod_navFrame.php
   branches/print_dev/http/javascripts/mod_pan.php
   branches/print_dev/http/javascripts/mod_resize_mapsize.php
   branches/print_dev/http/javascripts/mod_sandclock.php
   branches/print_dev/http/javascripts/mod_saveWKT.js
   branches/print_dev/http/javascripts/mod_savewmc.php
   branches/print_dev/http/javascripts/mod_scaleHint.php
   branches/print_dev/http/javascripts/mod_scaleSel.php
   branches/print_dev/http/javascripts/mod_scalebar.php
   branches/print_dev/http/javascripts/mod_selArea1.php
   branches/print_dev/http/javascripts/mod_setBBOX1.php
   branches/print_dev/http/javascripts/mod_setBackground.php
   branches/print_dev/http/javascripts/mod_setPOI2Scale.php
   branches/print_dev/http/javascripts/mod_switchLocale_noreload.php
   branches/print_dev/http/javascripts/mod_tab.js
   branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php
   branches/print_dev/http/javascripts/mod_zoomCoords.php
   branches/print_dev/http/javascripts/mod_zoomFull.php
   branches/print_dev/http/javascripts/mod_zoomIn1.php
   branches/print_dev/http/javascripts/mod_zoomOut1.php
   branches/print_dev/http/javascripts/wms.js
   branches/print_dev/http/php/mb_listGUIs.php
   branches/print_dev/http/php/mod_button_tooltips.php
   branches/print_dev/http/php/mod_editGuiWms.php
   branches/print_dev/http/php/mod_editUser.php
   branches/print_dev/http/php/mod_forgottenPassword.php
   branches/print_dev/http/php/mod_map1.php
   branches/print_dev/http/php/mod_mapOV.php
   branches/print_dev/http/php/mod_savewmc_server.php
   branches/print_dev/http/php/mod_treefolderClient.php
   branches/print_dev/http/php/mod_wfs_result.php
   branches/print_dev/http/php/mod_zoomCoords.php
   branches/print_dev/http/print/mod_printPDF.php
   branches/print_dev/http/print/mod_printPDF_pdf.php
   branches/print_dev/http/sld/sld_function_getusersld.php
   branches/print_dev/http/tools/mapbender_setup.php
   branches/print_dev/lib/ajax.js
   branches/print_dev/lib/basic.js
   branches/print_dev/lib/button.js
   branches/print_dev/lib/buttonNew.js
   branches/print_dev/lib/core.js
   branches/print_dev/lib/event.js
   branches/print_dev/lib/exception.js
   branches/print_dev/resources/db/update/update_2.6.sql
Log:
merged from trunk

Modified: branches/print_dev/core/globalSettings.php
===================================================================
--- branches/print_dev/core/globalSettings.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/core/globalSettings.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -68,4 +68,10 @@
 // Do not display PHP errors
 //
 ini_set("display_errors", "0");
+
+//
+// AJAX wrapper
+//
+require_once(dirname(__FILE__)."/../lib/ajax.php");
+
 ?>

Modified: branches/print_dev/core/system.php
===================================================================
--- branches/print_dev/core/system.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/core/system.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -35,3 +35,5 @@
 define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
 
 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");

Modified: branches/print_dev/http/classes/class_administration.php
===================================================================
--- branches/print_dev/http/classes/class_administration.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_administration.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -585,6 +585,83 @@
 		}
 	}
 
+	function getAllFilteredUsers($owner) {
+		$allUsers = array();
+		$sql = "SELECT mb_user_id,mb_user_name,mb_user_email FROM mb_user ";
+		$sql .= " WHERE mb_user_owner = $1 ORDER BY mb_user_name ";
+		$v = array($owner);
+		$t = array('i'); 
+		$res = db_prep_query($sql, $v, $t);
+		while ($row = db_fetch_array($res)) {
+			array_push($allUsers, array("mb_user_id" => $row["mb_user_id"], "mb_user_name" => $row["mb_user_name"], "mb_user_email" => $row["mb_user_email"]));
+		}
+		$json = new Mapbender_JSON();
+		$output = $json->encode($allUsers);
+
+		header("Content-type:text/plain; charset=utf-8");
+		return $output;
+	}
+
+	function getAllUserColumns($userId) {
+		$userArray = array();
+		$sql = "SELECT * FROM mb_user WHERE mb_user_id = $1";
+		$v = array($userId); 
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		while ($row = db_fetch_array($res)) {
+			foreach ($row as $key => $value){
+				if (is_int($key)==false) {
+					array_push($userArray, array("id" => $key, "value" => $value));
+				}
+			}
+		}
+		$json = new Mapbender_JSON();
+		$output = $json->encode($userArray);
+
+		header("Content-type:text/plain; charset=utf-8");
+		return $output;
+	}
+
+	/**
+	 * Returns an array of column names and fieldtype for a table.
+	 * 
+	 */
+	function getTableColumns($table) {
+		$sql = "SELECT * FROM $table LIMIT 1";
+		$columnArray = array();
+
+		$v = array(); 
+		$t = array();
+		$res = db_prep_query($sql,$v,$t);
+
+		$i = 0;
+		while ($i < db_num_fields($res)) {
+			if(db_field_type($res, $i)=="varchar") {
+				$fieldType = "s";
+			}
+			else {
+				$fieldType = "i";
+			}
+			$columnArray[db_fieldname($res, $i)] = $fieldType;
+			$i++;
+		}
+
+		return $columnArray;
+	}
+
+	function deleteTableRecord($table,$keyField,$keyFieldValue) {
+		$sql = "DELETE FROM $table WHERE $keyField = $1";
+		$v = array($keyFieldValue); 
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		if (!$res) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
 	function getUserIdByUserName($username){
 		$sql = "SELECT mb_user_id FROM mb_user ";
 		$sql .= "WHERE mb_user_name = $1 GROUP BY mb_user_id";

Modified: branches/print_dev/http/classes/class_bbox.php
===================================================================
--- branches/print_dev/http/classes/class_bbox.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_bbox.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -31,7 +31,23 @@
 	/**
 	 * @constructor
 	 */
-	function __construct($param0, $param1, $param2, $param3, $param4) {
+	function __construct() {
+		if (func_num_args() == 5) {
+			$param0 = func_get_arg(0);
+			$param1 = func_get_arg(1);
+			$param2 = func_get_arg(2);
+			$param3 = func_get_arg(3);
+			$param4 = func_get_arg(4);
+		}
+		else if (func_num_args() == 3) {
+			$param0 = func_get_arg(0);
+			$param1 = func_get_arg(1);
+			$param2 = func_get_arg(2);
+		}
+		else {
+			return;
+		}
+		
 		// params are point, point, epsg
 		if (is_a($param0, "Mapbender_point") && is_a($param1, "Mapbender_point") && !$param3 && !$param4) {
 			$e = new mb_notice("Mapbender_bbox: constructor: point1, point2, epsg");

Modified: branches/print_dev/http/classes/class_element.php
===================================================================
--- branches/print_dev/http/classes/class_element.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_element.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -45,6 +45,7 @@
 	var $target;
 	var $requires;
 	var $helpUrl;
+	var $isBodyAndUsesSplashScreen = false;
 	
 	public function __contruct() {
 		
@@ -126,7 +127,7 @@
 
 	private function getHtmlOpenTag () {
 		$openTag = "";
-		
+	
 		if ($this->id) {
 			// tag name
 			$openTag .= "<" . $this->element . " ";
@@ -184,17 +185,37 @@
 			}
 			$openTag .= "'>";
 
-			if ($this->element == "body" && USE_LOAD_MESSAGE) {
-				$htmlWhileLoading = "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-					"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-					MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-					"loading application '" . $this->guiId . "'";
+			if ($this->element == "body") {
+				$e_id = "body";
+				$gui_id = $this->guiId;
+				include(dirname(__FILE__)."/../include/dyn_php.php");
+				
+				$splashScreen = "";
+				
+				if ($use_load_message) {
+					$this->isBodyAndUsesSplashScreen = true;
+					if (isset($htmlWhileLoading) && $htmlWhileLoading != '') {
+						$splashScreen .= $htmlWhileLoading; 
+					} elseif (isset($includeWhileLoading) && $includeWhileLoading != '' && file_exists(dirname(__FILE__)."/".$includeWhileLoading)) { 
+						ob_start();
+						include(dirname(__FILE__)."/".$includeWhileLoading);
+						$splashScreen .= ob_get_contents();
+						ob_end_clean();
+					}
+				}
+				else {
+					$splashScreen .= "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
+						"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
+						MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
+						"loading application '" . $this->guiId . "'";
+				}
 	
 				$openTag .= "<div id='loading_mapbender' " .
-								"style='position:absolute;top:100;left:100'>" . 
-								$htmlWhileLoading . "</div>" . 
+								"style='margin:0px;padding:0px;width:100%;height:100%;'>" . 
+								$splashScreen . "</div>" . 
 								"<div id='complete_mapbender' " .
 								"style='display:none'>";
+				unset ($e_id, $gui_id);
 			}
 		}
 		return $openTag;
@@ -209,7 +230,7 @@
 	}
 	
 	private function getHtmlCloseTag () {
-		if ($this->element == "body" && USE_LOAD_MESSAGE) {
+		if ($this->element == "body" && $this->isBodyAndUsesSplashScreen) {
 			return "</div></body>";
 		}
 		if ($this->closeTag != "") {

Modified: branches/print_dev/http/classes/class_gml2.php
===================================================================
--- branches/print_dev/http/classes/class_gml2.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_gml2.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -16,11 +16,11 @@
 # 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__)."/../../core/globalSettings.php");
-
-require_once(dirname(__FILE__)."/../classes/class_connector.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
 class gml2 {
 	var $geomtype_point = 'Point';					
 	var $geomtype_polygon = 'Polygon';
@@ -35,6 +35,7 @@
 	var $geometry = array();
 	var $bbox = array();
 	var $doc;
+	var $geomFeaturetypeElement = null;
 	
 	
 	function gml2(){
@@ -55,8 +56,10 @@
 	}
 	
 	function parseXML($data) {
-		
-		$this->doc = $data;
+		if (func_num_args() == 2) {
+			$this->geomFeaturetypeElement = func_get_arg(1);
+		}
+		$this->doc = $this->removeWhiteSpace($data);
 		return $this->toGeoJSON();
 	}
 
@@ -78,6 +81,7 @@
 		$gmlDoc = new SimpleXMLElement($this->doc);
 		
 		$gmlDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls');
+		$gmlDoc->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs');
 		$gmlDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 		
 		// build feature collection
@@ -92,7 +96,12 @@
 				$featureMember_dom = dom_import_simplexml($gmlFeatureMember);
 				
 				$feature = new Feature();
-				$feature->parse($featureMember_dom);
+				if ($this->geomFeaturetypeElement != null) {
+					$feature->parse($featureMember_dom, $this->geomFeaturetypeElement);
+				}
+				else {
+					$feature->parse($featureMember_dom);
+				}
 				if (isset($feature->geometry)) {
 					$featureCollection->addFeature($feature);
 				}
@@ -102,7 +111,7 @@
 			return $featureCollection->toGeoJSON();
 		}
 		else{
-			return "{'errorMessage':'Kein Ergebnis'}";
+			return "{}";
 		}
 	}
 
@@ -197,7 +206,7 @@
 		xml_parser_free($parser);
 		
 		foreach ($values as $element) {
-			#$e = new mb_exception($element[tag]);
+			#$e = new mb_exception($element[tag]);
 			if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("boundedBy") && $element[type] == "open"){
 				$boundedBy = true;
 			}
@@ -359,10 +368,10 @@
 		elseif ($this->getGeometryTypeFromMember($i) == $this->geomtype_polygon || $this->getGeometryTypeFromMember($i) == $this->geomtype_multipolygon) {
 			$js .= "var current_geomtype = ".$prefix."geomType.polygon;\n";
 		}
-		else{
-			$e = new mb_notice("unknown geometry type: '".$this->getGeometryTypeFromMember($i)."' or no geometry existing");
-			return "";
-		}	
+		else{
+			$e = new mb_notice("unknown geometry type: '".$this->getGeometryTypeFromMember($i)."' or no geometry existing");
+			return "";
+		}	
 		
 		$js .= "var q = new ".$prefix."MultiGeometry(current_geomtype);\n";
 		
@@ -421,6 +430,7 @@
 	var $fid;
 	var $geometry = false;
 	var $properties = array();
+	var $geomFeaturetypeElement = null;
 	
 	public function __construct() {
 	}
@@ -431,50 +441,54 @@
 		return $nodeName;
 	}
 	
-	/**
-	 * Parses the feature segment of a GML and stores the geometry in the
-	 * $geometry variable of the class.
-	 * 	
-	 * Example of a feature segment of a GML. 
-	 * 	<gml:featureMember>
-	 * 		<ms:ROUTE fid="ROUTE.228168">
-	 * 			<gml:boundedBy>
-	 * 				<gml:Box srsName="EPSG:31466">
-	 * 					<gml:coordinates>2557381.0,5562371.1 2557653.7,5562526.0</gml:coordinates>
-	 * 				</gml:Box>
-	 * 			</gml:boundedBy>
-	 * 			<ms:geometry>
-	 * 				<gml:LineString>
-	 * 					<gml:coordinates>
-	 * 						2557380.97,5562526 2557390.96,
-	 * 						5562523.22 2557404.03,5562518.2 2557422.31,
-	 * 						5562512 2557437.16,5562508.37 2557441.79,
-	 * 						5562507.49 2557454.31,5562505.1 2557464.27,
-	 * 						5562503.97 2557473.24,5562502.97 2557491.67,
-	 * 						5562502.12 2557505.65,5562502.43 2557513.78,
-	 * 						5562501.12 2557520.89,5562498.79 2557528.5,
-	 * 						5562495.07 2557538.9,5562488.91 2557549.5,
-	 * 						5562483.83 2557558.55,5562476.61 2557569.07,
-	 * 						5562469.82 2557576.61,5562462.72 2557582.75,
-	 * 						5562457.92 2557588.57,5562452.56 2557590.38,
-	 * 						5562449.69 2557593.57,5562445.07 2557596.17,
-	 * 						5562441.31 2557601.71,5562433.93 2557612.97,
-	 * 						5562421.03 2557626,5562405.33 2557639.66,
-	 * 						5562389.75 2557653.69,5562371.12 
-	 * 					</gml:coordinates>
-	 * 				</gml:LineString>
-	 * 			</ms:geometry>
-	 * 			<code>354</code>
-	 * 			<Verkehr>0</Verkehr>
-	 * 			<rlp>t</rlp>
-	 * 		</ms:ROUTE>
-	 * 	</gml:featureMember>
-	 * 
-	 * @return void
-	 * @param $domNode DOMNodeObject the feature tag of the GML 
-	 * 								(<gml:featureMember> in the above example)
-	 */
+	/**
+	 * Parses the feature segment of a GML and stores the geometry in the
+	 * $geometry variable of the class.
+	 * 	
+	 * Example of a feature segment of a GML. 
+	 * 	<gml:featureMember>
+	 * 		<ms:ROUTE fid="ROUTE.228168">
+	 * 			<gml:boundedBy>
+	 * 				<gml:Box srsName="EPSG:31466">
+	 * 					<gml:coordinates>2557381.0,5562371.1 2557653.7,5562526.0</gml:coordinates>
+	 * 				</gml:Box>
+	 * 			</gml:boundedBy>
+	 * 			<ms:geometry>
+	 * 				<gml:LineString>
+	 * 					<gml:coordinates>
+	 * 						2557380.97,5562526 2557390.96,
+	 * 						5562523.22 2557404.03,5562518.2 2557422.31,
+	 * 						5562512 2557437.16,5562508.37 2557441.79,
+	 * 						5562507.49 2557454.31,5562505.1 2557464.27,
+	 * 						5562503.97 2557473.24,5562502.97 2557491.67,
+	 * 						5562502.12 2557505.65,5562502.43 2557513.78,
+	 * 						5562501.12 2557520.89,5562498.79 2557528.5,
+	 * 						5562495.07 2557538.9,5562488.91 2557549.5,
+	 * 						5562483.83 2557558.55,5562476.61 2557569.07,
+	 * 						5562469.82 2557576.61,5562462.72 2557582.75,
+	 * 						5562457.92 2557588.57,5562452.56 2557590.38,
+	 * 						5562449.69 2557593.57,5562445.07 2557596.17,
+	 * 						5562441.31 2557601.71,5562433.93 2557612.97,
+	 * 						5562421.03 2557626,5562405.33 2557639.66,
+	 * 						5562389.75 2557653.69,5562371.12 
+	 * 					</gml:coordinates>
+	 * 				</gml:LineString>
+	 * 			</ms:geometry>
+	 * 			<code>354</code>
+	 * 			<Verkehr>0</Verkehr>
+	 * 			<rlp>t</rlp>
+	 * 		</ms:ROUTE>
+	 * 	</gml:featureMember>
+	 * 
+	 * @return void
+	 * @param $domNode DOMNodeObject the feature tag of the GML 
+	 * 								(<gml:featureMember> in the above example)
+	 */
 	public function parse($domNode) {
+		if (func_num_args() == 2) {
+			$this->geomFeaturetypeElement = func_get_arg(1);
+		}
+
 		$currentSibling = $domNode->firstChild;
 		
 		$this->fid = $currentSibling->getAttribute("fid");
@@ -489,13 +503,14 @@
 			$namespace = $this->sepNameSpace($name);
 			$ns = $namespace['ns'];
 			$columnName = $namespace['value'];
+			$isGeomColumn = ($this->geomFeaturetypeElement == null || $columnName == $this->geomFeaturetypeElement);
 			
-			// check if this node is a geometry node.
-			// however, even if it is a property node, 
-			// it has a child node, the text node!
-			// So we might need to do something more 
-			// sophisticated here...
-			if ($currentSibling->hasChildNodes()){
+			// check if this node is a geometry node.
+			// however, even if it is a property node, 
+			// it has a child node, the text node!
+			// So we might need to do something more 
+			// sophisticated here...
+			if ($currentSibling->hasChildNodes() && $isGeomColumn){
 				$geomNode = $currentSibling->firstChild; 
 					$geomType = $geomNode->nodeName;
 					switch ($geomType) {
@@ -522,12 +537,12 @@
 						case "gml:Envelope" :
 							$this->geometry = new GMLEnvelope();
 							$this->geometry->parseEnvelope($geomNode);
-						default:
-							$this->properties[$columnName] = $value;
-							break;
+						default:
+							$this->properties[$columnName] = $value;
+							break;
 					}
-			} 
-			else {
+			} 
+			else {
 					$this->properties[$columnName] = $value;
 			}
 			
@@ -555,7 +570,7 @@
 				$cnt ++;
 		}
 
-		$json = new Mapbender_JSON();
+		$json = new Mapbender_JSON();
 		$str .= $json->encode($prop); 
 		$str .= "}";
 		
@@ -646,6 +661,7 @@
 class GMLPolygon {
 
 	var $pointArray = array();
+	var $innerRingArray = array();
 
 	public function __construct() {
 		
@@ -675,13 +691,38 @@
 			$cnt++;
 		}
 		
+		$innerRingNodeArray = $simpleXMLNode->xpath("gml:innerBoundaryIs/gml:LinearRing");
+		if ($innerRingNodeArray) {
+			$ringCount = 0;
+			foreach ($innerRingNodeArray as $ringNode) {
+				$coordinates = $ringNode->xpath("gml:coordinates");
+				foreach ($coordinates as $coordinate) {
+					$coordsDom = dom_import_simplexml($coordinate);
+						
+					foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
 		
+						list($x,$y,$z) = explode(',',$pointCoords);
+						$this->addPointToRing($ringCount, $x, $y);
+					}
+				}
+				$ringCount++;
+			}
+		}
 	}
 	
 	protected function addPoint ($x, $y) {
 		array_push($this->pointArray, array("x" => $x, "y" => $y));
 	}
 	
+	protected function addPointToRing ($i, $x, $y) {
+		if (count($this->innerRingArray) <= $i) {
+			array_push($this->innerRingArray, array());
+		}
+		$index = count($this->innerRingIndex);
+		$currentIndex = ($i < $index ? $i : $index);
+		array_push($this->innerRingArray[$currentIndex], array("x" => $x, "y" => $y));
+	}
+	
 	public function toGeoJSON () {
 		$numberOfPoints = count($this->pointArray);
 		$str = "";
@@ -693,7 +734,19 @@
 				}
 				$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
 			}
-			$str .= "]]}";
+			$str .= "]";
+			
+			for ($i=0; $i < count($this->innerRingArray); $i++) {
+				$str .= ",[";
+				for ($j=0; $j < count($this->innerRingArray[$i]); $j++) {
+					if ($j > 0) {
+						$str .= ",";
+					}
+					$str .= "[".$this->innerRingArray[$i][$j]["x"].",".$this->innerRingArray[$i][$j]["y"]."]";
+				}
+				$str .= "]";
+			}
+			$str .= "]}";
 		}
 		else {
 			$e = new mb_exception("GMLPolygon: toGeoJSON: this point is null.");
@@ -762,7 +815,6 @@
 	}
 	
 	protected function addPoint ($x, $y, $i) {
-
 		array_push($this->lineArray[$i], array("x" => $x, "y" => $y));
 	}
 	
@@ -799,38 +851,68 @@
 class GMLMultiPolygon {
 
 	var $polygonArray = array();
+	var $innerRingArray = array();
 
 	public function __construct() {
 		
 	}
 
+	protected function addPointToRing ($i, $j, $x, $y) {
+		if (count($this->innerRingArray[$i]) <= $j) {
+			array_push($this->innerRingArray[$i], array());
+		}
+		array_push($this->innerRingArray[$i][$j], array("x" => $x, "y" => $y));
+	}
+	
+
 	public function parseMultiPolygon ($domNode) {
 //		echo $domNode->nodeName."<br>";
 		$simpleXMLNode = simplexml_import_dom($domNode);
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 
-		$allCoords = $simpleXMLNode->xpath("gml:polygonMember/gml:Polygon/gml:outerBoundaryIs/gml:LinearRing/gml:coordinates");
-			
+		$allPolygons = $simpleXMLNode->xpath("gml:polygonMember/gml:Polygon");
+		
 		$cnt=0;
-		foreach ($allCoords as $Coords) {
-			
+		foreach ($allPolygons as $polygon) {
+			$allCoords = $polygon->xpath("gml:outerBoundaryIs/gml:LinearRing/gml:coordinates");
+				
 			$this->polygonArray[$cnt] = array();
+			foreach ($allCoords as $Coords) {
+				
+				$coordsDom = dom_import_simplexml($Coords);
+					
+				foreach (explode(' ',$coordsDom->nodeValue) as $pointCoords) {
+					list($x,$y,$z) = explode(',',$pointCoords);
+					$this->addPoint($x, $y, $cnt);
+				}
+			}
 			
-			$coordsDom = dom_import_simplexml($Coords);
+			$this->innerRingArray[$cnt] = array();
+			$innerRingNodeArray = $polygon->xpath("gml:innerBoundaryIs");
+			if ($innerRingNodeArray) {
+				$ringCount = 0;
+				foreach ($innerRingNodeArray as $ringNode) {
+					$currentRingNode = $ringNode->xpath("gml:LinearRing");
+					foreach ($currentRingNode as $node) {
+						$coordinates = $node->xpath("gml:coordinates");
+						foreach ($coordinates as $coordinate) {
+							$coordsDom = dom_import_simplexml($coordinate);
+								
+							foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
 				
-//			$name = $coordsDom->nodeName;
-//			$value = $coordsDom->nodeValue;				
-//			echo "===> name: ".$name. ", Value: ".$value."<br>";
-
-			foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
-				list($x,$y,$z) = explode(',',$pointCoords);
-				$this->addPoint($x, $y, $cnt);
+								list($x,$y,$z) = explode(',',$pointCoords);
+								$this->addPointToRing($cnt, $ringCount, $x, $y);
+							}
+						}
+						$ringCount++;
+						
+					}
 				}
-			
+			}
 			$cnt++;
-		}
-		
+			new mb_exception("create multipolygon " . serialize($this->innerRingArray));
+		}		
 	}
 	
 	protected function addPoint ($x, $y, $i) {
@@ -846,17 +928,30 @@
 			
 			for ($cnt =0; $cnt < $numberPolygonArray; $cnt++){
 				if ($cnt > 0) {
-						$str .= ",";
-					}
-					$str .="[";
-			
+					$str .= ",";
+				}
+				$str .= "[";
+
+				$str .= "[";
 				for ($i=0; $i < count($this->polygonArray[$cnt]); $i++) {
 					if ($i > 0) {
 						$str .= ",";
 					}
 					$str .= "[".$this->polygonArray[$cnt][$i]["x"].",".$this->polygonArray[$cnt][$i]["y"]."]";
 				}
-				$str .="]";
+				$str .= "]";
+				
+				for ($i=0; $i < count($this->innerRingArray[$cnt]); $i++) {
+					$str .= ",[";
+					for ($j=0; $j < count($this->innerRingArray[$cnt][$i]); $j++) {
+						if ($j > 0) {
+							$str .= ",";
+						}
+						$str .= "[".$this->innerRingArray[$cnt][$i][$j]["x"].",".$this->innerRingArray[$cnt][$i][$j]["y"]."]";
+					}
+					$str .= "]";
+				}
+				$str .= "]";
 			}
 			$str .= "]}";
 			
@@ -867,4 +962,4 @@
 		return $str;
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: branches/print_dev/http/classes/class_json.php
===================================================================
--- branches/print_dev/http/classes/class_json.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_json.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -40,6 +40,16 @@
 	private $library = JSON_PEAR;
 
 	/**
+	 * Check whether Mapbender will use the native PHP JSON functions
+	 * or the PEAR library
+	 * 
+	 * @return Boolean 
+	 */
+	public static function usesNative () {
+		return function_exists("json_encode");
+	}
+	
+	/**
 	 * Determines which JSON lib to use.
 	 * @constructor
 	 */

Modified: branches/print_dev/http/classes/class_locale.php
===================================================================
--- branches/print_dev/http/classes/class_locale.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_locale.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -27,120 +27,124 @@
  *
  */
 class Mb_locale {
-        var $knownLanguages = null;
-        var $systemLocales = null;
-        var $browserLanguages = null;
-        var $os = null;
-        var $name = null;
-        var $defaultLanguage = "en";
-        var $status = "No locale set.";
+	var $knownLanguages = null;
+	var $systemLocales = null;
+	var $browserLanguages = null;
+	var $os = null;
+	var $name = null;
+	var $defaultLanguage = "en";
+	var $status = "No locale set.";
 
-        function Mb_locale($languageId) {
-                if (!$languageId) {
-                        $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 . "'");
-                        }
-                }
-                else {
-                        $this->setCurrentLocale($this->defaultLanguage);
-                }
-        }
+	function Mb_locale($languageId) {
+		if (!$languageId) {
+		        $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 . "'");
+			}
+		}
+		else {
+			$this->setCurrentLocale($this->defaultLanguage);
+		}
+	}
 
-        /**
-         * Get the current locale, evaluating GET/POST variables, browser languages
-         * and a default locale (in that preference)
-         *
-         * @returns current locale
-         */
-        function setCurrentLocale($languageId) {
+    /**
+     * Get the current locale, evaluating GET/POST variables, browser languages
+     * and a default locale (in that preference)
+     *
+     * @returns current locale
+     */
+    function setCurrentLocale($languageId) {
 
-                  // try to set the locale to $languageId
-                if ($this->checkAndSetLocale($languageId)) {
-                        return true;
-                  }
-                  else {
-                          $e = new Mb_notice("class_locale: no input parameter specified.");
-                  }
+		// try to set the locale to $languageId
+		if ($this->checkAndSetLocale($languageId)) {
+			return true;
+		}
+		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();
+		}
+		foreach ($this->browserLanguages as $lang) {
+	        $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);
+	}
 
-                // determine the browser setting and try to set locale according to that
-                if ($this->browserLanguage == null) {
-                        $this->setBrowserLanguages();
-                }
-                foreach ($this->browserLanguages as $lang) {
-                        $e = new Mb_notice("trying browser setting " . $lang);
-                        if ($this->checkAndSetLocale($lang)) {
-                                return true;
-                        }
-                }
+	/**
+	* 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();
+		}
+		
+		if (!USE_I18N || ($this->os != null && isset($languageId))) {
+			if ($this->isKnownLanguage($languageId)) {
+		
+				if ($this->systemLocales == null) {
+					$this->setSystemLocales();
+				}
+		
+				$locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];
+				$selectedLocale = setlocale(LC_MESSAGES, $locale);
 
-                // set to default language
-                $e = new Mb_notice("trying default language " . $this->defaultLanguage);
-                return $this->checkAndSetLocale($this->defaultLanguage);
-        }
+				if ($selectedLocale) {
+					$this->name = $selectedLocale;
+					$_SESSION["mb_lang"] = $languageId;
+					$_SESSION["mb_locale"] = $this->name;
+					$e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
 
-        /**
-         * 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();
-                }
+					// from http://de3.php.net/manual/de/function.gettext.php
+					$path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
+					$enc = bind_textdomain_codeset("Mapbender", "UTF-8");
+					$dom = textdomain("Mapbender");
+					return true;
+				}
+			}
+		}
+		$e = new Mb_notice("locale " . $locale . " not found.");
+		return false;
+	}
 
-                if (!USE_I18N || ($this->os != null && isset($languageId))) {
-                        if ($this->isKnownLanguage($languageId)) {
+	/**
+	* Guess the operating system which on which this code is running
+	* multiple methods are tested for reliably guessing the os
+	*
+	* @private
+	* @returns string with os name
+	*/
+	function guessHostOS(){
+		if (strncasecmp(php_uname(), 'Windows', 7) == 0) {
+			return 'windows';
+		}
+		else if (strncasecmp(php_uname(), 'Linux', 5) == 0) {
+			return 'linux';
+		}
+		else if (strncasecmp(php_uname(), 'OpenBSD', 7) == 0) {
+			return 'bsd';
+		}
+		else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0) {
+			return 'bsd';
+		}
+		new mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
+		return null;
+	}
 
-                                if ($this->systemLocales == null) {
-                                        $this->setSystemLocales();
-                                }
-
-                                $locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];
-                                $selectedLocale = setlocale(LC_MESSAGES, $locale);
-                                if ($selectedLocale) {
-                                        $this->name = $selectedLocale;
-                                        $_SESSION["mb_lang"] = $languageId;
-                                        $_SESSION["mb_locale"] = $this->name;
-                                        $e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
-                                        // from http://de3.php.net/manual/de/function.gettext.php
-                                        $path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
-                                        $enc = bind_textdomain_codeset("Mapbender", "UTF-8");
-                                        $dom = textdomain("Mapbender");
-                                        return true;
-                                }
-                        }
-                }
-                $e = new Mb_notice("locale " . $locale . " not found.");
-                return false;
-        }
-
         /**
-         * Guess the operating system which on which this code is running
-         * multiple methods are tested for reliably guessing the os
-         *
-         * @private
-         * @returns string with os name
-         */
-        function guessHostOS(){
-          if (strncasecmp(php_uname(), 'Windows', 7) == 0)
-            return 'windows';
-          else if (strncasecmp(php_uname(), 'Linux', 5) == 0)
-            return 'linux';
-          else if (strncasecmp(php_uname(), 'OpenBSD', 7) == 0)
-            return 'bsd';
-          else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0)
-            return 'bsd';
-          else {
-            throw new Mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
-            return null;
-          }
-        }
-
-        /**
          * checks if a language is supported
          *
          * @returns true if the language is supported; otherwise false
@@ -164,40 +168,54 @@
          * determines the available Locales on this system
          */
         function setSystemLocales() {
-                $this->systemLocales['it_IT'] = array('linux' => 'it_IT.utf8',
+                $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',
+                $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',
+                $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');
         }
 
         /**
          * set the known languages
          */
         function setKnownLanguages() {
-                $this->knownLanguages = array('en_US' => 'en_US',
-                      'en' => 'en_US',
-                      'de_DE' => 'de_DE',
-                      'de' => 'de_DE',
-                      'bg_BG' => 'bg_BG',
-                      'bg' => 'bg_BG',
-                      'es_ES' => 'es_ES',
-                      'es' => 'es_ES',
-                      'nl_NL' => 'nl_NL',
-                      'nl' => 'nl_NL',
-					  'fr_FR' => 'fr_FR',
-                      'fr' => 'fr_FR',
-                      'gr_GR' => 'gr_GR',
-                      'gr' => 'gr_GR',
-                      'it_IT' => 'it_IT',
-                      'it' => 'it_IT');
+                $this->knownLanguages = array(
+						'en_US' => 'en_US',
+						'en' => 'en_US',
+						'de_DE' => 'de_DE',
+						'de' => 'de_DE',
+						'bg_BG' => 'bg_BG',
+						'bg' => 'bg_BG',
+						'es_ES' => 'es_ES',
+						'es' => 'es_ES',
+						'nl_NL' => 'nl_NL',
+						'nl' => 'nl_NL',
+						'fr_FR' => 'fr_FR',
+						'fr' => 'fr_FR',
+						'el_GR' => 'el_GR',
+						'gr' => 'el_GR',
+						'it_IT' => 'it_IT',
+						'it' => 'it_IT');
         }
 
         /**

Modified: branches/print_dev/http/classes/class_map.php
===================================================================
--- branches/print_dev/http/classes/class_map.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_map.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -69,6 +69,13 @@
 	}
 
 	/**
+	 * @param $value String
+	 */
+	public function setElementName ($value) {
+		$this->elementName = $value;
+	}
+
+	/**
 	 * 
 	 * @return String
 	 */
@@ -90,37 +97,37 @@
 	public function getExtent () {
 		return $this->extent;	
 	}
-
-	/**
-	 * 
-	 * @return Mapbender_bbox extent information
-	 */
-	public function getExtentInfo () {
-		return array($this->extent->min->x, $this->extent->min->y, $this->extent->max->x, $this->extent->max->y);	
-	}	
-	
-	/**
-	 * converts the extent of the map so that the maximum	extent will be displayed
-	 *
-	 */
-	public function calculateExtent($aMapbenderBbox) {
-		$relation_px_x = $this->getWidth() / $this->getHeight();
-		$relation_px_y = $this->getHeight() / $this->getWidth();
-		$extentx = ($aMapbenderBbox->max->x - $aMapbenderBbox->min->x);
-		$extenty = ($aMapbenderBbox->max->y - $aMapbenderBbox->min->y);
-		$centerx = $aMapbenderBbox->min->x + $extentx/2;
-		$centery = $aMapbenderBbox->min->y + $extenty/2;
-		$relation_bbox_x = $extentx / $extenty;     
-		if($relation_bbox_x <= $relation_px_x){                
-			$aMapbenderBbox->min->x = $centerx - $relation_px_x * $extenty / 2;
-			$aMapbenderBbox->max->x = $centerx + $relation_px_x * $extenty / 2;
-		}
-		if($relation_bbox_x > $relation_px_x){                
-			$aMapbenderBbox->min->y = $centery - $relation_px_y * $extentx / 2;
-			$aMapbenderBbox->max->y = $centery + $relation_px_y * $extentx / 2;
-		}
-		$this->setExtent($aMapbenderBbox);
-	}
+
+	/**
+	 * 
+	 * @return Mapbender_bbox extent information
+	 */
+	public function getExtentInfo () {
+		return array($this->extent->min->x, $this->extent->min->y, $this->extent->max->x, $this->extent->max->y);	
+	}	
+	
+	/**
+	 * converts the extent of the map so that the maximum	extent will be displayed
+	 *
+	 */
+	public function calculateExtent($aMapbenderBbox) {
+		$relation_px_x = $this->getWidth() / $this->getHeight();
+		$relation_px_y = $this->getHeight() / $this->getWidth();
+		$extentx = ($aMapbenderBbox->max->x - $aMapbenderBbox->min->x);
+		$extenty = ($aMapbenderBbox->max->y - $aMapbenderBbox->min->y);
+		$centerx = $aMapbenderBbox->min->x + $extentx/2;
+		$centery = $aMapbenderBbox->min->y + $extenty/2;
+		$relation_bbox_x = $extentx / $extenty;     
+		if($relation_bbox_x <= $relation_px_x){                
+			$aMapbenderBbox->min->x = $centerx - $relation_px_x * $extenty / 2;
+			$aMapbenderBbox->max->x = $centerx + $relation_px_x * $extenty / 2;
+		}
+		if($relation_bbox_x > $relation_px_x){                
+			$aMapbenderBbox->min->y = $centery - $relation_px_y * $extentx / 2;
+			$aMapbenderBbox->max->y = $centery + $relation_px_y * $extentx / 2;
+		}
+		$this->setExtent($aMapbenderBbox);
+	}
 		
 	/**
 	 * 
@@ -296,11 +303,20 @@
 				$newLayer->layer_minscale = $currentLayer->layer_minscale;
 				$newLayer->layer_maxscale = $currentLayer->layer_maxscale;
 				$newLayer->layer_metadataurl = $currentLayer->metadataurl;
-				$newLayer->gui_layer_wms_id = $wms->objLayer[0]->layer_uid;
+				$newLayer->gui_layer_wms_id = $currentLayer->gui_layer_wms_id;
+//				$newLayer->gui_layer_wms_id = $wms->objLayer[0]->layer_uid;
 				$newLayer->gui_layer_status = $currentLayer->gui_layer_status;
 				$newLayer->gui_layer_style = $currentLayer->gui_layer_style;
 				$newLayer->gui_layer_selectable = $currentLayer->gui_layer_selectable;
-				$newLayer->gui_layer_visible = $currentLayer->gui_layer_visible;
+				if ($this->isOverview) {
+					preg_match_all("/LAYERS\=([^&]*)/", $jsMapObject->mapURL[0], $resultMatrix);
+					$layerList = $resultMatrix[1][0];
+					$layerListArray = explode(",", $layerList);
+					$newLayer->gui_layer_visible = (in_array($currentLayer->layer_name, $layerListArray)) ? 1 : 0;
+				}
+				else {
+					$newLayer->gui_layer_visible = $currentLayer->gui_layer_visible;
+				}
 				$newLayer->gui_layer_queryable = $currentLayer->gui_layer_queryable;
 				$newLayer->gui_layer_querylayer = $currentLayer->gui_layer_querylayer;
 				$newLayer->gui_layer_minscale = $currentLayer->gui_layer_minscale;
@@ -322,8 +338,8 @@
 				$newLayer->layer_style = array();
 				for ($z = 0; $z < count($currentLayer->layer_style); $z++) {
 					$newLayer->layer_style[$z] = array();
-					$newLayer->layer_style[$z]["name"] = $currentLayer->layer_style[$z]->name;
-					$newLayer->layer_style[$z]["title"] = $currentLayer->layer_style[$z]->title;
+					$newLayer->layer_style[$z]["name"] = $currentLayer->layer_style[$z]->name ? $currentLayer->layer_style[$z]->name : "default";
+					$newLayer->layer_style[$z]["title"] = $currentLayer->layer_style[$z]->title ? $currentLayer->layer_style[$z]->title : "default";
 					$newLayer->layer_style[$z]["legendurl"] = $currentLayer->layer_style[$z]->legendurl;
 					$newLayer->layer_style[$z]["legendurlformat"] = $currentLayer->layer_style[$z]->legendurlformat;
 				}

Modified: branches/print_dev/http/classes/class_point.php
===================================================================
--- branches/print_dev/http/classes/class_point.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_point.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -31,13 +31,23 @@
 	/**
 	 * @constructor
 	 */
-	function __construct($x, $y, $z, $epsg) {
-		// may be called without $z; so $epsg is the third parameter, $z
-		if (isset($x) && isset($y) && isset($z) && !isset($epsg)) {
-			$e = new mb_notice("Mapbender_point: constructor: probably 2d call (x: ".$x.", y: ".$y.", z: ".$z.", epsg:".$epsg.")!");
-			$epsg = $z;
+	function __construct() {
+		if (func_num_args() == 4) {
+			$x = func_get_arg(0);
+			$y = func_get_arg(1);
+			$z = func_get_arg(2);
+			$epsg = func_get_arg(3);
+		}
+		else if (func_num_args() == 3) {
+			$x = func_get_arg(0);
+			$y = func_get_arg(1);
 			$z = false;
+			$epsg = func_get_arg(2);
 		}
+		else {
+			return;
+		}
+
 		if (!isset($x) || !isset($y) || !isset($epsg)) {
 			$e = new mb_exception("Mapbender_point: constructor: some parameters are not set (set (x: ".$x.", y: ".$y.", z: ".$z.", epsg:".$epsg.")!");
 		}

Modified: branches/print_dev/http/classes/class_stripRequest.php
===================================================================
--- branches/print_dev/http/classes/class_stripRequest.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_stripRequest.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -81,6 +81,48 @@
 			return $output;
 		}
 	}
+	
+	function getFormat(){
+		$format = $this->get("format");
+			
+		if ($format=="PNG" || $format=="image/png"){
+			return "png";
+		} else if ($format=="JPEG" || $format=="image/jpeg"){
+			return "jpeg";
+		} else {
+			return null;
+		}
+
+	}
+	
+	function setFormat($formatType){
+		$version = $this->get("version");
+		if($version == "1.0.0"){
+			if ($formatType=='png'){
+				$output = $this->set("format","PNG");
+				return $output;	
+			} else if ($formatType=='jpeg'){
+				$output = $this->set("format","JPEG");
+				return $output;	
+			} else {
+				return;
+			}
+			
+		}
+		else{						
+			if ($formatType=='png'){
+				$output = $this->set("format","image/png");
+				return $output;	
+			} else if ($formatType=='jpeg'){
+				$output = $this->set("format","image/jpeg");
+				return $output;	
+			} else {
+				return;
+			}
+			
+		}
+	}
+	
 	function append($param){
 		$this->url .= "&".$param;
 		$this->encodeGET();

Modified: branches/print_dev/http/classes/class_wfs_conf.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_conf.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_wfs_conf.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -49,7 +49,7 @@
 			
 			// parameter is a number	
 			if (!is_array($idOrIdArray) && is_numeric($idOrIdArray)) {
-				$idArray = array(intval($idOrIdArray));
+				$idOrIdArray = array(intval($idOrIdArray));
 			}
 
 			// parameter is an array of numbers
@@ -69,7 +69,7 @@
 					$idArray = array_intersect($idArray, $user->getWfsConfByPermission());
 				}
 
-				return $this->getWfsConfFromDB($idArray);
+				return $this->getWfsConfFromDbByArray($idArray);
 			}
 			// parameter is invalid
 			else {
@@ -108,6 +108,16 @@
         return $rowArray;
 	}
 	
+	public static function getGeomColumnNameByConfId ($confId) {
+		$elArray = self::getWfsConfElementFromDb($confId);
+		foreach ($elArray as $element) {
+			if ($element["f_geom"] == "1") {
+				return $element["element_name"];
+			}
+		}
+		return null;
+	}
+	
 	/**
 	 * Gets the database content of a WFS conf element given by a WFS conf ID.
 	 * 

Modified: branches/print_dev/http/classes/class_wmc.php
===================================================================
--- branches/print_dev/http/classes/class_wmc.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_wmc.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -84,7 +84,7 @@
 	
 	// constants
 	var $monitoringIsOn = false;
-	var $saveWmcAsFile = true;
+	var $saveWmcAsFile = false;
 	var $extensionNamespace = "mapbender";
 	var $extensionNamespaceUrl = "http://www.mapbender.org";
 		
@@ -146,7 +146,11 @@
 		$this->monitoringIsOn = true;
 		
 		$doc = wmc::getDocument($wmcId);
+		if ($doc === false) {
+			return false;
+		}
 		$this->createObjFromWMC_xml($doc);
+		return true;
 	}
 
 	public function createFromApplication ($appId) {
@@ -268,9 +272,9 @@
 	 * @param $id String the WMC id
 	 */
 	public static function getDocument ($id) {
-		$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1";
-		$v = array($id);
-		$t = array('s');
+		$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1 AND fkey_user_id = $2";
+		$v = array($id, $_SESSION["mb_user_id"]);
+		$t = array('s', 'i');
 		$res = db_prep_query($sql,$v,$t);
 		$row = db_fetch_array($res);
 		if ($row) {
@@ -345,19 +349,12 @@
 
 		// add WMS for main map frame
 		$wmsArray = $this->mainMap->getWmsArray();
-		// for all wms...
-		for ($i = 0; $i < count($wmsArray); $i++) {
-			// ..add wms and set properties
-			array_push($wmcJsArray, $wmsArray[$i]->createJsObjFromWMS_());
-		}
 
-		// delete existing map objects...
-		array_push($wmcJsArray, "mb_mapObj = [];");
-
-		// .. and add the overview map (if exists)
+		// find the WMS in the main map which is equal to the WMS
+		// in the overview map
+		$overviewWmsIndex = null;
+		$ovWmsArray = array();
 		if ($this->overviewMap !== null) {
-			// find the WMS in the main map which is equal to the WMS
-			// in the overview map
 			$ovWmsArray = $this->overviewMap->getWmsArray();
 			$overviewWmsIndex = 0;
 			for ($i = 0; $i < count($ovWmsArray); $i++) {
@@ -368,14 +365,48 @@
 					}
 				}
 			}
-			$wmcJsArray = array_merge($wmcJsArray, $this->overviewMap->toJavaScript($overviewWmsIndex));
+		}
 
+
+
+		// for all wms...
+		for ($i = 0; $i < count($wmsArray); $i++) {
+			// ..use settings from ov if available
+			if ($overviewWmsIndex !== null && $this->overviewMap !== null && 
+				$overviewWmsIndex == $i && count($ovWmsArray) > $i) {
+				array_push($wmcJsArray, $ovWmsArray[$i]->createJsObjFromWMS_());
+			}
+			else {
+				// ..otherwise use data from mapframe1
+				array_push($wmcJsArray, $wmsArray[$i]->createJsObjFromWMS_());
+			}			
 		}
 
+		// delete existing map objects...
+		array_push($wmcJsArray, "mb_mapObj = [];");
+
+		// .. and add the overview map (if exists) and set map request
+		if ($this->overviewMap !== null) {
+			$wmcJsArray = array_merge($wmcJsArray, $this->overviewMap->toJavaScript($overviewWmsIndex));
+		}
+
 		// .. and add main map ..
 		$wmcJsArray = array_merge($wmcJsArray, $this->mainMap->toJavaScript(null));
 
-		// Finally, request the maps
+		// set visibility of main map WMS (may be different from overview)
+		if ($this->overviewMap !== null) {
+			for ($i = 0; $i < count($wmsArray[$overviewWmsIndex]->objLayer); $i++) {
+				$visStr = "mb_mapObj[1].wms[" .$overviewWmsIndex . "].handleLayer(" . 
+					"'" . $wmsArray[$overviewWmsIndex]->objLayer[$i]->layer_name . "', " . 
+					"'visible', " . 
+					($wmsArray[$overviewWmsIndex]->objLayer[$i]->gui_layer_visible ? 1 : 0) . ");";
+				array_push($wmcJsArray, $visStr);
+			}
+			array_push($wmcJsArray, "mb_mapObj[1].restateLayers(" . $wmsArray[$overviewWmsIndex]->wms_id . ");");
+		}
+		
+
+		// .. request the map
 		array_push($wmcJsArray, "setMapRequest('" . $this->mainMap->getFrameName() . "');");
 		if ($this->overviewMap !== null) {
 			array_push($wmcJsArray, "setMapRequest('" . $this->overviewMap->getFrameName() . "');");
@@ -696,7 +727,7 @@
 						 }
 					 }
 					 elseif ($stylelist) {
-						 if ($style) {
+						if ($style) {
 							$index = count($currentLayer["style"]) - 1;
 							if ($tag == "STYLE" && $type == "close") {
 								$style = false;
@@ -718,10 +749,10 @@
 							}
 							else {
 								if ($tag == "NAME"){
-									$currentLayer["style"][$index]["name"] = $value;
+									$currentLayer["style"][$index]["name"] = $value ? $value : "default";
 								}
 								if ($tag == "TITLE") {
-									$currentLayer["style"][$index]["title"] = $value;
+									$currentLayer["style"][$index]["title"] = $value ? $value : "default";
 								}
 								if ($legendurl) {
 									if ($tag == "LEGENDURL" && $type == "close") {
@@ -820,7 +851,7 @@
 		// set WMS data
 		
 		$layerlistCompleteArray = array_merge($layerlistArray["main"], $layerlistArray["overview"]);
-		
+
 		for ($i = 0; $i < count($layerlistCompleteArray); $i++) {
 			$this->setLayerData($layerlistCompleteArray[$i]);
 		}
@@ -956,7 +987,7 @@
 			$wms->objLayer[0]->layer_queryable = 0;
 			$wms->objLayer[0]->layer_minscale = 0;
 			$wms->objLayer[0]->layer_maxscale = 0;
-			$wms->objLayer[0]->gui_layer_wms_id = $currentLayer["extension"]["WMS_LAYER_ID"];
+			$wms->objLayer[0]->gui_layer_wms_id = $currentLayer["extension"]["WMS_ID"];
 			$wms->objLayer[0]->gui_layer_status = 1;
 			$wms->objLayer[0]->gui_layer_selectable = 1; 
 			$wms->objLayer[0]->gui_layer_visible = 1;
@@ -1053,8 +1084,6 @@
 		$wmcToXml = new WmcToXml($this);
 		$this->xml = $wmcToXml->getXml();
 	}
-
-	
 } 
 
 /**

Modified: branches/print_dev/http/classes/class_wmcToXml.php
===================================================================
--- branches/print_dev/http/classes/class_wmcToXml.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_wmcToXml.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -364,7 +364,7 @@
 		$layerExtensionData["wms_layer_id"] = $currentWms->objLayer[0]->layer_uid;
 		$layerExtensionData["layer_pos"] = $currentLayer->layer_pos;
 		$layerExtensionData["layer_parent"] = $currentLayer->layer_parent;
-		$layerExtensionData["wms_id"] = $currentWms->wms_id;
+		$layerExtensionData["wms_id"] = $currentLayer->gui_layer_wms_id;
 		$layerExtensionData["querylayer"] = $currentLayer->gui_layer_querylayer;
 		$layerExtensionData["gui_selectable"] = $currentLayer->gui_layer_selectable;
 		$layerExtensionData["gui_queryable"] = $currentLayer->gui_layer_queryable;
@@ -436,10 +436,10 @@
 					$e_layer_style->setAttribute("current", "1");
 				}
 
-				$e_layer_style_name = $this->doc->createElement("Name", $currentStyle->name);
+				$e_layer_style_name = $this->doc->createElement("Name", $currentStyle["name"]);
 				$e_layer_style->appendChild($e_layer_style_name);
 
-				$e_layer_style_title = $this->doc->createElement("Title", $currentStyle->title);
+				$e_layer_style_title = $this->doc->createElement("Title", $currentStyle["title"]);
 				$e_layer_style->appendChild($e_layer_style_title);
 				
 				
@@ -456,7 +456,7 @@
 				$e_layer_style_legendurl_or = $this->doc->createElement("OnlineResource");
 				$e_layer_style_legendurl_or->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
 				$e_layer_style_legendurl_or->setAttribute("xlink:type", "simple");
-				$e_layer_style_legendurl_or->setAttribute("xlink:href", $currentWms->wms_getlegendurl);
+				$e_layer_style_legendurl_or->setAttribute("xlink:href", $currentStyle["legendurl"]);
 				$e_layer_style_legendurl->appendChild($e_layer_style_legendurl_or);
 				$e_layer_style->appendChild($e_layer_style_legendurl);
 			}

Modified: branches/print_dev/http/classes/class_wms.php
===================================================================
--- branches/print_dev/http/classes/class_wms.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/classes/class_wms.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -72,6 +72,24 @@
 	function wms() {
 	} 
 
+	public static function getConjunctionCharacter ($url) {
+		if (mb_strpos($url, "?") !== false) { 
+			if (mb_substr($url, mb_strlen($url)-1, 1) == "?") { 
+				return "";
+			}
+			else if (mb_substr($url, mb_strlen($url)-1, 1) == "&"){
+				return "";
+			}
+			else {
+				return "&";
+			}
+		}
+		else {
+			return "?";
+		}
+		return "";
+	}
+
 	function createOlObjFromWMS($base){
 	 	if(!$this->wms_title || $this->wms_title == ""){
 			echo "alert('Error: no valid capabilities-document !!');";
@@ -530,7 +548,7 @@
 			}
 			if($section == "style"){
 				if(mb_strtoupper($element[tag]) == "NAME"){
-					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["name"] = ($element[value] ? $element[value] : '');
+					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["name"] = ($element[value] ? $element[value] : 'default');
 				}
 				if(mb_strtoupper($element[tag]) == "TITLE"){
 					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["title"] = ($element[value] ? $element[value] : '');
@@ -839,7 +857,7 @@
 		$newLayer->layer_minscale = $currentLayer["extension"]["MINSCALE"];
 		$newLayer->layer_maxscale = $currentLayer["extension"]["MAXSCALE"];
 		$newLayer->layer_metadataurl = $currentLayer["metadataurl"];
-		$newLayer->gui_layer_wms_id = $currentLayer["extension"]["WMS_LAYER_ID"];
+		$newLayer->gui_layer_wms_id = $currentLayer["extension"]["WMS_ID"];
 		$newLayer->gui_layer_status = $currentLayer["extension"]["GUI_STATUS"];
 		$newLayer->gui_layer_style = ""; // TODO: Add correct data
 		$newLayer->gui_layer_selectable = $currentLayer["extension"]["GUI_SELECTABLE"];
@@ -893,14 +911,13 @@
 		//
 		// set layer style
 		//
-		for ($i = 0; $i < count($currentLayer["format"]); $i++) {
+		for ($i = 0; $i < count($currentLayer["style"]); $i++) {
 			$layerStyleIndex = count($newLayer->gui_layer_style) - 1;
 			$newLayer->layer_style[$layerStyleIndex] = array();
-			$currentStyle = $newLayer->layer_style[$layerStyleIndex];
-			$currentStyle["name"] = $currentLayer["style"][$i]["name"];
-			$currentStyle["title"] = $currentLayer["style"][$i]["title"];
-			$currentStyle["legendurl"] = $currentLayer["style"][$i]["legendurl"];
-			$currentStyle["legendurl_format"] = $currentLayer["style"][$i]["legendurl_type"];
+			$newLayer->layer_style[$layerStyleIndex]["name"] = $currentLayer["style"][$i]["name"];
+			$newLayer->layer_style[$layerStyleIndex]["title"] = $currentLayer["style"][$i]["title"];	
+			$newLayer->layer_style[$layerStyleIndex]["legendurl"] = $currentLayer["style"][$i]["legendurl"];
+			$newLayer->layer_style[$layerStyleIndex]["legendurl_format"] = $currentLayer["style"][$i]["legendurl_type"];
 		}
 	}
 	

Modified: branches/print_dev/http/css/treeGDE2.css
===================================================================
--- branches/print_dev/http/css/treeGDE2.css	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/css/treeGDE2.css	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,47 +1,50 @@
-a {
+#treeGDE a {
 	text-decoration:none;
 	color:black;
 }
-a.node
+#treeGDE a.node
 {
 	vertical-align:middle;
 }
-a:link
+#treeGDE a:link
 {
 	color: #000000;
 }
-a:visited
+#treeGDE a:visited
 {
 	color: #000000;
 }
-a:hover
+#treeGDE a:hover
 {
 	color: #8080FF;
 	text-decoration:underline;
 }
-table
+#treeGDE table
 {
 	font-size:8pt;
 	line-height:8pt;
+	margin: 0px;
+	padding: 0px;
 }
-table.menu
+#treeGDE table.menu
 {
 	background-color: #ffffff;
 	border: 1px solid #999999
 }
-td
+#treeGDE tr td
 {
 	color: #000000;
-	font-family: Verdana
+	font-family: Verdana;
+	padding: 0px;
 }
-img
+#treeGDE img
 {
 	border:none;
 	padding:0px;
 	margin:0px;
 	vertical-align:middle;		
 }
-input
+#treeGDE input
 {
 	margin-top:0px;
 	margin-bottom:0px;

Modified: branches/print_dev/http/html/mod_treefolder2.php
===================================================================
--- branches/print_dev/http/html/mod_treefolder2.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/html/mod_treefolder2.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -150,7 +150,7 @@
 		return;
 	}
 	//scalehints
-	var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+	var scale = parseInt(parent.mb_mapObj[selectedMap].getScale());
 	if(scale < parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
 		if(selectedLayer==0)
 		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
@@ -178,8 +178,8 @@
 function updateScale(){
 	if(!init)return;
 	for(var i=0; i<parent.mb_mapObj.length; i++){
-		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
 		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+			var scale = parent.mb_mapObj[i].getScale();
 			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
 				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
 					if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){
@@ -210,8 +210,8 @@
 	if(!init||lock_check)return;
 	lock_check=true;
 	for(var i=0; i<parent.mb_mapObj.length; i++){
-		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
 		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+			var scale = parent.mb_mapObj[i].getScale();
 			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
 				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
 					if(!parent.mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
@@ -548,7 +548,7 @@
 								if(menu.indexOf("opacity_down")!=-1 && parseFloat(parent.mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
 								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
 								c_menu+="]";
-								controls=null;
+								controls='';
 								if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
 								if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
 								addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");

Added: branches/print_dev/http/html/mod_treefolderPlain.php
===================================================================
--- branches/print_dev/http/html/mod_treefolderPlain.php	                        (rev 0)
+++ branches/print_dev/http/html/mod_treefolderPlain.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,696 @@
+<?php
+# $Id: mod_treefolder2.php 2975 2008-09-18 12:58:42Z nimix $
+# http://www.mapbender.org/index.php/Mod_treefolder2.php
+# Copyright (C) 2007 Melchior Moos
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# 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_validateSession.php");
+include '../include/dyn_js.php';
+?>
+function openwindow(Adresse) {
+Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+Fenster1.focus();
+}
+<?php
+
+   echo "mod_treeGDE_map = '".$e_target[0]."';";   
+session_write_close();
+?>
+var msgObj = {};
+msgObj.tooltipHandleWms = '<?php echo _mb("(De)activate this service");?>';
+msgObj.tooltipLayerVisible = '<?php echo _mb("Toggles the visibility of this service");?>';
+msgObj.tooltipLayerQuerylayer = '<?php echo _mb("Toggles the queryability of this service");?>';
+msgObj.tooltipLayerContextMenu = '<?php echo _mb("Opens the layer context menu");?>';
+msgObj.tooltipWmsContextMenu = '<?php echo _mb("Opens the WMS context menu");?>';
+msgObj.tooltipRemoveWms = '<?php echo _mb("Removes the selected WMS");?>';
+msgObj.tooltipMoveSelectionUp = '<?php echo _mb("Moves the selection up");?>';
+msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
+
+var jst_container = "document.getElementById('treeContainer')";
+var jst_image_folder = imagedir;
+var jst_display_root = false;
+var defaultTarget = 'examplemain';
+var lock=false;
+var lock_update=false;
+var lock_check=false;
+var selectedMap=-1;
+var selectedWMS=-1;
+var selectedLayer=-1;
+var initialized=false;
+var errors = 0;
+var state=Array();
+var treeState = "";
+<?php
+//load structure
+$sql = "SELECT * FROM gui_treegde WHERE fkey_gui_id = $1 ORDER BY lft;";
+$v = array($_SESSION["mb_user_gui"]);
+$t = array("s");
+$res = db_prep_query($sql, $v, $t);
+
+//init tree converting arrays
+$nr = array(); 			//array for nested sets numbers
+$str = array();			//array for js array elements
+$categories = array();	//array for wms folders
+$path = array();		//stack for actual path elements
+$rights = array();		//stack for rights of open elements
+
+//build javascript data array for jsTree
+while($row = db_fetch_array($res)){
+	//push javascript array elements to a single array with lefts and rights
+	$left = "['folder_".$row['id']."', ['".$row['my_layer_title']."', 'javascript:_foo()'],[";
+	$right = "]],";
+	array_push($nr, $row['lft']);
+	array_push($str, $left);
+	array_push($nr, $row['rgt']);
+	array_push($str, $right);
+	
+	//finish all nodes that have no further childs
+	while(count($rights) > 0 && $rights[count($rights)-1]<$row['lft']){
+		array_pop($rights);
+		array_pop($path);
+	}
+
+	//set path for each wms that is referenced in this folder
+	array_push($rights, $row['rgt']);
+	array_push($path, "folder_".$row['id']);
+	if($row['wms_id']!=""){
+		foreach(explode(",",$row['wms_id']) as $wms){
+			array_push($categories, "'wms_".$wms."':\"root_id|".implode("|", $path)."\"");
+		}
+	}
+}
+//if we have a configured structure output it
+if(count($str)>0){
+	//order js array elements
+	array_multisort($nr, $str);
+	
+	//output javascript vars
+	echo "var arrNodesStr = \"[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];\";\n";
+	echo "var categories = {".implode(",", $categories)."};\n";
+}
+else{
+//if there is no structure take default
+?>
+var arrNodesStr = "[['root_id', ['Layer','javascript:_foo()']]];";
+var categories = {};
+<?php
+}
+?>
+var arrNodes = eval(arrNodesStr);
+function _foo(){selectedMap=-1;selectedWMS=-1;selectedLayer=-1}
+
+// some defaults
+if (typeof(reverse) === 'undefined')reverse = 'false';
+if (typeof(switchwms) === 'undefined')switchwms = 'true';
+if (typeof(ficheckbox) === 'undefined')ficheckbox = 'false';
+if (typeof(metadatalink) === 'undefined')metadatalink = 'false';
+if (typeof(wmsbuttons) === 'undefined')wmsbuttons = 'false';
+if (typeof(showstatus) === 'undefined')showstatus = 'false';
+if (typeof(alerterror) === 'undefined')alerterror = 'false';
+if (typeof(openfolder) === 'undefined')openfolder = 'false';
+if (typeof(handlesublayer) === 'undefined')handlesublayer = 'false';
+if (typeof(menu) === 'undefined')menu = '';
+if (typeof(redirectToMetadataUrl) !== 'undefined' && redirectToMetadataUrl == "false") {
+	redirectToMetadataUrl = false;
+}
+else {
+	redirectToMetadataUrl = true;
+}
+
+var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
+if (redirectToMetadataUrl) {
+	defaultMetadataUrl += 'redirectToMetadataUrl=1';
+}
+else {
+	defaultMetadataUrl += 'redirectToMetadataUrl=0';
+}
+
+//menu elements
+var menu_move_up = ['menu_move_up', ['Move up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_move_down = ['menu_move_down', ['Move down&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_delete = ['menu_delete', ['Remove&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
+var menu_opacity_up = ['menu_opacity_up', ['Opacity up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_opacity_down = ['menu_opacity_down', ['Opacity down&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_metalink = ['menu_metalink', ['Information&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
+var menu_zoom = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
+var menu_hide = ['menu_hide', ['Hide menu&nbsp;', 'javascript:hideMenu()',,'hide.png']];
+//var menu_wms_switch = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_layer_switch = ['menu_zoom', ['Zjjj&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_info_switch = ['menu_zoom', ['Zmn&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+
+//parent.eventMapRequestFailed.register(function(t){imgerror(t)});
+
+eventAfterLoadWMS.register(reloadTree);
+eventInit.register(loadTree);
+if(showstatus=='true'||alerterror=='true'){
+	eventAfterMapRequest.register(init_mapcheck);
+	init_mapcheck();
+}
+eventAfterMapRequest.register(updateScale);
+eventAfterMapRequest.register(updateCheckState);
+
+if(wmsbuttons != "true")
+	jst_highlight = false;
+
+function select(i,ii,iii){
+	//ignore if selected
+	if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
+	if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
+		selectedMap=i;
+		selectedWMS=ii;
+		selectedLayer=iii;		
+		return;
+	}
+	//scalehints
+	var scale = parseInt(mb_getScale(mod_treeGDE_map));	
+	if(scale < parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+	}
+	else if(scale > parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+	}
+	else{
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
+	}
+
+	selectedMap=i;
+	selectedWMS=ii;
+	selectedLayer=iii;
+}
+
+function updateScale(){
+	if(!initialized)return;
+	myMapObj = getMapObjByName(mod_treeGDE_map);
+	if(myMapObj){
+		var scale = parseInt( mb_getScale(mod_treeGDE_map));
+		for(var ii=0; ii< myMapObj.wms.length; ii++){
+			for(var iii=1; iii< myMapObj.wms[ii].objLayer.length; iii++){
+				if(scale < parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) != 0){                    
+						if(iii==0)
+					   	setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
+						else
+					   	setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
+					}
+				else if(scale > parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
+						if(iii==0)
+					   	setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
+						else
+					   	setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
+					}
+					else{
+						if(iii==0)
+					   	setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '');
+						else
+					   	setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '');
+					}
+				}
+			}
+		}
+	}	
+
+function updateCheckState(){
+	if(!initialized||lock_check)return;
+	lock_check=true;
+	for(var i=0; i< mb_mapObj.length; i++){
+		var scale = parseInt( mb_getScale(mod_treeGDE_map));
+		if( mb_mapObj[i].elementName == mod_treeGDE_map){
+			for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
+				for(var iii=1; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
+					if(! mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
+						path = arrNodes[0][0]+"|wms_"+ mb_mapObj[i].wms[ii].wms_id+"|"+ mb_mapObj[i].wms[ii].objLayer[iii].layer_id;
+						checkNode(path, 0,  mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible=='1', false);
+						if(ficheckbox == 'true')
+							checkNode(path, 1,  mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer=='1', false);	
+					}
+				}
+			}
+		}
+	}
+	lock_check=false;
+}
+
+function operaLoad(){
+	initArray();
+	renderTree();
+	setTimeout('initWmsCheckboxen();updateScale();',100);	
+}
+
+function loadTree(){
+	if(wmsbuttons=='true'){
+		var div = document.createElement("div");
+		div.innerHTML = '<a href="javascript:move_up()"><img title="'+msgObj.tooltipMoveSelectionUp+'" src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a><a href="javascript:move_down()"><img title="'+msgObj.tooltipMoveSelectionDown+'" src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a><a href="javascript:remove_wms()"><img title="'+msgObj.tooltipRemoveWms+'" src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>';
+		document.getElementById("treeGDE").appendChild(div);
+	}
+	var div = document.createElement("div");
+	div.id = "treeContainer"
+	document.getElementById("treeGDE").appendChild(div);
+
+	if(window.opera){
+		setTimeout('operaLoad()',200);	
+		return;
+	}
+	initArray();
+	renderTree();
+	initWmsCheckboxen();
+	updateScale();
+}
+
+function reloadTree(){
+	if(!initialized) return;
+	selectedMap=-1;
+	selectedWMS=-1;
+	selectedLayer=-1;
+	initialized=false;
+	arrNodes = eval(arrNodesStr)
+	initArray();
+	if(showstatus=='true'||alerterror=='true')
+		init_mapcheck();
+	renderTree();
+	if(window.opera)
+		setTimeout('initWmsCheckboxen();updateScale();',100);	
+	else{
+		initWmsCheckboxen();
+		updateScale();
+	}
+}
+
+function imgerror(t){
+	var map= getMapObjIndexByName(mod_treeGDE_map);
+	var wms=Number(t.id.substr(4));
+	t.onerror=null;
+	t.onabort=null;
+	if(state[wms]!=-1 && alerterror=='true'){
+		state[wms]=-1;	
+		if(confirm('Failed to Load WMS "'+ mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+ mb_mapObj[map].wms[wms].wms_getmap.substr(0, mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
+			window.open(t.src,"");
+		}
+	}
+	state[wms]=-1;
+	errors++;
+	if(showstatus=='true')
+		setNodeImage(arrNodes[0][0]+"|wms_"+ mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
+}
+
+function checkComplete(wms, map, img, first){
+	var ind= getMapObjIndexByName(mod_treeGDE_map);
+	if( mb_mapObj[ind].wms[wms].mapURL == false ||  mb_mapObj[ind].getDomElement().ownerDocument.getElementById(map).complete){
+		if(state[wms]!=-1){
+			for(var i=1;i< mb_mapObj[ind].wms[wms].objLayer.length;i++){
+				if( mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
+					state[wms]=1;
+					if(showstatus=='true')
+						setNodeImage(img);
+					break;
+				}
+			}
+		}
+	}
+	else{
+		if(first){
+			state[wms]=0;
+//			 frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
+//			 frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
+	
+			if(showstatus=='true')
+				setNodeImage(img, "loading_folder.gif");
+		}
+
+		if(state[wms]!=-1)
+			setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);		
+	}
+}
+
+// mb_registerWmsLoadErrorFunctions("window.frames['treeGDE'].imgerror();");
+
+function init_mapcheck(){
+	if(!initialized)return;
+	errors = 0;
+	var ind =  getMapObjIndexByName(mod_treeGDE_map);
+	if(! mb_mapObj[ind]||!initialized){
+		setTimeout("init_mapcheck();",100);
+		return;
+	}
+	for(var wms=0;wms< mb_mapObj[ind].wms.length;wms++){
+		var wmsimgid=mod_treeGDE_map+"_map_"+wms;
+		if( mb_mapObj[ind].getDomElement().ownerDocument.getElementById(wmsimgid)){
+			checkComplete(wms, wmsimgid, arrNodes[0][0]+'|wms_'+ mb_mapObj[ind].wms[wms].wms_id, true);
+		}
+	}
+}
+
+function handleSelectedLayer(mapObj,wms_id,layername,type,status){
+	if(lock_update||lock_check)return;
+	var ind =  getMapObjIndexByName(mapObj);
+	for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+		if( mb_mapObj[ind].wms[i].wms_id == wms_id){
+			 mb_mapObj[ind].wms[i].handleLayer(layername, type, status);
+			break;
+		}
+	}
+}
+
+function zoomToLayer(j,k,l){
+	if(!j&&!k&&!l){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	var my= mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
+	for (var i=0;i<my.length;i++){
+		if(my[i]["epsg"]== mb_mapObj[j].epsg){
+			 mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
+			var arrayExt =  mb_mapObj[j].extent.split(",");
+			 mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+			break;
+		}
+	}
+}
+
+
+//---begin------------- opacity --------------------
+
+var opacityIncrement = 20;
+
+function opacity_up(j, k, l) {
+	handleOpacity(j, k, opacityIncrement);
+}
+
+function opacity_down(j, k, l) {
+	handleOpacity(j, k, -opacityIncrement);
+}
+
+function handleOpacity(mapObj_id, wms_id, increment) {
+	var opacity =  mb_mapObj[mapObj_id].wms[wms_id].gui_wms_mapopacity*100 + increment;
+	 mb_mapObj[mapObj_id].wms[wms_id].setOpacity(opacity);
+	reloadTree();
+}
+
+//---end------------- opacity --------------------
+
+function move_up(j,k,l){
+	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1){
+		alert("You have to select the WMS you want to move up!")		
+		return;
+	}
+	var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
+	if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?false:true)){
+		alert("Illegal move operation");
+		return;
+	}
+	treeState = getState();
+	 zoom( mb_mapObj[j].frameName, true, 1.0);
+	 mb_execloadWmsSubFunctions();
+	//find layer and select
+	for(k=0;k< mb_mapObj[j].wms.length;k++){
+		for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
+			if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
+				select(j,k,l);
+				if(l!=0)
+					selectNode(String(lid));
+				else
+					selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
+			}
+		}
+	}
+}
+
+function move_down(j,k,l){
+	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1){
+		alert("You have to select the WMS you want to move down!")		
+		return;
+	}
+	var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
+	if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?true:false)){
+		alert("Illegal move operation");
+		return;
+	}
+	treeState = getState();
+	 zoom( mb_mapObj[j].frameName, true, 1.0);
+	 mb_execloadWmsSubFunctions();	
+	//find layer and select
+	for(k=0;k< mb_mapObj[j].wms.length;k++){
+		for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
+			if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
+				select(j,k,l);
+				if(l!=0)
+					selectNode(String(lid));
+				else
+					selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
+			}
+		}
+	}
+}
+
+function remove_wms(j,k,l){
+	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1){
+		alert("You have to select the WMS you want to delete!")		
+		return;
+	}
+	if(l!=0){
+		alert("It is not possible to delete a single layer, please select a WMS!")
+		return;
+	}
+	var visibleWMS=0;
+	for(var i=0;i< mb_mapObj[j].wms.length;i++)
+		if( mb_mapObj[j].wms[i].gui_wms_visible=='1'|| mb_mapObj[j].wms[i].gui_wms_visible==1)
+			visibleWMS++;
+	if(visibleWMS<=1){
+		alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
+		return;
+	}
+	if(confirm('Are you sure you want to remove "'+ mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
+  		 mb_mapObjremoveWMS(j,k); 
+		 zoom( mb_mapObj[j].frameName, true, 1.0);
+		 mb_execloadWmsSubFunctions();	
+	}
+}
+
+function updateParent(path){
+	if(lock_check)return;
+	var reset_lock=!lock_update; 
+	lock_update=true;
+	var state=getChildrenCheckState(path, 0);
+	//enableCheckbox(path, (state!=-1)); //3rd state
+	checkNode(path, 0, (state==1));
+	if(state==0 && showstatus=='true' && path.split(jst_delimiter[0]).length == 2){
+		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+	}
+	if(reset_lock)
+		lock_update=false;
+}
+
+function handleSelectedWMS(path){
+	if(lock_update)return;
+	var t = path.split("|");
+	var wms_id = t[t.length-1].substr(4);
+	var reset_lock=!lock_check; 
+	var ind =  getMapObjIndexByName(mod_treeGDE_map);
+	var wms =  getWMSIndexById(mod_treeGDE_map,wms_id);
+	var layername =  mb_mapObj[ind].wms[wms].objLayer[0].layer_name;
+	var bChk = IsChecked(path, 0);	
+	 mb_mapObj[ind].wms[wms].handleLayer(layername,"visible",bChk?"1":"0");
+	 mb_mapObj[ind].wms[wms].handleLayer(layername,"querylayer",bChk?"1":"0");
+	lock_check=true;
+	checkChildren(path, 0, bChk);
+	if(ficheckbox)checkChildren(path, 1, bChk);
+	if(bChk==false && showstatus=='true')
+		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+	if(reset_lock)
+	{
+		 mb_restateLayers(mod_treeGDE_map,wms_id);
+		 setSingleMapRequest(mod_treeGDE_map,wms_id);
+		lock_check=false;
+	}
+}
+
+function handleSelection(path, box){
+	if(lock_update)return;
+	var reset_lock=!lock_check; 
+	lock_check=true;
+	var bChk = IsChecked(path, box);	
+//	enableCheckbox(path, 0, true);
+	checkChildren(path, box, bChk);
+	if(reset_lock){
+		//find wms id from path
+		var t = path.split("|");
+		for(var i=1;t[i].indexOf("wms_")!=0;i++){}
+		var wms_id = t[i].substr(4);
+		//set maprequest
+		 mb_restateLayers(mod_treeGDE_map,wms_id);
+		if(box==0)
+			 setSingleMapRequest(mod_treeGDE_map,wms_id);
+		lock_check=false;
+	}
+}
+
+function initArray(){
+	var parentObj = "";
+	var controls="";
+	if( mb_mapObj.length > 0){
+		for(var i=0; i< mb_mapObj.length; i++){
+			if( mb_mapObj[i].elementName == mod_treeGDE_map){ 
+				for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
+					if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' ||  mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){          
+							var temp =  mb_mapObj[i].wms[ii].objLayer[iii];     
+							if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){ 
+								if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
+									continue;				
+
+								parentNode = arrNodes[0][0];
+								if(eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id) !== undefined)
+									parentNode = eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id);
+								else
+									eval("categories['wms_"+ mb_mapObj[i].wms[ii].wms_id+"'] = parentNode");
+
+								var c_menu="[";
+								if(reverse=="true"){
+									if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
+									if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_down,";
+								}
+								else{
+									if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
+									if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
+								}
+								if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
+//								if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
+								if(menu.indexOf("opacity_up")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) < 1)c_menu+="menu_opacity_up,";
+								if(menu.indexOf("opacity_down")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
+								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
+								c_menu+="]";
+								controls=null;
+								if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '" checked onclick="handleSelectedWMS(\''+parentNode+'|wms_'+ mb_mapObj[i].wms[ii].wms_id+'\');" />';
+								if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
+								addNode(parentNode,["wms_"+ mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
+								parentObj = parentNode+"|wms_"+ mb_mapObj[i].wms[ii].wms_id;              
+							}
+							if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"|| mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
+								var parentLayer = "";
+								var j = iii;
+								while( mb_mapObj[i].wms[ii].objLayer[j].layer_parent!="0"){
+									//find parent
+									for(var jj=0; jj <  mb_mapObj[i].wms[ii].objLayer.length; jj++){
+										if( mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt( mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
+											j=jj;
+											break;
+										}										
+									}									
+									parentLayer = "|" +  mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
+								}
+								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
+									var c_menu="[";
+									if(reverse=="true"){
+										if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_up,";
+										if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_down,";
+									}
+									else{
+										if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
+										if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
+									}
+									if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
+									if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
+//									if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
+//									if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
+									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
+									c_menu+="]";
+									
+									controls = [];
+									controls.push('<input type="checkbox"  title="' + msgObj.tooltipLayerVisible + '" ');
+									if(temp.layer_name=="")
+										controls.push('style="display:none;" ');
+									if(temp.gui_layer_visible=='1')
+										controls.push('checked ');
+									if(temp.gui_layer_selectable!='1')
+										controls.push('disabled ');
+									controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);");
+									if(ficheckbox == 'false')
+										controls.push("handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
+									controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);");
+									controls.push("updateParent('"+parentObj+parentLayer+"');\" />");
+									if(ficheckbox == 'true'){
+										controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerQuerylayer + '" ');
+										if(temp.gui_layer_querylayer=='1')
+											controls.push('checked ');
+										if(temp.gui_layer_queryable!='1')
+											controls.push('disabled ');
+										controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
+										controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
+									}
+									if(wmsbuttons == 'true'&&metadatalink == 'true'){
+										controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');
+									}
+									addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls.join(""),[i,ii,iii]]],false,false,reverse=="true");
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	initialized=true;   
+}
+
+function initWmsCheckboxen(){
+	var hidden=0;
+	if( mb_mapObj.length > 0){
+		for(var i=0; i< mb_mapObj.length; i++){
+			if( mb_mapObj[i].elementName == mod_treeGDE_map){ 
+				for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
+					if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' ||  mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){          
+							var temp =  mb_mapObj[i].wms[ii].objLayer[iii];     
+							if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){                    
+								updateParent(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ii].wms_id);                  
+							}
+						}
+					}
+					else if(ii<= parseInt(openfolder)+hidden)
+						hidden++;
+				}
+				closeAll()
+				if(treeState!='')
+					setState(treeState);
+				else if(openfolder!='false')
+					setState(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ parseInt(openfolder)+hidden].wms_id);
+			}
+		}
+	}
+}

Modified: branches/print_dev/http/include/dyn_js.php
===================================================================
--- branches/print_dev/http/include/dyn_js.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/include/dyn_js.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -45,7 +45,7 @@
 			echo $row["var_name"]." = ".stripslashes($row["var_value"]).";\n";
 		}
 		else {
-			echo $row["var_name"]." = '".stripslashes($row["var_value"])."';\n";
+			echo $row["var_name"]." = '".str_replace(array('"',"'", "\r", "\n", "\0"), array('\"','\\\'','\r', '\n', '\0'), stripslashes($row["var_value"]))."';\n";
 		}
 	}
 }

Added: branches/print_dev/http/include/gui1_splash.php
===================================================================
--- branches/print_dev/http/include/gui1_splash.php	                        (rev 0)
+++ branches/print_dev/http/include/gui1_splash.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,6 @@
+<?php
+echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
+	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
+	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
+	"loading application '" . $gui_id . "'";
+?>

Modified: branches/print_dev/http/index.php
===================================================================
--- branches/print_dev/http/index.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/index.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -65,11 +65,11 @@
 		<br>
 		<a href="http://www.mapbender.org" target="_blank"><b>Homepage</b></a><br>
 		<br>
-		<a href="http://www.mapbender.org/index.php/Modules" target="_blank"><b>Documentation</b></a><br>
+		<a href="http://www.mapbender.org/index.php/Tutorials" target="_blank"><b>Documentation</b></a><br>
 		<br>
-		<a href="http://www.mapbender.org/index.php/Mapbender_Gallery" target="_blank"><b>Application Gallery</b></a><br>
+		<a href="http://www.mapbender.org/Mapbender_Gallery" target="_blank"><b>Application Gallery</b></a><br>
 		<br>
-		<a href="http://wms1.ccgis.de/mapbender2/frames/login.php?name=mb&password=mb&mb_user_myGui=mapbender" target="_blank"><b>Mapbender User Map</b></a><br>
+		<a href="http://wms.wheregroup.com/mapbender/frames/login.php?name=mb&password=mb&mb_user_myGui=mapbender_user" target="_blank"><b>Mapbender User Map</b></a><br>
 		<br>
 		<a href="http://mapbender.osgeo.org" target="_blank"><b>Mapbender on OSGeo</b></a><br>		
 		<br>

Modified: branches/print_dev/http/javascripts/geometry.js
===================================================================
--- branches/print_dev/http/javascripts/geometry.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/geometry.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -310,171 +310,153 @@
 };
 
 GeometryArray.prototype.importGeoJSON = function (geoJSON) {
-	var isFeatureCollection = false;
-	var featureCollectionEpsg = 4326;
-	var featureEpsg = 4326;
+	// you can pass either geoJSON or the evaluated geoJSON string
+	// for backwards compatibility
+	if (typeof(geoJSON) == 'string') {
+		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
 	//
-	for (var i in geoJSON) {
-		if (typeof(geoJSON[i]) != "function") {
-			switch (i) {
-				case "type":
-					isFeatureCollection = (geoJSON[i] == "FeatureCollection") ? true : false;
-					break;
-				case "crs":
-					if (geoJSON[i].type == "EPSG") {
-						featureCollectionEpsg = geoJSON[i].properties.code;
-						featureEpsg = geoJSON[i].properties.code;
-					}
-					break;
-				case "features":
-					if (isFeatureCollection) {
+	var isFeatureCollection = (geoJSON.type == "FeatureCollection") ? true : false;
+	if (isFeatureCollection) {
+		//
+		// FEATURE
+		//
+		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) {
+				//
+				// GEOMETRY
+				//
+				var currentGeometry = currentFeature.geometry;
+				var geometrytype = currentGeometry.type;
+				var coordinates = currentGeometry.coordinates;
+				switch (geometrytype) {
+					case "Point":
 						//
-						// FEATURE
+						// POINT
 						//
-						var featureArray = geoJSON[i];
-						for (var j = 0; j < featureArray.length; j++) {
-							featureEpsg = featureCollectionEpsg;
-							var currentFeature = featureArray[j];
-							var isFeature = false;
-
-							for (var k in currentFeature) {
-								if (typeof(currentFeature[k]) != "function") {
-									var geometrytype;
-
-									switch(k) {
-										case "type":
-											isFeature = (currentFeature[k] == "Feature") ? true : false;
-											break;
-
-										case "properties":
-											var properties = currentFeature[k];
-											
-											// GeometryCollections are NOT YET IMPLEMENTED
-											if (geometrytype != "GeometryCollection") {
-												for (var l in properties) {
-													if (typeof(properties[l]) != "function") {
-														this.get(-1).e.setElement(l, properties[l]);
-													}
-												}
-											}
-											break;
-										
-										case "crs":
-											if (currentFeature[k].type == "EPSG") {
-												featureEpsg = currentFeature[k].properties.code;
-											}
-											break;
-
-										case "geometry":
-											if (isFeature) {
-
-												//
-												// GEOMETRY
-												//
-												var currentGeometry = currentFeature[k];
-												for (var l in currentGeometry) {
-													
-													if (typeof(currentGeometry[l]) != "function") {
-														switch (l) {
-															case "type":
-																geometrytype = currentGeometry[l];
-																break;
-															case "coordinates":
-																var coordinates = currentGeometry[l];
-																switch (geometrytype) {
-																	case "Point":
-																		//
-																		// POINT
-																		//
-																		this.addMember(geomType.point);
-																		
-																		this.get(-1).addGeometry();
-																		this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
-																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
-																		this.close();
-																		break;
-																	
-																	case "LineString":
-																		//
-																		// LINESTRING
-																		//
-																		this.addMember(geomType.line);
-																		this.get(-1).addGeometry();
-																		for (var m = 0; m < coordinates.length; m++) {
-																			var currentPoint = coordinates[m];
-																			this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-																		}
-																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
-																		this.close();
-																		break;
-																		
-																	case "MultiLineString":
-																		//
-																		// MULTILINESTRING
-																		//
-																		this.addMember(geomType.line);
-																		for (var m = 0; m < coordinates.length; m++) {
-																			this.get(-1).addGeometry();
-																			var currentLine = coordinates[m];
-																			for (var n = 0; n < currentLine.length; n++) {
-																				var currentPoint = currentLine[n];
-																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-																			}
-																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
-																		}
-																		this.close();
-																		break;
-																	
-																	case "Polygon":
-																		//
-																		// POLYGON
-																		//
-																		this.addMember(geomType.polygon);
-																		for (var m = 0; m < coordinates.length; m++) {
-																			this.get(-1).addGeometry();
-																			var currentPolygon = coordinates[m];
-																			for (var n = 0; n < currentPolygon.length; n++) {
-																				var currentPoint = currentPolygon[n];
-																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-																			}
-																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
-																		}
-																		this.close();
-																		break;
-																		
-																	case "MultiPolygon":
-																		//
-																		// MULTIPOLYGON
-																		//
-																		this.addMember(geomType.polygon);
-																		for (var m = 0; m < coordinates.length; m++) {
-																			this.get(-1).addGeometry();
-																			var currentPolygon = coordinates[m];
-																			for (var n = 0; n < currentPolygon.length; n++) {
-																				var currentPoint = currentPolygon[n];
-																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-																			}
-																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
-																		}
-																		this.close();
-																		break;
-							
-																	case "GeometryCollection":
-																		var exc = new Mb_exception("Geometry: GeometryCollections are not yet supported");
-																		break;
-																}
-														}
-													}
-												}
-											}
+						this.addMember(geomType.point);
+						
+						this.get(-1).addGeometry();
+						this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
+						this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						this.close();
+						break;
+					
+					case "LineString":
+						//
+						// LINESTRING
+						//
+						this.addMember(geomType.line);
+						this.get(-1).addGeometry();
+						for (var m = 0; m < coordinates.length; m++) {
+							var currentPoint = coordinates[m];
+							this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+						}
+						this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						this.close();
+						break;
+						
+					case "MultiLineString":
+						//
+						// MULTILINESTRING
+						//
+						this.addMember(geomType.line);
+						for (var m = 0; m < coordinates.length; m++) {
+							this.get(-1).addGeometry();
+							var currentLine = coordinates[m];
+							for (var n = 0; n < currentLine.length; n++) {
+								var currentPoint = currentLine[n];
+								this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+							}
+							this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						}
+						this.close();
+						break;
+					
+					case "Polygon":
+						//
+						// POLYGON
+						//
+						this.addMember(geomType.polygon);
+						for (var m = 0; m < coordinates.length; m++) {
+							this.get(-1).addGeometry();
+							var currentPolygon = coordinates[m];
+							for (var n = 0; n < currentPolygon.length; n++) {
+								var currentPoint = currentPolygon[n];
+								this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+							}
+							this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						}
+						this.close();
+						break;
+						
+					case "MultiPolygon":
+						//
+						// MULTIPOLYGON
+						//
+						this.addMember(geomType.polygon);
+						for (var m = 0; m < coordinates.length; m++) {
+							this.get(-1).addGeometry();
+							var currentPolygon = coordinates[m];
+							for (var n = 0; n < currentPolygon.length; n++) {
+								var currentRing = currentPolygon[n];
+								if (n == 0) {
+									for (var p = 0; p < currentRing.length; p++) {
+										var currentPoint = currentRing[p];
+										this.getGeometry(-1, -1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
 									}
 								}
+								else {
+									var ring = new Geometry(geomType.polygon);
+									for (var p = 0; p < currentRing.length; p++) {
+										var currentPoint = currentRing[p];
+										ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+									}
+									ring.close();
+									this.getGeometry(-1,-1).addInnerRing(ring);				
+								}
 							}
+							this.getGeometry(-1,-1).setEpsg(featureEpsg);
 						}
+						this.close();
+						break;
+	
+					case "GeometryCollection":
+						var exc = new Mb_exception("Geometry: GeometryCollections are not yet supported");
+						break;
+				}
+			}
+			
+			if (currentFeature.properties) {
+				var properties = currentFeature.properties;
+				// GeometryCollections are NOT YET IMPLEMENTED
+				if (geometrytype != "GeometryCollection") {
+					for (var l in properties) {
+						if (typeof(properties[l]) != "function") {
+							this.get(-1).e.setElement(l, properties[l]);
+						}
 					}
+					this.get(-1).e.setElement("fid", currentFeature.id);
+				}
 			}
+			if (currentFeature.crs) {
+				if (currentFeature.crs.type == "EPSG") {
+					featureEpsg = currentFeature.crs.properties.code;
+				}
+				
+			}	
 		}
 	}
 }
@@ -1661,7 +1643,7 @@
 		mapframeHeight = mb_mapObj[mapObjInd].height;
 	});
 	var style = aStyle;
-	var canvas = new jsGraphics(aTagName, window.frames[mapframe]);
+	var canvas = new jsGraphics(aTagName, mb_mapObj[mapObjInd].getDomElement().frameName?window.frames[mapframe]:window);
 	canvas.setStroke(lineWidth);
 	mb_registerPanSubElement(aTagName);
 }

Modified: branches/print_dev/http/javascripts/jsTree.js
===================================================================
--- branches/print_dev/http/javascripts/jsTree.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/jsTree.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -647,6 +647,17 @@
 	
 	jst_cm.innerHTML = renderChildren(strData + "[1][5]", "menu", true)
 	
+	//TODO find a proper solution for this
+	var treeGDE = jst_cm.parentNode.parentNode;
+	if(treeGDE.id=="treeGDE"){
+		offX -= parseInt(treeGDE.style.left);
+		offY -= parseInt(treeGDE.style.top);
+		if(treeGDE.scrollTop)
+			offY += treeGDE.scrollTop;
+		if(treeGDE.scrollLeft)
+			offX += treeGDE.scrollLeft;
+	}
+	
 	jst_cm.style.top = offY + event.clientY
 	jst_cm.style.left = offX + event.clientX
 	jst_cm.style.visibility = ""

Modified: branches/print_dev/http/javascripts/map.js
===================================================================
--- branches/print_dev/http/javascripts/map.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/map.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -7,6 +7,27 @@
 var mb_end_y = 0;
 
 /**
+ * @class extent
+ * @param {float} minx
+ * @param {float} miny
+ * @param {float} maxx
+ * @param {float} maxy
+ * @return the extent as object
+ * @type Object
+ */
+function Extent(minx,miny,maxx,maxy) {
+	this.minx = parseFloat(minx);
+	this.miny = parseFloat(miny);
+	this.maxx = parseFloat(maxx);
+	this.maxy = parseFloat(maxy);
+	this.extentx = this.maxx - this.minx;
+	this.extenty = this.maxy - this.miny;
+	this.centerx = this.minx + this.extentx/2;
+	this.centery = this.miny + this.extenty/2;	
+	return this;
+}
+
+/**
  * @deprecated
  */
 function mb_execloadWmsSubFunctions(){
@@ -47,319 +68,67 @@
 eventAfterInit.register(function () {
 	// performs a map request for each map frame
 	for (var i = 0; i < mb_mapObj.length; i++){
-		setMapRequest(mb_mapObj[i].frameName);
+		setMapRequest(mb_mapObj[i].elementName);
 	}      	
 });
 
-eventBeforeFeatureInfo.register(function() {
-	for (var j=0; j<mb_mapObj.length; j++) {
-		var mapObj = mb_mapObj[j];
-
-		//
-		// set list of visible layers, active querylayers 
-		// and styles for each WMS in this map
-		//
-		
-		var cnt_layers;
-		var cnt_querylayers;
-		var styles;
-		var layers;
-		var querylayers = "";
-		for(i=0; i< mapObj.wms.length; i++){
-			cnt_layers = 0;
-			cnt_querylayers = 0;
-			styles = "";
-			layers = "";
-			querylayers = "";
-	
-			for(var ii=0; ii<mapObj.wms[i].objLayer.length; ii++){
-				// layer is visible and not root layer
-				if(mapObj.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
-					if(cnt_layers > 0){
-						layers += ","; styles += ","; 
-					}
-					layers += wms[i].objLayer[ii].layer_name; 
-					styles += ""; 
-					cnt_layers++;
-				}            
-				// layer is queryable and not root layer
-				if(mapObj.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
-					if(cnt_querylayers > 0){
-						querylayers += ",";
-					}
-					querylayers += wms[i].objLayer[ii].layer_name; 
-					cnt_querylayers++;
-				}                          
-			}
-			mapObj.layers[i] = layers;
-			mapObj.styles[i] = styles;
-			mapObj.querylayers[i] = querylayers;
-		}
-	}
-});
-
 function mb_registerMapObj(frameName, elementName,wms_index,width, height){
 	mb_mapObj.push(new mb_mapObj_const(frameName, elementName, width, height, wms_index));    
 }
 
-
+/**
+ * @deprecated
+ */
 function mb_mapObjremoveWMS(objind,wmsind){
-	var wms_ID = null;
-	var i;
-	var new_wmsarray = [];
-	var new_layerarray = [];
-	var new_querylayerarray = [];
-	var new_stylesarray = [];
-	var new_mapURLarray = [];
-	
-	for	(i=0;i<mb_mapObj[objind].wms.length; i++){
-		if(i != wmsind){
-			new_wmsarray[new_wmsarray.length] = mb_mapObj[objind].wms[i];
-			new_layerarray[new_layerarray.length] = mb_mapObj[objind].layers[i];
-			new_querylayerarray[new_querylayerarray.length] = mb_mapObj[objind].querylayers[i];
-			new_stylesarray[new_stylesarray.length] = mb_mapObj[objind].styles[i];
-			new_mapURLarray[new_mapURLarray.length] = mb_mapObj[objind].mapURL[i];
-		}
-		else {
-			wms_ID = mb_mapObj[objind].wms[i].wms_id;
-		}
-	}
-	mb_mapObj[objind].wms = new_wmsarray; 
-	mb_mapObj[objind].layers = new_layerarray; 
-	mb_mapObj[objind].querylayers = new_querylayerarray; 
-	mb_mapObj[objind].styles = new_stylesarray; 
-	mb_mapObj[objind].mapURL = new_mapURLarray;
+	new Mb_warning("The function mb_mapObjremoveWMS is deprecated.");
+	return mb_mapObj[objind].removeWms(wmsind);
+};
 
-	var another_new_wmsarray = [];
-	for	(i=0;i<wms.length; i++){
-		if(wms[i].wms_id != wms_ID){
-			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
-		}
-	}
-	wms = another_new_wmsarray; 
-}
-function setExtent(width,height,epsg){
-   for(var i=0; i < wms[0].gui_epsg.length; i++){
-      if(wms[0].gui_epsg[i] == epsg){      
-         var bbox_minx = parseFloat(wms[0].gui_minx[i]);
-         var bbox_miny = parseFloat(wms[0].gui_miny[i]);
-         var bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
-         var bbox_maxy = parseFloat(wms[0].gui_maxy[i]);     
-   
-         var extenty = bbox_maxy - bbox_miny;
-         var extentx = bbox_maxx - bbox_minx;
-
-         var relation_px_x = width / height;
-         var relation_px_y = height / width;
-         var relation_bbox_x = extentx / extenty;         
-         var centerx = bbox_minx + (extentx/2);
-         var centery = bbox_miny + (extenty/2);
-         if(relation_bbox_x <= relation_px_x){                
-                bbox_minx = centerx - relation_px_x * extenty / 2;
-                bbox_maxx = centerx + relation_px_x * extenty / 2;
-         }
-        
-         if(relation_bbox_x > relation_px_x){                
-                bbox_miny = centery - relation_px_y * extentx / 2;
-                bbox_maxy = centery + relation_px_y * extentx / 2;
-         }
-        return bbox_minx  +","+ bbox_miny +","+ bbox_maxx  +","+ bbox_maxy;
-     }
-   }
-}
+/**
+ * @deprecated
+ */
 function setMapRequest(frameName){
-	var functionName = 'setMapRequest';
-
-	var ret = eventBeforeMapRequest.trigger({frameName:frameName}, "AND");
-	if (ret === false) {
-		return true;
-	}
-
-	var ts = mb_timestamp();
-	var myMapId = [];
-	for (var i=0; i < mb_mapObj.length; i++){
-		var currentMapObject = mb_mapObj[i];
-		if (currentMapObject.frameName != frameName) {
-			continue;
-		}
-		
-		var newMapRequest = "";
-		for (var ii = 0; ii < currentMapObject.wms.length; ii++){
-			var currentWms = currentMapObject.wms[ii];
-			if (!(currentWms.gui_wms_visible > 0)) {
-				continue;
-			}
-			myMapId.push("map_"+ii);
-			
-			newMapRequest += getLayerHtmlCode(frameName, i, ii);
-			
-		}
-		writeTag(mb_mapObj[i].frameName, mb_mapObj[i].elementName, newMapRequest);
-	}
-	eventAfterMapRequest.trigger({
-		"frameName": frameName,
-		"myMapId": myMapId.join(",")
-	});
-/*
-	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
-		eval(mb_MapRequestSubFunctions[i]);
-	}
-*/
+	new Mb_warning("The function setMapRequest is deprecated.");
+	var ind = getMapObjIndexByName(frameName);	
+	return mb_mapObj[ind].setMapRequest();
 }
 
-function getLayerHtmlCode (frameName, i, ii) {
-	var currentMapObject = mb_mapObj[i];
-	var currentWms = currentMapObject.wms[ii];
-
-	var myDivId = "div_" + ii;          
-	var myMapId = "map_" + ii;
-	//disable Layer which are out of scale
-	var validLayers = mb_checkScale(frameName, i, ii);
-	var layerNames = validLayers.toString();
-
-	var newMapURL = false;
-	var opacityString = "";
-	if (currentMapObject.layers[ii] !== "" && layerNames !== ''){
-		// get map URL
-		newMapURL = currentMapObject.getMapUrl(i, ii);
-
-		var currentOpacity = currentWms.gui_wms_mapopacity;
-		if (currentOpacity != 1) {
-			opacityString += "opacity:" + currentOpacity + "; ";
-			opacityString += "Filter: Alpha(Opacity=" + currentOpacity*100 + "); ";
-			opacityString += "-moz-opacity:" + currentOpacity + " ; ";
-			opacityString += "-khtml-opacity:" + currentOpacity;
-		}
-	}
-
-	var imageString = "";
-	if (newMapURL) {
-		imageString = "<img id='"+myMapId+"' name='mapimage' ";
-		imageString += "src='" + newMapURL + "' ";
-		imageString += "width='"+currentMapObject.width+"' ";
-		imageString += "height='"+currentMapObject.height+"' ";
-		imageString += "border='0'>";	
-	}
-
-	var newMapRequest = "<div id='"+myDivId+"' ";
-	newMapRequest += "style=\"position:absolute; top:0px; left:0px; ";
-	newMapRequest += "z-index:" + ii + ";" + opacityString + "\">";
-	newMapRequest += imageString;
-	newMapRequest += "</div>";   
-
-	currentMapObject.mapURL[ii]= newMapURL;	
-	currentWms.mapURL = newMapURL;
-
-	if (mb_log && currentWms.mapURL) {
-		var tmp = eval(mb_log + "('" +newMapURL + "','" + ts + "')");
-	}
-
-	return newMapRequest;
-}
-
+/**
+ * @deprecated
+ */
 function setSingleMapRequest(frameName,wms_id){
-	var functionName = 'setSingleMapRequest';
-	
-	eventBeforeMapRequest.trigger({frameName:frameName});
-
-	var ts = mb_timestamp();	
-
-	for(i = 0; i < mb_mapObj.length; i++){
-		var currentMapObject = mb_mapObj[i];
-		if (currentMapObject.frameName != frameName) {
-			continue;
-		}
-		
-		for (var ii=0; ii < currentMapObject.wms.length; ii++){ 
-			var currentWms = currentMapObject.wms[ii];
-			if (currentWms.wms_id != wms_id) {
-				continue;
-			}
-
-			var newMapRequest = getLayerHtmlCode(frameName, i, ii);
-
-			if (mb_log) {
-				var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
-			}
-			var myDivId = "div_" + ii;          
-			writeTag(currentMapObject.frameName, myDivId, newMapRequest);
-			var myMapId = "map_" + ii;
-			eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
-			return true;
-		}      
-	}  
-	return false; 
+	new Mb_warning("The function setSingleMapRequest is deprecated.");
+	var ind = getMapObjIndexByName(frameName);	
+	return mb_mapObj[ind].setSingleMapRequest(wms_id);
 }
 
-
+/**
+ * @deprecated
+ */
 function mb_restateLayers(frameName,wms_id){
-	//alert(frameName + " / " + wms_id);
+	new Mb_warning("The function mb_restateLayers is deprecated.");
 	var ind = getMapObjIndexByName(frameName);	
-	for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-		if(mb_mapObj[ind].wms[i].wms_id == wms_id){
-			var cnt_layers = 0;
-			var cnt_querylayers = 0;
-			var layers = "";
-			var styles = "";
-			var querylayers = "";
-			for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
-				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
-					if(cnt_layers > 0){layers += ","; styles += ","; }
-					layers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name;
-					//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name); 
-					styles += ""; 
-					cnt_layers++;
-				}            
-				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
-					if(cnt_querylayers > 0){querylayers += ",";}
-					querylayers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name; 
-					cnt_querylayers++;
-				}
-			}
-			mb_mapObj[ind].layers[i] = layers;
-			mb_mapObj[ind].querylayers[i] = querylayers;
-			mb_mapObj[ind].styles[i] = styles;
-		}
-	}
+	mb_mapObj[ind].restateLayers(wms_id);
 }
 
+/**
+ * @deprecated
+ */
 function mb_checkScale(frameName,mObj,wmsObj){
-	var thisLayer = mb_mapObj[mObj].layers[wmsObj].split(",");
-	var thisScale = mb_getScale(frameName);  
-	var str_layer = "";
-	var cnt_layer = 0;
-	for(var i=0; i<mb_mapObj[mObj].wms[wmsObj].objLayer.length; i++){  
-		var myLayername = mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_name;
-		var myMinscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_minscale;
-		var myMaxscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_maxscale;
-		for(var ii=0; ii<thisLayer.length; ii++){
-			var minscaleOK = false;
-			var maxscaleOK = false;   
-			if(thisLayer[ii] == myLayername){
-				if(myMinscale === 0 || thisScale >= myMinscale){minscaleOK = true;}
-				if(myMaxscale === 0 || thisScale <= myMaxscale){maxscaleOK = true;}
-				if(maxscaleOK === true && minscaleOK === true  && !mb_mapObj[mObj].wms[wmsObj].objLayer[i].has_childs){
-					if(cnt_layer > 0){str_layer += ","; }//str_styles += ","; str_titles += ",";str_parent += ","; str_legendurls += ",";}
-					str_layer += thisLayer[ii];
-					cnt_layer++;
-				}
-			}
-		}
-	}
-	var str_layerstyles = [];
-	str_layerstyles[0] = str_layer;
-	return str_layerstyles;
+	new Mb_warning("The function mb_checkScale is deprecated.");
+	return mb_mapObj[mObj].checkScale(wmsObj);
 }
 
+/**
+ * @deprecated
+ */
 function setFeatureInfoRequest(fName,x,y, path) {
+	new Mb_warning("The function setFeatureInfoRequest is deprecated.");
+
+/*
 	var functionName = 'setFeatureInfoRequest';
 	var ts = mb_timestamp();
 	eventBeforeFeatureInfo.trigger({"fName":fName});
-/*
-	for(var i=0; i<mb_FeatureInfoPreFunctions.length; i++){
-		eval(mb_FeatureInfoPreFunctions[i]);
-	}   
-*/
 	var cnt_fi = 0;
 	for(i=0; i<mb_mapObj.length; i++){
 		if(mb_mapObj[i].frameName == fName){
@@ -460,305 +229,158 @@
    	if(cnt_fi === 0){
 		alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
 	}
+*/
 }
 
-/*
- * global function to zoom a mapobject
- * 
- * use: mb_mapObj.zoom() {@link mb_mapObj_const#zoom}
+/**
  * @deprecated
- * 
  */
 function zoom(frameName,in_, factor,x,y) {
+	new Mb_warning("The function zoom is deprecated.");
 	var obj = getMapObjByName(frameName);
-	if(x && y){
-		obj.zoom(in_, factor, x, y);
-	}
-	else{
-		obj.zoom(in_, factor, false, false);
-	}	
-	setMapRequest(frameName);
+	return obj.zoom(in_, factor, x, y);
 }
-function mb_panMap(frameName,dir){
-   var ind = getMapObjIndexByName(frameName);
-   var arrayBBox = mb_mapObj[ind].extent.split(",");
-   var minx = parseFloat(arrayBBox[0]);
-   var miny = parseFloat(arrayBBox[1]);
-   var maxx = parseFloat(arrayBBox[2]);
-   var maxy = parseFloat(arrayBBox[3]);
-   var xtentx = parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]);
-   var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
 
-   if(dir == "NW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "N"){miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "NE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "W"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2);}
-   if(dir == "E"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2);}
-   if(dir == "SW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-   if(dir == "S"){miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-   if(dir == "SE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-  mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-  setMapRequest(frameName);
+/**
+ * @deprecated
+ */
+function mb_panMap(frameName,dir){
+	new Mb_warning("The function mb_panMap is deprecated.");
+	var obj = getMapObjByName(frameName);
+	return obj.pan(dir);
 }
 
+/**
+ * @deprecated
+ */
 function handleSelectedLayer (frameName, wms_title, layerName, type, status) {
-//	alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
-//	type = {visible || querylayer] status = {0 || 1}
-	for (var i=0; i < mb_mapObj.length; i++) {
-		if (mb_mapObj[i].frameName == frameName) {
-			var cnt_layer = 0;
-			var str_layer = "";
-			var myMapObj = i;
-			for (var ii = 0; ii < mb_mapObj[i].wms.length; ii++) {
-				if (mb_mapObj[i].wms[ii].wms_title == wms_title) { //ii is true
-					var myWMS = ii; 
-					if (type == "visible") {
-						var arrayLayer = mb_mapObj[i].layers[ii].split(",");
-					}
-					if (type == "querylayer") {
-						var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");
-					}
-					for (var iii = 1; iii < mb_mapObj[i].wms[ii].objLayer.length; iii++) {
-						var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
-						if (type == "querylayer") {
-							if (layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;                   
-							}
-						}
-						else if (type == "visible") {
-							if (layer_name == layerName && status == 1) {
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;                   
-							}
-						}
-						for (var iiii = 0; iiii < arrayLayer.length; iiii++) {
-							if (layer_name == arrayLayer[iiii] && layer_name != layerName) {
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;             
-							}
-						}
-					}
-				}   
-			}         
+	new Mb_warning("The function handleSelectedLayer is deprecated.");
+	var obj = getMapObjByName(frameName);
+	for (var ii = 0; ii < obj.wms.length; ii++) {
+		if (obj.wms[ii].wms_title == wms_title) {
+			obj.wms[ii].handleLayer(layerName, type, status);
+            obj.restateLayers(obj.wms[ii].wms_id);
 		}
 	}
-	if (type == "visible") {
-		mb_mapObj[myMapObj].layers[myWMS] = str_layer;
-		var array_str_layer = str_layer.split(",");
-		var str_styles = "";
-		for (var cnt=0; cnt < array_str_layer.length; cnt++) {
-			if (cnt > 0) {
-				str_styles += ",";
-			}
-			str_styles += "";
-		}
-		mb_mapObj[myMapObj].styles[myWMS] = str_styles;
-	}
-	if (type == "querylayer") {
-		mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;
-	}
-/*
-	if(type == 'visible'){
-		setSingleMapRequest(frameName,wms_title);
-	}
-*/
 }
 
-function handleSelectedLayer_array(mapObj, array_wms, array_layer, type, status){
-	//alert(mapObj+" / "+array_wms[0]+" / "+ array_layer[0]+" / "+ type+" / "+ status);
-	var ind = getMapObjIndexByName(mapObj);
-	for(var j=0; j<array_wms.length; j++){
-		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-			if(mb_mapObj[ind].wms[i].wms_id == array_wms[j]){
-				var check = false;
-				for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
-					if(mb_mapObj[ind].wms[i].wms_id == array_wms[j] && mb_mapObj[ind].wms[i].objLayer[ii].layer_name == array_layer[j]){
-						if(type == "visible"){
-							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible = parseInt(status, 10);
-							//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name);
-							check = true;
-						}
-                        if(type == "querylayer" && (mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == "1" || mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == 1)){
-							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer = parseInt(status, 10);
-						}
-					}
-				}
-                mb_restateLayers(mapObj, array_wms[j]);
-                //alert('restate');
-                /*
-                * hier noch checken, welche wms sich geaendert haben und disctinct eine singleRequest aufrufen:
-                */ 
-                if(check === true){					
-                    
-                    if(mb_mapObj[ind].wms[i].gui_wms_visible == 1){
-						setSingleMapRequest(mapObj,mb_mapObj[ind].wms[i].wms_id);
-                        //alert('sSMR');
-					}
-				}
+/**
+ * @deprecated
+ */
+function handleSelectedLayer_array(frameName, array_wms, array_layer, type, status){
+	new Mb_warning("The function handleSelectedLayer_array is deprecated.");
+	var obj = getMapObjByName(frameName);
+	changedWms = [];
+	for (var i = 0; i < array_wms.length; i++) {
+		var wmsWillBeUpdated = false;
+		for (var ii = 0; ii < obj.wms.length; ii++) {
+			if (obj.wms[ii].wms_id == array_wms[i]) {
+				obj.wms[ii].handleLayer(array_layer[i], type, status);
+				obj.restateLayers(obj.wms[ii].wms_id);
+				if (!wmsWillBeUpdated) {
+					changedWms.push(obj.wms[ii].wms_id);
+					wmsWillBeUpdated = true;
+				}				
 			}
 		}
 	}
+	for (aWms in changedWms) {
+		obj.setSingleMapRequest(aWms);
+	}
 }
 
+/**
+ * @deprecated
+ */
 function makeClickPos2RealWorldPos(frameName, myClickX, myClickY) {
+	new Mb_warning("The function makeClickPos2RealWorldPos is deprecated.");
 	var ind = getMapObjIndexByName(frameName);
-	var width = parseInt(mb_mapObj[ind].width, 10);
-	var height = parseInt(mb_mapObj[ind].height, 10);
-	var arrayBBox = mb_mapObj[ind].extent.split(",");
-	var minX = parseFloat(arrayBBox[0]);
-	var minY = parseFloat(arrayBBox[1]);
-	var maxX = parseFloat(arrayBBox[2]);
-	var maxY = parseFloat(arrayBBox[3]);
-	var deltaX = (maxX - minX)/width;
-	var deltaY = (maxY - minY)/height;
-	if(deltaX > 0){
-		var roundx = 1/Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
-	}
-	else{
-		var roundx =  Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
-	}
-	if(deltaY > 0){
-		var roundy = 1/Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
-	}
-	else{
-		var roundy =  Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
-	}	
-	var xtentx = maxX - minX;
-	var xtenty =  maxY - minY;
-	var posX = parseFloat(minX + (myClickX / width) * xtentx);
-	var posY = parseFloat(maxY - (myClickY / height) * xtenty);
-	posX = Math.round(posX * roundx)/roundx;
-	posY = Math.round(posY * roundy)/roundy;
-	return [posX, posY];
+	var newPoint = mb_mapObj[ind].convertPixelToReal(new Point(myClickX, myClickY));
+	return [newPoint.x, newPoint.y]
 }
 
+/**
+ * @deprecated
+ */
 function makeRealWorld2mapPos(frameName,rw_posx, rw_posy){
-   var ind = getMapObjIndexByName(frameName);
-   var mpObj = mb_mapObj[ind]; 
-   var arrayBBox = mpObj.extent.split(",");
-   var minX = parseFloat(arrayBBox[0]);
-   var minY = parseFloat(arrayBBox[1]);
-   var maxX = parseFloat(arrayBBox[2]);
-   var maxY = parseFloat(arrayBBox[3]);
-   return [Math.round((rw_posx - minX)*mpObj.width/(maxX - minX)), Math.round((maxY - rw_posy)*mpObj.height/(maxY - minY))];
+	new Mb_warning("The function makeRealWorld2mapPos is deprecated.");
+	var ind = getMapObjIndexByName(frameName);
+	var aPoint = mb_mapObj[ind].convertRealToPixel(new Point(rw_posx, rw_posy)); 
+	return [aPoint.x, aPoint.y];
 }
 
 // function for object-identification 
-function getMapObjIndexByName(frameName){
+function getMapObjIndexByName(elementName){
 	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == frameName){
+		if(mb_mapObj[i].elementName == elementName){
 			return i;
 		}
 	}   
 }
-function getMapObjByName(frameName){
+function getMapObjByName(elementName){
 	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == frameName){
+		if(mb_mapObj[i].elementName == elementName){
 			return mb_mapObj[i];
 		}
 	}
 	return false;
 }
+
+/**
+ * @deprecated
+ */
 function getWMSIDByTitle(frameName,wms_title){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
-         //return i;
-         return mb_mapObj[ind].wms[i].wms_id;
-      }
-   }
+	new Mb_warning("The function getWMSIDByTitle is deprecated.");
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].getWmsIdByTitle(wms_title);
 }
+
+/**
+ * @deprecated
+ */
 function getWMSIndexById(frameName,wms_id){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_id == wms_id){
-         return i;
-      }
-   }
+	new Mb_warning("The function getWMSIndexById is deprecated.");
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].getWmsIndexById(wms_id);
 }
-//scale
-function mb_getScale(frameName) {
 
-	var myScale = eventBeforeGetScale.trigger({"frameName":frameName});
-/*
-   for(var i=0; i<mb_GetScalePreFunctions.length; i++){
-		var myScale = eval(mb_GetScalePreFunctions[i]);
-	}
-*/
-   if(typeof(myScale) == "number"){
-      var Y_str = myScale;
-   }
-   else{
-      var ind = getMapObjIndexByName(frameName);
-      var arrayBBox = mb_mapObj[ind].extent.split(",");
-      var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
-      var scaleY = (xtenty / mb_mapObj[ind].height) *(mb_resolution * 100);
-      if (scaleY<1){
-      	var Y_str = scaleY;
-      }else{
-      	var Y_str = Math.round(scaleY);
-      }
-   }   
-   return Y_str;   
-}
-
+/**
+ * @deprecated
+ */
 function mb_repaintScale(frameName, x, y, scale){
-   var ind = getMapObjIndexByName(frameName);
-   if(x === null && y === null){
-      var arrayBBox = mb_mapObj[ind].extent.split(",");
-      x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
-      y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
-   }
-   var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
-   var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
-   var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
-   var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
-   mb_repaint(frameName,minx, miny, maxx, maxy);
+	new Mb_warning("The function mb_repaintScale is deprecated.");
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].repaintScale(x, y, scale);
 }
+
+/**
+ * @deprecated
+ */
 function mb_repaint(frameName,minx,miny,maxx,maxy){
-   var ind = getMapObjIndexByName(frameName);
-   mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-   setMapRequest(frameName);
+	new Mb_warning("The function mb_repaint is deprecated.");
+	var ind = getMapObjIndexByName(frameName);
+	mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+	setMapRequest(frameName);
 }
-/*
+
+/**
+ * @deprecated 
+ */
+function mb_getScale(frameName) {
+	new Mb_warning("The function mb_getScale is deprecated.");
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].getScale();
+}
+
+/**
  * converts the extent of the mapobject so that the maximum	extent will be displayed {@link mb_mapObj_const#calculateExtent}
  * use: mb_mapObj.calculateExtent
  * @deprecated
  * 
  */
 function mb_calculateExtent(frameName,minx,miny,maxx,maxy){
+  new Mb_warning("The function mb_calculateExtent is deprecated.");
   var map = getMapObjByName(frameName);
   var extent = new Extent(minx,miny,maxx,maxy);
   map.calculateExtent(extent);
-}
-/*
- * @class extent
- * @param {float} minx
- * @param {float} miny
- * @param {float} maxx
- * @param {float} maxy
- * @return the extent as object
- * @type Object
- */
-function Extent(minx,miny,maxx,maxy){
-	this.minx = parseFloat(minx);
-	this.miny = parseFloat(miny);
-	this.maxx = parseFloat(maxx);
-	this.maxy = parseFloat(maxy);
-	this.extentx = this.maxx - this.minx;
-	this.extenty = this.maxy - this.miny;
-	this.centerx = this.minx + this.extentx/2;
-	this.centery = this.miny + this.extenty/2;	
-	return this;
-}
-
+}
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/map.php
===================================================================
--- branches/print_dev/http/javascripts/map.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/map.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -55,13 +55,13 @@
 echo "var mb_myLogin = '".$_SESSION["mb_login"]."';";
 echo "var mb_styleID = '".md5($_SESSION["mb_user_name"])."';";
 echo "var mb_myBBOX = '".$_SESSION["mb_myBBOX"]."';";
-echo "var mapbender = {};";
-echo "mapbender.locale = '" . $_SESSION["mb_locale"] . "';";
-echo "mapbender.languageId = '" . $_SESSION["mb_lang"] . "';";
-echo "mapbender.versionNumber = '" . MB_VERSION_NUMBER . "';";
-echo "mapbender.versionAppendix = '" . MB_VERSION_APPENDIX . "';";
-echo "mapbender.releaseDate = new Date(".date("Y",MB_RELEASE_DATE).",".date("n",MB_RELEASE_DATE).",".date("j",MB_RELEASE_DATE).");";
-echo "mapbender.zoomMousewheel = " . ZOOM_MOUSEWHEEL . ";";
+echo "var Mapbender = {};";
+echo "Mapbender.locale = '" . $_SESSION["mb_locale"] . "';";
+echo "Mapbender.languageId = '" . $_SESSION["mb_lang"] . "';";
+echo "Mapbender.versionNumber = '" . MB_VERSION_NUMBER . "';";
+echo "Mapbender.versionAppendix = '" . MB_VERSION_APPENDIX . "';";
+echo "Mapbender.releaseDate = new Date(".date("Y",MB_RELEASE_DATE).",".date("n",MB_RELEASE_DATE).",".date("j",MB_RELEASE_DATE).");";
+echo "Mapbender.zoomMousewheel = " . ZOOM_MOUSEWHEEL . ";";
 echo "var owsproxy = '".OWSPROXY."';";
 echo "var global_mb_log_js = '".LOG_JS."';";
 echo "var global_mb_log_level = '".LOG_LEVEL."';";
@@ -142,8 +142,12 @@
 //
 // Load JavaScript files of GUI elements
 //
+
+$modulesNotRelyingOnGlobalsArray = explode(",", MODULES_NOT_RELYING_ON_GLOBALS);
+
+echo "\nMapbender.Modules = {};\n";
 $mb_sql = "SELECT DISTINCT e_js_file, e_id, e_src, e_target, e_pos, " .
-		"e_requires FROM gui_element WHERE e_public = 1 AND " .
+		"e_url, e_left, e_top, e_width, e_height, e_requires FROM gui_element WHERE e_public = 1 AND " .
 		"fkey_gui_id = $1 ORDER BY e_pos";
 $mb_v = array($gui_id);
 $mb_t = array("s");
@@ -158,7 +162,22 @@
 			$e_target = explode(",",$row_js["e_target"]);
 			$currentFile = trim($jsArray[$i]);
 			if (file_exists($currentFile)) {
-				require_once($currentFile);
+				if (in_array($e_id, $modulesNotRelyingOnGlobalsArray)) {
+					echo "Mapbender.Modules." . $e_id . " = {
+						init : function () {\n";
+					require_once($currentFile);
+					echo "},\n";
+					echo "id:'".$row_js["e_id"]."',";
+					echo "url:'".$row_js["e_url"]."',";
+					echo "top:'".$row_js["e_top"]."',";
+					echo "left:'".$row_js["e_left"]."',";
+					echo "width:'".$row_js["e_width"]."',";
+					echo "height:'".$row_js["e_height"]."'";
+					echo "};\n";
+				}
+				else {
+					require_once($currentFile);
+				}
 			}
 			else {
 				$e = new mb_exception("Javascript not found: " . $currentFile);
@@ -169,3 +188,8 @@
 	}
 }
 ?>
+eventBeforeInit.register(function () {
+	for (var module in Mapbender.Modules) {
+		Mapbender.Modules[module].init();
+	}
+});

Modified: branches/print_dev/http/javascripts/map_obj.js
===================================================================
--- branches/print_dev/http/javascripts/map_obj.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/map_obj.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -6,6 +6,93 @@
 var mb_mapObj = [];
 
 function mb_mapObj_const(frameName, elementName, width, height, wms_index){
+
+	/**
+	 * set the extent of the wms
+	 */
+	this.setExtent = function(minx, miny, maxx, maxy){
+		this.extent = String(minx) + "," + String(miny) + "," + String(maxx) + "," + String(maxy);
+	};
+	
+	/**
+	 * get the width of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return width of the mapObj
+	 * @type integer
+	 */
+	this.getWidth = function(){
+		return parseInt(this.width, 10);
+	};
+	
+	/**
+	 * set the width of the mapObj
+	 *
+	 * @param {integer} widht the width of the mapObj
+	 */
+	this.setWidth = function(width){
+		this.width = parseInt(width, 10);
+
+		//apply new width
+		if(this.frameName){
+			document.getElementById(this.frameName).style.width = this.width;
+		}
+		var domElement = this.getDomElement();
+		domElement.style.width = this.width;
+	};
+	
+	/**
+	 * get the height of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return width of the mapObj
+	 * @type integer
+	 */
+	this.getHeight = function(){
+		return parseInt(this.height, 10);
+	};
+	
+	this.getDomElement = function(){
+		if(this.frameName){
+			return window.frames[this.frameName].document.getElementById(this.elementName);
+		}
+		return document.getElementById(this.elementName);
+	}
+	
+	/**
+	 * set the height of the mapObj
+	 *
+	 * @param {integer} height the height of the mapObj
+	 */
+	this.setHeight = function(height){
+		this.height = parseInt(height, 10);
+		//apply new height
+		if(this.frameName){
+			document.getElementById(this.frameName).style.height = this.height;
+		}
+		var domElement = this.getDomElement();
+		domElement.style.width = this.width;
+	};
+	
+	/**
+	 * converts the extent of the mapobject so that the maximum	extent will be displayed
+	 */
+	this.calculateExtent = function(ext){
+		var relation_px_x = this.getWidth() / this.getHeight();
+		var relation_px_y = this.getHeight() / this.getWidth();
+		var relation_bbox_x = ext.extentx / ext.extenty;
+		if (relation_bbox_x <= relation_px_x) {
+			ext.minx = ext.centerx - relation_px_x * ext.extenty / 2;
+			ext.maxx = ext.centerx + relation_px_x * ext.extenty / 2;
+		}
+		if (relation_bbox_x > relation_px_x) {
+			ext.miny = ext.centery - relation_px_y * ext.extentx / 2;
+			ext.maxy = ext.centery + relation_px_y * ext.extentx / 2;
+		}
+		this.setExtent(ext.minx, ext.miny, ext.maxx, ext.maxy);
+		return ext;
+	};
+	
 	this.width = width;
 	this.height = height;
 	this.frameName = frameName;
@@ -14,16 +101,16 @@
 	this.styles = [];
 	this.querylayers = [];
 	this.geom = "";
-	this.gml = ""; 
+	this.gml = "";
 	this.wms = [];
-
+	
 	// 
 	// Add pointers to WMS objects which are in this map.
 	// If wms_index is set (=map is overview), only this 
 	// WMS is being pointed to.
 	//
 	var index = 0;
-	for(var i=0; i < wms.length; i++){
+	for (var i = 0; i < wms.length; i++) {
 		var isValidWms = (wms_index === null) || (wms_index == i);
 		if (isValidWms) {
 			this.wms[index] = wms[i];
@@ -31,7 +118,7 @@
 			index++;
 		}
 	}
-
+	
 	//
 	// set list of visible layers, active querylayers 
 	// and styles for each WMS in this map
@@ -41,89 +128,64 @@
 	var styles;
 	var layers;
 	var querylayers = "";
-	for(i=0; i< this.wms.length; i++){
+	for (i = 0; i < this.wms.length; i++) {
 		cnt_layers = 0;
 		cnt_querylayers = 0;
 		styles = "";
 		layers = "";
 		querylayers = "";
-
-		for(var ii=0; ii<this.wms[i].objLayer.length; ii++){
+		
+		for (var ii = 0; ii < this.wms[i].objLayer.length; ii++) {
 			// layer is visible and not root layer
-			if(this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
-				if(cnt_layers > 0){
-					layers += ","; styles += ","; 
+			if (this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii > 0) {
+				if (cnt_layers > 0) {
+					layers += ",";
+					styles += ",";
 				}
-				layers += wms[i].objLayer[ii].layer_name; 
-				styles += ""; 
+				layers += wms[i].objLayer[ii].layer_name;
+				styles += "";
 				cnt_layers++;
-			}            
+			}
 			// layer is queryable and not root layer
-			if(this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
-				if(cnt_querylayers > 0){
+			if (this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii > 0) {
+				if (cnt_querylayers > 0) {
 					querylayers += ",";
 				}
-				querylayers += wms[i].objLayer[ii].layer_name; 
+				querylayers += wms[i].objLayer[ii].layer_name;
 				cnt_querylayers++;
-			}                          
+			}
 		}
 		this.layers[i] = layers;
 		this.styles[i] = styles;
 		this.querylayers[i] = querylayers;
 	}
-   
+	
 	this.epsg = wms[0].gui_wms_epsg;
-	this.extent = setExtent(this.width,this.height,this.epsg);
+	var bbox_minx, bbox_miny, bbox_maxx, bbox_maxy;
+	
+	for (var i = 0; i < wms[0].gui_epsg.length; i++) {
+		if (this.epsg == wms[0].gui_epsg[i]) {
+			bbox_minx = parseFloat(wms[0].gui_minx[i]);
+			bbox_miny = parseFloat(wms[0].gui_miny[i]);
+			bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
+			bbox_maxy = parseFloat(wms[0].gui_maxy[i]);
+		}
+	}
+	var wmsExtent = new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
+	
+	this.calculateExtent(wmsExtent);
+
 	this.mapURL = [];
-	var styleTag = window.frames[this.frameName].document.getElementById(this.elementName).style;
-	styleTag.width = this.width;
-	styleTag.height = this.height;   
+	var domElement = this.getDomElement();
+	domElement.style.width = this.width;
+	domElement.style.height = this.height;   
    
-	/**
-	 * get the width of the mapObj
-	 *
-	 * @member mb_mapObj_const
-	 * @return width of the mapObj  
-	 * @type integer  
-	 */
-	this.getWidth = function(){
-		return parseInt(this.width, 10);
-	};
 	
 	/**
-	 * set the width of the mapObj
-	 *
-	 * @param {integer} widht the width of the mapObj  
-	 */
-	this.setWidth = function(width){
-		this.width = parseInt(width, 10);
-	};
-	
-	/**
-	 * get the height of the mapObj
-	 *
-	 * @member mb_mapObj_const
-	 * @return width of the mapObj  
-	 * @type integer  
-	 */
-	this.getHeight = function(){
-		return parseInt(this.height, 10);
-	};
-	
-	/**
-	 * set the height of the mapObj
-	 *
-	 * @param {integer} height the height of the mapObj  
-	 */
-	this.setHeight = function(height){
-		this.height = parseInt(height, 10);
-	};
-	
-	/**
 	 * get the extent of the mapObj
 	 *
 	 * @member mb_mapObj_const
-	 * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy  
+	 * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy
 	 * @type string
 	 */
 	this.getExtent = function(){
@@ -133,44 +195,139 @@
 	/**
 	 * get the extent as minx, maxx, miny, maxy
 	 *
-	 * @return extent and additional informations of the mapObj  
+	 * @return extent and additional informations of the mapObj
 	 * @type Object
 	 */
 	this.getExtentInfos = function(){
 		var c = this.getExtent().split(",");
-		var ext = new Extent(c[0],c[1],c[2],c[3]);
+		var ext = new Extent(c[0], c[1], c[2], c[3]);
 		return ext;
 	};
 	
 	/**
-	 * converts the extent of the mapobject so that the maximum	extent will be displayed
-	 *
+	 * Sets the list of layers, styles and querylayers for a specified WMS
 	 */
-	this.calculateExtent = function(ext){
-		var relation_px_x = this.getWidth() / this.getHeight();
-		var relation_px_y = this.getHeight() / this.getWidth();
-		var relation_bbox_x = ext.extentx / ext.extenty;     
-		if(relation_bbox_x <= relation_px_x){                
-			ext.minx = ext.centerx - relation_px_x * ext.extenty / 2;
-			ext.maxx = ext.centerx + relation_px_x * ext.extenty / 2;
+	this.restateLayers = function(wms_id){
+		for (var i = 0; i < this.wms.length; i++) {
+			if (this.wms[i].wms_id == wms_id) {
+				var currentWms = this.wms[i];
+				var cnt_layers = 0;
+				var cnt_querylayers = 0;
+				var layers = "";
+				var styles = "";
+				var querylayers = "";
+				for (var ii = 0; ii < currentWms.objLayer.length; ii++) {
+					var currentLayer = currentWms.objLayer[ii];
+					if (currentLayer.gui_layer_visible == 1 && !currentLayer.has_childs) {
+						if (cnt_layers > 0) {
+							layers += ",";
+							styles += ",";
+						}
+						layers += currentLayer.layer_name;
+						styles += "";
+						cnt_layers++;
+					}
+					if (currentLayer.gui_layer_querylayer == 1 && !currentLayer.has_childs) {
+						if (cnt_querylayers > 0) {
+							querylayers += ",";
+						}
+						querylayers += currentLayer.layer_name;
+						cnt_querylayers++;
+					}
+				}
+				this.layers[i] = layers;
+				this.querylayers[i] = querylayers;
+				this.styles[i] = styles;
+			}
 		}
-		if(relation_bbox_x > relation_px_x){                
-			ext.miny = ext.centery - relation_px_y * ext.extentx / 2;
-			ext.maxy = ext.centery + relation_px_y * ext.extentx / 2;
+//		this.setExtent(ext.minx,ext.miny,ext.maxx,ext.maxy);
+	};
+	
+	/**
+	 * 
+	 * @param {Object} direction
+	 */
+	this.pan = function (direction) {
+		var arrayBBox = this.extent.split(",");
+		var minx = parseFloat(arrayBBox[0]);
+		var miny = parseFloat(arrayBBox[1]);
+		var maxx = parseFloat(arrayBBox[2]);
+		var maxy = parseFloat(arrayBBox[3]);
+		var xtentx = maxx - minx;
+		var xtenty =  maxy - miny;
+		var factor = 0.5;
+		
+		switch (direction) {
+			case "NW" :
+				minx -= (xtentx * factor); 
+				maxx -= (xtentx * factor); 
+				miny += (xtenty * factor); 
+				maxy += (xtenty * factor);
+				break;
+			case "N" :
+				miny += (xtenty * factor); 
+				maxy += (xtenty * factor);
+				break;
+			case "NE" :
+				minx += (xtentx * factor); 
+				maxx += (xtentx * factor); 
+				miny += (xtenty * factor); 
+				maxy += (xtenty * factor);
+				break;
+			case "E" :
+				minx += (xtentx * factor); 
+				maxx += (xtentx * factor);
+				break;
+			case "SE" :
+				minx += (xtentx * factor); 
+				maxx += (xtentx * factor); 
+				miny -= (xtenty * factor); 
+				maxy -= (xtenty * factor);				
+				break;
+			case "S" :
+				miny -= (xtenty * factor); 
+				maxy -= (xtenty * factor);
+				break;
+			case "SW" :
+				minx -= (xtentx * factor); 
+				maxx -= (xtentx * factor); 
+				miny -= (xtenty * factor); 
+				maxy -= (xtenty * factor);
+				break;
+			case "W" :
+				minx -= (xtentx * factor); 
+				maxx -= (xtentx * factor);
+				break;
 		}
-		this.setExtent(ext.minx,ext.miny,ext.maxx,ext.maxy);
+		this.extent = minx + "," + miny + "," + maxx + "," + maxy;
+		this.setMapRequest();
+		
 	};
 	
+	this.zoomFull = function () {
+		
+		for (var i = 0; i < this.wms[0].gui_epsg.length; i++) {
+			if (this.epsg == this.wms[0].gui_epsg[i]) {
+				var bbox_minx = parseFloat(this.wms[0].gui_minx[i]);
+				var bbox_miny = parseFloat(this.wms[0].gui_miny[i]);
+				var bbox_maxx = parseFloat(this.wms[0].gui_maxx[i]);
+				var bbox_maxy = parseFloat(this.wms[0].gui_maxy[i]);
+				var wmsExtent = new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
+				var newExtent = this.calculateExtent(wmsExtent);
+				this.repaint(new Point(newExtent.minx, newExtent.miny), new Point(newExtent.maxx, newExtent.maxy));
+			}
+		}
+	};
 	
 	/**
 	 * zoom the map with a zoomfactor and optional to x,y coords
-	 * 
+	 *
 	 * @param {boolean} in_ in = true, out = false
 	 * @param {float} factor the zoomfactor 1 equals 100%
 	 * @param {float} x center to x-position
 	 * @param {float} y center to y-position
 	 */
-	 this.zoom = function(in_, factor, x, y){
+	this.zoom = function(in_, factor, x, y){
 		factor = parseFloat(factor);
 		if (!in_) {
 			factor = 1 / factor;
@@ -178,41 +335,88 @@
 		
 		var extent = this.getExtentInfos();
 		var distx = extent.maxx - extent.minx;
-		var disty =  extent.maxy - extent.miny;
+		var disty = extent.maxy - extent.miny;
 		
 		
-		if(x && y){
+		if (x && y) {
 			var centerx = parseFloat(x);
 			var centery = parseFloat(y);
 		}
-		else{
-			var centerx = extent.minx + distx/2;
-			var centery = extent.miny + disty/2;
+		else {
+			var centerx = extent.minx + distx / 2;
+			var centery = extent.miny + disty / 2;
 		}
 		
-		
 		var new_distx = distx / factor;
 		var new_disty = disty / factor;
 		var minx = centerx - new_distx / 2;
 		var miny = centery - new_disty / 2;
 		var maxx = centerx + new_distx / 2;
 		var maxy = centery + new_disty / 2;
-		this.setExtent(minx,miny,maxx,maxy);
-		//Todo:
-		//setMapRequest!
-	 };
+		this.setExtent(minx, miny, maxx, maxy);
 
+		this.setMapRequest();
+	};
+	
+	var performUnknownCalculation = function (value) {
+		return Math.pow(10,(
+			Math.round(
+				Math.log(value)/
+				Math.log(10)
+			)
+		));
+	};
+	
+	this.convertPixelToReal = function (aPoint) {
+		var arrayBBox = this.extent.split(",");
+		var minX = parseFloat(arrayBBox[0]);
+		var minY = parseFloat(arrayBBox[1]);
+		var maxX = parseFloat(arrayBBox[2]);
+		var maxY = parseFloat(arrayBBox[3]);
+		var xtentx = maxX - minX;
+		var xtenty = maxY - minY;
+		var deltaX = xtentx/this.width;
+		var deltaY = xtenty/this.height;
+		var roundx, roundy;
+
+		if(deltaX > 0){
+			roundx = 1/performUnknownCalculation(deltaX);
+		}
+		else{
+			roundx = performUnknownCalculation(deltaX);
+		}
+		if(deltaY > 0){
+			roundy = 1/performUnknownCalculation(deltaY);
+		}
+		else{
+			roundy =  performUnknownCalculation(deltaY);
+		}	
+		var posX = parseFloat(minX + (aPoint.x / this.width) * xtentx);
+		var posY = parseFloat(maxY - (aPoint.y / this.height) * xtenty);
+		posX = Math.round(posX * roundx) / roundx;
+		posY = Math.round(posY * roundy) / roundy;
+		return new Point(posX, posY);
+	};
+	
 	/**
-	 * set the extent of the wms
+	 * Convert real world coordinates to pixel coordinates
 	 */
-	 this.setExtent = function(minx,miny,maxx,maxy){
-	 	this.extent = String(minx)+","+String(miny)+","+String(maxx)+","+String(maxy);
-	 };
+	this.convertRealToPixel = function (aPoint) {
+		var arrayBBox = this.extent.split(",");
+		var minX = parseFloat(arrayBBox[0]);
+		var minY = parseFloat(arrayBBox[1]);
+		var maxX = parseFloat(arrayBBox[2]);
+		var maxY = parseFloat(arrayBBox[3]);
+		return new Point(
+			Math.round((aPoint.x - minX) * this.width /(maxX - minX)), 
+			Math.round((maxY - aPoint.y) * this.height/(maxY - minY))
+		);
+	};
 	
 	/**
 	 * get the srs of the mapObj
 	 *
-	 * @return srs as epsg:number  
+	 * @return srs as epsg:number
 	 * @type string
 	 */
 	this.getSRS = function(){
@@ -220,51 +424,54 @@
 	};
 	
 	/**
-	 * get all mapRequests 
+	 * get all mapRequests
 	 *
-	 * @return array of mapRequests of this map object  
-	 * @type string[]  
+	 * @return array of mapRequests of this map object
+	 * @type string[]
 	 */
 	this.getMapRequests = function(){
 		var allRequests = [];
 		//loop through all wms to get the mapRequests
-		for(var i=0; i<this.wms.length; i++){
+		for (var i = 0; i < this.wms.length; i++) {
 			var currentRequest = this.wms[i].getMapRequest(this);
-			if(currentRequest){ 
+			if (currentRequest) {
 				allRequests.push(currentRequest);
 			}
 		}
-		if(allRequests.length > 0){
+		if (allRequests.length > 0) {
 			return allRequests;
 		}
 		return false;
 	};
-
+	
 	/**
 	 * Return the map URL of the WMS at index i
 	 * @param {Object} currentWmsIndex
 	 */
-	this.getMapUrl = function (i, ii) {
+	this.getMapUrl = function(ii){
 		var currentWms = this.wms[ii];
 		var validLayers = currentWms.getLayers(this);
+		if(validLayers.length === 0) {
+			return false;
+		}
 		var layerNames = validLayers.join(",");
 		
-		url = currentWms.wms_getmap; 
+		url = currentWms.wms_getmap;
 		url += mb_getConjunctionCharacter(currentWms.wms_getmap);
-			
+		
 		if (currentWms.wms_version == "1.0.0") {
 			url += "WMTVER=" + currentWms.wms_version + "&REQUEST=map&";
 		}
 		else {
 			url += "VERSION=" + currentWms.wms_version + "&REQUEST=GetMap&SERVICE=WMS&";
-		}             
+		}
 		
 		url += "LAYERS=" + layerNames + "&";
 		url += "STYLES=";
 		var layer = layerNames.split(",");
-		for (var j = 0; j < layer.length; j++){
+		for (var j = 0; j < layer.length; j++) {
 			if (j > 0) {
-				url  += ",";
+				url += ",";
 			}
 			if (currentWms.getCurrentStyleByLayerName(layer[j]) !== false) {
 				url += currentWms.getCurrentStyleByLayerName(layer[j]);
@@ -277,87 +484,341 @@
 		url += "HEIGHT=" + this.height + "&";
 		url += "FORMAT=" + currentWms.gui_wms_mapformat + "&";
 		url += "BGCOLOR=0xffffff&";
-	
-		if (currentWms.gui_wms_mapformat.search(/gif/i)>-1 || 
-			currentWms.gui_wms_mapformat.search(/png/i)>-1) {
-				url += "TRANSPARENT=TRUE&";
+		
+		if (currentWms.gui_wms_mapformat.search(/gif/i) > -1 ||
+		currentWms.gui_wms_mapformat.search(/png/i) > -1) {
+			url += "TRANSPARENT=TRUE&";
 		}
-	
+		
 		url += "EXCEPTIONS=" + currentWms.gui_wms_exceptionformat + "&";
-	
+		
 		// add vendor-specific
 		for (var v = 0; v < mb_vendorSpecific.length; v++) {
-			var vendorSpecificString = eval(mb_vendorSpecific[v]); 
+			var vendorSpecificString = eval(mb_vendorSpecific[v]);
 			// if eval doesn't evaluate a function, the result is undefined.
 			// Sometimes it is necessary not to evaluate a function, for
 			// example if you want to change a variable from the current
 			// scope (see mod_addSLD.php) 
 			if (typeof(vendorSpecificString) != "undefined") {
 				url += vendorSpecificString + "&";
-			} 
+			}
 		}
 		// add Filter
-		if (currentWms.wms_filter !== ""){
-			url += "&SLD=" + currentWms.wms_filter +"?id="+ mb_styleID + "&";
+		if (currentWms.wms_filter !== "") {
+			url += "&SLD=" + currentWms.wms_filter + "?id=" + mb_styleID + "&";
 		}
 		// add sld
-		if(currentWms.gui_wms_sldurl !== ""){
+		if (currentWms.gui_wms_sldurl !== "") {
 			url += "&SLD=" + escape(currentWms.gui_wms_sldurl) + "&";
 		}
 		return url;
 	}
-
+	
 	/**
-	 * get all featureInfoRequests 
+	 * get all featureInfoRequests
 	 *
 	 * @member mb_mapObj_const
 	 * @param float x the x-value of the click position in pixel
 	 * @param float y the y-value of the click position in pixel
-	 * @return array of all featureInfoRequests of this map object  
-	 * @type string[]  
+	 * @return array of all featureInfoRequests of this map object
+	 * @type string[]
 	 */
 	this.getFeatureInfoRequests = function(clickPoint){
 		var allRequests = [];
 		//loop through all wms to get the FeatureInfoRequests
-		for(var i=0; i<this.wms.length; i++){
+		for (var i = 0; i < this.wms.length; i++) {
 			var currentRequest = this.wms[i].getFeatureInfoRequest(this, clickPoint);
-			if(currentRequest){ 
+			if (currentRequest) {
 				allRequests.push(currentRequest);
 			}
 		}
-		if(allRequests.length > 0){
+		if (allRequests.length > 0) {
 			return allRequests;
 		}
 		return false;
 	};
 	
 	/**
-	 * calculation of the mapscale 
+	 * calculation of the mapscale
 	 *
 	 * @member mb_mapObj_const
-	 * @return scale  
-	 * @type integer  
+	 * @return scale
+	 * @type integer
 	 */
 	this.getScale = function(){
 		var scale;
 		var bbox = this.extent.split(",");
 		var xtenty;
-		if(this.epsg=="EPSG:4326"){
-			var pxLenx = (parseFloat(bbox[2])-parseFloat(bbox[0]))/this.width;
-			var pxLeny = (parseFloat(bbox[3])-parseFloat(bbox[1]))/this.height;
-			var lat_from = ((parseFloat(bbox[3])-parseFloat(bbox[1])/2)*Math.PI)/180;
-			var lat_to = ((parseFloat(bbox[3])-parseFloat(bbox[1])/2+pxLeny)*Math.PI)/180;
-			var lon_from = ((parseFloat(bbox[2])-parseFloat(bbox[0])/2)*Math.PI)/180;
-			var lon_to = ((parseFloat(bbox[2])-parseFloat(bbox[0])/2+pxLeny)*Math.PI)/180;
-			var dist=6371229*Math.acos(Math.sin(lat_from)*Math.sin(lat_to)+Math.cos(lat_from)*Math.cos(lat_to)*Math.cos(lon_from-lon_to));
-			scale = (dist/Math.SQRT2) * (mb_resolution * 100);
-		}else{
-			xtenty =  parseFloat(bbox[3]) - parseFloat(bbox[1]);
+		if (this.epsg == "EPSG:4326") {
+			var pxLenx = (parseFloat(bbox[2]) - parseFloat(bbox[0])) / this.width;
+			var pxLeny = (parseFloat(bbox[3]) - parseFloat(bbox[1])) / this.height;
+			var lat_from = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2) * Math.PI) / 180;
+			var lat_to = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2 + pxLeny) * Math.PI) / 180;
+			var lon_from = ((parseFloat(bbox[2]) - parseFloat(bbox[0]) / 2) * Math.PI) / 180;
+			var lon_to = ((parseFloat(bbox[2]) - parseFloat(bbox[0]) / 2 + pxLeny) * Math.PI) / 180;
+			var dist = 6371229 * Math.acos(Math.sin(lat_from) * Math.sin(lat_to) + Math.cos(lat_from) * Math.cos(lat_to) * Math.cos(lon_from - lon_to));
+			scale = (dist / Math.SQRT2) * (mb_resolution * 100);
+		}
+		else {
+			xtenty = parseFloat(bbox[3]) - parseFloat(bbox[1]);
 			scale = (xtenty / this.height) * (mb_resolution * 100);
 		}
-		return Math.round(scale);
+		return parseInt(Math.round(scale));
 	};
+	
 	/**
+	 *
+	 */
+	this.checkScale = function(wmsIndex){
+		var thisLayer = this.layers[wmsIndex].split(",");
+		var thisScale = this.getScale();
+		var str_layer = "";
+		var cnt_layer = 0;
+		for (var i = 0; i < this.wms[wmsIndex].objLayer.length; i++) {
+			var currentLayer = this.wms[wmsIndex].objLayer[i];
+			var myLayername = currentLayer.layer_name;
+			
+			var myMinscale = currentLayer.gui_layer_minscale;
+			var myMaxscale = currentLayer.gui_layer_maxscale;
+			
+			for (var ii = 0; ii < thisLayer.length; ii++) {
+				if (thisLayer[ii] == myLayername && !currentLayer.has_childs) {
+					if (myMinscale !== 0 && thisScale < myMinscale) {
+						continue;
+					}
+					if (myMaxscale !== 0 && thisScale > myMaxscale) {
+						continue;
+					}
+					if (cnt_layer > 0) {
+						str_layer += ",";
+					}
+					str_layer += thisLayer[ii];
+					cnt_layer++;
+				}
+			}
+		}
+		var str_layerstyles = [];
+		str_layerstyles[0] = str_layer;
+		return str_layerstyles;
+		
+	};
+	
+	this.repaintScale = function(x, y, scale){
+		if (x === null && y === null) {
+			var arrayBBox = this.extent.split(",");
+			x = parseFloat(arrayBBox[0]) +
+			((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0])) /
+			2);
+			y = parseFloat(arrayBBox[1]) +
+			((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1])) /
+			2);
+		}
+		var minx = parseFloat(x) - (this.width / (mb_resolution * 100 * 2) * scale);
+		var miny = parseFloat(y) - (this.height / (mb_resolution * 100 * 2) * scale);
+		var maxx = parseFloat(x) + (this.width / (mb_resolution * 100 * 2) * scale);
+		var maxy = parseFloat(y) + (this.height / (mb_resolution * 100 * 2) * scale);
+		this.repaint(new Point(minx, miny), new Point(maxx, maxy));
+	};
+	
+	this.repaint = function(min, max){
+		this.extent = min.x + "," + min.y + "," + max.x + "," + max.y;
+		this.setMapRequest();
+	};
+	
+	this.setSingleMapRequest = function (wms_id) {
+		eventBeforeMapRequest.trigger({frameName:this.frameName});
+	
+		var ts = mb_timestamp();	
+	
+		for (var ii = 0; ii < this.wms.length; ii++){ 
+			var currentWms = this.wms[ii];
+			if (currentWms.wms_id != wms_id) {
+				continue;
+			}
+			var newMapRequest = getLayerHtmlCode(ii);
+
+			if (mb_log) {
+				var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
+			}
+			var myDivId = this.elementName + "_div_" + ii;          
+			writeTag(this.frameName, myDivId, newMapRequest);
+			var myMapId = this.elementName + "_map_" + ii;
+			eventAfterMapRequest.trigger({"frameName":this.elementName, "myMapId":myMapId});
+			return true;
+		}  
+		return false; 
+			
+	};
+	
+	this.mb_setFutureObj = function(mod_back_cnt){
+		var cnt = this.mb_MapFutureObj.length;
+		this.mb_MapFutureObj[cnt] = {};
+		this.mb_MapFutureObj[cnt].reqCnt = mod_back_cnt;
+		this.mb_MapFutureObj[cnt].width = this.width;
+		this.mb_MapFutureObj[cnt].height = this.height;
+		this.mb_MapFutureObj[cnt].epsg = this.epsg;
+		this.mb_MapFutureObj[cnt].extent = this.extent;
+		this.mb_MapFutureObj[cnt].layers = [];
+		
+		for(var i=0; i<this.layers.length;i++){
+			this.mb_MapFutureObj[cnt].layers[i] = this.layers[i];
+		}
+
+		this.mb_MapFutureObj[cnt].styles = [];
+
+		for(var i=0; i < this.styles.length;i++){
+			this.mb_MapFutureObj[cnt].styles[i] = this.styles[i];
+		}
+
+		this.mb_MapFutureObj[cnt].querylayers = [];
+
+		for(var i=0; i < this.querylayers.length; i++) {
+			this.mb_MapFutureObj[cnt].querylayers[i] = this.querylayers[i];
+		}
+	}
+	
+	this.setMapRequest = function(){
+		var functionName = 'setMapRequest';
+		
+		var ret = eventBeforeMapRequest.trigger({
+				frameName: this.frameName
+			}, "AND");
+		if (ret === false) {
+			return true;
+		}
+		var ts = mb_timestamp();
+		var myMapId = [];
+		
+		var newMapRequest = "";
+		
+		for (var ii = 0; ii < this.wms.length; ii++) {
+			var currentWms = this.wms[ii];
+		
+			if (!(currentWms.gui_wms_visible > 0)) {
+				continue;
+			}
+			myMapId.push(this.elementName + "_map_" + ii);
+			
+			newMapRequest += getLayerHtmlCode(ii);
+			
+		}
+		writeTag(this.frameName, this.elementName+"_maps", newMapRequest);
+
+		eventAfterMapRequest.trigger({
+			"frameName": this.elementName,
+			"myMapId": myMapId.join(",")
+		});
+	};
+
+	var that = this;
+
+	var getLayerHtmlCode = function (ii) {
+		var currentWms = that.wms[ii];
+	
+		var myDivId = that.elementName + "_div_" + ii;          
+		var myMapId = that.elementName + "_map_" + ii;
+
+		//disable Layer which are out of scale
+		var validLayers = that.checkScale(ii);
+		var layerNames = validLayers.toString();
+	
+		var newMapURL = false;
+		var opacityString = "";
+		
+		if (that.layers[ii] !== "" && layerNames !== ''){
+			// get map URL
+			newMapURL = that.getMapUrl(ii);
+	
+			var currentOpacity = currentWms.gui_wms_mapopacity;
+			if (currentOpacity != 1) {
+				opacityString += "opacity:" + currentOpacity + "; ";
+				opacityString += "Filter: Alpha(Opacity=" + currentOpacity*100 + "); ";
+				opacityString += "-moz-opacity:" + currentOpacity + " ; ";
+				opacityString += "-khtml-opacity:" + currentOpacity;
+			}
+		}
+	
+		var imageString = "";
+		if (newMapURL) {
+			imageString = "<img id='"+myMapId+"' name='mapimage' ";
+			imageString += "src='" + newMapURL + "' ";
+			imageString += "width='"+that.width+"' ";
+			imageString += "height='"+that.height+"' ";
+			imageString += "border='0'>";	
+		}
+	
+		var newMapRequest = "<div id='"+myDivId+"' ";
+		newMapRequest += "style=\"position:absolute; top:0px; left:0px; ";
+		newMapRequest += "z-index:" + ii + ";" + opacityString + "\">";
+		newMapRequest += imageString;
+		newMapRequest += "</div>";   
+	
+		that.mapURL[ii]= newMapURL;	
+		currentWms.mapURL = newMapURL;
+	
+		if (mb_log && currentWms.mapURL) {
+			var tmp = eval(mb_log + "('" +newMapURL + "','" + ts + "')");
+		}
+	
+		return newMapRequest;
+	}
+	
+	this.getWmsIdByTitle = function (title) {
+		for (var i=0; i < this.wms.length; i++) {
+			if (this.wms[i].wms_title == title) {
+				return this.wms[i].wms_id;
+			}
+		}
+		return null;
+	};
+
+	this.getWmsIndexById = function (wms_id) {
+		for (var i=0; i< this.wms.length; i++){
+			if(this.wms[i].wms_id == wms_id){
+				return i;
+			}
+		}
+		return null;
+	};
+
+	this.removeWms = function (wmsIndex) {
+		var wms_ID = null;
+		var i;
+		var new_wmsarray = [];
+		var new_layerarray = [];
+		var new_querylayerarray = [];
+		var new_stylesarray = [];
+		var new_mapURLarray = [];
+		
+		for	(i = 0; i < this.wms.length; i++) {
+			if (i != wmsIndex) {
+				new_wmsarray.push(this.wms[i]);
+				new_layerarray.push(this.layers[i]);
+				new_querylayerarray.push(this.querylayers[i]);
+				new_stylesarray.push(this.styles[i]);
+				new_mapURLarray.push(this.mapURL[i]);
+			}
+			else {
+				wms_ID = this.wms[i].wms_id;
+			}
+		}
+		this.wms = new_wmsarray; 
+		this.layers = new_layerarray; 
+		this.querylayers = new_querylayerarray; 
+		this.styles = new_stylesarray; 
+		this.mapURL = new_mapURLarray;
+	
+		var another_new_wmsarray = [];
+
+		for	(i = 0; i < window.wms.length; i++) {
+			if (window.wms[i].wms_id != wms_ID) {
+				another_new_wmsarray.push(window.wms[i]); 
+			}
+		}
+		window.wms = another_new_wmsarray; 
+	};
+	
+	/**
 	 * move a wms or layer 
 	 *
 	 * @param int wms_id id of wms to move
@@ -400,5 +861,28 @@
 		return true;
 	};
 	
+	this.getMousePos = function(e){
+		if(ie){
+			if(this.frameName){
+				clickX = window.frames[fName].event.clientX;
+				clickY = window.frames[fName].event.clientY;
+			}
+			else{
+				clickX = event.clientX;
+				clickY = event.clientY;
+			}
+		}
+		else{
+			clickX = e.pageX;
+			clickY = e.pageY;
+		}
+		
+		//remove divtag offset
+		clickX -= parseInt(this.getDomElement().style.left);
+		clickY -= parseInt(this.getDomElement().style.top);
+		
+		return new Point(clickX, clickY);
+	}
+
 	eventAfterMapObjectConstruction.trigger();
-}
\ No newline at end of file
+}

Added: branches/print_dev/http/javascripts/mapnf.php
===================================================================
--- branches/print_dev/http/javascripts/mapnf.php	                        (rev 0)
+++ branches/print_dev/http/javascripts/mapnf.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,22 @@
+<?php 
+# $Id:$
+# http://www.mapbender.org/Mapbender_without_iframes
+# 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_validateSession.php");
+?>
+mb_registerMapObj('', 'mapframe1', null,500, 500);
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_adminNavigation.js
===================================================================
--- branches/print_dev/http/javascripts/mod_adminNavigation.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_adminNavigation.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,12 +1,8 @@
-function mod_adminNavigation_init(){
-	eventInit.trigger();
-	for (var i=0; i< document.getElementsByTagName("a").length; i++){
-		document.getElementsByTagName("a")[i].onclick = new Function("mod_adminNavigation(this)");
-	}
-}
-function mod_adminNavigation(obj){
-	for (var i=0; i< document.getElementsByTagName("a").length; i++){
-		document.getElementsByTagName("a")[i].style.color = "#808080";
-	}
-	obj.style.color = "#0000ff";
-}
\ No newline at end of file
+eventInit.register(function () {
+	$("a").click(function () {
+		$("a").each(function () {
+			this.style.color = "#808080";
+		});
+		this.style.color = "#0000ff";
+	});
+});
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_back.php
===================================================================
--- branches/print_dev/http/javascripts/mod_back.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_back.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -23,20 +23,34 @@
 echo "var mod_back_overview = '".$e_target[1]."';";
 
 ?>
-var mb_MapHistoryObj = new Array();
-var mod_back_img_off = new Image(); mod_back_img_off.src = "<?php  echo preg_replace("/_off_disabled/","_off",$e_src);  ?>";
-var mod_back_img_off_disabled = new Image(); mod_back_img_off_disabled.src = "<?php  echo $e_src;  ?>";
-var mod_back_img_over = new Image(); mod_back_img_over.src = "<?php  echo preg_replace("/_off_disabled/","_over",$e_src);  ?>";
+var mod_back_img_off = new Image(); 
+mod_back_img_off.src = "<?php  echo preg_replace("/_off_disabled/","_off",$e_src);  ?>";
+var mod_back_img_off_disabled = new Image(); 
+mod_back_img_off_disabled.src = "<?php  echo $e_src;  ?>";
+var mod_back_img_over = new Image(); 
+mod_back_img_over.src = "<?php  echo preg_replace("/_off_disabled/","_over",$e_src);  ?>";
 var mod_back_img_previous = null;
 var mod_back_cnt = -1;
 
-mb_registerSubFunctions("mb_setHistoryObj(frameName)");
-mb_registerSubFunctions("mod_back_check(frameName)");
+$('#<?php echo $e_id;?>').mouseover(function () {
+	mod_back_over(this);
+}).mouseout(function() {
+	mod_back_out(this);
+}).click(function() {
+	mod_back_set();
+});
 
+eventAfterMapRequest.register(function (obj) {
+	mb_setHistoryObj(obj.frameName);
+	mod_back_check(obj.frameName);
+});
+
+
 function mod_back_check(frameName){
 	if(frameName == mod_back_map){
+		var ind = getMapObjIndexByName(frameName);
 		mod_back_cnt++;
-		if(mb_MapHistoryObj[mod_back_map].length > 1){
+		if(mb_mapObj[ind].mb_MapHistoryObj.length > 1){
 			document.getElementById("back").src =  mod_back_img_off.src;
 		}
 		else{
@@ -58,56 +72,56 @@
 
 function mod_back_set(){
 	if(mod_back_img_previous ==  mod_back_img_off.src){
-		if(mb_MapFutureObj){
-			mb_setFutureObj(mod_back_map);
+		var ind = getMapObjIndexByName(mod_back_map);
+		if(mb_mapObj[ind].mb_MapFutureObj){
+			mb_mapObj[ind].mb_setFutureObj(mod_back_cnt);
 		}
-		var ind = getMapObjIndexByName(mod_back_map);
-		var cnt = mb_MapHistoryObj[mod_back_map].length - 2;
-		if(mb_mapObj[ind].epsg != mb_MapHistoryObj[mod_back_map][cnt].epsg){
+		var cnt = mb_mapObj[ind].mb_MapHistoryObj.length - 2;
+		if(mb_mapObj[ind].epsg != mb_mapObj[ind].mb_MapHistoryObj[cnt].epsg){
 			var oind = getMapObjIndexByName(mod_back_overview);
-			for(var i=0; i < mb_MapHistoryObj[mod_back_overview].length; i++){
-				if(mb_MapHistoryObj[mod_back_overview][i].epsg == mb_MapHistoryObj[mod_back_map][cnt].epsg){
-					mb_mapObj[oind].epsg = mb_MapHistoryObj[mod_back_overview][i].epsg;
-					mb_mapObj[oind].extent = mb_MapHistoryObj[mod_back_overview][i].extent;
+			for(var i=0; i < mb_mapObj[oind].mb_MapHistoryObj.length; i++){
+				if(mb_mapObj[oind].mb_MapHistoryObj[i].epsg == mb_mapObj[ind].mb_MapHistoryObj[cnt].epsg){
+					mb_mapObj[oind].epsg = mb_mapObj[oind].mb_MapHistoryObj[i].epsg;
+					mb_mapObj[oind].extent = mb_mapObj[oind].mb_MapHistoryObj[i].extent;
 					setMapRequest(mod_back_overview);
 					break;
 				}
 			}
 		}
-		document.getElementById(mod_back_map).style.width = mb_MapHistoryObj[mod_back_map][cnt].width;
-		document.getElementById(mod_back_map).style.height = mb_MapHistoryObj[mod_back_map][cnt].height;     
-		mb_mapObj[ind].width = mb_MapHistoryObj[mod_back_map][cnt].width;
-		mb_mapObj[ind].height = mb_MapHistoryObj[mod_back_map][cnt].height;     
-		mb_mapObj[ind].epsg = mb_MapHistoryObj[mod_back_map][cnt].epsg;
-		mb_mapObj[ind].extent = mb_MapHistoryObj[mod_back_map][cnt].extent;
-		mb_mapObj[ind].layers = mb_MapHistoryObj[mod_back_map][cnt].layers;
-		mb_mapObj[ind].styles = mb_MapHistoryObj[mod_back_map][cnt].styles;
-		mb_mapObj[ind].querylayers = mb_MapHistoryObj[mod_back_map][cnt].querylayers;
-		mb_MapHistoryObj[mod_back_map].length = (mb_MapHistoryObj[mod_back_map].length - 2);
+		document.getElementById(mod_back_map).style.width = mb_mapObj[ind].mb_MapHistoryObj[cnt].width;
+		document.getElementById(mod_back_map).style.height = mb_mapObj[ind].mb_MapHistoryObj[cnt].height;     
+		mb_mapObj[ind].width = mb_mapObj[ind].mb_MapHistoryObj[cnt].width;
+		mb_mapObj[ind].height = mb_mapObj[ind].mb_MapHistoryObj[cnt].height;     
+		mb_mapObj[ind].epsg = mb_mapObj[ind].mb_MapHistoryObj[cnt].epsg;
+		mb_mapObj[ind].extent = mb_mapObj[ind].mb_MapHistoryObj[cnt].extent;
+		mb_mapObj[ind].layers = mb_mapObj[ind].mb_MapHistoryObj[cnt].layers;
+		mb_mapObj[ind].styles = mb_mapObj[ind].mb_MapHistoryObj[cnt].styles;
+		mb_mapObj[ind].querylayers = mb_mapObj[ind].mb_MapHistoryObj[cnt].querylayers;
+		mb_mapObj[ind].mb_MapHistoryObj.length = (mb_mapObj[ind].mb_MapHistoryObj.length - 2);
 		setMapRequest(mod_back_map);
 	}
 }
 function mb_setHistoryObj(frameName){
-	if(mb_MapHistoryObj[frameName] == null){
-		mb_MapHistoryObj[frameName] = new Array();
+	var ind = getMapObjIndexByName(frameName);
+	if(mb_mapObj[ind].mb_MapHistoryObj == null){
+		mb_mapObj[ind].mb_MapHistoryObj = [];
 	}
-	var ind = getMapObjIndexByName(frameName);
-	var cnt = mb_MapHistoryObj[frameName].length;
-	mb_MapHistoryObj[frameName][cnt] = new Object();
-	mb_MapHistoryObj[frameName][cnt].width = mb_mapObj[ind].width;
-	mb_MapHistoryObj[frameName][cnt].height = mb_mapObj[ind].height;
-	mb_MapHistoryObj[frameName][cnt].epsg = mb_mapObj[ind].epsg;
-	mb_MapHistoryObj[frameName][cnt].extent = mb_mapObj[ind].extent;
-	mb_MapHistoryObj[frameName][cnt].layers = new Array();
+	var cnt = mb_mapObj[ind].mb_MapHistoryObj.length;
+	mb_mapObj[ind].mb_MapHistoryObj[cnt] = new Object();
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].width = mb_mapObj[ind].width;
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].height = mb_mapObj[ind].height;
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].epsg = mb_mapObj[ind].epsg;
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].extent = mb_mapObj[ind].extent;
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].layers = new Array();
 	for(var i=0; i<mb_mapObj[ind].layers.length;i++){
-		mb_MapHistoryObj[frameName][cnt].layers[i] = mb_mapObj[ind].layers[i];
+		mb_mapObj[ind].mb_MapHistoryObj[cnt].layers[i] = mb_mapObj[ind].layers[i];
 	}
-	mb_MapHistoryObj[frameName][cnt].styles = new Array();
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].styles = [];
 	for(var i=0; i<mb_mapObj[ind].styles.length;i++){
-		mb_MapHistoryObj[frameName][cnt].styles[i] = mb_mapObj[ind].styles[i];
+		mb_mapObj[ind].mb_MapHistoryObj[cnt].styles[i] = mb_mapObj[ind].styles[i];
 	}
-	mb_MapHistoryObj[frameName][cnt].querylayers = new Array();
+	mb_mapObj[ind].mb_MapHistoryObj[cnt].querylayers = [];
 	for(var i=0; i<mb_mapObj[ind].querylayers.length;i++){
-		mb_MapHistoryObj[frameName][cnt].querylayers[i] = mb_mapObj[ind].querylayers[i];
+		mb_mapObj[ind].mb_MapHistoryObj[cnt].querylayers[i] = mb_mapObj[ind].querylayers[i];
 	}
 }

Modified: branches/print_dev/http/javascripts/mod_box1.js
===================================================================
--- branches/print_dev/http/javascripts/mod_box1.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_box1.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -7,6 +7,7 @@
 var mb_isActive = false;
 var mb_isBF = false;
 var mb_zF = false;
+var mb_boxMapObj = null;
 
 var mb_offset_top = 0;
 var mb_offset_right = 0;
@@ -14,8 +15,9 @@
 var mb_offset_left = 0;
 
 function  mod_box_start(e){
+	mb_boxMapObj = getMapObjByName(mb_isBF);
 	mb_isActive = true;
-	mb_getMousePos(e,mb_isBF);
+	mb_boxMapObj.getMousePos(e);
 	mb_start_x = clickX;
 	mb_start_y = clickY;
 	mb_end_x = mb_start_x+1;
@@ -29,13 +31,10 @@
 }
 function mod_box_run(e){
 	if(mb_isActive){
-		mb_getMousePos(e,mb_isBF);
-		for(var i=0; i<mb_mapObj.length; i++){
-			if(mb_mapObj[i].frameName == mb_isBF){
-				var width = mb_mapObj[i].width;
-				var height = mb_mapObj[i].height;
-			}
-		}
+		mb_boxMapObj.getMousePos(e);
+		var width = mb_boxMapObj.width;
+		var height = mb_boxMapObj.height;
+
 		if (((clickX>width) || (clickY>height) || (clickX<=0) ||(clickY<=0))){
 			isActive = false;  
 			mod_box_stop(e);
@@ -60,6 +59,37 @@
 	mb_isActive = false;
 }
 function mb_drawBox(left,top,right,bottom){
+	//Look if we have the Box elements
+	mb_boxMapObj = getMapObjByName(mb_isBF);
+	var map_el = mb_boxMapObj.getDomElement();
+	if(!map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_l_top")){
+		//create Box Elements
+		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.width = "0px";
+		el_top.style.height = "0px";
+		el_top.style.overflow = "hidden";
+		el_top.style.zIndex = "10";
+		el_top.style.visibility = "hidden";
+		el_top.style.cursor = "crosshair";
+		el_top.style.backgroundColor = "#ff0000";
+		
+		el_left = el_top.cloneNode(false);
+		el_right = el_top.cloneNode(false);
+		el_bottom = el_top.cloneNode(false);
+		
+		el_top.id = mb_boxMapObj.elementName+"_l_top";
+		el_left.id = mb_boxMapObj.elementName+"_l_left";
+		el_right.id = mb_boxMapObj.elementName+"_l_right";
+		el_bottom.id = mb_boxMapObj.elementName+"_l_bottom";
+		
+		map_el.appendChild(el_top);
+		map_el.appendChild(el_left);
+		map_el.appendChild(el_right);
+		map_el.appendChild(el_bottom);
+	}
 	mb_arrangeBox("l_top",left,top,right,top+2);
 	mb_arrangeBox("l_left",left,top,left+2,bottom);
 	mb_arrangeBox("l_right",right-2,top,right,bottom);
@@ -70,17 +100,20 @@
 	mb_displayElement("l_bottom");
 }
 function mb_arrangeBox(name, left, top, right, bottom){
-	var el = window.frames[mb_isBF].document.getElementById(name).style;
+	var map_el = mb_boxMapObj.getDomElement();
+	var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style;
 	el.height = Math.abs(bottom - top);
 	el.width = Math.abs(right - left);
 	el.top = top + "px";
 	el.left = left + "px";
 }
 function mb_displayElement(name){
-	window.frames[mb_isBF].document.getElementById(name).style.visibility = "visible";
+	var map_el = mb_boxMapObj.getDomElement();
+	var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style.visibility = "visible";
 }
 function mb_hideElement(name) {
-	window.frames[mb_isBF].document.getElementById(name).style.visibility = "hidden";
+	var map_el = mb_boxMapObj.getDomElement();
+	var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style.visibility = "hidden";
 }
 function evalExtent(){
 	if(mb_start_x>mb_end_x){
@@ -139,4 +172,14 @@
 		return ret;      
 		//zoom(mb_zF,true,1.0,pos[0], pos[1]);
 	}
-}
\ No newline at end of file
+}
+
+function mod_box_setValidClipping(coords){
+	if(coords.length > 2){
+		mb_calculateExtent(mb_zF,coords[0],coords[1],coords[2],coords[3]);
+		setMapRequest(mb_zF);
+	}
+	else{
+		zoom(mb_zF,true,1.0,coords[0], coords[1]);
+	}
+}

Modified: branches/print_dev/http/javascripts/mod_center1.php
===================================================================
--- branches/print_dev/http/javascripts/mod_center1.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_center1.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -21,6 +21,7 @@
 echo "var mod_center_target = '".$e_target[0]."';";
 ?>
 
+var mod_center_mapObj = null;
 var mod_center_elName = "center1";
 var mod_center_frameName = "";
 
@@ -29,7 +30,10 @@
 var mod_center_img_off = new Image(); mod_center_img_off.src = "<?php  echo $e_src;  ?>";
 var mod_center_img_over = new Image(); mod_center_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
-function init_gui1_center(ind){
+function init_gui1_center(ind){ 
+	//get Pointer to my MapObj
+	mod_center_mapObj = getMapObjByName(mod_center_target);
+	
 	mb_button[ind] = document.getElementById(mod_center_elName);
 	mb_button[ind].img_over = mod_center_img_over.src;
 	mb_button[ind].img_on = mod_center_img_on.src;
@@ -41,21 +45,14 @@
 	mb_button[ind].stop = new Function ("mod_center_disable()");
 }
 function mod_center_click(){
-	window.frames[mod_center_target].document.onclick = mod_center_event;
+	mod_center_mapObj.getDomElement().onclick = mod_center_event;
 }
 function mod_center_disable(){
-	window.frames[mod_center_target].document.onclick = null;
+	mod_center_mapObj.getDomElement().onclick = null;
 }
 function mod_center_event(e){
-	if(ie){
-		clickX = window.frames[mod_center_target].event.clientX;
-		clickY = window.frames[mod_center_target].event.clientY;
+	mod_center_mapObj.getMousePos(e);
 
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
 	var pos = makeClickPos2RealWorldPos(mod_center_target, clickX, clickY);
 	zoom(mod_center_target,true,1.0,pos[0], pos[1]);
-}
\ No newline at end of file
+}

Added: branches/print_dev/http/javascripts/mod_changeEPSG.php
===================================================================
--- branches/print_dev/http/javascripts/mod_changeEPSG.php	                        (rev 0)
+++ branches/print_dev/http/javascripts/mod_changeEPSG.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,109 @@
+<?php
+# $Id: mod_changeEPSG.php 3397 2009-01-02 15:24:40Z christoph $
+# http://www.mapbender.org/index.php/mod_changeEPSG.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require(dirname(__FILE__)."/mb_validateSession.php");
+
+include(dirname(__FILE__)."/../include/dyn_js.php");
+
+echo "var myTarget = '".$e_target[0]."';";
+echo "var myId = '".$e_id."';";
+?>
+var exists = false;
+
+eventAfterMapRequest.register(function () {
+	mod_changeEPSG_setBox();
+});
+
+eventInit.register(function () {
+//	mod_changeEPSG_init();
+});
+
+function mod_changeEPSG_setBox(){
+	$("#"+myId+" option").each(function () {
+		if (this.value == mb_mapObj[0].epsg) {
+			isEPSG = true;
+			$(this).attr("selected", "selected");
+		}
+	});
+}
+
+$("#"+myId).change(function () {
+	var srsArray = [];
+	for (var i = 0; i < mb_mapObj.length; i++) {
+		var currentSrs = {
+			"frameName" : mb_mapObj[i].elementName,
+			"epsg" : mb_mapObj[i].epsg,
+			"extent" : mb_mapObj[i].extent,
+			"width" : mb_mapObj[i].width,
+			"height" : mb_mapObj[i].height
+		};
+		srsArray.push(currentSrs);
+	}
+
+	var req = new Mapbender.Ajax.Request({
+		"method":"changeEpsg",
+		"parameters":{
+			"srs":srsArray,
+			"newSrs": $("#"+myId).get(0).value
+		}
+	});
+	req.send("../php/mod_changeEPSG_server.php", function (obj, success, message) {
+		if (!success) {
+			new Mb_exception("!!!!!!"+message);
+			return;
+		}
+		
+		var newExtent = obj;
+		
+		for(var i = 0; i < newExtent.length; i++) {
+			if(newExtent[i].frameName == myTarget){
+
+				var ind = getMapObjIndexByName(myTarget);
+				
+				for(var ii = 0; ii < mb_mapObj[ind].mb_MapHistoryObj.length; ii++) {
+					if (mb_mapObj[ind].mb_MapHistoryObj[ii].epsg == newExtent[i].newSrs) {
+						exists = ii;
+						var goback = true;
+					}
+				}
+
+				if (goback) {
+					mb_mapObj[ind].epsg = newExtent[i].newSrs;
+					mb_mapObj[ind].extent = mb_mapObj[ind].mb_MapHistoryObj[exists].extent;
+					setMapRequest(newExtent[i].frameName);
+				}
+				else{
+					mb_mapObj[ind].epsg = newExtent[i].newSrs;
+					mb_mapObj[ind].extent = parseFloat(newExtent[i].minx) + "," + parseFloat(newExtent[i].miny) + "," + 
+						parseFloat(newExtent[i].maxx) + "," + parseFloat(newExtent[i].maxy);
+				setMapRequest(newExtent[i].frameName);
+				}
+			}
+			else {
+				var ind = getMapObjIndexByName(newExtent[i].frameName);
+				mb_mapObj[ind].epsg = newExtent[i].newSrs;
+				mb_mapObj[ind].extent = parseFloat(newExtent[i].minx) + "," + parseFloat(newExtent[i].miny) + "," + 
+					parseFloat(newExtent[i].maxx) + "," + parseFloat(newExtent[i].maxy);
+				setMapRequest(newExtent[i].frameName);
+			}
+		}
+
+
+	});
+});
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_coords.php
===================================================================
--- branches/print_dev/http/javascripts/mod_coords.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_coords.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -21,6 +21,7 @@
 echo "var mod_showCoords_target = '".$e_target[0]."';";
 ?>
 
+var mod_showCoords_map = null;
 var mod_showCoords_win = null;
 var mod_showCoords_elName = "showCoords";
 var mod_showCoords_frameName = "";
@@ -37,43 +38,33 @@
 	mb_button[ind].elName = mod_showCoords_elName;
 	mb_button[ind].fName = mod_showCoords_frameName;
 	mb_button[ind].go = new Function ("mod_showCoords_run()");
-	mb_button[ind].stop = new Function ("mod_showCoords_disable()");   
+	mb_button[ind].stop = new Function ("mod_showCoords_disable()");
+	
+	mod_showCoords_map = getMapObjByName(mod_showCoords_target);
 }
 function mod_showCoords_run(){
-	window.frames[mod_showCoords_target].document.onmousemove = mod_showCoords_display;
-	window.frames[mod_showCoords_target].document.onclick = mod_showCoords_click;
+	var el = mod_showCoords_map.getDomElement();
+	el.onmousemove = mod_showCoords_display;
+	el.onclick = mod_showCoords_click;
 }
 function mod_showCoords_disable(){
-	window.frames[mod_showCoords_target].document.onclick = null;
-	window.frames[mod_showCoords_target].document.onmousemove = null;
+	var el = mod_showCoords_map.getDomElement();
+	el.onmousemove = null;
+	el.onclick = null;
 	window.status = "";
 }
 function mod_showCoords_click(e){
 	mod_showCoords_win = window.open("","","width=150, height=100");
 	mod_showCoords_win.document.open("text/html");
-	if(ie){
-		clickX = window.frames[mod_showCoords_target].event.clientX;
-		clickY = window.frames[mod_showCoords_target].event.clientY;
 
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
+	mod_showCoords_map.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_showCoords_target, clickX, clickY);
 	mod_showCoords_win.document.write((Math.round(pos[0]*100)/100) + " / " +  (Math.round(pos[1]*100)/100));
 	mod_showCoords_win.document.close();
 	mod_showCoords_win.focus();
 }
 function mod_showCoords_display(e){
-	if(ie){
-		clickX = window.frames[mod_showCoords_target].event.clientX;
-		clickY = window.frames[mod_showCoords_target].event.clientY;
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
+	mod_showCoords_map.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_showCoords_target, clickX, clickY);
 	window.status = pos[0] + " / " +  pos[1];
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_coords_div.php
===================================================================
--- branches/print_dev/http/javascripts/mod_coords_div.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_coords_div.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -28,8 +28,11 @@
 var mod_showCoords_div_img_off = new Image(); mod_showCoords_div_img_off.src = "<?php  echo $e_src;  ?>";
 var mod_showCoords_div_img_over = new Image(); mod_showCoords_div_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 var mod_showCoords_div_fix = "";
+var mod_showCoords_div_mapObj = null;
 
 function init_mod_showCoords_div(ind){
+	mod_showCoords_div_mapObj = getMapObjByName(mod_showCoords_div_target );
+	
 	mb_button[ind] = document.getElementById(mod_showCoords_div_elName);
 	mb_button[ind].img_over = mod_showCoords_div_img_over.src;
 	mb_button[ind].img_on = mod_showCoords_div_img_on.src;
@@ -41,40 +44,24 @@
 	mb_button[ind].stop = new Function ("mod_showCoords_div_disable()");   
 }
 function mod_showCoords_div_run(){
-	window.frames[mod_showCoords_div_target].document.onmousemove = mod_showCoords_div_display;
-	window.frames[mod_showCoords_div_target].document.onclick = mod_showCoords_div_click;
+	mod_showCoords_div_mapObj.getDomElement().onmousemove = mod_showCoords_div_display;
+	mod_showCoords_div_mapObj.getDomElement().onclick = mod_showCoords_div_click;
 }
 function mod_showCoords_div_disable(){
-	window.frames[mod_showCoords_div_target].document.onclick = null;
-	window.frames[mod_showCoords_div_target].document.onmousemove = null;
+	mod_showCoords_div_mapObj.getDomElement().onclick = null;
+	mod_showCoords_div_mapObj.getDomElement().onmousemove = null;
 	if(document.getElementById("dependentDiv")){
 		writeTag("","dependentDiv","");
 	}
 }
 function mod_showCoords_div_click(e){
-	if(ie){
-		clickX = window.frames[mod_showCoords_div_target].event.clientX;
-		clickY = window.frames[mod_showCoords_div_target].event.clientY;
-
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
+	mod_showCoords_div_mapObj.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_showCoords_div_target, clickX, clickY);
 	mod_showCoords_div_fix = "Selection: " + pos[0] + " / " +  pos[1];
 	mod_showCoord_write(pos[0],pos[1]);
 }
 function mod_showCoords_div_display(e){
-	if(ie){
-		clickX = window.frames[mod_showCoords_div_target].event.clientX;
-		clickY = window.frames[mod_showCoords_div_target].event.clientY;
-
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
+	mod_showCoords_div_mapObj.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_showCoords_div_target, clickX, clickY);
 	mod_showCoord_write(pos[0],pos[1]);
 }
@@ -86,4 +73,4 @@
 		}
 		writeTag("","dependentDiv", str);
 	}
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_copyright.php
===================================================================
--- branches/print_dev/http/javascripts/mod_copyright.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_copyright.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -36,14 +36,36 @@
 var mod_copyright_font = "Arial, Helvetica, sans-serif";
 var mod_copyright_fontsize = "9px";
 
-mb_registerSubFunctions("mod_copyright()");
+eventAfterMapRequest.register(function () {
+	mod_copyright();
+});
 function mod_copyright(){
 	var ind = getMapObjIndexByName(mod_copyright_target);
+	var myMapObj = mb_mapObj[ind];
+
 	var str_c = "<div>";
 	str_c += "<img src='../img/transparent.gif' width ='"+mb_mapObj[ind].width+"' height='"+mb_mapObj[ind].height+"'>";
 	str_c += "<div style='font-family:"+mod_copyright_font+";font-size:"+mod_copyright_fontsize+";color:"+mod_copyright_color1+";position:absolute;top:"+(mb_mapObj[ind].height - (mod_copyright_bottom-1))+"px;left:"+mod_copyright_left+"px'>"+mod_copyright_text+"</div>";
 	str_c += "<div style='font-family:"+mod_copyright_font+";font-size:"+mod_copyright_fontsize+";color:"+mod_copyright_color1+";position:absolute;top:"+(mb_mapObj[ind].height - mod_copyright_bottom)+"px;left:"+mod_copyright_left+"px'>"+mod_copyright_text+"</div>";
 	str_c += "<div style='font-family:"+mod_copyright_font+";font-size:"+mod_copyright_fontsize+";color:"+mod_copyright_color2+";position:absolute;top:"+(mb_mapObj[ind].height - mod_copyright_bottom)+"px;left:"+(mod_copyright_left+1)+"px'>"+mod_copyright_text+"</div>";
 	str_c += "</div>";
-	writeTag(mod_copyright_target,"copyright",str_c); 
-}
\ No newline at end of file
+
+	var map_el = myMapObj.getDomElement();
+	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_copyright")){
+		//create Box Elements
+		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.width = "0px";
+		el_top.style.height = "0px";
+		el_top.style.overflow = "hidden";
+		el_top.style.zIndex = "10";
+		el_top.style.visibility = "hidden";
+		el_top.style.cursor = "crosshair";
+		el_top.style.backgroundColor = "#ff0000";
+		el_top.id = myMapObj.elementName+"_copyright";
+		map_el.appendChild(el_top);
+	}
+	writeTag(myMapObj.frameName, myMapObj.elementName+"_copyright", str_c);
+}

Modified: branches/print_dev/http/javascripts/mod_dependentDiv.php
===================================================================
--- branches/print_dev/http/javascripts/mod_dependentDiv.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_dependentDiv.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -38,11 +38,14 @@
 }
 
 
-mb_registerSubFunctions("mod_dependentDiv()");
+eventAfterMapRequest.register(function () {
+	mod_dependentDiv();
+});
+
 function mod_dependentDiv(){
 	var obj = document.getElementById(mod_dependentDiv_target).style;
 	var thisObj = document.getElementById('dependentDiv').style; 
 	thisObj.left = parseInt(obj.left) + dependentDiv_offsetLeft;
 	thisObj.top = parseInt(obj.top) + parseInt(obj.height) +  dependentDiv_offsetTop;
 	thisObj.width = parseInt(obj.width) + (2*dependentDiv_offsetTop);
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/print_dev/http/javascripts/mod_digitize_tab.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_digitize_tab.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -49,6 +49,15 @@
 	buttonDig_y.push(y);
 }
 
+function htmlspecialchars(p_string) {
+	p_string = p_string.replace(/&/g, '&amp;');
+	p_string = p_string.replace(/</g, '&lt;');
+	p_string = p_string.replace(/>/g, '&gt;');
+	p_string = p_string.replace(/"/g, '&quot;');
+	//	p_string = p_string.replace(/'/g, '&#039;');
+	return p_string;
+};
+   
 //default definition of image directory for digitize buttons, might
 //be overwritten with digitize conf data
 var buttonDig_imgdir = "../img/button_digitize/";
@@ -802,8 +811,10 @@
 			parent.mb_ajax_post("../php/mod_digitize_splitPolygon.php", {polygon: polygonText, line: lineText}, function(json, status) {
 				var response = eval('(' + json + ')');
 				var polygonArray = response.polygons;
+				var wfsConfId = d.get(0).wfs_conf;
 				for (var i in polygonArray) {
 					d.importGeometryFromText(polygonArray[i]);
+					d.get(-1).wfs_conf = wfsConfId;
 				}
 				parent.mb_disableThisButton(button_split);
 			});
@@ -824,8 +835,12 @@
 			parent.mb_ajax_post("../php/mod_digitize_differencePolygon.php", {polygon1: polygon1Text, polygon2: polygon2Text}, function(json, status) {
 				var response = eval('(' + json + ')');
 				var polygonArray = response.polygons;
+				var wfsConfId = d.get(0).wfs_conf;
+				var wfsProperties = d.get(0).e;
 				for (var i in polygonArray) {
 					d.importGeometryFromText(polygonArray[i]);
+					d.get(-1).wfs_conf = wfsConfId;
+					d.get(-1).e = wfsProperties;
 				}
 				parent.mb_disableThisButton(button_difference);
 			});
@@ -1150,7 +1165,7 @@
 				if (d.get(i).count() > 1) {
 					multi = "multi";
 				}
-				listOfGeom += ">" + geomName +" (" + multi + currentGeomType + ")</div>";
+				listOfGeom += ">" + htmlspecialchars(geomName) +" (" + multi + currentGeomType + ")</div>";
 				
 				// multigeometries
 				listOfGeom += "<ul>";

Modified: branches/print_dev/http/javascripts/mod_dragMapSize.php
===================================================================
--- branches/print_dev/http/javascripts/mod_dragMapSize.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_dragMapSize.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -22,8 +22,12 @@
 ?>
 var mod_dagMapSize_offset  = 15;
 var mod_dagMapSize_active  = false;
-mb_registerInitFunctions("mod_dragMapSize_init()");
-mb_registerSubFunctions("mod_dragMapSize_arrange()");
+eventInit.register(function () {
+	mod_dragMapSize_init();
+});
+eventAfterMapRequest.register(function () {
+	mod_dragMapSize_arrange()
+});
 
 function mod_dragMapSize_arrange(){
 	var left = parseInt(document.getElementById(mod_dragMapSize_target).style.left) + parseInt(document.getElementById(mod_dragMapSize_target).style.width) + mod_dagMapSize_offset - (parseInt(document.getElementById('dragMapSize').style.width)/2);
@@ -78,29 +82,27 @@
 	mb_getMousePos(e);
 	mb_end_x = clickX;
 	mb_end_y = clickY;
-	var ind = getMapObjIndexByName(mod_dragMapSize_target);
+	targetObject = getMapObjByName(mod_dragMapSize_target);
 	var dif_x = (parseFloat(mb_end_x) - parseFloat(mb_start_x));
 	var dif_y = (parseFloat(mb_end_y) - parseFloat(mb_start_y));
 	
-	if(parseFloat(mb_mapObj[ind].width) + parseFloat(dif_x)<0 ||
-		parseFloat(mb_mapObj[ind].height) + parseFloat(dif_y)<0)
+	if(parseFloat(targetObject.width) + parseFloat(dif_x)<0 ||
+		parseFloat(targetObject.height) + parseFloat(dif_y)<0)
 	{
 		var dif_x = mb_start_x - (parseInt(document.getElementById('dragMapSize').style.width) / 2);
 		var dif_y = mb_start_y - (parseInt(document.getElementById('dragMapSize').style.height) / 2);
 		mb_arrangeElement('', "dragMapSize", dif_x, dif_y);
 		return;
 	}
-	
-	var pos =  makeClickPos2RealWorldPos(mod_dragMapSize_target, (parseFloat(mb_mapObj[ind].width) + parseFloat(dif_x)), (parseFloat(mb_mapObj[ind].height) + parseFloat(dif_y)));
-	mb_mapObj[ind].width = parseFloat(mb_mapObj[ind].width) + parseFloat(dif_x);
-	mb_mapObj[ind].height = parseFloat(mb_mapObj[ind].height) + parseFloat(dif_y);
-	document.getElementById(mod_dragMapSize_target).style.width = mb_mapObj[ind].width;
-	document.getElementById(mod_dragMapSize_target).style.height = mb_mapObj[ind].height;
-	window.frames[mod_dragMapSize_target].document.getElementById("maps").style.width = mb_mapObj[ind].width;
-	window.frames[mod_dragMapSize_target].document.getElementById("maps").style.height = mb_mapObj[ind].height;
-	var mybbox = mb_mapObj[ind].extent.split(",");
-	mb_mapObj[ind].extent = mybbox[0] + "," + pos[1] + "," + pos[0] + "," +  mybbox[3];
-	setMapRequest(mod_dragMapSize_target);
+	var newX = (parseFloat(targetObject.width) + parseFloat(dif_x));
+	var newY = (parseFloat(targetObject.height) + parseFloat(dif_y));
+	var pos =  makeClickPos2RealWorldPos(mod_dragMapSize_target, newX, newY);
+	targetObject.setWidth(targetObject.getWidth() + parseFloat(dif_x));
+	targetObject.setHeight(targetObject.getHeight() + parseFloat(dif_y));
+
+	var mybbox = targetObject.extent.split(",");
+	targetObject.setExtent(mybbox[0], pos[1], pos[0], mybbox[3]);
+	targetObject.setMapRequest();
 	eventResizeMap.trigger();
 }
 

Modified: branches/print_dev/http/javascripts/mod_featureInfo.php
===================================================================
--- branches/print_dev/http/javascripts/mod_featureInfo.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_featureInfo.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -18,16 +18,28 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+//defaults for element vars
 ?>
+if(typeof(featureInfoLayerPopup)==='undefined')
+	var featureInfoLayerPopup = 'false';
+if(typeof(featureInfoPopupHeight)==='undefined')
+	var featureInfoPopupHeight = '200';
+if(typeof(featureInfoPopupWidth)==='undefined')
+	var featureInfoPopupWidth = '270';
+
 var mod_featureInfo_elName = "featureInfo1";
 var mod_featureInfo_frameName = "";
 var mod_featureInfo_target = "<?php echo $e_target[0]; ?>";
+var mod_featureInfo_mapObj = null;
 
 var mod_featureInfo_img_on = new Image(); mod_featureInfo_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_featureInfo_img_off = new Image(); mod_featureInfo_img_off.src ="<?php  echo $e_src;  ?>";
 var mod_featureInfo_img_over = new Image(); mod_featureInfo_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
 function init_featureInfo1(ind){
+	mod_featureInfo_mapObj = getMapObjByName(mod_featureInfo_target);
+	
 	mb_button[ind] = document.getElementById(mod_featureInfo_elName);
 	mb_button[ind].img_over = mod_featureInfo_img_over.src;
 	mb_button[ind].img_on = mod_featureInfo_img_on.src;
@@ -39,19 +51,45 @@
 	mb_button[ind].stop = new Function ("mod_featureInfo_disable()");
 }
 function mod_featureInfo_click(){   
-	window.frames[mod_featureInfo_target].document.onclick = mod_featureInfo_event;
+	mod_featureInfo_mapObj.getDomElement().onclick = mod_featureInfo_event;
 }
 function mod_featureInfo_disable(){
-	window.frames[mod_featureInfo_target].document.onclick = null;
+	mod_featureInfo_mapObj.getDomElement().onclick = null;
 }
 function mod_featureInfo_event(e){
-	if(ie){
-		clickX = window.frames[mod_featureInfo_target].event.clientX;
-		clickY = window.frames[mod_featureInfo_target].event.clientY;
+	var point = mod_featureInfo_mapObj.getMousePos(e);
+	
+	eventBeforeFeatureInfo.trigger({"fName":mod_featureInfo_target});
+	
+//TODO that code should go to featureInfo Redirect module
+	if(document.getElementById("FeatureInfoRedirect")){
+		//fill the frames
+		for(var i=0; i<mod_featureInfo_mapObj.wms.length; i++){
+			var req = mod_featureInfo_mapObj.wms[i].getFeatureInfoRequest(mod_featureInfo_mapObj, point);
+			if(req)
+				window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfo_mapObj.wms[i].wms_id).src = req;
+		}
 	}
 	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
+		urls = mod_featureInfo_mapObj.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:urls[i],
+						width:parseInt(featureInfoPopupWidth, 10),
+						height:parseInt(featureInfoPopupHeight, 10),
+						top:200,
+						left:600
+					});
+				}
+				else
+					window.open(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_featureInfo_target,clickX,clickY);
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_featureInfoRedirect.php
===================================================================
--- branches/print_dev/http/javascripts/mod_featureInfoRedirect.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_featureInfoRedirect.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -22,8 +22,12 @@
 * sticky IFRAME, right from the main mapframe "mapframe1"
 */
 
-mb_registerSubFunctions("mod_featureInfoRedirect_position()");
-mb_registerFeatureInfoPreFunctions("mod_featureInfoRedirect_set(fName)");
+eventAfterMapRequest.register(function () {
+	mod_featureInfoRedirect_position();
+});
+eventBeforeFeatureInfo.register(function (obj) {
+	mod_featureInfoRedirect_set(obj.fName);
+});
 
 function mod_featureInfoRedirect_set(fName){
 	var ind = getMapObjIndexByName("mapframe1");

Modified: branches/print_dev/http/javascripts/mod_featureInfoTunnel.php
===================================================================
--- branches/print_dev/http/javascripts/mod_featureInfoTunnel.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_featureInfoTunnel.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -18,10 +18,20 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+//defaults for element vars
 ?>
+if(typeof(featureInfoLayerPopup)==='undefined')
+	var featureInfoLayerPopup = 'false';
+if(typeof(featureInfoPopupHeight)==='undefined')
+	var featureInfoPopupHeight = '200';
+if(typeof(featureInfoPopupWidth)==='undefined')
+	var featureInfoPopupWidth = '270';
+
 var mod_featureInfoTunnel_elName = "featureInfoTunnel";
 var mod_featureInfoTunnel_frameName = "";
 var mod_featureInfoTunnel_target = "<?php echo $e_target[0]; ?>";
+var mod_featureInfoTunnel_map = null;
 
 var mod_featureInfoTunnel_img_on = new Image(); mod_featureInfoTunnel_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_featureInfoTunnel_img_off = new Image(); mod_featureInfoTunnel_img_off.src ="<?php  echo $e_src;  ?>";
@@ -37,22 +47,52 @@
 	mb_button[ind].fName = mod_featureInfoTunnel_frameName;
 	mb_button[ind].go = new Function ("mod_featureInfoTunnel_click()");
 	mb_button[ind].stop = new Function ("mod_featureInfoTunnel_disable()");
+	
+	mod_featureInfoTunnel_map = getMapObjByName(mod_featureInfoTunnel_target);
 }
 function mod_featureInfoTunnel_click(){   
-	window.frames[mod_featureInfoTunnel_target].document.onclick = mod_featureInfoTunnel_event;
+	mod_featureInfoTunnel_map.getDomElement().onclick = mod_featureInfoTunnel_event;
 }
 function mod_featureInfoTunnel_disable(){
-	window.frames[mod_featureInfoTunnel_target].document.onclick = null;
+	mod_featureInfoTunnel_map.getDomElement().onclick = null;
 }
 function mod_featureInfoTunnel_event(e){
-	if(ie){
-		clickX = window.frames[mod_featureInfoTunnel_target].event.clientX;
-		clickY = window.frames[mod_featureInfoTunnel_target].event.clientY;
+	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
+	if(document.getElementById("FeatureInfoRedirect")){
+		//fill the frames
+		for(var i=0; i<mod_featureInfoTunnel_map.wms.length; i++){
+			var req = mod_featureInfoTunnel_map.wms[i].getFeatureInfoRequest(mb_mapObj[ind], point);
+			if(req)
+				window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfoTunnel_map.wms[i].wms_id).src = path+"?url="+escape(req);
+		}
 	}
 	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
-	setFeatureInfoRequest(mod_featureInfoTunnel_target,clickX,clickY, '../extensions/ext_featureInfoTunnel.php');
-}
\ No newline at end of file
+		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
+					});
+				}
+				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_forward.php
===================================================================
--- branches/print_dev/http/javascripts/mod_forward.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_forward.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -22,7 +22,6 @@
 echo "var mod_forward_overview = '".$e_target[1]."';";
 
 ?>
-var mb_MapFutureObj = new Array();
 var mod_forward_img_off = new Image(); 
 mod_forward_img_off.src = "<?php  echo preg_replace("/_off_disabled/","_off",$e_src);?>";
 var mod_forward_img_off_disabled = new Image(); 
@@ -30,16 +29,30 @@
 var mod_forward_img_over = new Image(); 
 mod_forward_img_over.src = "<?php  echo preg_replace("/_off_disabled/","_over",$e_src);?>";
 var mod_forward_img_previous = mod_forward_img_off_disabled.src;
+
+eventAfterMapRequest.register(function (obj) {
+	mod_forward_check(obj.frameName);
+});
+
+$('#<?php echo $e_id;?>').mouseover(function () {
+	mod_forward_over(this);
+}).mouseout(function() {
+	mod_forward_out(this);
+}).click(function() {
+	mod_forward_set();
+});
+
 var mod_forward_cnt = 0;
 var mod_forward_hist_cnt = 0;
-mb_registerSubFunctions("mod_forward_check(frameName)");
 
 function mod_forward_check(frameName){
-	if(mb_MapFutureObj[frameName] == null){
-		mb_MapFutureObj[frameName] = new Array();
+	var ind = getMapObjIndexByName(frameName);
+	var map = mb_mapObj[ind];
+	if(!map.mb_MapFutureObj) {
+		map.mb_MapFutureObj = [];
 	}
 	if(frameName == mod_forward_map){
-		if(mb_MapFutureObj[mod_forward_map].length > 0){
+		if(map.mb_MapFutureObj.length > 0){
 			document.getElementById("forward").src =  mod_forward_img_off.src;
 		}
 		else{
@@ -47,77 +60,63 @@
 			mod_forward_img_previous = document.getElementById("forward").src;
 		}
 	}
-	if(mb_MapHistoryObj[mod_forward_map]){
-		if(mb_MapHistoryObj[mod_forward_map].length > mod_forward_hist_cnt && mb_MapFutureObj[mod_forward_map].length == mod_forward_cnt){
+	var indForward = getMapObjIndexByName(mod_forward_map);
+	if(mb_mapObj[indForward].mb_MapHistoryObj){
+		if(mb_mapObj[indForward].mb_MapHistoryObj.length > mod_forward_hist_cnt && mb_mapObj[indForward].mb_MapFutureObj.length == mod_forward_cnt){
 			mod_forward_reset();
 		}
-		mod_forward_cnt = mb_MapFutureObj[mod_forward_map].length;
-		mod_forward_hist_cnt = mb_MapHistoryObj[mod_forward_map].length;
+		mod_forward_cnt = mb_mapObj[indForward].mb_MapFutureObj.length;
+		mod_forward_hist_cnt = mb_mapObj[indForward].mb_MapHistoryObj.length;
 	}
 }
 function mod_forward_reset(){
-	if(mb_MapHistoryObj[mod_forward_map].length > 0){
-		mb_MapFutureObj[mod_forward_map] = new Array();
-		document.getElementById("forward").src =  mod_forward_img_off_disabled.src;
+	var ind = getMapObjIndexByName(mod_forward_map);
+	if (mb_mapObj[ind].mb_MapFutureObj.length > 0){
+		mb_mapObj[ind].mb_MapFutureObj = [];
+		document.getElementById("forward").src = mod_forward_img_off_disabled.src;
 		mod_forward_img_previous = document.getElementById("forward").src;
 	}
 }
+
 function mod_forward_over(obj){
 	mod_forward_img_previous = document.getElementById("forward").src;
 	if(document.getElementById("forward").src ==  mod_forward_img_off.src){
 		document.getElementById("forward").src = mod_forward_img_over.src;
 	}
 }
+
 function mod_forward_out(obj){
 	document.getElementById("forward").src  = mod_forward_img_previous;
 }
+
 function mod_forward_set(){
 	if(mod_forward_img_previous ==  mod_forward_img_off.src){
 		var ind = getMapObjIndexByName(mod_forward_map);
-		var cnt = mb_MapFutureObj[mod_forward_map].length - 1;
-		if(mb_mapObj[ind].epsg != mb_MapFutureObj[mod_forward_map][cnt].epsg){
+		var map = mb_mapObj[ind];
+		var cnt = map.mb_MapFutureObj.length - 1;
+		if(map.epsg != map.mb_MapFutureObj[cnt].epsg){
 			var oind = getMapObjIndexByName(mod_forward_overview);
-			for(var i=0; i<mb_MapHistoryObj[mod_forward_overview].length; i++){
-				if(mb_MapHistoryObj[mod_forward_overview][i].epsg == mb_MapFutureObj[mod_forward_map][cnt].epsg){
-					mb_mapObj[oind].epsg = mb_MapHistoryObj[mod_forward_overview][i].epsg;
-					mb_mapObj[oind].extent = mb_MapHistoryObj[mod_forward_overview][i].extent;
-					setMapRequest(mod_forward_overview);
+			var ov = mb_mapObj[oind];
+			for(var i=0; i<ov.mb_MapHistoryObj.length; i++){
+				if(ov.mb_MapHistoryObj[i].epsg == map.mb_MapFutureObj[cnt].epsg){
+					ov.epsg = ov.mb_MapHistoryObj[i].epsg;
+					ov.extent = ov.mb_MapHistoryObj[i].extent;
+					ov.setMapRequest();
 					break;
 				}
 			}
 		}
-		document.getElementById(mod_forward_map).style.width = mb_MapFutureObj[mod_forward_map][cnt].width;
-		document.getElementById(mod_forward_map).style.height = mb_MapFutureObj[mod_forward_map][cnt].height;     
-		mb_mapObj[ind].width = mb_MapFutureObj[mod_forward_map][cnt].width;
-		mb_mapObj[ind].height = mb_MapFutureObj[mod_forward_map][cnt].height;
-		mb_mapObj[ind].epsg = mb_MapFutureObj[mod_forward_map][cnt].epsg;
-		mb_mapObj[ind].extent = mb_MapFutureObj[mod_forward_map][cnt].extent;
-		mb_mapObj[ind].layers = mb_MapFutureObj[mod_forward_map][cnt].layers;
-		mb_mapObj[ind].styles = mb_MapFutureObj[mod_forward_map][cnt].styles;
-		mb_mapObj[ind].querylayers = mb_MapFutureObj[mod_forward_map][cnt].querylayers;
-		mb_MapFutureObj[mod_forward_map].length = (mb_MapFutureObj[mod_forward_map].length - 1);
-		setMapRequest(mod_forward_map);
+		document.getElementById(mod_forward_map).style.width = map.mb_MapFutureObj[cnt].width;
+		document.getElementById(mod_forward_map).style.height = map.mb_MapFutureObj[cnt].height;     
+		map.width = map.mb_MapFutureObj[cnt].width;
+		map.height = map.mb_MapFutureObj[cnt].height;
+		map.epsg = map.mb_MapFutureObj[cnt].epsg;
+		map.extent = map.mb_MapFutureObj[cnt].extent;
+		map.layers = map.mb_MapFutureObj[cnt].layers;
+		map.styles = map.mb_MapFutureObj[cnt].styles;
+		map.querylayers = map.mb_MapFutureObj[cnt].querylayers;
+		map.mb_MapFutureObj.length = (map.mb_MapFutureObj.length - 1);
+		map.setMapRequest();
 	}
 }
-function mb_setFutureObj(frameName){
-	var ind = getMapObjIndexByName(frameName);
-	var cnt = mb_MapFutureObj[frameName].length;
-	mb_MapFutureObj[frameName][cnt] = new Object();
-	mb_MapFutureObj[frameName][cnt].reqCnt = mod_back_cnt;
-	mb_MapFutureObj[frameName][cnt].width = mb_mapObj[ind].width;
-	mb_MapFutureObj[frameName][cnt].height = mb_mapObj[ind].height;
-	mb_MapFutureObj[frameName][cnt].epsg = mb_mapObj[ind].epsg;
-	mb_MapFutureObj[frameName][cnt].extent = mb_mapObj[ind].extent;
-	mb_MapFutureObj[frameName][cnt].layers = new Array();
-	for(var i=0; i<mb_mapObj[ind].layers.length;i++){
-		mb_MapFutureObj[frameName][cnt].layers[i] = mb_mapObj[ind].layers[i];
-	}
-	mb_MapFutureObj[frameName][cnt].styles = new Array();
-	for(var i=0; i<mb_mapObj[ind].styles.length;i++){
-		mb_MapFutureObj[frameName][cnt].styles[i] = mb_mapObj[ind].styles[i];
-	}
-	mb_MapFutureObj[frameName][cnt].querylayers = new Array();
-	for(var i=0; i<mb_mapObj[ind].querylayers.length;i++){
-		mb_MapFutureObj[frameName][cnt].querylayers[i] = mb_mapObj[ind].querylayers[i];
-	}
-}
\ No newline at end of file
+

Modified: branches/print_dev/http/javascripts/mod_help.php
===================================================================
--- branches/print_dev/http/javascripts/mod_help.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_help.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -22,33 +22,76 @@
 ?>
 try{if(mod_help_color){}}catch(e){mod_help_color = '#cc33cc';}
 try{if(mod_help_thickness){}}catch(e){mod_help_color = 3;}
-var mod_help_elName = "help";
+try{if(mod_help_width){}}catch(e){mod_help_width = 1000;}
+try{if(mod_help_height){}}catch(e){mod_help_height = 1000;}
+try{if(mod_help_text){}}catch(e){mod_help_text = "<?php echo _mb("click highlighted elements for help");?>"}
+var mod_help_elName = "<?php echo $e_id; ?>";
 var mod_help_str = "";
 var mod_help_img_on = new Image(); mod_help_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_help_img_off = new Image(); mod_help_img_off.src ="<?php  echo $e_src;  ?>";
 var mod_help_img_over = new Image(); mod_help_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
-function init_help(ind){
+mb_regButton(function (ind) {
 	mb_button[ind] = document.getElementById(mod_help_elName);
 	mb_button[ind].img_over = mod_help_img_over.src;
 	mb_button[ind].img_on = mod_help_img_on.src;
 	mb_button[ind].img_off = mod_help_img_off.src;
 	mb_button[ind].status = 0;
 	mb_button[ind].elName = mod_help_elName;
-	mb_button[ind].go = new Function ("mod_help_click()");
-	mb_button[ind].stop = new Function ("mod_help_disable()");
-}
+	mb_button[ind].go = function () {
+		mod_help_click();
+	};
+	mb_button[ind].stop = function () {
+		mod_help_disable();
+	};
+});
+
 function mod_help_click(){
-	if(!document.getElementById('mod_help_img')){
 		//create html tags
 		mod_help_set();
 		//request help string
-		mb_ajax_post("../php/mod_help.php?gui_id=<?php echo $gui_id ?>", null, mod_help_set_str);
+		var usemapHtml = "";
+		for (var module in Mapbender.Modules) {
+			var currentModule = Mapbender.Modules[module];
+			var top = parseInt(currentModule.top) || 0;
+			var left = parseInt(currentModule.left) || 0;
+			var width = parseInt(currentModule.width) || 0;
+			var height = parseInt(currentModule.height) || 0;
+			
+			usemapHtml += "<area id='helpArea_" + module + "' " + 
+				"shape='rect' coords='" + left + "," + 
+				top + "," + (parseInt(left + width)) + "," + 
+				parseInt(top + height) + "' href='#' " + 
+				"alt='" + ((currentModule.id == mod_help_elName) ? mod_help_text : "HELP: " + currentModule.url) + "' " +
+				"title='" + ((currentModule.id == mod_help_elName) ? mod_help_text : "HELP: " + currentModule.url) + "' " + 
+				"nohref />";
+
+		}		
+			
+		var transparentImgHtml = "<img src='../img/transparent.gif' style='cursor:help' " + 
+			"width='" + mod_help_width + "' height='" + mod_help_height + 
+			"' usemap='#mod_help_imagemap' border='0'>";
+		
+		var html = "<div id='helpMapContainer'>" + transparentImgHtml + "<map name='mod_help_imagemap'>" + usemapHtml + "</map></div>";
+
+		$('#mod_help_img').empty().html(html);
+
+		for (var module in Mapbender.Modules) {
+			(function () {
+				var currentModule = Mapbender.Modules[module];
+				$("#helpArea_" + module).click(function () {
+					mod_help_disable();
+					var w = window.open(currentModule.url, "help");
+				});
+			}());
+		}
+			
+		mod_help_set_str();
 		return;
-	}
 	
-	mod_help_set_str(mod_help_str, "success");
+	mod_help_set_str();
 }
+
 function mod_help_disable(){
 	document.getElementById('mod_help_img').innerHTML = '';
 	document.getElementById('mod_help_img').style.width = '0px';
@@ -79,9 +122,7 @@
 	
 	return true;
 }
-function mod_help_set_str(str, status){
-	mod_help_str = str;
-	document.getElementById('mod_help_img').innerHTML = mod_help_str;
+function mod_help_set_str(){
 	mod_help_update();
 	mod_help_draw();
 }
@@ -89,14 +130,22 @@
 function mod_help_update(){
 	//try to update tab coords
 	try{
-		for(var j=0;j< tabs.count(); j++){
-			var ta = tabs.get(j);
-			var area = document.getElementById("helpArea_"+ta.module);
-			if(area)
-				area.coords = tabs.getCoords(ta.module);
+		for (var module in Mapbender.Modules) {
+			var tab = $("#tabs_" + module).get(0);
+			if (tab) {
+				var area = $("#helpArea_" + module).get(0);			
+				var top = parseInt(tab.style.top);
+				var left = parseInt(tab.style.left);
+				var width = parseInt(tab.style.width);
+				var height = parseInt(tab.style.height);
+				var lly = parseInt(top-height);
+				var urx = parseInt(left+width);
+				area.coords = left + "," + lly + "," + urx + "," + top;
+			}
 		}
 	}
 	catch(e){
+		console.log(e);
 	}
 }
 

Modified: branches/print_dev/http/javascripts/mod_highlightPOI.php
===================================================================
--- branches/print_dev/http/javascripts/mod_highlightPOI.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_highlightPOI.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -52,8 +52,12 @@
 	poi_style = 'background-color:white;font-weight: bold;color:black;font-family:Arial;';
 }
 
-mb_registerInitFunctions('mod_highlightPOI_init()');
-mb_registerSubFunctions('mod_highlightPOI_draw()');
+eventInit.register(function () {
+	mod_highlightPOI_init();
+});
+eventAfterMapRequest.register(function () {
+	mod_highlightPOI_draw();
+});
 
 var mod_highlightPOI_minx;
 var mod_highlightPOI_miny;
@@ -121,11 +125,17 @@
 
 function mod_highlightPOI_draw(){
   var ind = getMapObjIndexByName(mod_highlightPOI_target);
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.width = mb_mapObj[ind].width;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.height = mb_mapObj[ind].height;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.top = 0;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.left = 0;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.visibility = 'visible';
+  var div = new DivTag(mod_highlightPOI_target+'permanent', mb_mapObj[ind].frameName, 
+  	{
+		"position":"absolute",
+		"width":mb_mapObj[ind].width+"px",
+		"height":mb_mapObj[ind].height+"px",
+		"top":0,
+		"left":0,
+		"width":0,
+		"height":0,
+		"visibility":"visible"
+	});
   var tagSource = "";
   for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
     var pos = makeRealWorld2mapPos(mod_highlightPOI_target,mod_highlightPOI_params[i+1], mod_highlightPOI_params[i+2]);
@@ -134,5 +144,5 @@
     tagSource += "<span style='"+poi_style+"'>"+mod_highlightPOI_params[i]+"<span>";
     tagSource += "</div>";
   }
-  writeTag(mod_highlightPOI_target, "permanent", tagSource);
-}
\ No newline at end of file
+  div.write(tagSource);
+}

Modified: branches/print_dev/http/javascripts/mod_initWmc.php
===================================================================
--- branches/print_dev/http/javascripts/mod_initWmc.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_initWmc.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -61,43 +61,36 @@
 	
 //WMC
 if (isset($wmc_id)) {
-	if ($adm->getWmcById($wmc_id) != false) {
+	$myInitWmc = new wmc();
+	$success = $myInitWmc->createFromDb($wmc_id);
+	if ($success) {
 
-		$valid_wmcs = $adm->getWmcByOwner($user);
-		if (in_array($wmc_id, $valid_wmcs)) {
-			echo "var wmc_id = false;";
-			echo "wmc_id = '".$wmc_id."';";
-			$wmc = new wmc();
-			$wmc->createFromDb($wmc_id);
-			$js_wmc .= $wmc->createJsObjFromWMC("", $e_target[0], $action);
+		$js_wmc = implode("", $myInitWmc->toJavaScript());
+		new mb_exception("WMC JS: " . $js_wmc);
+		
+		if (!empty($x) && !empty($y) && !empty($icon)) {
 			
-			if (!empty($x) && !empty($y) && !empty($icon)) {
-				
-				$js_kml .= "var myPoint = realToMap('".$e_target[0]."', new Point(".$x.",".$y."));\n";
+			$js_kml .= "var myPoint = realToMap('".$e_target[0]."', new Point(".$x.",".$y."));\n";
 
-				// 7 is half the width of pin.png
-				$js_kml .= "myPoint.x -= 7;";
-				// 20 is the height of pin.png
-				$js_kml .= "myPoint.y -= 20;";
+			// 7 is half the width of pin.png
+			$js_kml .= "myPoint.x -= 7;";
+			// 20 is the height of pin.png
+			$js_kml .= "myPoint.y -= 20;";
 
-				$js_kml .= "var meetingPointLogoStyle = {'position':'absolute', 'top':0, 'left':0, 'z-index':100, 'font-size':'10px'};\n"; 
-				$js_kml .= "meetingPointLogoTag = new DivTag('meeting_logo', '".$e_target[0]."', meetingPointLogoStyle);\n";
-				$js_img .= "<img id='meeting_img' border='0' src='".$icon."' title='".$alt."'>";
-				if ($url) {
-					$js_img = "<a href='".$url."' target='_blank'>" . $js_img . "</a>";
-				}
-				$js_kml .= "var meetingPointLogoText = \"" . $js_img . "\";\n";
-				$js_kml .= "meetingPointLogoTag.write(meetingPointLogoText);\n";
-				$js_kml .= "var meeting_img = window.frames['".$e_target[0]."'].document.getElementById('meeting_img');";
-				$js_kml .= "meeting_img.style.position = 'absolute';";
-				$js_kml .= "meeting_img.style.top = myPoint.y;";
-				$js_kml .= "meeting_img.style.left = myPoint.x;";
-				$js_kml .= "mb_registerPanSubElement('meeting_logo');";
+			$js_kml .= "var meetingPointLogoStyle = {'position':'absolute', 'top':0, 'left':0, 'z-index':100, 'font-size':'10px'};\n"; 
+			$js_kml .= "meetingPointLogoTag = new DivTag('meeting_logo', '".$e_target[0]."', meetingPointLogoStyle);\n";
+			$js_img .= "<img id='meeting_img' border='0' src='".$icon."' title='".$alt."'>";
+			if ($url) {
+				$js_img = "<a href='".$url."' target='_blank'>" . $js_img . "</a>";
 			}
+			$js_kml .= "var meetingPointLogoText = \"" . $js_img . "\";\n";
+			$js_kml .= "meetingPointLogoTag.write(meetingPointLogoText);\n";
+			$js_kml .= "var meeting_img = window.frames['".$e_target[0]."'].document.getElementById('meeting_img');";
+			$js_kml .= "meeting_img.style.position = 'absolute';";
+			$js_kml .= "meeting_img.style.top = myPoint.y;";
+			$js_kml .= "meeting_img.style.left = myPoint.x;";
+			$js_kml .= "mb_registerPanSubElement('meeting_logo');";
 		}
-		else {
-			$js_error .= "alert('".$adm->getUserNameByUserId($user)." is not allowed to access WMC ".$wmc_id.". Default GUI will be loaded instead.');"; 
-		}
 	}
 	else {
 		$js_error .= "alert('WMC id ".$wmc_id." is not valid. Default GUI will be loaded instead.');"; 
@@ -111,7 +104,6 @@
 
 echo "function addFlag() {";
 echo $js_kml;
-echo $js_error;
 echo "}";
 
 

Modified: branches/print_dev/http/javascripts/mod_loadwmc.js
===================================================================
--- branches/print_dev/http/javascripts/mod_loadwmc.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_loadwmc.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -281,4 +281,4 @@
 			$tr.fadeIn("slow");
 		}());
 	}
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_loadwmc.php
===================================================================
--- branches/print_dev/http/javascripts/mod_loadwmc.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_loadwmc.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -29,11 +29,11 @@
 		$e = new mb_notice("wmc not set, generating from app: " . $_SESSION["mb_user_gui"]);
 		$wmc->createFromApplication($_SESSION["mb_user_gui"]);		
 		$_SESSION["mb_wmc"] = $wmc->toXml();
-		$e = new mb_exception("initial WMC: " . $_SESSION["mb_wmc"]);
+//		$e = new mb_exception("initial WMC: " . $_SESSION["mb_wmc"]);
 	}
 
 	if (isset($_SESSION['mb_wmc'])) {
-		$e = new mb_notice("merging with WMC.");
+		$e = new mb_exception("merging with WMC.");
 
 		if ($wmc->createFromXml($_SESSION['mb_wmc'])) {
 	

Modified: branches/print_dev/http/javascripts/mod_measure.php
===================================================================
--- branches/print_dev/http/javascripts/mod_measure.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_measure.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -34,6 +34,7 @@
 
 var mod_measure_elName = "measure";
 var mod_measure_frameName = "";
+var mod_measure_mapObj = null;
 var mod_measure_epsg;
 var mod_measure_width;
 var mod_measure_height;
@@ -41,13 +42,46 @@
 var mod_measure_RY = new Array();
 var mod_measure_Dist = new Array();
 var mod_measure_TotalDist = new Array();
-var mod_measureSubFunctions = new Array();
 
+// global variable
+window.eventAfterMeasure = new MapbenderEvent();
+
 var mod_measure_img_on = new Image(); mod_measure_img_on.src = "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_measure_img_off = new Image(); mod_measure_img_off.src = "<?php  echo $e_src;  ?>";
 var mod_measure_img_over = new Image(); mod_measure_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
+eventBeforeInit.register(function () {
+	mb_regButton(function (ind) {
+		init_mod_measure(ind);
+	});
+});
+
 function init_mod_measure(ind){
+	mod_measure_mapObj = getMapObjByName(mod_measure_target);
+	//ensure we have the div elements in Mapframe
+	var map_el = mod_measure_mapObj.getDomElement()
+	if(!map_el.ownerDocument.getElementById(mod_measure_target+"_measure_sub")){
+		el = map_el.ownerDocument.createElement("div");
+		el.style.position = "absolute";
+		el.style.top = "0px";
+		el.style.left = "0px";
+		el.style.zIndex = "16";
+		el.style.fontSize = "10px";
+
+		el1 = el.cloneNode(false);
+		el2 = el.cloneNode(false);
+
+		el.id = mod_measure_target+"_measure_sub";
+		el.style.zIndex = "19";
+		el1.id = mod_measure_target+"_measure_display";
+		el1.style.zIndex = "17";
+		el2.id = mod_measure_target+"_measuring";
+		
+		map_el.appendChild(el);
+		map_el.appendChild(el1);
+		map_el.appendChild(el2);
+	}
+	
 	mb_button[ind] = document.getElementById(mod_measure_elName);
 	mb_button[ind].img_over = mod_measure_img_over.src;
 	mb_button[ind].img_on = mod_measure_img_on.src;
@@ -55,56 +89,56 @@
 	mb_button[ind].status = 0;
 	mb_button[ind].elName = mod_measure_elName;
 	mb_button[ind].fName = mod_measure_frameName;
-	mb_button[ind].go = new Function ("mod_measure_go()");
-	mb_button[ind].stop = new Function ("mod_measure_disable()");
-	var ind = getMapObjIndexByName(mod_measure_target);
-	mod_measure_width = mb_mapObj[ind].width;
-	mod_measure_height = mb_mapObj[ind].height;
-	mod_measure_epsg = mb_mapObj[ind].epsg;
-	mb_registerSubFunctions("drawDashedLine()");
-	mb_registerPanSubElement("measuring");
+	mb_button[ind].go = function () {
+		mod_measure_go();
+	};
+	mb_button[ind].stop = function () {
+		mod_measure_disable();
+	};
+	mod_measure_width = mod_measure_mapObj.width;
+	mod_measure_height = mod_measure_mapObj.height;
+	mod_measure_epsg = mod_measure_mapObj.epsg;
+	eventAfterMapRequest.register(function () {
+		drawDashedLine();
+	});
+	mb_registerPanSubElement(mod_measure_target+"_measuring");
 }
-function register_measureSubFunctions(stringFunction){
-	mod_measureSubFunctions[mod_measureSubFunctions.length] = stringFunction;
-}
 function mod_measure_go(){
-	var el = window.frames[mod_measure_target].document;
+	var el = mod_measure_mapObj.getDomElement();
 	el.onmousedown = mod_measure_start;
 	el.onmousemove = mod_measure_run;
 	el.onmouseover = function () {
-		el.body.style.cursor = 'crosshair';
+		el.style.cursor = 'crosshair';
 	}
 	el.onmouseout = function () {
-		el.body.style.cursor = 'auto';
+		el.style.cursor = 'auto';
 	}
-	var measureSub = "";
-	for(var i=0; i<mod_measureSubFunctions.length; i++){
-		measureSub += eval(mod_measureSubFunctions[i]);
-	}   
-	writeTag(mod_measure_target,"measure_sub",measureSub);
+	var measureSub = eventAfterMeasure.trigger({}, "CAT");
+	writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measure_sub",measureSub);
 }
 function mod_measure_disable(){
-	var el = window.frames[mod_measure_target].document; 
+	var el = mod_measure_mapObj.getDomElement();
 	el.onmousedown = null;
 	el.onmousemove = null;
 	el.onmouseover = null;
 	el.onmouseout = null;
-	writeTag(mod_measure_target,"measure_display","");
-	writeTag(mod_measure_target,"measure_sub","");
+	writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measure_display","");
+	writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measure_sub","");
 }
 function mod_measure_timeout(){
-	var el = window.frames[mod_measure_target].document; 
+	var el = mod_measure_mapObj.getDomElement();
 	el.onmousedown = null;
 	el.ondblclick = null;
 	el.onmousemove = null;
 }
 function mod_measure_disableTimeout(){
-	var el = window.frames[mod_measure_target].document;
+	var el = mod_measure_mapObj.getDomElement();
 	el.onmousedown = mod_measure_start;
 	el.onmousemove = mod_measure_run;
 }
 function mod_measure_start(e){
-	mb_getMousePos(e,mod_measure_target);
+	mod_measure_mapObj.getMousePos(e);
+	
 	var realWorldPos = makeClickPos2RealWorldPos(mod_measure_target,clickX,clickY);
 	if(mod_measure_epsg=="EPSG:4326"){
 		mod_measure_RX[mod_measure_RX.length] = realWorldPos[0];
@@ -142,12 +176,11 @@
 }
 function drawDashedLine(){
 	//check if epsg has changed
-	var ind = getMapObjIndexByName(mod_measure_target);
-	mod_measure_width = mb_mapObj[ind].width;
-	mod_measure_height = mb_mapObj[ind].height;
-	if(mod_measure_epsg != mb_mapObj[ind].epsg){
+	mod_measure_width = mod_measure_mapObj.width;
+	mod_measure_height = mod_measure_mapObj.height;
+	if(mod_measure_epsg != mod_measure_mapObj.epsg){
 		mod_measure_delete();
-		mod_measure_epsg = mb_mapObj[ind].epsg;
+		mod_measure_epsg = mod_measure_mapObj.epsg;
 	}
 	var str_mPoints = "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='"+mod_measure_width+"' height='0'></div>";
 	str_mPoints += "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='0' height='"+mod_measure_height+"'></div>";
@@ -170,7 +203,7 @@
 			str_mPoints += evaluateDashes(pos1[0],pos1[1],pos0[0],pos0[1],k);
 		}
 	}
-	writeTag(mod_measure_target,"measuring",str_mPoints);
+	writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measuring",str_mPoints);
 }
 function evaluateDashes(x1,y1,x2,y2,count){
 	var str_dashedLine = "";
@@ -195,7 +228,7 @@
 	return str_dashedLine;
 }
 function mod_measure_run(e){
-	mb_getMousePos(e,mod_measure_target);
+	mod_measure_mapObj.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_measure_target,clickX,clickY);
 	var dist;
 	if(mod_measure_epsg=="EPSG:4326"){
@@ -213,11 +246,11 @@
 	}
 	if(isNaN(dist) == false && clickX > 0 && clickX < mod_measure_width && clickY > 0 && clickY < mod_measure_height){
 		var str_display = "<span style='font-family:"+mod_measure_font+";font-size:"+mod_measure_fontsize+";color:"+mod_measure_color2+";'>"+(Math.round(dist*100)/100)+" m</span>";
-		writeTag(mod_measure_target,"measure_display",str_display);
-		mb_arrangeElement(mod_measure_target,"measure_display",clickX +2, clickY - 10);
+		writeTag(mod_measure_mapObj.frameName, mod_measure_target+"_measure_display",str_display);
+		mb_arrangeElement(mod_measure_mapObj.frameName,mod_measure_target+"_measure_display",clickX +2, clickY - 10);
 	}
 	else{
-		writeTag(mod_measure_target,"measure_display","");
+		writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measure_display","");
 	}
 }
 function mod_measure_close(){
@@ -255,6 +288,89 @@
 	mod_measure_RY = new Array();
 	mod_measure_Dist = new Array();
 	mod_measure_TotalDist = new Array();
-	writeTag(mod_measure_target,"measuring","");
-	writeTag(mod_measure_target,"measure_display","");
-}
\ No newline at end of file
+	writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measuring","");
+	writeTag(mod_measure_mapObj.frameName,mod_measure_target+"_measure_display","");
+}
+
+var mod_closePolygon_img = new Image();
+mod_closePolygon_img.src = "../img/button_gray/closePolygon_off.gif";
+
+eventAfterMeasure.register(function(){
+	return mod_closePolygon();
+});
+
+function mod_closePolygon(){
+	var str =  "<div style='position:absolute;top:25px' onmouseup='parent.mod_closePolygon_go()' ";
+	str += "onmouseover='parent.mod_measure_timeout()' onmouseout='parent.mod_measure_disableTimeout()'><img src='"+mod_closePolygon_img.src+"'></div>";
+	return str;
+}
+function mod_closePolygon_go(){
+	mod_measure_close();
+}
+
+var mod_rubber_img = new Image();
+mod_rubber_img.src = "../img/button_gray/rubber_off.gif";
+mod_rubber_img.title = "gemessene Strecke l&ouml;schen";
+eventAfterMeasure.register(function () {
+	return mod_rubber();
+});
+
+function mod_rubber(){
+   var str =  "<div onmouseup='parent.mod_rubber_go()' onmouseover='parent.mod_measure_timeout()' onmouseout='parent.mod_measure_go()'><img src='"+mod_rubber_img.src+"' title='"+mod_rubber_img.title+"'></div>";
+   return str;
+}
+function mod_rubber_go(){
+   mod_measure_delete();
+}
+
+var mod_getArea_img = new Image();
+mod_getArea_img.src = "../img/button_gray/getArea_off.gif";
+eventAfterMeasure.register(function () {
+	return mod_getArea();
+});
+
+function mod_getArea(){
+	var str =  "<div id='getAreaButton' style='position:absolute;top:50px' onmouseup='parent.mod_getArea_go()' ";
+	str += "onmouseover='parent.mod_measure_timeout()' onmouseout='parent.mod_measure_disableTimeout()'><img src='"+mod_getArea_img.src+"'></div>";
+	return str;
+}
+function mod_getArea_go(){
+	if(mod_measure_RX[mod_measure_RX.length -1] == mod_measure_RX[0] && mod_measure_RY[mod_measure_RY.length -1] == mod_measure_RY[0]){
+		var ind = getMapObjIndexByName(mod_measure_target);
+		var url = "../php/mod_evalArea.php?x=";
+		for(var i=0; i<mod_measure_RX.length;i++){
+			if(i>0){ url += ",";}
+			url += mod_measure_RX[i];
+		}
+		url += "&y=";
+		for(var i=0; i<mod_measure_RY.length;i++){
+			if(i>0){ url += ",";}
+			url += mod_measure_RY[i];
+		}
+		var srs = mb_mapObj[ind].epsg.split(":");
+		url += "&srs="+ escape(srs[1]);
+		url += "&length=" + mod_measure_TotalDist[mod_measure_TotalDist.length-1];
+		url += "&distance="  + mod_measure_TotalDist[mod_measure_TotalDist.length-2];
+		if(!mod_measure_win || mod_measure_win == null || mod_measure_win.closed == true){
+			mod_measure_win = window.open(url,"mod_measure_win","width=200,height=150,resizable=yes");
+		}
+		else{
+			mod_measure_win.document.location.href = url;
+		}
+		mod_measure_win.focus();
+	}
+	else{
+		if(!mod_measure_win || mod_measure_win == null || mod_measure_win.closed == true){
+			mod_measure_win = window.open("","mod_measure_win","width=200,height=150,resizable=yes");
+			mod_measure_win.document.open("text/html");
+			mod_measure_win.document.write("<span style = 'font-family : Arial, Helvetica, sans-serif;font-size : 12px;font-weight : bold;';>Strecke: " +mod_measure_TotalDist[mod_measure_TotalDist.length-1]+" m</span>");
+			mod_measure_win.document.close();        
+		}
+		else{
+			mod_measure_win.document.open("text/html");
+			mod_measure_win.document.write("<span style = 'font-family : Arial, Helvetica, sans-serif;font-size : 12px;font-weight : bold;';>Strecke: " +mod_measure_TotalDist[mod_measure_TotalDist.length-1]+" m</span>");
+			mod_measure_win.document.close();
+		}
+		mod_measure_win.focus();      
+	}
+}

Modified: branches/print_dev/http/javascripts/mod_navFrame.php
===================================================================
--- branches/print_dev/http/javascripts/mod_navFrame.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_navFrame.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -30,8 +30,20 @@
 	mod_navFrame_ext = 10;
 }
 
-mb_registerSubFunctions("mod_navFrame_arrange()");
+eventAfterMapRequest.register(function () {
+	mod_navFrame_arrange();
+});
 
+var directionArray = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
+for (var i in directionArray) {
+	(function () {
+		var currentDirection = directionArray[i];
+		$("#mb"+currentDirection).click(function () {
+			mod_navFrame(currentDirection);
+		});
+	}());
+}
+
 function  mod_navFrame_arrange(){
 	var el = document.getElementById(mod_navFrame_target).style;
 	var ext = mod_navFrame_ext;

Modified: branches/print_dev/http/javascripts/mod_pan.php
===================================================================
--- branches/print_dev/http/javascripts/mod_pan.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_pan.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -22,8 +22,8 @@
 ?>
 var mod_pan_elName = "pan1";
 var mod_pan_frameName = "";
+var mod_pan_MapObj = null;
 
-
 var mod_pan_img_on = new Image(); mod_pan_img_on.src = "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_pan_img_off = new Image(); mod_pan_img_off.src = "<?php  echo $e_src;  ?>";
 var mod_pan_img_over = new Image(); mod_pan_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
@@ -32,6 +32,7 @@
 var mb_panActive = false;
 
 function init_mod_pan(ind){
+	mod_pan_MapObj = getMapObjByName(mod_pan_target);
 	mb_button[ind] = document.getElementById(mod_pan_elName);
 	mb_button[ind].img_over = mod_pan_img_over.src;
 	mb_button[ind].img_on = mod_pan_img_on.src;
@@ -43,26 +44,25 @@
 	mb_button[ind].stop = new Function ("mod_pan_disable()");
 }
 function mod_pan_click(){   
-	var p = window.frames[mod_pan_target].document.getElementById("maps");
+	var p = mod_pan_MapObj.getDomElement();
 	p.style.cursor = "pointer";
 	
-	var el = window.frames[mod_pan_target].document; 
-	el.onmousedown = mod_pan_start;
-	el.onmouseup = mod_pan_stop;
-	el.onmousemove = mod_pan_run;
+	p.onmousedown = mod_pan_start;
+	p.onmouseup = mod_pan_stop;
+	p.onmousemove = mod_pan_run;
 }
 function mod_pan_disable(){
-	var p = window.frames[mod_pan_target].document.getElementById("maps");
-	p.style.cursor = "";
-	
-	var el = window.frames[mod_pan_target].document; 
-	el.onmousedown = null;
-	el.onmouseup = null;
-	el.onmousemove = null;
+	var p = mod_pan_MapObj.getDomElement();
+	p.style.cursor = "pointer";
+
+	p.onmousedown = null;
+	p.onmouseup = null;
+	p.onmousemove = null;
 }
 function mod_pan_start(e){
 	mb_panActive = true;
 	mb_getMousePos(e,mod_pan_target);
+	var el = mod_pan_MapObj.getDomElement();
 	mb_start_x=clickX;
 	mb_start_y=clickY;
 	mb_end_x = clickX;
@@ -71,7 +71,7 @@
 }
 function mod_pan_run(e){
 	if(mb_panActive){
-		mb_getMousePos(e,mod_pan_target);
+		mb_getMousePos(e,mod_pan_MapObj.frameName);
 		mb_end_x = clickX;
 		mb_end_y = clickY;
 		mod_pan_move_map();
@@ -87,27 +87,27 @@
 	mb_panActive = false;
 	var dif_x = mb_end_x - mb_start_x;
 	var dif_y = mb_end_y - mb_start_y;
-	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == mod_pan_target){
-			var width = mb_mapObj[i].width;
-			var height = mb_mapObj[i].height;      
-		}
-	} 
+	var width = mod_pan_MapObj.width;
+	var height = mod_pan_MapObj.height;      
+
+	var el = mod_pan_MapObj.getDomElement();
 	var center_x = (width / 2)  - dif_x;
 	var center_y = (height / 2) - dif_y;
 	var real_center = makeClickPos2RealWorldPos(mod_pan_target,center_x, center_y);   
-	mb_arrangeElement(mod_pan_target, "maps", 0, 0);
+
+	mb_arrangeElement(mod_pan_MapObj.frameName, mod_pan_target+"_maps", 0, 0);
 	for(var i=0; i<mb_PanSubElements.length; i++){
-		mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], 0, 0);
-	}
+		mb_arrangeElement(mod_pan_MapObj.frameName, mb_PanSubElements[i], 0, 0);
+	} 
    zoom(mod_pan_target,false, 1.0, real_center[0], real_center[1]);   
 }
 function mod_pan_move_map(){
 	var dif_x = mb_end_x - mb_start_x;
 	var dif_y = mb_end_y - mb_start_y;
-	mb_arrangeElement(mod_pan_target, "maps", dif_x, dif_y);
+	
+	mb_arrangeElement(mod_pan_MapObj.frameName, mod_pan_target+"_maps", dif_x, dif_y);
 	for(var i=0; i<mb_PanSubElements.length; i++){
-		mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], dif_x, dif_y);
+		mb_arrangeElement(mod_pan_MapObj.frameName, mb_PanSubElements[i], dif_x, dif_y);
 	} 
 	return false;  
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_resize_mapsize.php
===================================================================
--- branches/print_dev/http/javascripts/mod_resize_mapsize.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_resize_mapsize.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -93,13 +93,9 @@
 	var coords = mb_mapObj[ind].extent.split(",");
 	midcoordx=parseFloat((parseFloat(coords[2])-parseFloat(coords[0]))/2)+parseFloat(coords[0]);
 	midcoordy=parseFloat((parseFloat(coords[3])-parseFloat(coords[1]))/2)+parseFloat(coords[1]);
-	mb_mapObj[ind].width = mapwidth;
-	mb_mapObj[ind].height = mapheight;
-	document.getElementById(map_frame).style.width = mb_mapObj[ind].width;
-	document.getElementById(map_frame).style.height = mb_mapObj[ind].height;
-	window.frames[map_frame].document.getElementById("maps").style.width = mb_mapObj[ind].width;
-	window.frames[map_frame].document.getElementById("maps").style.height = mb_mapObj[ind].height;
-	mb_repaintScale("<?php  echo $e_target;  ?>",midcoordx,midcoordy,mb_getScale("<?php  echo $e_target;  ?>"));
+	mb_mapObj[ind].setWidth(mapwidth);
+	mb_mapObj[ind].setHeight(mapheight);
+	mb_mapObj[ind].repaintScale(midcoordx,midcoordy,mb_mapObj[ind].getScale());
 }
 
 function rebuild() {

Modified: branches/print_dev/http/javascripts/mod_sandclock.php
===================================================================
--- branches/print_dev/http/javascripts/mod_sandclock.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_sandclock.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -31,28 +31,51 @@
 var mod_sandclock_img = new Image();
 mod_sandclock_img.src = mod_sandclock_image;
 
-mb_registerSubFunctions("mod_sandclock(true,myMapId)");
+eventAfterMapRequest.register(function (obj) {
+	mod_sandclock(true,obj.myMapId);
+});
 
 function mod_sandclock(start,myMapId){
 	var ind = getMapObjIndexByName(mod_sandclock_target);
 	if(start){
 		var temp = "<img src='"+mod_sandclock_img.src+"'>";
-		writeTag(mod_sandclock_target, "sandclock", temp);
-		mb_arrangeElement(mod_sandclock_target, "sandclock", (mb_mapObj[ind].width/2 - 16), (mb_mapObj[ind].height/2 - 16));
+
+		var map_el = mb_mapObj[ind].getDomElement();
+		if(!map_el.ownerDocument.getElementById(mb_mapObj[ind].elementName+"_sandclock")){
+			//create Box Elements
+			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.width = "0px";
+			el_top.style.height = "0px";
+			el_top.style.overflow = "hidden";
+			el_top.style.zIndex = "10";
+			el_top.style.visibility = "hidden";
+			el_top.style.cursor = "crosshair";
+			el_top.style.backgroundColor = "#ff0000";
+			el_top.id = mb_mapObj[ind].elementName+"_sandclock";
+			map_el.appendChild(el_top);
+		}
+		writeTag(mb_mapObj[ind].frameName, mb_mapObj[ind].elementName+"_sandclock", temp);
+		mb_arrangeElement("", mod_sandclock_target+"_sandclock", (mb_mapObj[ind].width/2 - 16), (mb_mapObj[ind].height/2 - 16));
 	}
-	aktiv = setTimeout("mod_sandclock('','"+myMapId+"')",10);
+	aktiv = setTimeout(function () {
+		mod_sandclock('',myMapId);
+		},10);
 	var myMapIdArray = myMapId.split(",");
 	var complete = true;
 	var myMapId;
 	for (var i = 0; i < myMapIdArray.length && complete; i++) {
 		myMapId = myMapIdArray[i];
-		if(window.frames[mod_sandclock_target].document.getElementById(myMapId) && 
-			!window.frames[mod_sandclock_target].document.getElementById(myMapId).complete) {
+		var myDoc = mb_mapObj[ind].getDomElement().ownerDocument;
+		if(myDoc.getElementById(myMapId) && 
+			!myDoc.getElementById(myMapId).complete) {
 			complete = false;
 		}
 	}
 	if (complete) {
 		clearTimeout(aktiv);
-		writeTag(mod_sandclock_target, "sandclock", "");
+		writeTag(mb_mapObj[ind].frameName, mb_mapObj[ind].elementName+"_sandclock", "");
 	} 
-}
\ No newline at end of file
+}

Modified: branches/print_dev/http/javascripts/mod_saveWKT.js
===================================================================
--- branches/print_dev/http/javascripts/mod_saveWKT.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_saveWKT.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,7 +1,9 @@
 var mod_saveWKT_img = new Image();
 var mod_saveWKT_win = null;
 mod_saveWKT_img.src = "../img/button_gray/save.gif";
-register_measureSubFunctions("mod_saveWKT()");
+eventAfterMeasure.register(function () {
+	return mod_saveWKT();
+});
 
 function mod_saveWKT(){
 	var str =  "<div style='position:absolute;top:75px' onmouseup='parent.mod_saveWKT_go()' ";

Modified: branches/print_dev/http/javascripts/mod_savewmc.php
===================================================================
--- branches/print_dev/http/javascripts/mod_savewmc.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_savewmc.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -71,7 +71,12 @@
 	}
 
 	if (storeInSession) {
-		$.ajaxSetup({async:false}); //TODO: find out why async doesn't work onunload
+		$.ajaxSetup({async:false}); 
 	}
-	$.post("../php/mod_savewmc_server.php", {"saveInSession":storeInSession, "generalTitle":generalTitle, "extensionData":extensionDataString, "mapObject":$.toJSON(mb_mapObj)}, callbackFunction);
+	$.post("../php/mod_savewmc_server.php", {
+		"saveInSession":storeInSession, 
+		"generalTitle":generalTitle, 
+		"extensionData":extensionDataString, 
+		"mapObject":$.toJSON(mb_mapObj)
+	}, callbackFunction);
 }

Modified: branches/print_dev/http/javascripts/mod_scaleHint.php
===================================================================
--- branches/print_dev/http/javascripts/mod_scaleHint.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_scaleHint.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -28,7 +28,8 @@
 mb_registerPreFunctions("mod_scaleHint_init(frameName)");
 function mod_scaleHint_init(frameName){
 	if(frameName == mod_scaleHint_target){
-		var scale = mb_getScale(frameName);
+		var ind = getMapObjIndexByName(frameName);
+		var scale = mb_mapObj[ind].getScale();
 		if(scale < mod_scaleHint_min || scale > mod_scaleHint_max){
 			if(scale < mod_scaleHint_min){
 				var newScale = mod_scaleHint_min;

Modified: branches/print_dev/http/javascripts/mod_scaleSel.php
===================================================================
--- branches/print_dev/http/javascripts/mod_scaleSel.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_scaleSel.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -20,14 +20,17 @@
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
 echo "var mod_scaleSelect_target = '".$e_target[0]."';";
 ?>
-mb_registerSubFunctions("mod_scaleSelect_val(frameName)");
+eventAfterMapRequest.register(function (obj) {
+	mod_scaleSelect_val(obj.frameName);
+});
 function mod_scaleSelect(obj){
 	var ind = obj.selectedIndex;
 	mb_repaintScale(mod_scaleSelect_target,null,null,obj.options[ind].value);
 }
 function mod_scaleSelect_val(frameName){
 	if(frameName == mod_scaleSelect_target){
-		var scale = mb_getScale(frameName);
+		var ind = getMapObjIndexByName(frameName);
+		var scale = mb_mapObj[ind].getScale();
 		document.getElementById("scaleSelect").options[0].text = "1 : " + scale;
 		document.getElementById("scaleSelect").options[0].selected = true;
 	}

Modified: branches/print_dev/http/javascripts/mod_scalebar.php
===================================================================
--- branches/print_dev/http/javascripts/mod_scalebar.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_scalebar.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -29,7 +29,9 @@
 var mod_scalebar_font = "Arial, Helvetica, sans-serif";
 var mod_scalebar_fontsize = "9px";
 
-mb_registerSubFunctions("mod_scalebar()");
+eventAfterMapRequest.register(function () {
+	mod_scalebar();
+});
 function mod_scalebar(){
 	var scale = mb_getScale(mod_scalebar_target);
 	var ind = getMapObjIndexByName(mod_scalebar_target);
@@ -83,6 +85,25 @@
 	scalebarTag += "<div style='position:absolute;left:"+(img_width + 2)+"px;top:7px;color:"+mod_scalebar_color1+";font-family:"+mod_scalebar_font+";font-size:"+mod_scalebar_fontsize+";'><nobr>"+ unit+"</nobr></div>";
 	scalebarTag += "<div style='position:absolute;left:"+(img_width + 2)+"px;top:5px;color:"+mod_scalebar_color1+";font-family:"+mod_scalebar_font+";font-size:"+mod_scalebar_fontsize+";'><nobr>"+ unit+"</nobr></div>";
 	scalebarTag += "<div style='position:absolute;left:"+(img_width + 3)+"px;top:6px;color:"+mod_scalebar_color2+";font-family:"+mod_scalebar_font+";font-size:"+mod_scalebar_fontsize+";'>"+ unit+"</div>";
-	mb_arrangeElement(mod_scalebar_target, "scalebar", mod_scalebar_left, (mb_mapObj[ind].height - mod_scalebar_bottom));
-	writeTag(mod_scalebar_target, "scalebar", scalebarTag);   
+
+	var map_el = mb_mapObj[ind].getDomElement();
+	if(!map_el.ownerDocument.getElementById(mb_mapObj[ind].elementName+"_scalebar")){
+		//create Box Elements
+		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.width = "0px";
+		el_top.style.height = "0px";
+		el_top.style.overflow = "hidden";
+		el_top.style.zIndex = "10";
+		el_top.style.visibility = "hidden";
+		el_top.style.cursor = "crosshair";
+		el_top.style.backgroundColor = "#ff0000";
+		el_top.id = mb_mapObj[ind].elementName+"_scalebar";
+		map_el.appendChild(el_top);
+	}
+	mb_arrangeElement("", mod_scalebar_target+"_scalebar", mod_scalebar_left, (mb_mapObj[ind].height - mod_scalebar_bottom));
+	writeTag(mb_mapObj[ind].frameName, mb_mapObj[ind].elementName+"_scalebar", scalebarTag);
+
 }
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_selArea1.php
===================================================================
--- branches/print_dev/http/javascripts/mod_selArea1.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_selArea1.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -23,6 +23,7 @@
 var mod_selArea_frameName = "";
 var mod_selArea_target = "<?php echo $e_target[0]; ?>";
 
+var mod_selArea_MapObj = null;
 var mod_selArea_img_on = new Image(); 
 mod_selArea_img_on.src = "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_selArea_img_off = new Image(); 
@@ -31,6 +32,7 @@
 mod_selArea_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
 function init_selArea1(ind){
+	mod_selArea_MapObj = getMapObjByName(mod_selArea_target);
 	mb_button[ind] = document.getElementById(mod_selArea_elName);
 	mb_button[ind].img_over = mod_selArea_img_over.src;
 	mb_button[ind].img_on = mod_selArea_img_on.src;
@@ -42,14 +44,14 @@
 	mb_button[ind].stop = new Function ("mod_selArea_disable()");
 }
 function mod_selArea_click(){
-	var el = window.frames[mod_selArea_target].document;
+	var el = mod_selArea_MapObj.getDomElement();
 	el.onmouseover = mod_selArea_init;
 	el.onmousedown = mod_box_start;
 	el.onmouseup = mod_selArea_get;
 	el.onmousemove = mod_box_run;
 }
 function mod_selArea_disable(){
-	var el = window.frames[mod_selArea_target].document; 
+	var el = mod_selArea_MapObj.getDomElement();
 	el.onmousedown = null;
 	el.onmouseup = null;
 	el.onmousemove = null;
@@ -59,16 +61,7 @@
 	mb_zF = mod_selArea_target;
 }
 function mod_selArea_get(e){
-	mod_selArea_setValidClipping(mod_box_stop(e));
 	mb_isBF = mod_selArea_target;
 	mb_zF = mod_selArea_target;
+	mod_box_setValidClipping(mod_box_stop(e));
 }
-function mod_selArea_setValidClipping(coords){
-	if(coords.length > 2){
-		mb_calculateExtent(mb_zF,coords[0],coords[1],coords[2],coords[3]);
-		setMapRequest(mb_zF);
-	}
-	else{
-		zoom(mb_zF,true,1.0,coords[0], coords[1]);
-	}
-}

Modified: branches/print_dev/http/javascripts/mod_setBBOX1.php
===================================================================
--- branches/print_dev/http/javascripts/mod_setBBOX1.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_setBBOX1.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -20,7 +20,9 @@
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
 echo "var mod_setBBOX_target = '".$e_target[0]."';";
 ?>
-mb_registerInitFunctions("mod_setBBOX_init()");
+eventInit.register(function () {
+	mod_setBBOX_init();
+});
 function mod_setBBOX_init(){
 	var my_target = mod_setBBOX_target.split(",");
 	var myBBOX = "<?php echo $_SESSION['mb_myBBOX'] ?>";

Modified: branches/print_dev/http/javascripts/mod_setBackground.php
===================================================================
--- branches/print_dev/http/javascripts/mod_setBackground.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_setBackground.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -27,7 +27,9 @@
 echo "var mod_setBackground_wms = ".$wms.";";
 echo "var mod_setBackground_target = '".$e_target[0]."';";
 ?>
-mb_registerInitFunctions("mod_setBackground_init()");
+eventInit.register(function () {
+	mod_setBackground_init();
+});
 var mod_setBackground_active = false;
 function mod_setBackground_init(){
 	var setBackgroundSelectBox = document.setBackground.mod_setBackground_list;

Modified: branches/print_dev/http/javascripts/mod_setPOI2Scale.php
===================================================================
--- branches/print_dev/http/javascripts/mod_setPOI2Scale.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_setPOI2Scale.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -30,7 +30,9 @@
 	mod_setPOI2Scale_defScale = 5000;
 }
 
-mb_registerInitFunctions("mod_setPOI2Scale()");
+eventInit.register(function () {
+	mod_setPOI2Scale();
+});
 
 function mod_setPOI2Scale(){
 	var my_target = mod_setPOI2Scale_target.split(",");

Modified: branches/print_dev/http/javascripts/mod_switchLocale_noreload.php
===================================================================
--- branches/print_dev/http/javascripts/mod_switchLocale_noreload.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_switchLocale_noreload.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -31,7 +31,7 @@
 	var index = document.getElementById("language").selectedIndex;
 	var lang = document.getElementById("language").options[index].value;
 	mb_ajax_post("../php/mod_setLocale.php", {"lang":lang}, function(result, status) {
-		mapbender.locale = result;
+		Mapbender.locale = result;
 		eventLocalize.trigger();
 	});
 }

Modified: branches/print_dev/http/javascripts/mod_tab.js
===================================================================
--- branches/print_dev/http/javascripts/mod_tab.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_tab.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -15,14 +15,12 @@
 
 var tabs;
 
-mb_registerInitFunctions('tab_init()');
-
-
 eventLocalize.register(function () {
 	localizeTabs();
 });
 
 eventInit.register(function () {
+	tab_init();
 	localizeTabs();
 });
 
@@ -166,6 +164,7 @@
 		this.add(tab);
 
 		document.getElementById(id).style.visibility = 'hidden';
+		document.getElementById(id).style.display = 'none';
 
 		// append the new tab
 		rootNode.appendChild(this.get(-1).getNode());
@@ -418,6 +417,7 @@
 			obj.width = tabWidth;
 			obj.height = (parseInt(that.get(index).height, 10) - 2);
 			obj.visibility = 'visible';
+			obj.display = 'block';
 		}
 	};
 
@@ -431,7 +431,9 @@
 		for (var i = 0; i < that.count(); i++) {
 			that.get(i).animationFinished = false;
 		}
-		tabInterval = setInterval("tabs.animate('"+openOrClose+"')",1);
+		tabInterval = setInterval(function(){
+			tabs.animate(openOrClose);
+		},1);
 	};
 	
 	/**

Modified: branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_wfs_SpatialRequest.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -445,14 +445,38 @@
 	for (var i=0; i<mb_mapObj[ind].wms.length; i++){
 		for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
 			var o = mb_mapObj[ind].wms[i].objLayer[ii];
-			if(o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1' && o.gui_layer_visible == '1'){
-				db_wfs_conf_id[db_wfs_conf_id.length] = o.gui_layer_wfs_featuretype;
+			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=0; ii<wfs_config.length; ii++){
-			if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i])  js_wfs_conf_id[js_wfs_conf_id.length] = ii;
+		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;
+				}
+			}
 		}
 	}
 
@@ -603,15 +627,14 @@
 
 function mb_get_geom(url, filter, index, typename, js_wfs_conf_id, db_wfs_conf_id) {
 
-	mb_ajax_post("../" + wfsResultModulePath + wfsResultModuleFilename,{'url':url,'filter':filter,'typename':typename,'js_wfs_conf_id':js_wfs_conf_id, 'db_wfs_conf_id':db_wfs_conf_id},function(js_code,status){
-		if (js_code) {
-			eval(js_code);
+	mb_ajax_post("../" + wfsResultModulePath + wfsResultModuleFilename,{'url':url,'filter':filter,'typename':typename,'js_wfs_conf_id':js_wfs_conf_id, 'db_wfs_conf_id':db_wfs_conf_id},function(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);
 		}
-		if (typeof(geom) == "undefined") {
-			var geom = new GeometryArray();
-		}
+
 		checkIfAllAjaxCallsFinished(geom);
-//		prompt('', js_code);
 	});
 }
 
@@ -623,7 +646,6 @@
 	if (numberOfFinishedAjaxCalls == numberOfAjaxCalls) {
 		numberOfFinishedAjaxCalls = 0;
 		mb_execWfsReadSubFunctions(_geomArray);
-
 	}
 }
 

Modified: branches/print_dev/http/javascripts/mod_zoomCoords.php
===================================================================
--- branches/print_dev/http/javascripts/mod_zoomCoords.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_zoomCoords.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,133 +1,107 @@
 <?php
 #$Id$
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_zoomCoords.php,v 1.10 2006/03/09 08:57:13 uli_rothstein Exp $
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+# http://www.mapbender.org/Mapbender_without_iframes
+# 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_validateSession.php");
+include(dirname(__FILE__)."/../include/dyn_js.php");
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta name="author-mail" content="info at ccgis.de">
-<meta name="author" content="U. Rothstein">
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Zoom to Coordinate</title>
-<style type="text/css">
-	    <!--
+try{
+	if (zoomCoords_permanentHighlight){}
+}
+catch(e){
+	zoomCoords_permanentHighlight = 'false';
+}
 
-	    body{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .labelx{
-	    	position: absolute;
-	    	left: 5px;
-	    	top:5px;
-	    	color: Gray;
-	    }
-	    .labely{
-	    	position: absolute;
-	    	left: 80px;
-	    	top:5px;
-	    	color: Gray;
-	    }
-	    .textx{
-	    	position: absolute;
-	    	left:5px;
-	    	top:20px;
-	    	color: Gray;
-	    	width:65px;
-         border: solid thin;
-         height:20px;
-	    }
-	    .texty{
-	    	position: absolute;
-	    	left:80px;
-	    	top:20px;
-         color: Gray;
-	    	width:65px;
-         border: solid thin;
-         height:20px;
-	    }
-       .send{
-  	    	position: absolute;
-	    	left:150px;
-	    	top:20px;
-         color: Gray;
-         border: solid thin;
-         height:20px;
-       }
-	    -->
-</style>
-<?php
-echo '<script type="text/javascript">';
-echo "var mod_zoomCoords_target = '".$e_target[0]."';";
-echo "var target = mod_zoomCoords_target.split(',')";
-echo "</script>";
-?>
-<script type="text/javascript">
-<!--
+var mod_zoomCoords_target = '<?php echo $e_target[0];?>';
+mod_zoomCoords_target = mod_zoomCoords_target.split(',');
+
 function zoomCoordinate(x,y){
    x=x.replace(",",".");
    y=y.replace(",",".");
    
-   document.form1.X.value=x;
-   document.form1.Y.value=y;
-   
+   document.zoomCoordsForm.X.value=x;
+   document.zoomCoordsForm.Y.value=y;
+	  
    if (isNaN(x)==true || isNaN(y)==true){
-       alert ("Bitte geben Sie eine Zahl ein.");
+       alert ("<?php echo _mb("Please type a number.");?>");
    }else{
-      parent.zoom(target[0],true, 1.0,x,y);
+   
+	   if(zoomCoords_permanentHighlight =='true'){
+		   setPermanentMarker(x,y);
+	   }
+  		hideHighlight()
+      	zoom(mod_zoomCoords_target[0],true, 1.0,x,y);
    }
 }
 
 function highlight(x, y){
-   
-   x=x.replace(",",".");
-   y=y.replace(",",".");
-   
-   document.form1.X.value=x;
-   document.form1.Y.value=y;
-  
-   
-   if (isNaN(x)==true || isNaN(y)==true){
-     
-   }
-   else{
-      parent.mb_showHighlight(target[0],x,y);
-      parent.mb_showHighlight(target[1],x,y);
-   }
+	if(x!='' && y!=''){   
+	   x=x.replace(",",".");
+	   y=y.replace(",",".");
+	   
+	   document.zoomCoordsForm.X.value=x;
+	   document.zoomCoordsForm.Y.value=y;
+	  
+	   
+	   if (isNaN(x)==true || isNaN(y)==true){
+	     
+	   }
+	   else{
+			for(var i=0;i<mod_zoomCoords_target.length;i++){
+				mb_showHighlight(mod_zoomCoords_target[i],x,y);
+			}
+	   }
+	}
 }
 
 
 function hideHighlight(){
-   parent.mb_hideHighlight(target[0]);
-   parent.mb_hideHighlight(target[1]);
+	for(var i=0;i<mod_zoomCoords_target.length;i++){
+		mb_hideHighlight(mod_zoomCoords_target[i]);
+	}
 }
 
-// -->
-</script>
-</head>
-<body bgcolor='#ffffff' onload=''>
+function setPermanentMarker(x,y){
+ 	mod_permanentHighlight_x = parseFloat(x);
+   	mod_permanentHighlight_y = parseFloat(y);
+   	mod_permanentHighlight_text = x + ' / '+ y;
+  
+   	mod_permanentHighlight_init();
+}
 
-<?php
-echo "<form name='form1' action='" . $PHP_SELF . "?".SID."' method='post'>";
+parent.eventInitMap.register(function zoomCoorsInit(){
+	var el = document.getElementById("zoomCoords");
+	if(el){
+		el.innerHTML="<?php
+echo "<form style='font-family : Arial, Helvetica, sans-serif;font-size: 11px;' name='zoomCoordsForm' action='" . $PHP_SELF . "?".SID."' method='post'>";
 #coordinates
    
    # Deutsche Version
 
    # English Version
-      echo "<span class='labelx'>Longitude:</span>";
-      echo "<span class='labely'>Latitude:</span>";
-      echo "<input class='textx' type='text' name='X'>";
-      echo "<input class='texty' type='text' name='Y'>";
-      echo "<input class='send' type='button' value='ok' onclick='zoomCoordinate(document.form1.X.value, document.form1.Y.value); highlight(document.form1.X.value, document.form1.Y.value)' onmouseover='highlight(document.form1.X.value, document.form1.Y.value)' onmouseout='hideHighlight(document.form1.X.value, document.form1.Y.value)' >";
+      echo "<span style='position: absolute;left: 5px;top:5px;color: Gray;'>"._mb("Longitude").":</span>";
+      echo "<span style='position: absolute;left: 80px;top:5px;color: Gray;'>"._mb("Latitude").":</span>";
+      echo "<input style='position: absolute;left:5px;top:20px;color: Gray;width:65px;border: solid thin;height:20px;' type='text' name='X'>";
+      echo "<input style='position: absolute;left:80px;top:20px;color: Gray;width:65px;border: solid thin;height:20px;'class='texty' type='text' name='Y'>";
+      echo "<input style='position: absolute;left:150px;top:20px;color: Gray;border: solid thin;height:20px;' type='button' value='"._mb("ok")."' onclick='zoomCoordinate(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value); highlight(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value)' onmouseover='highlight(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value)' onmouseout='hideHighlight(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value)' >";
 
-?>
-</form>
-</body>
-</html>
+echo "</form>";
+?>";
+	}
+});
+

Modified: branches/print_dev/http/javascripts/mod_zoomFull.php
===================================================================
--- branches/print_dev/http/javascripts/mod_zoomFull.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_zoomFull.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -9,22 +9,10 @@
    mod_zoomFull_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
 function mod_zoomFull(){
-    var ind         = this.getMapObjIndexByName("<?php  echo $e_target[0];  ?>");		
-		var arrayThemen = new Array();
-		var arrayThemen = mb_mapObj[ind].wms[0].objLayer[0].layer_name;
-		this.Layer0     = arrayThemen;
-		//alert(mb_mapObj[ind].width + " - " + mb_mapObj[ind].height);
-		this.width      = mb_mapObj[ind].width;
-		this.height     = mb_mapObj[ind].height;
-      this.epsg       = wms[0].gui_wms_epsg;
-		//mb_mapObj[ind].epsg = "EPSG:31493";
-    //alert(Layer0);
-		var arrayExt = new Array();		
-		var frameName = "<?php  echo $e_target[0];  ?>"
-		var exts = setExtent(width,height,epsg);
-		arrayExt = exts.split(",");
-		
-		mb_repaint(frameName,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+	var frameName = "<?php  echo $e_target[0];  ?>"
+    var ind = this.getMapObjIndexByName(frameName);
+	
+	mb_mapObj[ind].zoomFull();
 }
 
 function mod_zoomFull_init(obj){

Modified: branches/print_dev/http/javascripts/mod_zoomIn1.php
===================================================================
--- branches/print_dev/http/javascripts/mod_zoomIn1.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_zoomIn1.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -19,14 +19,18 @@
 
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
 ?>
+var zoomin1Id = '<?php echo $e_id; ?>';
 var mod_zoom1_img = new Image(); 
 mod_zoom1_img.src = "<?php  echo $e_src;  ?>";
 var mod_zoom1_img_over = new Image(); 
 mod_zoom1_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
-function mod_zoomIn1(){
-	zoom("<?php  echo $e_target[0];  ?>", true,2.0);
-}
+var $zoomin1Button = $("#"+zoomin1Id);
+
+$zoomin1Button.click(function () {
+	zoom("<?php  echo $e_target[0];  ?>", true, 2.0);
+});
+
 function mod_zoomIn1_init(obj){
 	document.getElementById("zoomIn1").src = mod_zoom1_img_over.src;
 	obj.onmouseover = new Function("mod_zoomIn1_over()");
@@ -38,3 +42,4 @@
 function mod_zoomIn1_out(){
 	document.getElementById("zoomIn1").src = mod_zoom1_img.src;
 }
+

Modified: branches/print_dev/http/javascripts/mod_zoomOut1.php
===================================================================
--- branches/print_dev/http/javascripts/mod_zoomOut1.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/mod_zoomOut1.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -9,10 +9,14 @@
 var mod_zoomOut_img_over = new Image(); 
 mod_zoomOut_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
+var zoomOut1Id = '<?php echo $e_id; ?>';
 
-function mod_zoomOut1(){
-   zoom("<?php  echo $e_target[0];  ?>", false,2.0);
-}
+var $zoomOut1Button = $("#"+zoomOut1Id);
+
+$zoomOut1Button.click(function () {
+	zoom("<?php  echo $e_target[0];  ?>", false, 2.0);
+});
+
 function mod_zoomOut1_init(obj){
    document.getElementById("zoomOut1").src = mod_zoomOut_img_over.src;
    obj.onmouseover = new Function("mod_zoomOut1_over()");

Added: branches/print_dev/http/javascripts/ovnf.php
===================================================================
--- branches/print_dev/http/javascripts/ovnf.php	                        (rev 0)
+++ branches/print_dev/http/javascripts/ovnf.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,50 @@
+<?php 
+# $Id:$
+# http://www.mapbender.org/Mapbender_without_iframes
+# 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_validateSession.php");
+include '../include/dyn_js.php';
+?>
+var mod_overview_target = "<?php echo $e_target[0]; ?>";
+if (typeof(overview_wms) === 'undefined')overview_wms = 0;
+overview_wms = parseInt(overview_wms);
+
+mb_registerMapObj('', 'overview', overview_wms ,150, 150);
+parent.eventInitMap.register(function init_overview(){
+		var ind = getMapObjIndexByName('overview');
+		
+		var el = mb_mapObj[ind].getDomElement();
+		el.onmouseover = mod_ovSetHandler;
+		el.onmousedown = mod_box_start;
+		el.onmouseup = mod_ovGetExtent;
+		el.onmousemove = mod_box_run;
+		
+		var ov_extent = mb_mapObj[ind].getExtentInfos();
+		mb_mapObj[ind].isOverview = true;
+});
+
+function mod_ovSetHandler(e){
+	mb_isBF = 'overview';
+	mb_zF = mod_overview_target;
+}
+function mod_ovGetExtent(e){
+	mb_isBF = 'overview';
+	mb_zF = mod_overview_target;
+	mod_box_setValidClipping(mod_box_stop(e));
+}
+

Added: branches/print_dev/http/javascripts/wfs.php
===================================================================
--- branches/print_dev/http/javascripts/wfs.php	                        (rev 0)
+++ branches/print_dev/http/javascripts/wfs.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,552 @@
+<?php
+# $Id$
+# 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_validateSession.php");
+
+?>
+// ---------------------------------------------------------------------------------------------------------------
+// --- usemap (begin) --------------------------------------------------------------------------------------------
+
+function mod_usemap(wfs_name) {
+	if (wfs_name == "") {
+		usemap = "";
+	}
+	var ind = getMapObjIndexByName(mb_wfs_targets[0]);
+	var myImg = window.frames[mb_wfs_targets[0]].document.getElementById("um_img").style; 
+	myImg.width = mb_mapObj[ind].width;
+	myImg.height = mb_mapObj[ind].height;
+
+	for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
+		if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
+		
+			if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
+				usemap += mod_usemap_polygon(i);
+			}
+			else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
+				usemap += mod_usemap_circle(i);
+			}
+			else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
+				usemap += mod_usemap_line(i);
+			}
+		}
+	}
+	writeUsemap(usemap);
+}
+
+function mod_usemap_circle(ind){
+	var str = "";
+	var coord = "";
+	
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var p = mb_wfs_fetch.getPoint(ind, i, 0);
+		var pos = realToMap(mb_wfs_targets[0],p);
+		coord += pos.x + ", " + pos.y;
+		
+		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
+		str += coord + ", " + mod_usemap_radius + "' href='#'>";
+	}
+	
+	return str;
+}
+
+function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
+	var coord = "";
+
+	var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
+	var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
+
+	var vec = p2.minus(p1);
+	
+	if (vec.x != 0 || vec.y != 0) {
+		var n_vec;
+		if (vec.x != 0) {
+			if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
+			else n_vec = new Point(vec.y/vec.x, 1);
+		}
+		else {
+			if (vec.y > 0) n_vec = new Point(1,0);
+			else n_vec = new Point(-1,0);
+		}
+		n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
+
+		lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
+
+		if (cnt > 0) coord += ", ";
+
+		coord += parseInt(lp.x) + ", " + parseInt(lp.y);
+		coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
+	}
+	return coord;
+}
+
+function mod_usemap_line(ind){
+	var str = "";
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var coord = "";
+		var cnt = 0;
+
+		for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1  ; j ++) {
+			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
+			if (result != "") {
+				coord += result;
+				cnt++;
+			}
+		}
+		
+		for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
+			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
+			if (result != "") {
+				coord += result;
+				cnt++;
+			}
+		}
+		
+		if (coord != "") {
+			str += "<AREA title='"+title+"'";
+			str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
+			str += "shape='poly'  coords='";
+			str += coord + "' href='#'>";
+		}
+		else {
+			//display circle
+			var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
+			coord += pos.x + ", " + pos.y;
+			
+			str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
+			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
+			str += coord + ", " + mod_usemap_radius + "' href='#'>";
+		}
+	}
+	
+	return str;
+}
+
+function mod_usemap_polygon(ind){
+	var str = "";
+	var coord = "";
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
+		coord += pos.x + ", " + pos.y;
+		
+		for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
+			pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
+			coord += ", " + pos.x + ", " + pos.y;
+		}
+		
+		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly'  coords='";
+		str += coord + "' href='#'>";
+	}
+	
+	return str;
+}
+
+function writeUsemap(str) {
+	writeTag(mb_wfs_targets[0], 'um', str);
+}
+// --- usemap (end) ----------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------
+
+
+var highlight_tag_id = "wfs_highlight_tag";
+var mb_wfs_fetched = [];
+
+var mb_wfs_objwin = null;
+var mb_wfs_objwin_left = 800;
+var mb_wfs_objwin_top = 200;
+var mb_wfs_objwin_width = 200;
+var mb_wfs_objwin_height = 200;
+var mb_wfs_targetString = "<?php echo implode(",", $e_target); ?>";
+var mb_wfs_targets = mb_wfs_targetString.split(",");
+var mb_wfs_fillColor = "#ff0000";
+var usemap = "";
+var mod_usemap_radius = 10;
+var mod_usemap_line_tolerance = 5;
+var useCheckboxForHighlighting = false;
+
+var mb_wfs_fetch = new GeometryArray();
+
+var highlight;
+
+try {if(generalHighlightZIndex){}}catch(e) {generalHighlightZIndex = 90;}
+try {if(generalHighlightLineWidth){}}catch(e) {generalHighlightLineWidth = 2;}
+try {if(useUsemap){}}catch(e) {useUsemap = 0;}
+
+mb_registerInitFunctions('initHighlight()');
+
+function initHighlight() {
+	var styleObj = {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex};
+	highlight = new Highlight(mb_wfs_targets, highlight_tag_id, styleObj, generalHighlightLineWidth);
+}
+try {if(displayWfsResultList){}}catch(e) {displayWfsResultList = 0;};
+
+if (displayWfsResultList == 1) {
+	//mb_registerWfsReadSubFunctions(function(geom){mb_wfs_listMember(geom)});
+}
+
+
+if (parseInt(useUsemap) == 1) {
+	mb_registerSubFunctions('mod_usemap("")');
+}
+
+if (useCheckboxForHighlighting) {
+	eventInit.register(function() {
+		mb_registerSubFunctions('highlight.paint()');
+	});
+}
+
+/*
+if (useExtentIsSet()) {
+	mb_registerSubFunctions("mb_setwfsrequest_extent()");
+}
+function mb_setwfsrequest_extent() {
+
+	if (useExtentIsSet()) {
+		var ind = getMapObjIndexByName(mb_wfs_targets[0]);
+		var pos_a = makeClickPos2RealWorldPos(mb_wfs_targets[0],0,0);
+		var pos_b = makeClickPos2RealWorldPos(mb_wfs_targets[0],mb_mapObj[ind].width,mb_mapObj[ind].height);
+
+		var x = [];
+		var y = [];
+		x[0] = pos_a[0];
+		x[1] = pos_b[0];
+		y[0] = pos_a[1];
+		y[1] = pos_b[1];
+
+		mb_setwfsrequest(mb_wfs_targets[0],'rectangle',x,y);
+	}
+}
+*/
+
+function mb_wfs_listMember(geomArray){
+	mb_wfs_fetch.union(geomArray);
+	var wfs_conf = get_complete_wfs_conf();
+	var str = "<table>";
+	for(var i=0; i<mb_wfs_fetch.count(); i++){
+		var t = wfs_conf[mb_wfs_fetch.get(i).wfs_conf];
+		for(var j=0; j<t['element'].length; j++){
+			if(t['element'][j]['f_show'] > 0){
+				var k = mb_wfs_fetch.get(i).e.getElementIndexByName(t['element'][j]['element_name']);
+				//alert(k);
+				if(k != -1){
+					str += "<tr><td>";
+					if (useCheckboxForHighlighting) {
+						str += "<input type=checkbox id=highlightCheckbox" + i + " onChange='highlightGeometry(" + i + ")'></td><td>";
+					}
+					str += "<div";
+					if (!useCheckboxForHighlighting) {
+						str += " onmouseover='mb_wfs_perform(\"over\",mb_wfs_fetch.get("+i+"))' ";
+						str += " onmouseout='mb_wfs_perform(\"out\",mb_wfs_fetch.get("+i+"))' ";
+					}
+					str += " onclick='mb_wfs_perform(\"click\",mb_wfs_fetch.get("+i+"))' ";
+					str += ">" + mb_wfs_fetch.get(i).e.getValue(k)+ "</div></td></tr>";
+				}
+			}
+		}
+	}
+	str += "</table>";
+	mb_wfs_objwin.innerHTML = str;
+//	if (parseInt(useUsemap) == 1) mod_usemap(wfs_name);
+}
+
+function mb_wfs_reset(){
+	mb_wfs_fetch = new parent.GeometryArray();
+	usemap = "";
+
+	if(mb_wfs_objwin == null){
+		var iframe=document.createElement('div');
+		iframe.setAttribute("style","position:absolute;left:"+mb_wfs_objwin_left+"px;top:"+mb_wfs_objwin_top+"px;width:"+mb_wfs_objwin_width+"px;height:"+mb_wfs_objwin_height+"px");
+		mb_wfs_objwin = document.body.appendChild(iframe);
+		mb_wfs_objwin.id = "mb_wfs_objwin";
+		mb_wfs_objwin.name = "mb_wfs_objwin";
+		mb_wfs_objwin.style.position = 'absolute';
+		mb_wfs_objwin.style.left = mb_wfs_objwin_left+"px";
+		mb_wfs_objwin.style.top = mb_wfs_objwin_top+"px";
+		mb_wfs_objwin.style.width = mb_wfs_objwin_width+"px";
+		mb_wfs_objwin.style.height = mb_wfs_objwin_height+"px";
+	}
+	for(var i=0; i<mb_wfsreq; i++){
+		if(document.getElementById("mb_wfs_win_"+mb_wfsreq)){
+			document.removeChild("mb_wfs_win_"+mb_wfsreq);
+		}
+	}
+	mb_wfsreq = 0;
+	return true;
+}
+
+function get_complete_wfs_conf() {
+	var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
+	return wfs_conf;
+}
+
+function highlightGeometry(i) {
+	var id = "highlightCheckbox"+i;
+	if (document.getElementById(id).checked) {
+		highlight.add(mb_wfs_fetch.get(i), '#00ff00');
+		highlight.paint();
+	}
+	else {
+		highlight.del(mb_wfs_fetch.get(i), '#00ff00');
+		highlight.paint();
+	}
+}
+
+function mb_wfs_perform(type,m){
+
+	var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
+	if(type=='over') {
+		highlight.add(m, '#ff0000');
+		highlight.paint();
+	}
+	else if (type == 'out') {
+		highlight.del(m, '#ff0000');
+		highlight.paint();
+	}
+	else
+		if (type == 'click') {
+			var tmp = m.getBBox();
+			if (m.geomType == geomType.point) {
+				var b = 1;
+			}
+			else {
+				var b = 0;
+			}
+			if (typeof(m.wfs_conf) != "undefined") {
+				b = parseFloat(wfs_conf[m.wfs_conf]['g_buffer']);
+			}
+			var buffer = new Point(b, b);
+			var bbox_ll = tmp[0].minus(buffer);
+			var bbox_ru = tmp[1].plus(buffer);
+			mb_calcExtent(mb_wfs_targets[0], bbox_ll, bbox_ru);
+			highlight.del(m, '#ff0000');
+			zoom(mb_wfs_targets[0], 'true', 1.0);
+			highlight.add(m, '#ff0000');
+			highlight.paint();
+		}
+}
+
+function get_wfs_str(myconf, d, m, type, fid) {
+
+	var featureTypeArray = myconf['featuretype_name'].split(':')
+	var featureNS = featureTypeArray[0];
+
+	var str = '<wfs:Transaction version="1.0.0" service="WFS" ';
+
+	var ns_gml = false;	var ns_ogc = false;	var ns_xsi = false;	var ns_wfs = false;	var ns_featureNS = false;
+
+	for (var q = 0 ; q < myconf['namespaces'].length ; q++) {
+
+		if (myconf['namespaces'][q]['name'] == "gml"){
+			 ns_gml = true;
+			 str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == "ogc") {
+			ns_ogc = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == "xsi") {
+			ns_xsi = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == "wfs") {
+			ns_wfs = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == featureNS) {
+			ns_featureNS = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" '
+			strForSchemaLocation = myconf['namespaces'][q]['location'];
+		}
+	}
+
+	if (ns_gml == false) str += 'xmlns:gml="http://www.opengis.net/gml" ';
+	if (ns_ogc == false) str += 'xmlns:ogc="http://www.opengis.net/ogc" ';
+	if (ns_xsi == false) str += 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
+	if (ns_featureNS == false) str += 'xmlns:"+featureNS+"="http://www.someserver.com/"+featureNS+"" ';
+	if (ns_wfs == false) str += 'xmlns:wfs="http://www.opengis.net/wfs" ';
+
+	str += 'xsi:schemaLocation="http://www.opengis.net/wfs';
+	str += ' http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd';
+	str += ' ' + strForSchemaLocation;
+	str += ' '+ myconf['wfs_describefeaturetype'];
+	//str += mb_getConjunctionCharacter(myconf['wfs_describefeaturetype']);
+	//str += 'typename=' + myconf['featuretype_name'];
+	str += '">';
+
+	//
+	// ---------------------------------------- SAVE -------------------------------------------------
+	//
+	if (type == "save") {
+		str += '<wfs:Insert><'+ myconf['featuretype_name']+'>';
+		for(var i=0; i<d.get(m).e.count(); i++){
+			if(d.get(m).e.getValue(i) != "" && d.get(m).e.getName(i) != "fid"){
+				var tmp = d.get(m).e.getName(i);
+				str += '<' + tmp  + '><![CDATA[' + d.get(m).e.getValue(i) + ']]></' + tmp  + '>';
+			}
+		}
+		for(var j=0; j<myconf['element'].length; j++){
+			if(myconf['element'][j]['f_geom'] == 1){
+				var el_geom = myconf['element'][j]['element_name'];
+			}
+		}
+		str += '<' + el_geom + '>';
+		if(d.get(m).geomType == geomType.point){
+			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '">';
+			str += '<gml:coordinates>';
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
+			str += '</gml:coordinates>';
+			str += '</gml:Point>';
+		}
+		if(d.get(m).geomType == geomType.line){
+			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
+			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
+			for(var k=0; k<d.getGeometry(m,0).count(); k++){
+				if(k>0)	str += " ";
+				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
+			}
+			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
+			str += '</gml:MultiLineString>';
+		}
+		if(d.get(m).geomType == geomType.polygon){
+			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
+			for (var k = 0; k < d.get(m).count(); k++) {
+				str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
+	
+				for(var l = 0; l < d.getGeometry(m, k).count(); l++){
+					if (l > 0) {
+						str += " ";
+					}	
+					str += d.getPoint(m,k,l).x + "," + d.getPoint(m,k,l).y;
+				}
+
+				str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
+				
+				if (d.getGeometry(m, k).innerRings) {
+					for(var ii = 0; ii < d.getGeometry(m, k).innerRings.count(); ii++){
+						str += '<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>';
+						for(var l = 0; l < d.getGeometry(m, k).innerRings.get(ii).count(); l++){
+							if (l > 0) {
+								str += " ";
+							}	
+							str += d.getPoint(m,k,ii,l).x + "," + d.getPoint(m,k,ii,l).y;
+						}
+						str += '</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>';
+					}
+				}
+
+				str += '</gml:Polygon></gml:polygonMember>';
+			}
+			str += '</gml:MultiPolygon>';
+		}
+		str += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';
+	}
+	//
+	// --------------------------------------- UPDATE ------------------------------------------------
+	//
+	else if (type == "update") {
+		str += '<wfs:Update typeName="'+ myconf['featuretype_name']+'">';
+		for(var i=0; i<d.get(m).e.count(); i++){
+			if(d.get(m).e.getValue(i) != "" && d.get(m).e.getName(i) != "fid"){
+				str += '<wfs:Property>';
+				str += '<wfs:Name>'+d.get(m).e.getName(i)+'</wfs:Name>';
+				str += '<wfs:Value><![CDATA['+d.get(m).e.getValue(i)+']]></wfs:Value>';
+				str += '</wfs:Property>';
+			}
+		}
+		for(var j=0; j<myconf['element'].length; j++){
+			if(myconf['element'][j]['f_geom'] == 1){
+				var el_geom = myconf['element'][j]['element_name'];
+			}
+		}
+		str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
+		if(d.get(m).geomType == geomType.point){
+			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '"><gml:coordinates>';
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
+			str += '</gml:coordinates></gml:Point>';
+		}
+		if(d.get(m).geomType == geomType.line){
+			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
+			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
+			for(var k=0; k<d.getGeometry(m,0).count(); k++){
+				if(k>0)	str += " ";
+				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
+			}
+			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
+			str += '</gml:MultiLineString>';
+		}
+		if(d.get(m).geomType == geomType.polygon){
+			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
+			for (var l = 0; l < d.get(m).count(); l++) {
+				str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
+				for(var k=0; k<d.getGeometry(m,l).count(); k++){
+					if(k>0)	str += " ";
+					str += d.getPoint(m,l,k).x + "," + d.getPoint(m,l,k).y;
+				}
+				str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
+				if (d.getGeometry(m, l).innerRings) {
+					for(var ii = 0; ii < d.getGeometry(m, l).innerRings.count(); ii++){
+						str += '<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>';
+						for(var p = 0; p < d.getGeometry(m, l).innerRings.get(ii).count(); p++){
+							if (p > 0) {
+								str += " ";
+							}	
+							str += d.getPoint(m,l,ii,p).x + "," + d.getPoint(m,l,ii,p).y;
+						}
+						str += '</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>';
+					}
+				}
+				str += '</gml:Polygon></gml:polygonMember>';
+			}
+		}
+		str += '</gml:MultiPolygon>';
+		str += '</wfs:Value></wfs:Property>';
+		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
+		str += '</wfs:Update>';
+	}
+	//
+	// --------------------------------------- DELETE ------------------------------------------------
+	//
+	else if (type == "delete") {
+		str += '<wfs:Delete typeName="'+ myconf['featuretype_name']+'">';
+		for(var j=0; j<myconf['element'].length; j++){
+			if(myconf['element'][j]['f_geom'] == 1){
+				var el_geom = myconf['element'][j]['element_name'];
+			}
+		}
+		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
+		str += '</wfs:Delete>';
+	}
+
+	str += '</wfs:Transaction>';
+	return str;
+}

Modified: branches/print_dev/http/javascripts/wms.js
===================================================================
--- branches/print_dev/http/javascripts/wms.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/javascripts/wms.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -270,7 +270,7 @@
 		//visibility of the wms
 		var wmsIsVisible = (this.gui_wms_visible > 0);
 		if(!wmsIsVisible){
-			return false;
+			return [];
 		}
 		visibleLayers = [];
 		for(var i=0; i< this.objLayer.length; i++){
@@ -284,13 +284,14 @@
 			}
 		}
 		if(visibleLayers.length === 0){
-			return false;
+			return [];
 		}
 		return visibleLayers;
 	}
 	catch (e) {
 		alert(e);
 	}
+	return [];
 };
 
 /**
@@ -773,4 +774,4 @@
 wms_layer.prototype.setQueryable = function(queryable){
 	this.gui_layer_querylayer = parseInt(queryable, 10);
 	//console.log("setQueryable(%i) for Layer %s",queryable, this.layer_name);
-};
\ No newline at end of file
+};

Modified: branches/print_dev/http/php/mb_listGUIs.php
===================================================================
--- branches/print_dev/http/php/mb_listGUIs.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mb_listGUIs.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -36,9 +36,6 @@
 		}
 		$sql_list_guis .= ") ORDER BY gui_name";
 		$res_list_guis = db_prep_query($sql_list_guis,$v,$t);
-		if ($_SESSION["mb_user_name"] != "test" && $_SESSION["mb_user_name"] != "demo" && $_SESSION["mb_user_name"] != "guest") {
-			echo "<a href=\"../php/mod_editSelf.php?".SID."\" class='list_guis' target=_blank>Change personal settings</a>";
-		}
 		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>";
@@ -55,7 +52,6 @@
 		}
 	}
 	else{
-		echo "<a href=\"../php/mod_editSelf.php?".SID."\" class='list_guis' target=_blank>Change personal settings</a>";
 		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>" ;

Modified: branches/print_dev/http/php/mod_button_tooltips.php
===================================================================
--- branches/print_dev/http/php/mod_button_tooltips.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_button_tooltips.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -18,8 +18,6 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
 
 $buttonObj = array();
 
@@ -31,9 +29,11 @@
 	array_push($buttonObj, array("id" => $row["e_id"], "title" => $row["e_title"]));
 }
 
-$json = new Mapbender_JSON();
-$output = $json->encode($buttonObj);
+$ajaxResponse = new AjaxResponse($_REQUEST);
+$ajaxResponse->setResult($buttonObj);
+$ajaxResponse->send();
+//$output = $json->encode($buttonObj);
 
-header("Content-type:text/plain; charset=utf-8");
-echo $output;
+//header("Content-type:text/plain; charset=utf-8");
+//echo $output;
 ?>
\ No newline at end of file

Added: branches/print_dev/http/php/mod_changeEPSG_server.php
===================================================================
--- branches/print_dev/http/php/mod_changeEPSG_server.php	                        (rev 0)
+++ branches/print_dev/http/php/mod_changeEPSG_server.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,123 @@
+<?php
+# $Id: mod_changeEPSG.php 2413 2008-04-23 16:21:04Z christoph $
+# http://www.mapbender.org/index.php/mod_changeEPSG.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require(dirname(__FILE__)."/mb_validateSession.php");
+
+$epsgObj = array();
+
+$ajaxResponse = new AjaxResponse($_REQUEST);
+
+switch ($ajaxResponse->getMethod()) {
+	case "changeEpsg" :
+		$epsgArray = $ajaxResponse->getParameter("srs");
+		$newSrs = $ajaxResponse->getParameter("newSrs");
+
+		for($i=0; $i < count($epsgArray); $i++){
+			// check if parameters are valid geometries to 
+			// avoid SQL injections
+			$currentEpsg = $epsgArray[$i];
+	
+			$oldEPSG = preg_replace("/EPSG:/","", $currentEpsg->epsg);
+			$newEPSG = preg_replace("/EPSG:/","", $newSrs);
+			 
+			$extArray = explode(",", $currentEpsg->extent);
+			if (is_numeric($extArray[0]) && is_numeric($extArray[1]) && 
+				is_numeric($extArray[2]) && is_numeric($extArray[3]) && 
+				is_numeric($oldEPSG) && is_numeric($newEPSG)) {
+			
+			
+				if(SYS_DBTYPE=='pgsql'){
+					$con = db_connect($DBSERVER,$OWNER,$PW);
+					$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as minx";
+					$resMinx = db_query($sqlMinx);
+					$minx = db_result($resMinx,0,"minx");
+					
+					$sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as miny";
+					$resMiny = db_query($sqlMiny);
+					$miny = db_result($resMiny,0,"miny");
+					
+					$sqlMaxx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxx";
+					$resMaxx = db_query($sqlMaxx);
+					$maxx = db_result($resMaxx,0,"maxx");
+					
+					$sqlMaxy = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxy";
+					$resMaxy = db_query($sqlMaxy);
+					$maxy = db_result($resMaxy,0,"maxy");
+				}else{
+					$con_string = "host=$GEOS_DBSERVER port=$GEOS_PORT dbname=$GEOS_DB user=$GEOS_OWNER password=$GEOS_PW";
+					$con = pg_connect($con_string) or die ("Error while connecting database");
+					
+					$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as minx";
+					$resMinx = pg_query($con,$sqlMinx);
+					$minx = pg_fetch_result($resMinx,0,"minx");
+					
+					$sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as miny";
+					$resMiny = pg_query($con,$sqlMiny);
+					$miny = pg_fetch_result($resMiny,0,"miny");
+					
+					$sqlMaxx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxx";
+					$resMaxx = pg_query($con,$sqlMaxx);
+					$maxx = pg_fetch_result($resMaxx,0,"maxx");
+					
+					$sqlMaxy = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxy";
+					$resMaxy = pg_query($con,$sqlMaxy);
+					$maxy = pg_fetch_result($resMaxy,0,"maxy");
+				}
+				$extenty = $maxy - $miny;
+				$extentx = $maxx - $minx;
+				$relation_px_x = $currentEpsg->width / $currentEpsg->height;
+				$relation_px_y = $currentEpsg->height / $currentEpsg->width;
+				$relation_bbox_x = $extentx / $extenty;
+		
+				if($relation_bbox_x <= $relation_px_x){
+					$centerx = $minx + ($extentx/2);
+					$minx = $centerx - $relation_px_x * $extenty / 2;
+					$maxx = $centerx + $relation_px_x * $extenty / 2;
+				}
+				if($relation_bbox_x > $relation_px_x){
+					$centery = $miny + ($extenty/2);
+					$miny = $centery - $relation_px_y * $extentx / 2;
+					$maxy = $centery + $relation_px_y * $extentx / 2;
+				}
+				$epsgObj[$i] = array(
+					"frameName" => $currentEpsg->frameName,
+					"newSrs" => $newSrs,
+					"minx" => $minx,
+					"miny" => $miny,
+					"maxx" => $maxx,
+					"maxy" => $maxy
+				);
+			}
+			else {
+				$ajaxResponse->setSuccess(false);
+				$ajaxResponse->setMessage(_mb("An unknown error occured."));
+				$ajaxResponse->send();
+			}
+		}
+		$ajaxResponse->setSuccess(true);
+		$ajaxResponse->setResult($epsgObj);
+		break;
+	default :
+		$ajaxResponse->setSuccess(false);
+		$ajaxResponse->setMessage(_mb("An unknown error occured."));
+		break;
+}
+
+$ajaxResponse->send();
+?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_editGuiWms.php
===================================================================
--- branches/print_dev/http/php/mod_editGuiWms.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_editGuiWms.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -19,6 +19,7 @@
 
 import_request_variables("PG");
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_wms.php");
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
@@ -484,8 +485,13 @@
 echo "<tr>";
 echo "<td colspan='2'>";
 echo "<a href='".$wms_getcapabilities[0];
-if( $wms_version[0] == "1.0.0"){ echo "&WMTVER=". $wms_version[0]."&REQUEST=capabilities";}
-else{echo "&VERSION=". $wms_version[0]."&REQUEST=GetCapabilities&SERVICE=WMS";}
+echo wms::getConjunctionCharacter($wms_getcapabilities[0]);
+if ($wms_version[0] == "1.0.0") { 
+	echo "WMTVER=". $wms_version[0]."&REQUEST=capabilities";
+}
+else {
+	echo "VERSION=". $wms_version[0]."&REQUEST=GetCapabilities&SERVICE=WMS";
+}
 echo "' style='font-size:14px' target='_blank'>LINK: Capabilities</a>";
 echo "</td>";
 echo "<td align = right>WMS ID: " . $wms_id[0] . "</td>";

Modified: branches/print_dev/http/php/mod_editUser.php
===================================================================
--- branches/print_dev/http/php/mod_editUser.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_editUser.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -123,11 +123,7 @@
 		if (SYS_DBTYPE=="mysql"){
 			$pw = "password('".$password."')";
 		}else{
-			if (MD5 == 'false'){
-				$pw = $password;
-			}else{
-				$pw = md5($password);
-			}
+			$pw = md5($password);
 		}
 		return $pw;
 	}

Modified: branches/print_dev/http/php/mod_forgottenPassword.php
===================================================================
--- branches/print_dev/http/php/mod_forgottenPassword.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_forgottenPassword.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -64,19 +64,20 @@
 	$upd = false;
 	
 	if ($_POST["sendnew"]) {
-		if ($_POST["username"]) {
+		if ($_POST["username"] && $_POST["email"]) {
 			$id = $admin->getUserIdByUserName($_POST["username"]);
+			$mailAddressMatch = ($admin->getEmailByUserId($id) == $_POST["email"]) && ($_POST["email"] != '');
 			$user_id = $id;
 	
-			if ($user_id) {
+			if ($user_id && $mailAddressMatch) {
 				$upd=true;
 			}
 			else {
-				echo "Your username could not be found. Please try again!<br><br>";
+				echo "Either your username could not be found or you have registered another or no mail address.<br><br>";
 			}
 		}
 		else {
-			echo "Please fill in your username.<br><br>";
+			echo "Please fill in your username and mail address.<br><br>";
 		}
 	}
 	
@@ -130,14 +131,21 @@
 	#echo "<fieldset><legend>Passwort vergessen ?</legend>";
 	#echo "<form name='form1' action='" . $PHP_SELF . "' method='post'>";
 	echo "<form name='form1' method='post'>";
-	echo "<table cellpadding='5' cellspacing='0' border='0'><tr>";
-	echo "<td>";
+	echo "<table cellpadding='5' cellspacing='0' border='0'>";
+	echo "<tr><td>";
 	echo "Username:";
 	echo "</td>";
 	echo "<td>";
 	echo "<input type='text' name='username' value=''>";
 	echo "</td>";
 	echo"</tr>";
+	echo "<tr><td>";
+	echo "E-Mail:";
+	echo "</td>";
+	echo "<td>";
+	echo "<input type='text' name='email' value=''>";
+	echo "</td>";
+	echo"</tr>";
 	echo"<tr><td>";
 	echo "<input type='hidden' name='upd' value=''>";
 	echo "<center><br><input type='submit' name='sendnew' value='Order a new Password'></center>";

Modified: branches/print_dev/http/php/mod_map1.php
===================================================================
--- branches/print_dev/http/php/mod_map1.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_map1.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -66,23 +66,26 @@
 function init () {
 	
 	parent.eventInitMap.register(function init_mod_map1(){
-		parent.mb_registerMapObj('mapframe1', 'maps', null,mod_map1_width, mod_map1_height);
+		parent.mb_registerMapObj('mapframe1', 'mapframe1', null,mod_map1_width, mod_map1_height);
 		
-		parent.$(document, window.frames['mapframe1']).mousewheel(function (event, delta) {
-			if (sum_delta == 0) {
-				mapTimeout = setTimeout(function () {
-						lastScrollPositionX=event.pageX;
-						lastScrollPositionY=event.pageY;
-						mousewheelZoom();	
-					}, 
-					100);
-			}
-			sum_delta = sum_delta + (delta);
-			var currentTime = new Date();
-			lastTimestamp = currentTime.getTime();
+		if (!parent.$.browser.msie) {
 			
-			return false;
-		});
+			parent.$(document, window.frames['mapframe1']).mousewheel(function (event, delta) {
+				if (sum_delta == 0) {
+					mapTimeout = setTimeout(function () {
+							lastScrollPositionX=event.pageX;
+							lastScrollPositionY=event.pageY;
+							mousewheelZoom();	
+						}, 
+						100);
+				}
+				sum_delta = sum_delta + (delta);
+				var currentTime = new Date();
+				lastTimestamp = currentTime.getTime();
+				
+				return false;
+			});
+		}
 	});
 }
 
@@ -95,10 +98,10 @@
 		var pos = parent.makeClickPos2RealWorldPos("mapframe1", lastScrollPositionX, lastScrollPositionY);
 				
 		if (sum_delta > 0) {
-			parent.zoom("mapframe1", true, Math.pow(parent.mapbender.zoomMousewheel, sum_delta), pos[0],pos[1]);
+			parent.zoom("mapframe1", true, Math.pow(parent.Mapbender.zoomMousewheel, sum_delta), pos[0],pos[1]);
 		}
 		else {
-			parent.zoom("mapframe1", false, Math.pow(parent.mapbender.zoomMousewheel, -sum_delta), pos[0], pos[1]);
+			parent.zoom("mapframe1", false, Math.pow(parent.Mapbender.zoomMousewheel, -sum_delta), pos[0], pos[1]);
 		}
 		
 		var newPosX =  parent.parent.mb_mapObj[ind].width - lastScrollPositionX;
@@ -121,8 +124,9 @@
 </script>
 </head>
 <body leftmargin='0' topmargin='0' onload="init()" bgcolor='#ffffff'>
+<div id='mapframe1' name='mapframe1' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'>
 <div id='markResult' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:26'> </div>
-<div id='maps' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'> </div>
+<div id='mapframe1_maps' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'> </div>
 <div id='highlight' style="position:absolute;top:-10px;left:-10px;width:14px;height:14px;z-index:3;visibility:visible"><img src="../img/redball.gif"/></div>
 <div id='l_right' name='l_right' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:10;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
 <div id='l_bottom'  name='l_bottom' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:11;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
@@ -141,5 +145,6 @@
 <div id='um_draw' name='um_draw' style="LEFT:0px;OVERFLOW:visible;POSITION:absolute;TOP:0px;z-index:99;"></div>
 <img id='um_img' name='um_img' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; border:0;z-index:100' src='../img/transparent.gif' useMap='#um'>
 <map name='um' id='um'></map>
+</div>
 </body>
 </html>

Modified: branches/print_dev/http/php/mod_mapOV.php
===================================================================
--- branches/print_dev/http/php/mod_mapOV.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_mapOV.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -63,7 +63,7 @@
 
 function init () {
 	parent.eventInitMap.register(function init_mod_mapOV(){
-		parent.mb_registerMapObj('overview', 'maps', mod_overview_rank, mod_overview_width, mod_overview_height);
+		parent.mb_registerMapObj('overview', 'overview', mod_overview_rank, mod_overview_width, mod_overview_height);
 		document.onmouseover = mod_ov_setHandler;
 		document.onmousedown = parent.mod_box_start;
 		document.onmouseup = mod_ov_getExtent;
@@ -90,12 +90,13 @@
 			var minY = parseFloat(arrayBBox[1]);
 			var maxX = parseFloat(arrayBBox[2]);
 			var maxY = parseFloat(arrayBBox[3]);
-			var posMin = parent.makeRealWorld2mapPos("overview",minX,maxY);
-			var posMax = parent.makeRealWorld2mapPos("overview",maxX,minY);
-			var px1 = posMin[0];
-			var py1 = posMin[1];
-			var px2 = posMax[0];
-			var py2 = posMax[1];
+			var ind = parent.getMapObjIndexByName(mod_overview_target);
+			var pointMin = parent.mb_mapObj[ind].convertRealToPixel(new parent.Point(minX, maxY)); 
+			var pointMax = parent.mb_mapObj[ind].convertRealToPixel(new parent.Point(maxX, minY)); 
+			var px1 = pointMin.x;
+			var py1 = pointMin.y;
+			var px2 = pointMax.x;
+			var py2 = pointMax.y;
 
 		parent.mb_isBF = "overview";
 		parent.mb_zF = mod_overview_target;
@@ -136,11 +137,13 @@
 </script>
 </head>
 <body leftmargin='0' topmargin='0' onload="init()"  bgcolor='#ffffff'>
-<div id='maps' name='maps' style =' position:absolute;left:0px;top:0px;width:0px;height:0px;' ></div>
+<div id='overview' name='overview' style =' position:absolute;left:0px;top:0px;width:0px;height:0px;' >
+<div id='overview_maps' name='maps' style =' position:absolute;left:0px;top:0px;width:0px;height:0px;' ></div>
 <div id='l_top' name='l_top' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:11;visibility:hidden;background-color:red;cursor: crosshair;"></div>
 <div id='l_right' name='l_right' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:12;visibility:hidden;background-color:red;cursor: crosshair;"></div>
 <div id='l_bottom'  name='l_bottom' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:13;visibility:hidden;background-color:red;cursor: crosshair;"></div>
 <div id='l_left' name='l_left' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:14;visibility:hidden;background-color:red;cursor: crosshair;"></div>
 <div id='highlight' style="position:absolute;top:-10px;left:-10px;width:14px;height:14px;z-index:3;visibility:visible"><img src="../img/redball.gif" width="14" height="14" /></div>
+</div>
 </body>
 </html>

Modified: branches/print_dev/http/php/mod_savewmc_server.php
===================================================================
--- branches/print_dev/http/php/mod_savewmc_server.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_savewmc_server.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -35,7 +35,7 @@
 $wmc = new wmc();
 $wmc->createFromJs($mapObject, $generalTitle, $extensionData);
 
-if ($saveInSession) {
+if ($saveInSession === 1) {
 	// store XML in session
 	$_SESSION["mb_wmc"] = $wmc->xml;
 	$_SESSION["epsg"] = $mapObject->epsg;

Modified: branches/print_dev/http/php/mod_treefolderClient.php
===================================================================
--- branches/print_dev/http/php/mod_treefolderClient.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_treefolderClient.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -74,7 +74,7 @@
     </STYLE>
 <?php
 echo "<script language='JavaScript'>";
-echo "var treetarget = '".$e_target[0]."';";
+echo "var treetarget = '".$e_target."';";
 echo "</script>";
 ?>
   <SCRIPT language="JavaScript1.2">

Modified: branches/print_dev/http/php/mod_wfs_result.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_result.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_wfs_result.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -20,10 +20,11 @@
 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_gml2.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
 
 $filter = stripslashes($_REQUEST["filter"]);
 $url = stripslashes($_REQUEST["url"]);
-$js_wfs_conf_id = $_REQUEST["js_wfs_conf_id"];
 $db_wfs_conf_id = $_REQUEST["db_wfs_conf_id"];
 $typename = $_REQUEST["typename"];
 
@@ -86,105 +87,13 @@
 $wfsRequest = $url . urlencode($filter);
 $connection = new connector($wfsRequest);
 $data = $connection->file;
-if (!$data) die('wfs not available');
+if (!$data) die('{}');
 
-$geometries = array('Point', 'Polygon', 'LineString', 'MultiPolygon', 'MultiLineString');
+$geomColumn = WfsConf::getGeomColumnNameByConfId($db_wfs_conf_id);
 
+$wfsResult = new gml2 ();
+$geoJson = $wfsResult->parseXML($data, $geomColumn);
 
-//TODO: 
-// parsing via class_gml
-// add method toJSON to classGML
-$parser = xml_parser_create();
-xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
-xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
-xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
-xml_parse_into_struct($parser,$data,$values,$tags);
-xml_parser_free($parser);
-$member = -1;
-$section = false;
-$geom = false;
-$memberHasBeenCreated = false;
-$str = array();
-$geomtype = array();
-$el = -1;
-$fid = -1;
-
-$element_str = "";
-$geom_str = "";
-foreach ($values as $element) {
-	if(mb_strtoupper($element[tag]) == mb_strtoupper("gml:featureMember") && $element[type] == "open"){
-		$member++;
-		$section = true;
-		$cnt_geom = 0;
-	}
-	else if(mb_strtoupper($element[tag]) == mb_strtoupper($typename) && $element[type] == "open") {
-		$fid = $element[attributes][fid];
-	}
-	else if(in_array(sepNameSpace($element[tag]),$geometries) && $element[type] == "open" && $section == true){
-		$geom = true;
-		if (sepNameSpace($element[tag]) == "MultiLineString") {
-			$geom_str .= "geom.addMember(geomType.line);\n";
-			$memberHasBeenCreated = true;
-		}
-		else if (sepNameSpace($element[tag]) == "MultiPolygon" ) {
-			$geom_str .= "geom.addMember(geomType.polygon);\n";
-			$memberHasBeenCreated = true;
-		}
-		elseif (sepNameSpace($element[tag]) == "Point") {
-			$geom_str .= "geom.addMember(geomType.point);\n";
-			$memberHasBeenCreated = true;
-			$geom_str .= "geom.get(-1).addGeometry();\n";
-		}
-		elseif (sepNameSpace($element[tag]) == "LineString") {
-			if (!$memberHasBeenCreated) {
-				$geom_str .= "geom.addMember(geomType.line);\n";
-				$memberHasBeenCreated = true;
-			}
-			$geom_str .= "geom.get(-1).addGeometry();\n";
-		}
-		else if (sepNameSpace($element[tag]) == "Polygon" ) {
-			if (!$memberHasBeenCreated) {
-				$geom_str .= "geom.addMember(geomType.polygon);\n";
-				$memberHasBeenCreated = true;
-			}
-			$geom_str .= "geom.get(-1).addGeometry();\n";
-		}
-		else {
-			$geom_str .= "alert('unknown geomtype ".sepNameSpace($element[tag])."');";
-		}
-		// TO DO: the following is added twice! Once suffices.
-		$element_str .= "geom.get(" . $member . ").e.setElement('fid', '".$fid."');\n";
-		$element_str .= "geom.get(" . $member . ").wfs_conf = ".$js_wfs_conf_id.";\n";
-	}
-	else if(mb_strtoupper($element[tag]) == mb_strtoupper("gml:coordinates") && $geom == true){
-		$tmp =  preg_replace("/,,/","",preg_replace("/ /",",",trim($element[value])));
-		$geom_str .= "var tmp1 = '".$tmp."';\n";
-		$geom_str .= "var tmp = tmp1.split(',');\n";
-		$geom_str .= "for (var i = 0 ; i < tmp.length ; i+=2) {\n";
-		$geom_str .= "\tgeom.getGeometry(-1,-1).addPointByCoordinates(parseFloat(tmp[i]), parseFloat(tmp[i+1]));\n";
-		$geom_str .= "}\n";
-		$geom_str .= "geom.close();\n";
-        $cnt_geom++;
-        
-	}
-	else if(in_array(sepNameSpace($element[tag]),$geometries) && $element[type] == "close"){			
-		$geom = false;
-		$memberHasBeenCreated = false;
-	}
-	else if($section == true && $geom == false && $element[value]){
-		$el++;
-		$str = $element[value];
-		$element_str .= "geom.get(" . $member . ").e.setElement('".sepNameSpace($element[tag])."', '".addslashes($str)."');\n";
-	}
-	else if(mb_strtoupper($element[tag]) == mb_strtoupper("gml:featureMember") && $element[type] == "close"){
-		$section = false;	
-		$el = -1;			
-	}
-}
-if ($geom_str != "") {
-	$geom_str = "var geom = new GeometryArray();\n" . $geom_str;
-}
 header('Content-type: text/html');
-echo $geom_str;
-echo $element_str;
+echo $geoJson;
 ?> 
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_zoomCoords.php
===================================================================
--- branches/print_dev/http/php/mod_zoomCoords.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/php/mod_zoomCoords.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,6 +1,6 @@
 <?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
+#$Id$
+# http://www.mapbender.org/Mapbender_without_iframes
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,139 +17,91 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-import_request_variables("PG");
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include(dirname(__FILE__)."/../include/dyn_js.php");
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Zoom to Coordinate</title>
-<?php
-
-include '../include/dyn_css.php';
-?>
-<style type="text/css">
-	    <!--
-	    body{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .labelx{
-	    	position: absolute;
-	    	left: 5px;
-	    	top:5px;
-	    	color: Gray;
-	    }
-	    .labely{
-	    	position: absolute;
-	    	left: 90px;
-	    	top:5px;
-	    	color: Gray;
-	    }
-	    .textx{
-	    	position: absolute;
-	    	left:5px;
-	    	top:20px;
-	    	color: Gray;
-	    	width:70px;
-         border: solid thin;
-         height:20px;
-	    }
-	    .texty{
-	    	position: absolute;
-	    	left:90px;
-	    	top:20px;
-         color: Gray;
-	    	width:70px;
-         border: solid thin;
-         height:20px;
-	    }
-       .send{
-  	    	position: absolute;
-	    	left:177px;
-	    	top:20px;
-         color: Gray;
-         border: solid thin;
-         height:20px;
-         width:30px;
-       }
-	    -->
-</style>
-<?php
-
-$sql = "SELECT e_target FROM gui_element WHERE e_id = 'zoomCoords' AND fkey_gui_id = $1 ";
-$v = array($_SESSION["mb_user_gui"]);
-$t = array('s');
-$res = db_prep_query($sql,$v,$t);
-$cnt = 0;
-while($row = db_fetch_array($res)){
-	$e_target = $row["e_target"];
-	$cnt++;
+try{
+	if (zoomCoords_permanentHighlight){}
 }
+catch(e){
+	zoomCoords_permanentHighlight = 'false';
+}
 
-echo '<script type="text/javascript">';
-if($cnt > 1){ echo "alert('zoomCoords: ID not unique!');";}
+var mod_zoomCoords_target = '<?php echo $e_target[0];?>';
+mod_zoomCoords_target = mod_zoomCoords_target.split(',');
 
-echo "var mod_zoomCoords_target = '".$e_target."';";
-echo "var target = mod_zoomCoords_target.split(',')";
-echo "</script>";
-?>
-<script type="text/javascript">
-<!--
-function zoomCoordinate(){
-   var coordx = document.form1.X.value; 
-   var coordy = document.form1.Y.value;
-   coordx = coordx.replace(",",".");
-   coordy = coordy.replace(",",".");
-   var valid = true;
-   setPermanentMarker(coordx,coordy);
-   parent.mb_hideHighlight(target[0]);
-   parent.mb_hideHighlight(target[1]);
-   parent.zoom(target[0],true, 1.0,coordx,coordy);
+function zoomCoordinate(x,y){
+   x=x.replace(",",".");
+   y=y.replace(",",".");
+   
+   document.zoomCoordsForm.X.value=x;
+   document.zoomCoordsForm.Y.value=y;
+	  
+   if (isNaN(x)==true || isNaN(y)==true){
+       alert ("<?php echo _mb("Please type a number.");?>");
+   }else{
+   
+	   if(zoomCoords_permanentHighlight =='true'){
+		   setPermanentMarker(x,y);
+	   }
+  		hideHighlight()
+      	zoom(mod_zoomCoords_target[0],true, 1.0,x,y);
+   }
 }
 
 function highlight(x, y){
-	x=x.replace(",",".");
-	y=y.replace(",",".");
-	document.form1.X.value=x;
-	document.form1.Y.value=y;
-	if (isNaN(x)==true || isNaN(y)==true){
+	if(x!='' && y!=''){   
+	   x=x.replace(",",".");
+	   y=y.replace(",",".");
+	   
+	   document.zoomCoordsForm.X.value=x;
+	   document.zoomCoordsForm.Y.value=y;
+	  
+	   
+	   if (isNaN(x)==true || isNaN(y)==true){
+	     
+	   }
+	   else{
+			for(var i=0;i<mod_zoomCoords_target.length;i++){
+				mb_showHighlight(mod_zoomCoords_target[i],x,y);
+			}
+	   }
 	}
-	else{
-		parent.mb_showHighlight(target[0],x,y);
-		parent.mb_showHighlight(target[1],x,y);
-	}
 }
 
+
 function hideHighlight(){
-	parent.mb_hideHighlight(target[0]);
-	parent.mb_hideHighlight(target[1]);
+	for(var i=0;i<mod_zoomCoords_target.length;i++){
+		mb_hideHighlight(mod_zoomCoords_target[i]);
+	}
 }
 
 function setPermanentMarker(x,y){
-	parent.mod_permanentHighlight_x = parseFloat(x);
-	parent.mod_permanentHighlight_y = parseFloat(y);
+ 	mod_permanentHighlight_x = parseFloat(x);
+   	mod_permanentHighlight_y = parseFloat(y);
+   	mod_permanentHighlight_text = x + ' / '+ y;
+  
+   	mod_permanentHighlight_init();
 }
-// -->
-</script>
-</head>
-<body bgcolor='#ffffff' onload=''>
 
-<?php
-# needs intl'!
-	echo "<form name='form1' action='" . $self ."' method='post'>";
-	echo "<span class='labelx'>L&auml;nge:</span>";
-	echo "<span class='labely'>Breite:</span>";
-	echo "<input class='textx' type='text' name='X'>";
-	echo "<input class='texty' type='text' name='Y'>";
-	echo "<input class='send' type='button' value='ok' onclick='zoomCoordinate();' onmouseover='highlight(document.form1.X.value, document.form1.Y.value)' onmouseout='hideHighlight(document.form1.X.value, document.form1.Y.value)' >";
-?>
-</form>
-</body>
-</html>
+parent.eventInitMap.register(function zoomCoorsInit(){
+	var el = document.getElementById("zoomCoords");
+	if(el){
+		el.innerHTML="<?php
+echo "<form style='font-family : Arial, Helvetica, sans-serif;font-size: 11px;' name='zoomCoordsForm' action='" . $PHP_SELF . "?".SID."' method='post'>";
+#coordinates
+   
+   # Deutsche Version
+
+   # English Version
+      echo "<span style='position: absolute;left: 5px;top:5px;color: Gray;'>"._mb("Longitude").":</span>";
+      echo "<span style='position: absolute;left: 80px;top:5px;color: Gray;'>"._mb("Latitude").":</span>";
+      echo "<input style='position: absolute;left:5px;top:20px;color: Gray;width:65px;border: solid thin;height:20px;' type='text' name='X'>";
+      echo "<input style='position: absolute;left:80px;top:20px;color: Gray;width:65px;border: solid thin;height:20px;'class='texty' type='text' name='Y'>";
+      echo "<input style='position: absolute;left:150px;top:20px;color: Gray;border: solid thin;height:20px;' type='button' value='"._mb("ok")."' onclick='zoomCoordinate(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value); highlight(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value)' onmouseover='highlight(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value)' onmouseout='hideHighlight(document.zoomCoordsForm.X.value, document.zoomCoordsForm.Y.value)' >";
+
+echo "</form>";
+?>";
+	}
+});
+

Modified: branches/print_dev/http/print/mod_printPDF.php
===================================================================
--- branches/print_dev/http/print/mod_printPDF.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/print/mod_printPDF.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,429 +1,403 @@
-<?php
-# $Id: mod_printPDF.php
-# http://www.mapbender.org/index.php/mod_printPDF.php
-# Copyright (C) 2002 CCGIS 
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-session_start();
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Print PDF</title>
-</head>
-<style type="text/css">
-<!-- 
-select{
-   width:150px;
-} 
-input{
-	width:150px;
-}
-.mycheck{
-	width:15px;
-}
-div{
-	font-family : Arial, Helvetica, sans-serif;
-	font-size: 12px;
-}
--->
-</style>
-<?php
-
-//FIXME:
-//setlocale(LC_ALL, "de_DE.utf8");
-
-require_once(dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
-echo "<script type='text/javascript'>";
-echo "var target = '".$_REQUEST["target"]."';";
-echo "var comment = '".$label_comment1."';";
-echo "var comment_length = ".$comment1_length.";";
-echo "var label_button = '".$label_button."';";
-echo "var type = '".$type."';";
-echo "</script>";
-?>
-<script type="text/javascript">
-<!--
-
-
-var size;
-var format;
-var map_width;
-var map_height;
-
-if(type=='window'){
-	var pt = window.opener;
-}
-else if(type == 'iframe'){
-	var pt = parent;
-}
-
-function mod_legend_print(){
-	var mod_legend_target = target;
-	var ind = pt.getMapObjIndexByName(mod_legend_target);
-	var layers;
-
-	document.forms[0].layers.value = "";
-	document.forms[0].wms_id.value = "";
-	document.forms[0].wms_title.value = "";
-	document.forms[0].legendurl.value = "";
-	
-	for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-		layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
-		if(layers != "" && layers){
-		
-			if(i>0 && document.forms[0].wms_id.value!=''){
-			    document.forms[0].layers.value += "___";
-			    document.forms[0].wms_id.value += "___";
-			    document.forms[0].wms_title.value += "___";
-			    document.forms[0].legendurl.value += "___";
-			}
-					
-			document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;   
-			document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
-				
-			for(var j=0; j<layers.length; j++){			
-				var layer = layers[j];
-				var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
-				var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
-				if(layerStyle==false){
-					var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");	
-				}
-				else{
-					var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
-				}
-				
-				//---------- legendurl ----------
-				tmp_name = "";	
-				if(j>0){
-					document.forms[0].layers.value += ",";
-				}
-					document.forms[0].layers.value += title;
-				if(j>0){
-					document.forms[0].legendurl.value += ",";
-				}
-				if (temp_legendurl!= '' || !temp_legendurl == 'true'){
-					document.forms[0].legendurl.value += temp_legendurl;
-				}else{
-					document.forms[0].legendurl.value +='0';
-				}	
-			}	
-		}
-		else{
-			if(i>0 && document.forms[0].wms_id.value!=''){
-			    document.forms[0].layers.value += "___";
-			    document.forms[0].wms_id.value += "___";
-			    document.forms[0].wms_title.value += "___";
-			    document.forms[0].legendurl.value += "___";
-		    }
-			
-			document.forms[0].layers.value += "0";
-		    document.forms[0].wms_id.value += "0";
-		    document.forms[0].wms_title.value += "0";
-		    document.forms[0].legendurl.value += "0";
-		}
-	}//for
-	//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);	
-		
-}
-
-function validate(){
-	size = document.form1.size.options[document.form1.size.selectedIndex].value;
-	format = document.form1.format.options[document.form1.format.selectedIndex].value;
-	if(size != "" && format != ""){
-		var ind = pt.getMapObjIndexByName(target);
-		var coord = pt.mb_mapObj[ind].extent.split(",");
-		var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
-		var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
-		if(size == "A4" && format == "portrait"){
-			map_width = <?php echo $a4p_map_width; ?>; 
-			map_height = <?php echo $a4p_map_height; ?>; 
-		}
-		if(size == "A4" && format == "landscape"){
-			map_width = <?php echo $a4l_map_width; ?>;
-			map_height = <?php echo $a4l_map_height; ?>; 
-		}
-		if(size == "A3" && format == "portrait"){
-			map_width = <?php echo $a3p_map_width; ?>;
-			map_height = <?php echo $a3p_map_height; ?>;
-		}
-		if(size == "A3" && format == "landscape"){
-			map_width = <?php echo $a3l_map_width; ?>;
-			map_height = <?php echo $a3l_map_height; ?>;
-		}  
-		if(size == "A2" && format == "portrait"){
-			map_width = <?php echo $a2p_map_width; ?>;
-			map_height = <?php echo $a2p_map_height; ?>;
-		}
-		if(size == "A2" && format == "landscape"){
-			map_width = <?php echo $a2l_map_width; ?>;
-			map_height = <?php echo $a2l_map_height; ?>;
-		}
-		if(size == "A1" && format == "portrait"){
-			map_width = <?php echo $a1p_map_width; ?>;
-			map_height = <?php echo $a1p_map_height; ?>;
-		}
-		if(size == "A1" && format == "landscape"){
-			map_width = <?php echo $a1l_map_width; ?>;
-			map_height = <?php echo $a1l_map_height; ?>;
-		}
-		if(size == "A0" && format == "portrait"){
-			map_width = <?php echo $a0p_map_width; ?>;
-			map_height = <?php echo $a0p_map_height; ?>;
-		}
-		if(size == "A0" && format == "landscape"){
-			map_width = <?php echo $a0l_map_width; ?>;
-			map_height = <?php echo $a0l_map_height; ?>;
-		}     
-		var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
-		var prevscale= pt.mb_getScale(target);
-		pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-
-		pt.mb_mapObj[ind].width = Math.round(map_width);
-		pt.mb_mapObj[ind].height = Math.round(map_height);
-		pt.document.getElementById(target).style.width = Math.round(map_width);
-		pt.document.getElementById(target).style.height = Math.round(map_height);
-		pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
-		pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
-
-		//pt.setMapRequest(target);		
-		pt.mb_repaintScale(target, null, null, prevscale);
-      	document.form1.map_url.value = '';
-		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-			if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
-					if(document.form1.map_url.value != ""){
-						document.form1.map_url.value += "___";
-					}         
-					document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
-				}
-			}
-		}
-		
-		//overview_url
-		var ind_overview = pt.getMapObjIndexByName('overview');
-
-		//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
-		if(pt.mb_mapObj[ind_overview].mapURL != false ){
-			document.forms[0].overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
-		}
-	}
-}
-function refreshParams(){
-	var f = document.forms[0];
-	size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
-	format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
-	
-	if(size != "" && format != ""){
-		var ind = pt.getMapObjIndexByName(target);
-		var coord = pt.mb_mapObj[ind].extent.split(",");
-		var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
-		var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
-		
-		var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
-		pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-
-		pt.mb_mapObj[ind].width = Math.round(map_width);
-		pt.mb_mapObj[ind].height = Math.round(map_height);
-		pt.document.getElementById(target).style.width = Math.round(map_width);
-		pt.document.getElementById(target).style.height = Math.round(map_height);
-		pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
-		pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
-
-		//pt.setMapRequest(target);		
-		pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
-		f.map_url.value = '';
-		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-			if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
-					if(f.map_url.value != ""){
-						f.map_url.value += "___";
-					}         
-					f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
-				}
-			}
-		}
-		
-		//overview_url
-		var ind_overview = pt.getMapObjIndexByName('overview');
-
-		//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
-		if(pt.mb_mapObj[ind_overview].mapURL != false ){
-			f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
-		}
-	}
-
-	f.map_scale.value = pt.mb_getScale(target);
-	f.epsg.value = pt.mb_mapObj[ind].epsg;
-	
-	mod_legend_print();
-}
-	
-function printMap(){
-	if(size != "" && (format == "portrait" || format == "landscape")){
-		refreshParams();
-		if(document.form1.c1.value != comment){
-			document.form1.comment1.value = document.form1.c1.value;
-		}
-		if(document.form1.c2.value != comment){
-			document.form1.comment2.value = document.form1.c2.value;
-		}
-		if(document.form1.mylegendcheckbox.checked == 0){
-			document.form1.mylegend.value = 'false';
-		}else{
-			document.form1.mylegend.value = 'true';
-		}
-		
-		// write the measured coordinates
-		
-		if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
-			var tmp_x = '';
-			var tmp_y = '';
-			for(i = 0; i<pt.mod_measure_RX.length; i++) {
-				if(tmp_x != '') {
-					tmp_x += ','
-				}
-				tmp_x += pt.mod_measure_RX[i];
-			}
-			for(i = 0; i<pt.mod_measure_RY.length; i++) {
-				if(tmp_y != '') {
-					tmp_y += ','
-				}
-				tmp_y += pt.mod_measure_RY[i];
-			}
-			document.forms['form1'].elements['measured_x_values'].value = tmp_x;
-			document.forms['form1'].elements['measured_y_values'].value = tmp_y;
-		}
-		
-		document.form1.submit();
-	}
-	else{
-		alert("<?php echo _("No format selected.")?>");
-	}
-}
-function valCom(obj){
-	if(obj.value.length > comment_length){
-		obj.value = obj.value.substr(0,comment_length);
-	}
-}
-// -->
-</script>
-<body>
-<form name='form1' method='POST' action='../print/mod_printPDF_pdf.php?<?php echo SID; ?>' target="_blank">
-<table border='0'>
-<tr>
-	<td>
-	<select name='size' onchange='validate()'>
-<?php
-	if($a4 == true && $a3 == true){
-		echo "<option value=''>".$label_format."</option>";
-	}
-	if($a4 == true){
-		echo "<option value='A4'>".$label_format_a4."</option>";
-	}
-	if($a3 == true){
-		echo "<option value='A3'>".$label_format_a3."</option>";
-	}
-	if($a2 == true){
-		echo "<option value='A2'>".$label_format_a2."</option>";
-	}
-	if($a1 == true){
-		echo "<option value='A1'>".$label_format_a1."</option>";
-	}
-	if($a0 == true){
-		echo "<option value='A0'>".$label_format_a0."</option>";
-	}
-?>
-	</select>
-	</td>   
-</tr>
-<tr>
-	<td>
-	<select name='format' onchange='validate()'>
-	<option value=''><?php echo $label_orientation; ?></option>
-	<option value='portrait'><?php echo $label_portrait; ?></option>
-	<option value='landscape'><?php echo $label_landscape; ?></option>
-	</select>
-	</td>
-</tr>
-<?php
-if($highquality == true){
-	echo "<tr>";
-		echo "<td>";
-		echo "<select name='quality'>";
-		echo "<option value='1'>".$label_72dpi."</option>";
-		echo "<option value='2'>".$label_288dpi."</option>";
-		echo "</select>";
-		echo "</td>";
-	echo "</tr>";
-}
-?>
-<tr>
-	<td>
-		<input type='text' name='c1' value='<?php echo $label_comment; ?>' onkeydown="valCom(this)">
-	</td>
-</tr>
-<tr>
-	<td>
-		<input type='text' name='c2' value='<?php echo $label_comment; ?>' onkeydown="valCom(this)">
-	</td>
-</tr>
-<?php
-if($legend == true){
-	echo "<tr>";
-		echo "<td>";
-		echo "<div><input type='checkbox' class='mycheck' name='mylegendcheckbox' value='false'>".$label_legend."</div>";
-		echo "</td>";
-	echo "</tr>";
-}else {
-	echo "<tr>";
-	echo "<td>";
-	echo "<input type='hidden' name='mylegendcheckbox' value='false'>";
-	echo "</td>";
-	echo "</tr>";
-}
-
-
-?>
-<table>  
-<input type='hidden' name='map_url' value=''>
-<input type='hidden' name='overview_url' value=''>
-<input type='hidden' name='wms_title' value=''>
-<input type='hidden' name='wms_id' value=''>
-<input type='hidden' name='layers' value=''>
-<input type='hidden' name='legendurl' value=''>
-<input type='hidden' name='map_scale' value=''>
-<input type='hidden' name='epsg' value=''>
-<input type='button' name='print' value="<?php echo $label_button; ?>" onclick='printMap()'>
-<input type='hidden' name='conf' value='<?php echo $_REQUEST["conf"]; ?>'>
-<input type='hidden' name='comment1' value=''>
-<input type='hidden' name='comment2' value=''>
-<input type='hidden' name='mylegend' value='true'>
-<input type='hidden' name='measured_x_values' value=''>
-<input type='hidden' name='measured_y_values' value=''>
-
-</form>
-</body>
-</html>
+<?php
+# $Id: mod_printPDF.php
+# http://www.mapbender.org/index.php/mod_printPDF.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+	<meta http-equiv="cache-control" content="no-cache" />
+	<meta http-equiv="pragma" content="no-cache" />
+	<meta http-equiv="expires" content="0" />
+	<?php printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />",CHARSET);	?>
+	<title>Print PDF</title>
+
+	<?php
+	//FIXME:
+	//setlocale(LC_ALL, "de_DE.utf8");
+
+	require_once(dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
+
+	printf("
+	<script type=\"text/javascript\">
+		var target = '%s';
+		var comment1 = '%s';
+		var comment1_length = %s;
+		var comment2 = '%s';
+		var comment2_length = %s;
+		var label_button = '%s';
+		var type = '%s';
+	</script>",
+	$_REQUEST["target"],$label_comment1,$comment1_length,$label_comment2,$comment2_length,$label_button,$type
+	);
+	?>
+
+	<script type="text/javascript">
+	<!--
+	var size;
+	var format;
+	var map_width;
+	var map_height;
+
+	if(type=='window'){
+		var pt = window.opener;
+	}
+	else if(type == 'iframe'){
+		var pt = parent;
+	}
+
+	function mod_legend_print(){
+		var mod_legend_target = target;
+		var ind = pt.getMapObjIndexByName(mod_legend_target);
+		var layers;
+
+		document.forms[0].layers.value = "";
+		document.forms[0].wms_id.value = "";
+		document.forms[0].wms_title.value = "";
+		document.forms[0].legendurl.value = "";
+
+		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+			layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
+			if(layers != "" && layers){
+
+				if(i>0 && document.forms[0].wms_id.value!=''){
+				    document.forms[0].layers.value += "___";
+				    document.forms[0].wms_id.value += "___";
+				    document.forms[0].wms_title.value += "___";
+				    document.forms[0].legendurl.value += "___";
+				}
+
+				document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;
+				document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
+
+				for(var j=0; j<layers.length; j++){
+					var layer = layers[j];
+					var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
+					var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
+					if(layerStyle==false){
+						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");
+					}
+					else{
+						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
+					}
+
+					//---------- legendurl ----------
+					tmp_name = "";
+					if(j>0){
+						document.forms[0].layers.value += ",";
+					}
+						document.forms[0].layers.value += title;
+					if(j>0){
+						document.forms[0].legendurl.value += ",";
+					}
+					if (temp_legendurl!= '' || !temp_legendurl == 'true'){
+						document.forms[0].legendurl.value += temp_legendurl;
+					}else{
+						document.forms[0].legendurl.value +='0';
+					}
+				}
+			}
+			else{
+				if(i>0 && document.forms[0].wms_id.value!=''){
+				    document.forms[0].layers.value += "___";
+				    document.forms[0].wms_id.value += "___";
+				    document.forms[0].wms_title.value += "___";
+				    document.forms[0].legendurl.value += "___";
+			    }
+
+				document.forms[0].layers.value += "0";
+			    document.forms[0].wms_id.value += "0";
+			    document.forms[0].wms_title.value += "0";
+			    document.forms[0].legendurl.value += "0";
+			}
+		}//for
+		//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);
+
+	}
+
+	function validate(){
+		size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+		format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+
+		if(size != "false" && format != "false"){
+			var ind = pt.getMapObjIndexByName(target);
+			var coord = pt.mb_mapObj[ind].extent.split(",");
+			var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+			var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+			if(size == "A4" && format == "portrait"){
+				map_width = <?php echo $a4p_map_width; ?>;
+				map_height = <?php echo $a4p_map_height; ?>;
+			}
+			if(size == "A4" && format == "landscape"){
+				map_width = <?php echo $a4l_map_width; ?>;
+				map_height = <?php echo $a4l_map_height; ?>;
+			}
+			if(size == "A3" && format == "portrait"){
+				map_width = <?php echo $a3p_map_width; ?>;
+				map_height = <?php echo $a3p_map_height; ?>;
+			}
+			if(size == "A3" && format == "landscape"){
+				map_width = <?php echo $a3l_map_width; ?>;
+				map_height = <?php echo $a3l_map_height; ?>;
+			}
+			if(size == "A2" && format == "portrait"){
+				map_width = <?php echo $a2p_map_width; ?>;
+				map_height = <?php echo $a2p_map_height; ?>;
+			}
+			if(size == "A2" && format == "landscape"){
+				map_width = <?php echo $a2l_map_width; ?>;
+				map_height = <?php echo $a2l_map_height; ?>;
+			}
+			if(size == "A1" && format == "portrait"){
+				map_width = <?php echo $a1p_map_width; ?>;
+				map_height = <?php echo $a1p_map_height; ?>;
+			}
+			if(size == "A1" && format == "landscape"){
+				map_width = <?php echo $a1l_map_width; ?>;
+				map_height = <?php echo $a1l_map_height; ?>;
+			}
+			if(size == "A0" && format == "portrait"){
+				map_width = <?php echo $a0p_map_width; ?>;
+				map_height = <?php echo $a0p_map_height; ?>;
+			}
+			if(size == "A0" && format == "landscape"){
+				map_width = <?php echo $a0l_map_width; ?>;
+				map_height = <?php echo $a0l_map_height; ?>;
+			}
+			var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+			var prevscale= pt.mb_getScale(target);
+			console.log(prevscale);
+			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+
+			pt.mb_mapObj[ind].width = Math.round(map_width);
+			pt.mb_mapObj[ind].height = Math.round(map_height);
+			pt.document.getElementById(target).style.width = Math.round(map_width);
+			pt.document.getElementById(target).style.height = Math.round(map_height);
+			pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
+			pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
+
+			//pt.setMapRequest(target);
+//			pt.mb_repaintScale(target, null, null, prevscale);
+			pt.mb_repaint(target, parseFloat(coord[0]), pos[1], pos[0], parseFloat(coord[3]));
+		document.form1.map_url.value = '';
+			for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+				if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+					if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
+						if(document.form1.map_url.value != ""){
+							document.form1.map_url.value += "___";
+						}
+						document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+					}
+				}
+			}
+
+			//overview_url
+			var ind_overview = pt.getMapObjIndexByName('overview');
+
+			//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+			if(pt.mb_mapObj[ind_overview].mapURL != false ){
+				document.forms[0].overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+			}
+		}
+	}
+	function refreshParams(){
+		var f = document.forms[0];
+		size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+		format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+		
+		if(size != "" && format != ""){
+			var ind = pt.getMapObjIndexByName(target);
+			var coord = pt.mb_mapObj[ind].extent.split(",");
+			var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+			var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+			
+			var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+	
+			pt.mb_mapObj[ind].width = Math.round(map_width);
+			pt.mb_mapObj[ind].height = Math.round(map_height);
+			pt.document.getElementById(target).style.width = Math.round(map_width);
+			pt.document.getElementById(target).style.height = Math.round(map_height);
+			pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
+			pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
+	
+			//pt.setMapRequest(target);		
+//			pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+			pt.mb_repaint(target, parseFloat(coord[0]), pos[1], pos[0], parseFloat(coord[3]));
+			f.map_url.value = '';
+			for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+				if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+					if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
+						if(f.map_url.value != ""){
+							f.map_url.value += "___";
+						}         
+						f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+					}
+				}
+			}
+			
+			//overview_url
+			var ind_overview = pt.getMapObjIndexByName('overview');
+	
+			//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+			if(pt.mb_mapObj[ind_overview].mapURL != false ){
+				f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+			}
+		}
+	
+		f.map_scale.value = pt.mb_getScale(target);
+		f.epsg.value = pt.mb_mapObj[ind].epsg;
+		
+		mod_legend_print();
+	}
+	function printMap(){
+		if(size != "false" && (format == "portrait" || format == "landscape")){
+			refreshParams();
+			if(document.form1.c1.value != comment1){
+				document.form1.comment1.value = document.form1.c1.value;
+			}
+			if(document.form1.c2.value != comment2){
+				document.form1.comment2.value = document.form1.c2.value;
+			}
+			if(document.form1.mylegendcheckbox.checked == 0){
+				document.form1.mylegend.value = 'false';
+			}else{
+				document.form1.mylegend.value = 'true';
+			}
+
+			// write the measured coordinates
+
+			if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
+				var tmp_x = '';
+				var tmp_y = '';
+				for(i = 0; i<pt.mod_measure_RX.length; i++) {
+					if(tmp_x != '') {
+						tmp_x += ','
+					}
+					tmp_x += pt.mod_measure_RX[i];
+				}
+				for(i = 0; i<pt.mod_measure_RY.length; i++) {
+					if(tmp_y != '') {
+						tmp_y += ','
+					}
+					tmp_y += pt.mod_measure_RY[i];
+				}
+				document.forms['form1'].elements['measured_x_values'].value = tmp_x;
+				document.forms['form1'].elements['measured_y_values'].value = tmp_y;
+			}
+
+			document.form1.submit();
+		}
+		else{
+			alert('<?php echo _mb("No format selected")."!"?>');
+		}
+	}
+
+	function checkCommentLength(obj,maxLength){
+		if(obj.value.length > maxLength){
+			obj.value = obj.value.substr(0,maxLength);
+		}
+	}
+	-->
+	</script>
+	<?php include("../include/dyn_css.php"); ?>
+</head>
+
+<body>
+<form name="form1" method="post" action="../print/mod_printPDF_pdf.php?<?php echo SID; ?>" target="_blank">
+<p id="container_size">
+	<label for="size"><?php echo $label_format ?></label>
+	<select id="size" name="size" onchange="validate();">
+		<option value="false">-</option>
+		<?php
+		for($i = 4; $i >= 0; $i--) {
+			if(${"a".$i}) {
+				printf("<option value=\"A%s\">%s</option>",$i,${"label_format_a".$i});
+			}
+		}
+		?>
+	</select>
+</p>
+
+<p id="container_orientation">
+	<label for="format"><?php echo $label_orientation; ?></label>
+	<select id="format" name="format" onchange="validate();">
+		<option value="portrait"><?php echo $label_portrait; ?></option>
+		<option value="landscape"><?php echo $label_landscape; ?></option>
+	</select>
+</p>
+
+<?php if($highquality === TRUE): ?>
+	<p id="container_quality">
+		<label for="quality"><?php echo $label_quality; ?></label>
+		<input type="radio" id="quality" name="quality" value="1" checked="checked" /> <?php echo $label_72dpi; ?>
+		<input type="radio" id="quality" name="quality" value="2" /> <?php echo $label_288dpi; ?>
+	</p>
+<?php endif; ?>
+
+<?php
+ini_set("error_reporting",E_ALL);
+ini_set("display_errors","on");
+	for($i = 1; $i <= 2; $i++) {
+		$max_comment_length = ${"comment".$i."_length"};
+		$label_hint         = ($max_comment_length > -1) ? sprintf(" <em>"._mb("max.")." %s)</em>",$max_comment_length) : NULL;
+		$javascript         = ($max_comment_length > -1) ? sprintf(" onblur=\"checkCommentLength(this,%s)\"",$max_comment_length) : NULL;
+
+		$html  = sprintf("<p id=\"container_comment%s\">",$i);
+		$html .= sprintf("<label for=\"c%s\">%s%s</label> ",$i,${"label_comment".$i},$label_hint);
+		$html .= sprintf("<textarea id=\"c%s\" name=\"c%s\" cols=\"20\" rows=\"2\"%s></textarea> ",$i,$i,$javascript);
+		$html .= "</p>";
+
+		echo $html;
+	}
+?>
+
+<?php if($legend === TRUE): ?>
+	<p id="container_legend">
+		<label for="mylegendcheckbox"><?php echo $label_legend; ?></label>
+		<input type="checkbox" id="mylegendcheckbox" name="mylegendcheckbox" value="false" />
+	</p>
+<?php else: ?>
+	<input type="hidden" name="mylegendcheckbox" value="false" />
+<?php endif; ?>
+
+<input type="hidden" name="map_url" />
+<input type="hidden" name="overview_url" />
+<input type="hidden" name="wms_title" />
+<input type="hidden" name="wms_id" />
+<input type="hidden" name="layers" />
+<input type="hidden" name="legendurl" />
+<input type="hidden" name="map_scale" />
+<input type="hidden" name="epsg" />
+<input type="hidden" name="conf" value="<?php echo $_REQUEST["conf"]; ?>" />
+<input type="hidden" name="comment1" />
+<input type="hidden" name="comment2" />
+<input type="hidden" name="mylegend" value="true" >
+<input type="hidden" name="measured_x_values" />
+<input type="hidden" name="measured_y_values" />
+
+<p>
+	<input type="button" id="print" name="print" value="<?php echo $label_button; ?>" onclick="printMap();" />
+</p>
+</form>
+</body>
+
+</html>

Modified: branches/print_dev/http/print/mod_printPDF_pdf.php
===================================================================
--- branches/print_dev/http/print/mod_printPDF_pdf.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/print/mod_printPDF_pdf.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -1,850 +1,850 @@
-<?php
-# $Id:
-# http://www.mapbender.org/index.php/mod_printPDF_pdf.php
-# Copyright (C) 2002 CCGIS 
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-include (dirname(__FILE__)."/../classes/class.ezpdf.php");
-include (dirname(__FILE__)."/../classes/class_stripRequest.php");
-include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
-include (dirname(__FILE__)."/../classes/class_weldOverview2PNG.php");
-include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
-include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
-include (dirname(__FILE__)."/../print/print_functions.php");
-
-if($log == true){
-	include (dirname(__FILE__)."/../classes/class_log.php");
-}
-
-#Globals
-
-$factor = intval($_REQUEST["quality"]);
-
-#$date = date("d.m.Y",strtotime("now"));
-$linewidth_dashed = 0.5;
-$linewidth = 0.5;
-
-// DURATION TIME:
-function microtime_float(){
-   list($usec, $sec) = explode(" ", microtime());
-   return ((float)$usec + (float)$sec);
-}
-$time_start = microtime_float();
-// END DURATION TIME
-
-$time_end = microtime_float();
-$time = $time_end - $time_start;
-
-/* -------------------------------------- */
-
-$size = $_REQUEST["size"];
-$format = $_REQUEST["format"];
-$map_scale = $_REQUEST["map_scale"];
-$overview_url = $_REQUEST["overview_url"];
-$epsg = $_REQUEST["epsg"];
-if($overview_url=='false'){
-	$overview = false;	
-}
-
-function setscalebar($scale){
-    	$mb_resolution = 28.35;
-        
-		if($scale < 16){
-	      $value = "10";
-	      $unit = "cm";
-	      $scalefactor = 10/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 16 && $scale < 151){
-	      $value = "1";	      
-	      $unit = "Meter";
-	      $scalefactor = 100/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 151 && $scale < 1550 ){
-	      $value = "10";	      
-	      $unit = "Meter";
-	      $scalefactor = 1000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 1550 && $scale < 15050){
-	      $value = "100";	      
-	      $unit = "Meter";
-	      $scalefactor = 10000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 150050 && $scale >= 15050){
-	      $value = "1";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 100000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 1500050 && $scale >= 150050){
-	      $value = "10";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 1000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 15000050 && $scale >= 1500050){
-	      $value = "100";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 10000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 150000001 && $scale >= 15000001){
-	      $value = "1000";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 100000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 150000001){
-	      $value = "1000";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 100000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }   
-	   $array_scale[0] = $unit;
-	   $array_scale[1] = $img_width;
-		$array_scale[2] = $value;	   
-	   
-	   return  $array_scale; 
-}
-
-
-$border = 0.8 * $DPC;
-
-if($matching == true){
-   $urls = preg_replace($pattern,$replacement,$_REQUEST["map_url"]);  
-}
-else{
-   $urls = $_REQUEST["map_url"];
-}
-
-
-$array_urls = explode("___", $urls);
-
-$myURL = new stripRequest($array_urls[0]);
-$map_width = round($myURL->get("width"));
-$map_height = round($myURL->get("height"));
-$map_extent = $myURL->get("BBOX");
-if($factor>1){
-	for($i=0; $i<count($array_urls); $i++){
-		$m = new stripRequest($array_urls[$i]);
-		$m->set('width',(intval($m->get('width'))*4));
-		$m->set('height',(intval($m->get('height'))*4));
-		if(in_array($m->get('map'),$highqualitymapfiles)){	
-			$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));			
-		}
-		$array_urls[$i] = $m->url;
-	}
-}
-$coord = mb_split(",",$map_extent);
-
-if($overview === true){
-	// analyse overview url and draw rectangle with position
-	$o_url = new stripRequest($overview_url);
-	$overview_width = round($o_url->get("width"));
-	$overview_height = round($o_url->get("height"));
-	
-	if($factor>1){
-		$o_url->set('width',(intval($o_url->get('width'))*4));
-		$o_url->set('height',(intval($o_url->get('height'))*4));
-		if(in_array($o_url->get('map'),$highqualitymapfiles)){	
-				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
-				$overview_url = $o_url->url;	
-		}
-	}
-	
-	if($matching == true){
-		$overview_url = preg_replace($pattern,$replacement,$overview_url);  
-	}
-	
-	
-	if ($size == "A4" && $format == "portrait"){
-		$overview_left = $a4p_overviewOffset_left;
-		$overview_bottom =$a4p_overviewOffset_bottom;
-	}elseif ($size == "A4" && $format == "landscape"){
-		$overview_left = $a4l_overviewOffset_left;
-		$overview_bottom =$a4l_overviewOffset_bottom;
-	}elseif ($size == "A3" && $format == "portrait"){
-		$overview_left = $a3p_overviewOffset_left;
-		$overview_bottom =$a3p_overviewOffset_bottom;
-	}elseif ($size == "A3" && $format == "landscape"){
-		$overview_left = $a3l_overviewOffset_left;
-		$overview_bottom = $a3l_overviewOffset_bottom;
-	}elseif ($size == "A2" && $format == "portrait"){
-		$overview_left = $a2p_overviewOffset_left;
-		$overview_bottom =$a2p_overviewOffset_bottom;
-	}elseif ($size == "A2" && $format == "landscape"){
-		$overview_left = $a2l_overviewOffset_left;
-		$overview_bottom = $a2l_overviewOffset_bottom;
-	}elseif ($size == "A1" && $format == "portrait"){
-		$overview_left = $a1p_overviewOffset_left;
-		$overview_bottom =$a1p_overviewOffset_bottom;
-	}elseif ($size == "A1" && $format == "landscape"){
-		$overview_left = $a1l_overviewOffset_left;
-		$overview_bottom = $a1l_overviewOffset_bottom;
-	}elseif ($size == "A0" && $format == "portrait"){
-		$overview_left = $a0p_overviewOffset_left;
-		$overview_bottom =$a0p_overviewOffset_bottom;
-	}elseif ($size == "A0" && $format == "landscape"){
-		$overview_left = $a0l_overviewOffset_left;
-		$overview_bottom = $a0l_overviewOffset_bottom;
-	}
-	
-	$o_extent = $o_url->get("BBOX");
-	
-	$array_overview_url[0] = $overview_url;
-	if($log == true){
-		$l = new log("printPDF_overview",$array_overview_url);
-	}
-	
-	/*
-	$o_new = new stripRequest($overview_url);
-	$o_new->set('width',50);
-	$o_new->set('height',50);
-	//$o->set('BBOX',$overview_extent);
-	$o_url_new =$o_new->url;
-	$array_overview[0] = $overview_url;
-	$array_overview[1] = $o_url;
-	*/
-}	
-
-/*
- * north arrow
- */
-if($size == "A4" && $format == "portrait"){
-	$northarrow_left = $a4p_northarrow_left;
-	$northarrow_bottom = $a4p_northarrow_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
-	$northarrow_left = $a4l_northarrow_left;
-	$northarrow_bottom = $a4l_northarrow_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
-	$northarrow_left = $a3p_northarrow_left;
-	$northarrow_bottom = $a3p_northarrow_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
-	$northarrow_left = $a3l_northarrow_left;
-	$northarrow_bottom = $a3l_northarrow_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
-	$northarrow_left = $a2p_northarrow_left;
-	$northarrow_bottom = $a2p_northarrow_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
-	$northarrow_left = $a2l_northarrow_left;
-	$northarrow_bottom = $a2l_northarrow_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
-	$northarrow_left = $a1p_northarrow_left;
-	$northarrow_bottom = $a1p_northarrow_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
-	$northarrow_left = $a1l_northarrow_left;
-	$northarrow_bottom = $a1l_northarrow_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
-	$northarrow_left = $a0p_northarrow_left;
-	$northarrow_bottom = $a0p_northarrow_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
-	$northarrow_left = $a0l_northarrow_left;
-	$northarrow_bottom = $a0l_northarrow_bottom;
-}
-
-/*
- * special image
- */
-if ($size == "A4" && $format == "portrait"){
-	$specialImage_left = $a4p_special_left;
-	$specialImage_bottom = $a4p_special_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
-	$specialImage_left = $a4l_special_left;
-	$specialImage_bottom = $a4l_special_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
-	$specialImage_left = $a3p_special_left;
-	$specialImage_bottom = $a3p_special_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
-	$specialImage_left = $a3l_special_left;
-	$specialImage_bottom = $a3l_special_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
-	$specialImage_left = $a2p_special_left;
-	$specialImage_bottom = $a2p_special_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
-	$specialImage_left = $a2l_special_left;
-	$specialImage_bottom = $a2l_special_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
-	$specialImage_left = $a1p_special_left;
-	$specialImage_bottom = $a1p_special_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
-	$specialImage_left = $a1l_special_left;
-	$specialImage_bottom = $a1l_special_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
-	$specialImage_left = $a0p_special_left;
-	$specialImage_bottom = $a0p_special_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
-	$specialImage_left = $a0l_special_left;
-	$specialImage_bottom = $a0l_special_bottom;
-}
-
-if($log == true){
-	$l = new log("printPDF",$array_urls);
-}
-$pdf = new Cezpdf();
-
-$pdf->Cezpdf(mb_strtolower($size),$format);
-$diff=array(196=>'Adieresis',228=>'adieresis',
-   214=>'Odieresis',246=>'odieresis',
-   220=>'Udieresis',252=>'udieresis',
-   223=>'germandbls');
-$pdf->selectFont('../classes/fonts/Helvetica.afm', array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
-if($size == "A4" && $format == "portrait"){
-	$mapOffset_left = $a4p_mapOffset_left;
-	$mapOffset_bottom = $a4p_mapOffset_bottom;
-	$header_height = $a4p_header_height;
-	$footer_height = $a4p_footer_height;
-}
-else{
-	$mapOffset_left = $a4l_mapOffset_left;
-	$mapOffset_bottom = $a4l_mapOffset_bottom;
-	$header_height = $a4l_header_height;
-	$header_width = $a4l_header_width;
-}
-session_write_close();
-$i = new weldMaps2PNG(implode("___",$array_urls),$filename);
-
-$pdf->addPngFromFile($filename, $mapOffset_left, $mapOffset_bottom, $map_width, $map_height);
-if($unlink == true){
-	unlink($filename);
-}
-
-/** ******************************************************************
-* user drawn elements
-*/
-
-$theMeasureConfigArray = array(
-   "do_fill" => FALSE,
-     "fill_color" => array(
-     "r" => 128 / 255,
-     "g" => 128 / 255,
-     "b" => 128 / 255
-   ),
-   "do_stroke" => FALSE,
-     "stroke_color" => array(
-     "r" => 254 / 255,
-     "g" => 1 / 255,
-     "b" => 1 / 255
-   ),
-   "line_style" => array(
-       "width" => 2,
-       "cap" => 'butt',
-       "join" => 'miter',
-       "dash" => array(10, 6)
-       )
-   );
-
-if ($_REQUEST["measured_x_values"]!=''){
-	addMeasuredItem($pdf, $_REQUEST["measured_x_values"], $_REQUEST["measured_y_values"], $theMeasureConfigArray);
-	hideElementsOutsideMapframe($pdf);
-}
-
-# dashed line
-$pdf->setLineStyle($linewidth_dashed, '','', array(2,2));
-$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed);
-$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
-$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed);
-$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed);
-
-
-#line
-$pdf->setLineStyle($linewidth, '', '', array());
-$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
-$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
-$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom -$border);
-$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border, $mapOffset_left - $border, $mapOffset_bottom - $border);
-
-if($epsg == "EPSG:4326"){
-
-	$text4 = "";
-}
-
-if($size == "A4" && $format == "portrait"){
-   #header:
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height);
-   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border);
-   $pdf->line( $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border + $header_height);
-   #header-text
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text1);
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text1);
-
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text2);   
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 45,$mySize,$text2);
-   
-   $length = $pdf->getTextWidth($mySize, $text3);
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 35,$mySize,$text3);
-
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text4);   
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text4);
-
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text5);   
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text5);
-   
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text6);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text6);
-   $length = $pdf->getTextWidth($mySize, $text7);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 50,$mySize,$text7);
-   $length = $pdf->getTextWidth($mySize, $text8);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 30,$mySize,$text8);
-   $length = $pdf->getTextWidth($mySize, $text9);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text9);
-   $length = $pdf->getTextWidth($mySize, $text10);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text10);
-   
-   //special image on the map-page
-   if ($special == true){
-   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
-   }
-   
-   #footer
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
-   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
-   
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text11);   
-   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 10,$mySize,$text11);
-   $mySize = 6;
-   $length = $pdf->getTextWidth($mySize, $text12);   
-   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 18,$mySize,$text12);
-   $length = $pdf->getTextWidth($mySize, $text13);
-   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 25,$mySize,$text13);
-}
-else{
-   $pdf->setColor(1,1,1);
-   $ll = array($mapOffset_left + $map_width - $header_width + $border - $linewidth, $mapOffset_bottom - $border + 1);
-   $pdf->filledRectangle($ll[0], $ll[1], $header_width,$header_height);
-   $pdf->line($ll[0], $ll[1], $ll[0], $ll[1] + $header_height);
-   $pdf->line($ll[0], $ll[1] + $header_height, $ll[0] + $header_width, $ll[1] + $header_height);
-
-   $pdf->line($ll[0] + 2, $ll[1] + 2, $ll[0] + 2,  $ll[1] + $header_height - 2);
-   $pdf->line($ll[0] + 2,  $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + $header_height - 2);
-   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + 2);
-   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + 2, $ll[0] + 2, $ll[1] + 2);
-   
-   $pdf->line($ll[0] + 2, $ll[1] + 110 , $ll[0] - 2 + $header_width, $ll[1] + 110);
-   $pdf->line($ll[0] + 2, $ll[1] + 40 , $ll[0] - 2 + $header_width, $ll[1] + 40);
-   
-   
-   //special image on the map-page
-   if ($special == true){
-   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
-   }
-   
-    if($epsg == "EPSG:4326"){
-
-	$text4 = "";
-	}
-	
-   $pdf->setColor(0,0,0);
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text1);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,185,$mySize,$text1);
-   
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text2);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,175,$mySize,$text2);
-   $length = $pdf->getTextWidth($mySize, $text3);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,165,$mySize,$text3);
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text4);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,155,$mySize,$text4);
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text5);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,145,$mySize,$text5);   
-   
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text6);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,125,$mySize,$text6);
-   $length = $pdf->getTextWidth($mySize, $text7);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,115,$mySize,$text7);
-   $length = $pdf->getTextWidth($mySize, $text8);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,95,$mySize,$text8);
-   $length = $pdf->getTextWidth($mySize, $text9);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,85,$mySize,$text9);
-   $length = $pdf->getTextWidth($mySize, $text10);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,75,$mySize,$text10);
-   
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text11);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,60,$mySize,$text11); 
-   $mySize = 6;
-   $length = $pdf->getTextWidth($mySize, $text14);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,53,$mySize,$text14);
-   $length = $pdf->getTextWidth($mySize, $text15);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,47,$mySize,$text15);
-   $length = $pdf->getTextWidth($mySize, $text16);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,41,$mySize,$text16);
-   $length = $pdf->getTextWidth($mySize, $text17);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,35,$mySize,$text17);                             
-}
-#Coordinates
-$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
-$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
-$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
-$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
-
-$mySize = 9;
-$pdf->addText($mapOffset_left - 3, $mapOffset_bottom, $mySize, $myMinx, -90);
-$pdf->addText($mapOffset_left, $mapOffset_bottom  - ($pdf->getFontHeight($mySize)), $mySize, $myMiny);
-$pdf->addText($mapOffset_left  + $map_width - ($pdf->getTextWidth($mySize, $myMaxx)), $mapOffset_bottom + $map_height  + 3, $mySize, $myMaxx);
-$pdf->addText($mapOffset_left + $map_width + 3, $mapOffset_bottom + $map_height, $mySize, $myMaxy, 90);
-
-
-
-
-
-
-if ($overview==true){
-	// analyse request, draw rectancle
-	$filename = preg_replace("/map_/","overview_",$filename);
-	if($size == "A4" && $format == "portrait"){
-		$i = new weldOverview2PNG($overview_url,$array_urls[0] ,$filename);
-
-		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
-		if($unlink == true){
-			unlink($filename);
-		}
-	}
-	else{
-		$i = new weldOverview2PNG($overview_url,$array_urls[0],$filename);
-
-		//$pdf->addPngFromFile($filename, $mapOffset_left,$mapOffset_bottom, $overview_width, $overview_height);
-		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
-		if($unlink == true){
-			unlink($filename);
-		}
-	}
-}
-
-if ($northarrow==true){
-	$pdf->addPngFromFile($northarrowImage, $northarrow_left, $northarrow_bottom , $northarrowImage_width, $northarrowImage_height);
-}
-
-if($epsg == "EPSG:4326"){
-
-	$scalebar = false;
-}
-
-if($scalebar == true){
-	if ($size == "A4" && $format == "portrait"){
-		$scalebar_left = $a4p_scalebar_left;
-		$scalebar_bottom = $a4p_scalebar_bottom;
-	}elseif ($size == "A4" && $format == "landscape"){
-		$scalebar_left = $a4l_scalebar_left;
-		$scalebar_bottom = $a4l_scalebar_bottom;
-	}elseif ($size == "A3" && $format == "portrait"){
-		$scalebar_left = $a3p_scalebar_left;
-		$scalebar_bottom = $a3p_scalebar_bottom;
-	}elseif ($size == "A3" && $format == "landscape"){
-		$scalebar_left = $a3l_scalebar_left;
-		$scalebar_bottom = $a3l_scalebar_bottom;
-	}elseif ($size == "A2" && $format == "portrait"){
-		$scalebar_left = $a2p_scalebar_left;
-		$scalebar_bottom = $a2p_scalebar_bottom;
-	}elseif ($size == "A2" && $format == "landscape"){
-		$scalebar_left = $a2l_scalebar_left;
-		$scalebar_bottom = $a2l_scalebar_bottom;
-	}elseif ($size == "A1" && $format == "portrait"){
-		$scalebar_left = $a1p_scalebar_left;
-		$scalebar_bottom = $a1p_scalebar_bottom;
-	}elseif ($size == "A1" && $format == "landscape"){
-		$scalebar_left = $a1l_scalebar_left;
-		$scalebar_bottom = $a1l_scalebar_bottom;
-	}elseif ($size == "A0" && $format == "portrait"){
-		$scalebar_left = $a0p_scalebar_left;
-		$scalebar_bottom = $a0p_scalebar_bottom;
-	}elseif ($size == "A0" && $format == "landscape"){
-		$scalebar_left = $a0l_scalebar_left;
-		$scalebar_bottom = $a0l_scalebar_bottom;
-	}
-	
-	$array_scalebar = setscalebar($map_scale);
-	
-	$scalebar_left = $scalebar_left + $header_width/2 - $array_scalebar[1]/2;
-	$pdf->setLineStyle($scalebar_height, '','', array());
-   	$pdf->setColor(0,0,0);
-	#$pdf->line($scalebar_left, $scalebar_bottom , $scalebar_left - 200 + $array_scalebar[1], $scalebar_bottom);
-	$pdf->filledRectangle($scalebar_left, $scalebar_bottom, $array_scalebar[1],$scalebar_height);
-	
-	$pdf->setColor(1,1,1);
-	$pdf->filledRectangle($scalebar_left + $array_scalebar[1]/4 + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 1 ,$scalebar_height-2);	
-	$pdf->setColor(1,1,1);
-	$pdf->filledRectangle($scalebar_left + 3*($array_scalebar[1]/4) + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 2 ,$scalebar_height-2);	
-		
-		
-	#$pdf->setColor(1,0,1);
-	#$pdf->filledRectangle($scalebar_left  , $scalebar_bottom - 20, 1 * $DPC ,$scalebar_height-2);	
-	
-	
-	# value - Einheiten 
-	$pdf->setColor(0,0,0);	
-   $mySize = 8;
-   $scalebar_height_half = 0.5 * $scalebar_height;  
-    
-	$myText = 0;
-   $length = $pdf->getTextWidth($mySize, $myText);  
-   $pdf->addText($scalebar_left - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
-   
-	$myText = $array_scalebar[2]/2;
-   $length = $pdf->getTextWidth($mySize, $myText);     
-   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
-	
-	$myText = $array_scalebar[2];
-   $length = $pdf->getTextWidth($mySize, $myText);  
-   $pdf->addText($scalebar_left + $array_scalebar[1] - $length/2 - $length/4 ,$scalebar_bottom + 9 ,$mySize,$myText);
- 
-	
-	$pdf->setColor(0,0,0);	
-   $mySize = 8;
-   $scalebar_height_half = 0.5 * $scalebar_height;   
-   $myText = $array_scalebar[0];
-
-   #$pdf->addText($scalebar_left + $scalebar_width + 5,$scalebar_bottom - $scalebar_height_half ,$mySize,$myText);
-  
-
-	#units  
-   $length = $pdf->getTextWidth($mySize, $myText);
-   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom - 12 ,$mySize,$myText);
- 
-}
-
-
-/* ------------------------ 
-    new page for legend
-   ------------------------ */
-if ($legend == true && $_REQUEST["mylegend"]=='true'){
-
-	$pdf->ezNewPage();
-
-	//Pageborder (top, bottom, left, right)
-	
-	if($size == "A4" && $format == "portrait"){
-	  $pdf->ezSetMargins(50,50,80,30);
-	} else {
-	  $pdf->ezSetMargins(60,35,60,60);
-	}
-	
-	//Requests
-	if(CHARSET=="UTF-8"){
-		$new_wms_title=utf8_decode($_REQUEST["wms_title"]);
-	}else{
-		$new_wms_title=$_REQUEST["wms_title"];
-	}
-	
-	if(CHARSET=="UTF-8"){
-		$new_layers=utf8_decode($_REQUEST["layers"]);
-	}else{
-		$new_layers=$_REQUEST["layers"];
-	}
-	
-	$my_wms_id = explode("___",$_REQUEST["wms_id"]);
-	$my_wms_title = explode("___",$new_wms_title);
-	$my_layers = explode("___",$new_layers);
-	if($matching == true){
-        $my_legend = preg_replace($pattern,$replacement,$_REQUEST["legendurl"]);  
-    }
-    else{
-        $my_legend = $_REQUEST["legendurl"];
-    }
-    $my_legend = explode("___",$my_legend);
-
-	//columns
-	if($size == "A4" && $format == "portrait"){
-	  $pdf->ezColumnsStart(array ('num'=>2, 'gap'=>10));
-	} else {
-	  $pdf->ezColumnsStart(array ('num'=>3, 'gap'=>10));
-	}
-
-	//header from printPDF.conf
-	//$pdf->ezText("<b>".$titel."</b>", 13);
-	$pdf->ezText("<b><u>".$legendText."</u></b>", 13);
-
-	
-	//Seitenraender (top, bottom, left, right)
-	if($size == "A4" && $format == "portrait"){
-	  $pdf->ezSetMargins(70,35,80,30);
-	} else {
-	  $pdf->ezSetMargins(100,35,60,60);
-	}
-	
-	//generate the legend---------------------------------------------
-	
-	// Gesamthoehe Legende / height of the legend
-	$sum_legend_height = 0;
-
-
-	for($i=0; $i<count($my_wms_id); $i++){
-		if ($my_wms_id[$i] != '0'){  //wms_id not 0
-			$layer = explode(",",$my_layers[$i]);
-			$my_legendurls = explode(",",$my_legend[$i]);
-			
-			$wms_y_position = $pdf->ezText("<b>".$my_wms_title[$i]."</b>", 12, array('spacing'=>1.2));
-			$wms_zeilenhoehe   =  $pdf->getFontHeight(12);
-				 
-			// add this to the height of the legend /addiere dies zur Gesamthoehe Legende
-			$sum_legend_height += $wms_zeilenhoehe;
-			
-			//Layer
-			$l = 0;		#l temporary parameter to count the layer /Hilfvariable zum durchz�hlen der angezeigten Layer
-			for($j=0; $j<count($my_legendurls); $j++){
-				// url with grouped layers------------------
-				$temp_url = explode('*',$my_legendurls[$j]);
-				$temp_layers = explode('*',$layer[$j]);
-	
-				for ($q=0; $q <count($temp_url);$q++){  
-					if($temp_url[$q] == '1' ){			// Layertitle for the parent of grouped layers	 
-						// add this to the height of the legend /addiere dies zur Gesamth�he Legende		
-						$layer_y_position = $pdf->ezText($temp_layers[$q], 11, array('spacing'=>1.2));
-						$layer_zeilenhoehe   =  $pdf->getFontHeight(12);
-						$sum_legend_height += $layer_zeilenhoehe;
-						
-					}elseif($temp_url[$q] != '0' ){
-						$funktionsaufruf = new SaveLegend($temp_url[$q],$legendFilename);
-						$imgsize = getimagesize($legendFilename);
-						// add this to the height of the legend /addiere dies zur Gesamthoehe der Legende
-						$sum_legend_height += $imgsize[1];
-	
-						//calculate text + picture / Berechnung Groesse Schrift + Bild
-						if($l == 0){
-						       $y_position = $wms_y_position;
-						       $wms_y_position = '';
-						}else{
-							 $y_position = $pdf->ezText("", 1, array('spacing'=>1.2));
-						}
-						$layer_zeilenhoehe = $pdf->getFontHeight(11);
-						$next_position = $y_position - $layer_zeilenhoehe - $imgsize[1];
-						
-						// add this to the height of the legend / addiere dies zur Gesamth�he Legende
-						$sum_legend_height += $layer_zeilenhoehe;
-							
-						$l = $l+1;
-		
-		     			// if text + picture are smaler then the lower margin + textsize, then set a space
-						//wenn Schrift + Bild kleiner der unteren Margin + Zeilenhoehe, dann Abstand setzen
-						 if($size == "A4" && $format == "portrait" && $next_position <= 35 +$layer_zeilenhoehe){ //90 $layer_zeilenhoehe
-							$space = $layer_zeilenhoehe + $imgsize[1];
-						  $pdf->ezSetDy(-$space);
-						} 
-						if($size == "A4" && $format == "landscape" && $next_position <= 35+$layer_zeilenhoehe){//50
-							$space = $layer_zeilenhoehe + $imgsize[1];
-						  $pdf->ezSetDy(-$space);
-						}
-				
-						//write the header layername / Ueberschrift schreiben
-						$legend = $temp_layers[$q]."\n";  //$layer[$j]."\n"; 
-						$pdf->ezText($legend, 11, array('spacing'=>1.2));
-						
-						//$pdf->ezText($url, 9, array('spacing'=>1.2));
-						//print the picture / Bild schreiben
-						$pdf->ezImage($legendFilename, 0, 'width', 'none', 'left');
-						if($unlink == true){
-							unlink($legendFilename);
-						}
-						
-					} //if legendurl
-				}// for legendurl
-	
-			  	//frames (x1, y1, x2, y2)
-				if($size == "A4" && $format == "portrait"){
-					#line  
-					$pdf->setLineStyle($linewidth, '', '', array());
-					//left
-					$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
-					//right
-					$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
-					//top
-					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
-					//bottom
-					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
-					
-					if ($legendImage!=''){
-						//image on top of page
-						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border + $header_height - $legendImage_height - 4 , $legendImage_width, $legendImage_height);
-					}    
-				} else {
-				  $pdf->setLineStyle($linewidth, '', '', array());
-				  //left
-				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
-				  //right
-				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
-				  //top
-				  $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
-				   //bottom
-				   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border , $mapOffset_left - $border, $mapOffset_bottom - $border);
-				   
-					if ($legendImage!=''){
-						//image on top of page
-						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border - $legendImage_height -4 , $legendImage_width, $legendImage_height);
-						//line under legend (only landscape)
-						//$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border  - $legendImage_height - 4 , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 6);
-					}
-				}
-			}// for layers
-		} //if wms_id not 0
-	}// for wms
-	
-	/****
-    * USER POLYGON:
-    */
-   if($_REQUEST["measured_x_values"] != ""
-      && $_REQUEST["measured_y_values"] != ""
-        && is_file($legendFilenameUserPolygon)) {
-     // load image
-       $myY = $pdf->ezText("<b>temporary Object</b>", 11);
-       $pdf->ezSetDy(-15);
-       $pdf->ezImage($legendFilenameUserPolygon, 5, 17, 'none', 'left');
-       if($unlink == true){
-       		unlink($legendFilenameUserPolygon);
-       }
-       $pdf->ezSetY($myY - 7);
-       
-        $pdf->ezText("Element", 11, array("left" => 25));
-             // deletes image
-	    
-	    $pdf->ezSetDy(-15);             
-                    
-   } 
-	
-$pdf->ezText($legendFooter, 11);
-}//legend true
-/* ------------------------ 
-    end of legend  
-   ------------------------ */
-
-ob_clean();
-if($download == false){
-	$pdf->ezStream();
-}
-else{
-	$content = $pdf->ezOutput();
-
-	$fp = fopen($downloadFile,'w');
-	fwrite($fp,$content);
-	fclose($fp);
-	echo "<html><head></head><body><a href='".$downloadFile."'>".$downloadText."</a></body></html>";
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_printPDF_pdf.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+include (dirname(__FILE__)."/../classes/class.ezpdf.php");
+include (dirname(__FILE__)."/../classes/class_stripRequest.php");
+include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
+include (dirname(__FILE__)."/../classes/class_weldOverview2PNG.php");
+include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
+include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
+include (dirname(__FILE__)."/../print/print_functions.php");
+
+if($log == true){
+	include (dirname(__FILE__)."/../classes/class_log.php");
+}
+
+#Globals
+
+$factor = intval($_REQUEST["quality"]);
+
+#$date = date("d.m.Y",strtotime("now"));
+$linewidth_dashed = 0.5;
+$linewidth = 0.5;
+
+// DURATION TIME:
+function microtime_float(){
+   list($usec, $sec) = explode(" ", microtime());
+   return ((float)$usec + (float)$sec);
+}
+$time_start = microtime_float();
+// END DURATION TIME
+
+$time_end = microtime_float();
+$time = $time_end - $time_start;
+
+/* -------------------------------------- */
+
+$size = $_REQUEST["size"];
+$format = $_REQUEST["format"];
+$map_scale = $_REQUEST["map_scale"];
+$overview_url = $_REQUEST["overview_url"];
+$epsg = $_REQUEST["epsg"];
+if($overview_url=='false'){
+	$overview = false;	
+}
+
+function setscalebar($scale){
+    	$mb_resolution = 28.35;
+        
+		if($scale < 16){
+	      $value = "10";
+	      $unit = "cm";
+	      $scalefactor = 10/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 16 && $scale < 151){
+	      $value = "1";	      
+	      $unit = "Meter";
+	      $scalefactor = 100/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 151 && $scale < 1550 ){
+	      $value = "10";	      
+	      $unit = "Meter";
+	      $scalefactor = 1000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 1550 && $scale < 15050){
+	      $value = "100";	      
+	      $unit = "Meter";
+	      $scalefactor = 10000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 150050 && $scale >= 15050){
+	      $value = "1";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 100000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 1500050 && $scale >= 150050){
+	      $value = "10";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 1000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 15000050 && $scale >= 1500050){
+	      $value = "100";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 10000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 150000001 && $scale >= 15000001){
+	      $value = "1000";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 100000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 150000001){
+	      $value = "1000";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 100000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }   
+	   $array_scale[0] = $unit;
+	   $array_scale[1] = $img_width;
+		$array_scale[2] = $value;	   
+	   
+	   return  $array_scale; 
+}
+
+
+$border = 0.8 * $DPC;
+
+if($matching == true){
+   $urls = preg_replace($pattern,$replacement,$_REQUEST["map_url"]);  
+}
+else{
+   $urls = $_REQUEST["map_url"];
+}
+
+
+$array_urls = explode("___", $urls);
+
+$myURL = new stripRequest($array_urls[0]);
+$map_width = round($myURL->get("width"));
+$map_height = round($myURL->get("height"));
+$map_extent = $myURL->get("BBOX");
+if($factor>1){
+	for($i=0; $i<count($array_urls); $i++){
+		$m = new stripRequest($array_urls[$i]);
+		$m->set('width',(intval($m->get('width'))*4));
+		$m->set('height',(intval($m->get('height'))*4));
+		if(in_array($m->get('map'),$highqualitymapfiles)){	
+			$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));			
+		}
+		$array_urls[$i] = $m->url;
+	}
+}
+$coord = mb_split(",",$map_extent);
+
+if($overview === true){
+	// analyse overview url and draw rectangle with position
+	$o_url = new stripRequest($overview_url);
+	$overview_width = round($o_url->get("width"));
+	$overview_height = round($o_url->get("height"));
+	
+	if($factor>1){
+		$o_url->set('width',(intval($o_url->get('width'))*4));
+		$o_url->set('height',(intval($o_url->get('height'))*4));
+		if(in_array($o_url->get('map'),$highqualitymapfiles)){	
+				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
+				$overview_url = $o_url->url;	
+		}
+	}
+	
+	if($matching == true){
+		$overview_url = preg_replace($pattern,$replacement,$overview_url);  
+	}
+	
+	
+	if ($size == "A4" && $format == "portrait"){
+		$overview_left = $a4p_overviewOffset_left;
+		$overview_bottom =$a4p_overviewOffset_bottom;
+	}elseif ($size == "A4" && $format == "landscape"){
+		$overview_left = $a4l_overviewOffset_left;
+		$overview_bottom =$a4l_overviewOffset_bottom;
+	}elseif ($size == "A3" && $format == "portrait"){
+		$overview_left = $a3p_overviewOffset_left;
+		$overview_bottom =$a3p_overviewOffset_bottom;
+	}elseif ($size == "A3" && $format == "landscape"){
+		$overview_left = $a3l_overviewOffset_left;
+		$overview_bottom = $a3l_overviewOffset_bottom;
+	}elseif ($size == "A2" && $format == "portrait"){
+		$overview_left = $a2p_overviewOffset_left;
+		$overview_bottom =$a2p_overviewOffset_bottom;
+	}elseif ($size == "A2" && $format == "landscape"){
+		$overview_left = $a2l_overviewOffset_left;
+		$overview_bottom = $a2l_overviewOffset_bottom;
+	}elseif ($size == "A1" && $format == "portrait"){
+		$overview_left = $a1p_overviewOffset_left;
+		$overview_bottom =$a1p_overviewOffset_bottom;
+	}elseif ($size == "A1" && $format == "landscape"){
+		$overview_left = $a1l_overviewOffset_left;
+		$overview_bottom = $a1l_overviewOffset_bottom;
+	}elseif ($size == "A0" && $format == "portrait"){
+		$overview_left = $a0p_overviewOffset_left;
+		$overview_bottom =$a0p_overviewOffset_bottom;
+	}elseif ($size == "A0" && $format == "landscape"){
+		$overview_left = $a0l_overviewOffset_left;
+		$overview_bottom = $a0l_overviewOffset_bottom;
+	}
+	
+	$o_extent = $o_url->get("BBOX");
+	
+	$array_overview_url[0] = $overview_url;
+	if($log == true){
+		$l = new log("printPDF_overview",$array_overview_url);
+	}
+	
+	/*
+	$o_new = new stripRequest($overview_url);
+	$o_new->set('width',50);
+	$o_new->set('height',50);
+	//$o->set('BBOX',$overview_extent);
+	$o_url_new =$o_new->url;
+	$array_overview[0] = $overview_url;
+	$array_overview[1] = $o_url;
+	*/
+}	
+
+/*
+ * north arrow
+ */
+if($size == "A4" && $format == "portrait"){
+	$northarrow_left = $a4p_northarrow_left;
+	$northarrow_bottom = $a4p_northarrow_bottom;
+}elseif ($size == "A4" && $format == "landscape"){
+	$northarrow_left = $a4l_northarrow_left;
+	$northarrow_bottom = $a4l_northarrow_bottom;
+}elseif ($size == "A3" && $format == "portrait"){
+	$northarrow_left = $a3p_northarrow_left;
+	$northarrow_bottom = $a3p_northarrow_bottom;
+}elseif ($size == "A3" && $format == "landscape"){
+	$northarrow_left = $a3l_northarrow_left;
+	$northarrow_bottom = $a3l_northarrow_bottom;
+}elseif ($size == "A2" && $format == "portrait"){
+	$northarrow_left = $a2p_northarrow_left;
+	$northarrow_bottom = $a2p_northarrow_bottom;
+}elseif ($size == "A2" && $format == "landscape"){
+	$northarrow_left = $a2l_northarrow_left;
+	$northarrow_bottom = $a2l_northarrow_bottom;
+}elseif ($size == "A1" && $format == "portrait"){
+	$northarrow_left = $a1p_northarrow_left;
+	$northarrow_bottom = $a1p_northarrow_bottom;
+}elseif ($size == "A1" && $format == "landscape"){
+	$northarrow_left = $a1l_northarrow_left;
+	$northarrow_bottom = $a1l_northarrow_bottom;
+}elseif ($size == "A0" && $format == "portrait"){
+	$northarrow_left = $a0p_northarrow_left;
+	$northarrow_bottom = $a0p_northarrow_bottom;
+}elseif ($size == "A0" && $format == "landscape"){
+	$northarrow_left = $a0l_northarrow_left;
+	$northarrow_bottom = $a0l_northarrow_bottom;
+}
+
+/*
+ * special image
+ */
+if ($size == "A4" && $format == "portrait"){
+	$specialImage_left = $a4p_special_left;
+	$specialImage_bottom = $a4p_special_bottom;
+}elseif ($size == "A4" && $format == "landscape"){
+	$specialImage_left = $a4l_special_left;
+	$specialImage_bottom = $a4l_special_bottom;
+}elseif ($size == "A3" && $format == "portrait"){
+	$specialImage_left = $a3p_special_left;
+	$specialImage_bottom = $a3p_special_bottom;
+}elseif ($size == "A3" && $format == "landscape"){
+	$specialImage_left = $a3l_special_left;
+	$specialImage_bottom = $a3l_special_bottom;
+}elseif ($size == "A2" && $format == "portrait"){
+	$specialImage_left = $a2p_special_left;
+	$specialImage_bottom = $a2p_special_bottom;
+}elseif ($size == "A2" && $format == "landscape"){
+	$specialImage_left = $a2l_special_left;
+	$specialImage_bottom = $a2l_special_bottom;
+}elseif ($size == "A1" && $format == "portrait"){
+	$specialImage_left = $a1p_special_left;
+	$specialImage_bottom = $a1p_special_bottom;
+}elseif ($size == "A1" && $format == "landscape"){
+	$specialImage_left = $a1l_special_left;
+	$specialImage_bottom = $a1l_special_bottom;
+}elseif ($size == "A0" && $format == "portrait"){
+	$specialImage_left = $a0p_special_left;
+	$specialImage_bottom = $a0p_special_bottom;
+}elseif ($size == "A0" && $format == "landscape"){
+	$specialImage_left = $a0l_special_left;
+	$specialImage_bottom = $a0l_special_bottom;
+}
+
+if($log == true){
+	$l = new log("printPDF",$array_urls);
+}
+$pdf = new Cezpdf();
+
+$pdf->Cezpdf(mb_strtolower($size),$format);
+$diff=array(196=>'Adieresis',228=>'adieresis',
+   214=>'Odieresis',246=>'odieresis',
+   220=>'Udieresis',252=>'udieresis',
+   223=>'germandbls');
+$pdf->selectFont('../classes/fonts/Helvetica.afm', array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
+if($size == "A4" && $format == "portrait"){
+	$mapOffset_left = $a4p_mapOffset_left;
+	$mapOffset_bottom = $a4p_mapOffset_bottom;
+	$header_height = $a4p_header_height;
+	$footer_height = $a4p_footer_height;
+}
+else{
+	$mapOffset_left = $a4l_mapOffset_left;
+	$mapOffset_bottom = $a4l_mapOffset_bottom;
+	$header_height = $a4l_header_height;
+	$header_width = $a4l_header_width;
+}
+session_write_close();
+$i = new weldMaps2PNG(implode("___",$array_urls),$filename);
+
+$pdf->addPngFromFile($filename, $mapOffset_left, $mapOffset_bottom, $map_width, $map_height);
+if($unlink == true){
+	unlink($filename);
+}
+
+/** ******************************************************************
+* user drawn elements
+*/
+
+$theMeasureConfigArray = array(
+   "do_fill" => FALSE,
+     "fill_color" => array(
+     "r" => 128 / 255,
+     "g" => 128 / 255,
+     "b" => 128 / 255
+   ),
+   "do_stroke" => FALSE,
+     "stroke_color" => array(
+     "r" => 254 / 255,
+     "g" => 1 / 255,
+     "b" => 1 / 255
+   ),
+   "line_style" => array(
+       "width" => 2,
+       "cap" => 'butt',
+       "join" => 'miter',
+       "dash" => array(10, 6)
+       )
+   );
+
+if ($_REQUEST["measured_x_values"]!=''){
+	addMeasuredItem($pdf, $_REQUEST["measured_x_values"], $_REQUEST["measured_y_values"], $theMeasureConfigArray);
+	hideElementsOutsideMapframe($pdf);
+}
+
+# dashed line
+$pdf->setLineStyle($linewidth_dashed, '','', array(2,2));
+$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed);
+$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
+$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed);
+$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed);
+
+
+#line
+$pdf->setLineStyle($linewidth, '', '', array());
+$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
+$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom -$border);
+$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border, $mapOffset_left - $border, $mapOffset_bottom - $border);
+
+if($epsg == "EPSG:4326"){
+
+	$text4 = "";
+}
+
+if($size == "A4" && $format == "portrait"){
+   #header:
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height);
+   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border);
+   $pdf->line( $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border + $header_height);
+   #header-text
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text1);
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text1);
+
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text2);   
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 45,$mySize,$text2);
+   
+   $length = $pdf->getTextWidth($mySize, $text3);
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 35,$mySize,$text3);
+
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text4);   
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text4);
+
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text5);   
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text5);
+   
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text6);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text6);
+   $length = $pdf->getTextWidth($mySize, $text7);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 50,$mySize,$text7);
+   $length = $pdf->getTextWidth($mySize, $text8);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 30,$mySize,$text8);
+   $length = $pdf->getTextWidth($mySize, $text9);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text9);
+   $length = $pdf->getTextWidth($mySize, $text10);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text10);
+   
+   //special image on the map-page
+   if ($special == true){
+   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
+   }
+   
+   #footer
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
+   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
+   
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text11);   
+   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 10,$mySize,$text11);
+   $mySize = 6;
+   $length = $pdf->getTextWidth($mySize, $text12);   
+   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 18,$mySize,$text12);
+   $length = $pdf->getTextWidth($mySize, $text13);
+   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 25,$mySize,$text13);
+}
+else{
+   $pdf->setColor(1,1,1);
+   $ll = array($mapOffset_left + $map_width - $header_width + $border - $linewidth, $mapOffset_bottom - $border + 1);
+   $pdf->filledRectangle($ll[0], $ll[1], $header_width,$header_height);
+   $pdf->line($ll[0], $ll[1], $ll[0], $ll[1] + $header_height);
+   $pdf->line($ll[0], $ll[1] + $header_height, $ll[0] + $header_width, $ll[1] + $header_height);
+
+   $pdf->line($ll[0] + 2, $ll[1] + 2, $ll[0] + 2,  $ll[1] + $header_height - 2);
+   $pdf->line($ll[0] + 2,  $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + $header_height - 2);
+   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + 2);
+   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + 2, $ll[0] + 2, $ll[1] + 2);
+   
+   $pdf->line($ll[0] + 2, $ll[1] + 110 , $ll[0] - 2 + $header_width, $ll[1] + 110);
+   $pdf->line($ll[0] + 2, $ll[1] + 40 , $ll[0] - 2 + $header_width, $ll[1] + 40);
+   
+   
+   //special image on the map-page
+   if ($special == true){
+   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
+   }
+   
+    if($epsg == "EPSG:4326"){
+
+	$text4 = "";
+	}
+	
+   $pdf->setColor(0,0,0);
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text1);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,185,$mySize,$text1);
+   
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text2);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,175,$mySize,$text2);
+   $length = $pdf->getTextWidth($mySize, $text3);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,165,$mySize,$text3);
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text4);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,155,$mySize,$text4);
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text5);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,145,$mySize,$text5);   
+   
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text6);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,125,$mySize,$text6);
+   $length = $pdf->getTextWidth($mySize, $text7);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,115,$mySize,$text7);
+   $length = $pdf->getTextWidth($mySize, $text8);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,95,$mySize,$text8);
+   $length = $pdf->getTextWidth($mySize, $text9);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,85,$mySize,$text9);
+   $length = $pdf->getTextWidth($mySize, $text10);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,75,$mySize,$text10);
+   
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text11);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,60,$mySize,$text11); 
+   $mySize = 6;
+   $length = $pdf->getTextWidth($mySize, $text14);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,53,$mySize,$text14);
+   $length = $pdf->getTextWidth($mySize, $text15);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,47,$mySize,$text15);
+   $length = $pdf->getTextWidth($mySize, $text16);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,41,$mySize,$text16);
+   $length = $pdf->getTextWidth($mySize, $text17);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,35,$mySize,$text17);                             
+}
+#Coordinates
+$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
+$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
+$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
+$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
+
+$mySize = 9;
+$pdf->addText($mapOffset_left - 3, $mapOffset_bottom, $mySize, $myMiny, -90);
+$pdf->addText($mapOffset_left, $mapOffset_bottom  - ($pdf->getFontHeight($mySize)), $mySize, $myMinx);
+$pdf->addText($mapOffset_left  + $map_width - ($pdf->getTextWidth($mySize, $myMaxx)), $mapOffset_bottom + $map_height  + 3, $mySize, $myMaxx);
+$pdf->addText($mapOffset_left + $map_width + 3, $mapOffset_bottom + $map_height, $mySize, $myMaxy, 90);
+
+
+
+
+
+
+if ($overview==true){
+	// analyse request, draw rectancle
+	$filename = preg_replace("/map_/","overview_",$filename);
+	if($size == "A4" && $format == "portrait"){
+		$i = new weldOverview2PNG($overview_url,$array_urls[0] ,$filename);
+
+		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
+		if($unlink == true){
+			unlink($filename);
+		}
+	}
+	else{
+		$i = new weldOverview2PNG($overview_url,$array_urls[0],$filename);
+
+		//$pdf->addPngFromFile($filename, $mapOffset_left,$mapOffset_bottom, $overview_width, $overview_height);
+		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
+		if($unlink == true){
+			unlink($filename);
+		}
+	}
+}
+
+if ($northarrow==true){
+	$pdf->addPngFromFile($northarrowImage, $northarrow_left, $northarrow_bottom , $northarrowImage_width, $northarrowImage_height);
+}
+
+if($epsg == "EPSG:4326"){
+
+	$scalebar = false;
+}
+
+if($scalebar == true){
+	if ($size == "A4" && $format == "portrait"){
+		$scalebar_left = $a4p_scalebar_left;
+		$scalebar_bottom = $a4p_scalebar_bottom;
+	}elseif ($size == "A4" && $format == "landscape"){
+		$scalebar_left = $a4l_scalebar_left;
+		$scalebar_bottom = $a4l_scalebar_bottom;
+	}elseif ($size == "A3" && $format == "portrait"){
+		$scalebar_left = $a3p_scalebar_left;
+		$scalebar_bottom = $a3p_scalebar_bottom;
+	}elseif ($size == "A3" && $format == "landscape"){
+		$scalebar_left = $a3l_scalebar_left;
+		$scalebar_bottom = $a3l_scalebar_bottom;
+	}elseif ($size == "A2" && $format == "portrait"){
+		$scalebar_left = $a2p_scalebar_left;
+		$scalebar_bottom = $a2p_scalebar_bottom;
+	}elseif ($size == "A2" && $format == "landscape"){
+		$scalebar_left = $a2l_scalebar_left;
+		$scalebar_bottom = $a2l_scalebar_bottom;
+	}elseif ($size == "A1" && $format == "portrait"){
+		$scalebar_left = $a1p_scalebar_left;
+		$scalebar_bottom = $a1p_scalebar_bottom;
+	}elseif ($size == "A1" && $format == "landscape"){
+		$scalebar_left = $a1l_scalebar_left;
+		$scalebar_bottom = $a1l_scalebar_bottom;
+	}elseif ($size == "A0" && $format == "portrait"){
+		$scalebar_left = $a0p_scalebar_left;
+		$scalebar_bottom = $a0p_scalebar_bottom;
+	}elseif ($size == "A0" && $format == "landscape"){
+		$scalebar_left = $a0l_scalebar_left;
+		$scalebar_bottom = $a0l_scalebar_bottom;
+	}
+	
+	$array_scalebar = setscalebar($map_scale);
+	
+	$scalebar_left = $scalebar_left + $header_width/2 - $array_scalebar[1]/2;
+	$pdf->setLineStyle($scalebar_height, '','', array());
+   	$pdf->setColor(0,0,0);
+	#$pdf->line($scalebar_left, $scalebar_bottom , $scalebar_left - 200 + $array_scalebar[1], $scalebar_bottom);
+	$pdf->filledRectangle($scalebar_left, $scalebar_bottom, $array_scalebar[1],$scalebar_height);
+	
+	$pdf->setColor(1,1,1);
+	$pdf->filledRectangle($scalebar_left + $array_scalebar[1]/4 + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 1 ,$scalebar_height-2);	
+	$pdf->setColor(1,1,1);
+	$pdf->filledRectangle($scalebar_left + 3*($array_scalebar[1]/4) + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 2 ,$scalebar_height-2);	
+		
+		
+	#$pdf->setColor(1,0,1);
+	#$pdf->filledRectangle($scalebar_left  , $scalebar_bottom - 20, 1 * $DPC ,$scalebar_height-2);	
+	
+	
+	# value - Einheiten 
+	$pdf->setColor(0,0,0);	
+   $mySize = 8;
+   $scalebar_height_half = 0.5 * $scalebar_height;  
+    
+	$myText = 0;
+   $length = $pdf->getTextWidth($mySize, $myText);  
+   $pdf->addText($scalebar_left - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
+   
+	$myText = $array_scalebar[2]/2;
+   $length = $pdf->getTextWidth($mySize, $myText);     
+   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
+	
+	$myText = $array_scalebar[2];
+   $length = $pdf->getTextWidth($mySize, $myText);  
+   $pdf->addText($scalebar_left + $array_scalebar[1] - $length/2 - $length/4 ,$scalebar_bottom + 9 ,$mySize,$myText);
+ 
+	
+	$pdf->setColor(0,0,0);	
+   $mySize = 8;
+   $scalebar_height_half = 0.5 * $scalebar_height;   
+   $myText = $array_scalebar[0];
+
+   #$pdf->addText($scalebar_left + $scalebar_width + 5,$scalebar_bottom - $scalebar_height_half ,$mySize,$myText);
+  
+
+	#units  
+   $length = $pdf->getTextWidth($mySize, $myText);
+   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom - 12 ,$mySize,$myText);
+ 
+}
+
+
+/* ------------------------ 
+    new page for legend
+   ------------------------ */
+if ($legend == true && $_REQUEST["mylegend"]=='true'){
+
+	$pdf->ezNewPage();
+
+	//Pageborder (top, bottom, left, right)
+	
+	if($size == "A4" && $format == "portrait"){
+	  $pdf->ezSetMargins(50,50,80,30);
+	} else {
+	  $pdf->ezSetMargins(60,35,60,60);
+	}
+	
+	//Requests
+	if(CHARSET=="UTF-8"){
+		$new_wms_title=utf8_decode($_REQUEST["wms_title"]);
+	}else{
+		$new_wms_title=$_REQUEST["wms_title"];
+	}
+	
+	if(CHARSET=="UTF-8"){
+		$new_layers=utf8_decode($_REQUEST["layers"]);
+	}else{
+		$new_layers=$_REQUEST["layers"];
+	}
+	
+	$my_wms_id = explode("___",$_REQUEST["wms_id"]);
+	$my_wms_title = explode("___",$new_wms_title);
+	$my_layers = explode("___",$new_layers);
+	if($matching == true){
+        $my_legend = preg_replace($pattern,$replacement,$_REQUEST["legendurl"]);  
+    }
+    else{
+        $my_legend = $_REQUEST["legendurl"];
+    }
+    $my_legend = explode("___",$my_legend);
+
+	//columns
+	if($size == "A4" && $format == "portrait"){
+	  $pdf->ezColumnsStart(array ('num'=>2, 'gap'=>10));
+	} else {
+	  $pdf->ezColumnsStart(array ('num'=>3, 'gap'=>10));
+	}
+
+	//header from printPDF.conf
+	//$pdf->ezText("<b>".$titel."</b>", 13);
+	$pdf->ezText("<b><u>".$legendText."</u></b>", 13);
+
+	
+	//Seitenraender (top, bottom, left, right)
+	if($size == "A4" && $format == "portrait"){
+	  $pdf->ezSetMargins(70,35,80,30);
+	} else {
+	  $pdf->ezSetMargins(100,35,60,60);
+	}
+	
+	//generate the legend---------------------------------------------
+	
+	// Gesamthoehe Legende / height of the legend
+	$sum_legend_height = 0;
+
+
+	for($i=0; $i<count($my_wms_id); $i++){
+		if ($my_wms_id[$i] != '0'){  //wms_id not 0
+			$layer = explode(",",$my_layers[$i]);
+			$my_legendurls = explode(",",$my_legend[$i]);
+			
+			$wms_y_position = $pdf->ezText("<b>".$my_wms_title[$i]."</b>", 12, array('spacing'=>1.2));
+			$wms_zeilenhoehe   =  $pdf->getFontHeight(12);
+				 
+			// add this to the height of the legend /addiere dies zur Gesamthoehe Legende
+			$sum_legend_height += $wms_zeilenhoehe;
+			
+			//Layer
+			$l = 0;		#l temporary parameter to count the layer /Hilfvariable zum durchz�hlen der angezeigten Layer
+			for($j=0; $j<count($my_legendurls); $j++){
+				// url with grouped layers------------------
+				$temp_url = explode('*',$my_legendurls[$j]);
+				$temp_layers = explode('*',$layer[$j]);
+	
+				for ($q=0; $q <count($temp_url);$q++){  
+					if($temp_url[$q] == '1' ){			// Layertitle for the parent of grouped layers	 
+						// add this to the height of the legend /addiere dies zur Gesamth�he Legende		
+						$layer_y_position = $pdf->ezText($temp_layers[$q], 11, array('spacing'=>1.2));
+						$layer_zeilenhoehe   =  $pdf->getFontHeight(12);
+						$sum_legend_height += $layer_zeilenhoehe;
+						
+					}elseif($temp_url[$q] != '0' ){
+						$funktionsaufruf = new SaveLegend($temp_url[$q],$legendFilename);
+						$imgsize = getimagesize($legendFilename);
+						// add this to the height of the legend /addiere dies zur Gesamthoehe der Legende
+						$sum_legend_height += $imgsize[1];
+	
+						//calculate text + picture / Berechnung Groesse Schrift + Bild
+						if($l == 0){
+						       $y_position = $wms_y_position;
+						       $wms_y_position = '';
+						}else{
+							 $y_position = $pdf->ezText("", 1, array('spacing'=>1.2));
+						}
+						$layer_zeilenhoehe = $pdf->getFontHeight(11);
+						$next_position = $y_position - $layer_zeilenhoehe - $imgsize[1];
+						
+						// add this to the height of the legend / addiere dies zur Gesamth�he Legende
+						$sum_legend_height += $layer_zeilenhoehe;
+							
+						$l = $l+1;
+		
+		     			// if text + picture are smaler then the lower margin + textsize, then set a space
+						//wenn Schrift + Bild kleiner der unteren Margin + Zeilenhoehe, dann Abstand setzen
+						 if($size == "A4" && $format == "portrait" && $next_position <= 35 +$layer_zeilenhoehe){ //90 $layer_zeilenhoehe
+							$space = $layer_zeilenhoehe + $imgsize[1];
+						  $pdf->ezSetDy(-$space);
+						} 
+						if($size == "A4" && $format == "landscape" && $next_position <= 35+$layer_zeilenhoehe){//50
+							$space = $layer_zeilenhoehe + $imgsize[1];
+						  $pdf->ezSetDy(-$space);
+						}
+				
+						//write the header layername / Ueberschrift schreiben
+						$legend = $temp_layers[$q]."\n";  //$layer[$j]."\n"; 
+						$pdf->ezText($legend, 11, array('spacing'=>1.2));
+						
+						//$pdf->ezText($url, 9, array('spacing'=>1.2));
+						//print the picture / Bild schreiben
+						$pdf->ezImage($legendFilename, 0, 'width', 'none', 'left');
+						if($unlink == true){
+							unlink($legendFilename);
+						}
+						
+					} //if legendurl
+				}// for legendurl
+	
+			  	//frames (x1, y1, x2, y2)
+				if($size == "A4" && $format == "portrait"){
+					#line  
+					$pdf->setLineStyle($linewidth, '', '', array());
+					//left
+					$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
+					//right
+					$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
+					//top
+					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
+					//bottom
+					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
+					
+					if ($legendImage!=''){
+						//image on top of page
+						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border + $header_height - $legendImage_height - 4 , $legendImage_width, $legendImage_height);
+					}    
+				} else {
+				  $pdf->setLineStyle($linewidth, '', '', array());
+				  //left
+				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
+				  //right
+				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+				  //top
+				  $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
+				   //bottom
+				   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border , $mapOffset_left - $border, $mapOffset_bottom - $border);
+				   
+					if ($legendImage!=''){
+						//image on top of page
+						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border - $legendImage_height -4 , $legendImage_width, $legendImage_height);
+						//line under legend (only landscape)
+						//$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border  - $legendImage_height - 4 , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 6);
+					}
+				}
+			}// for layers
+		} //if wms_id not 0
+	}// for wms
+	
+	/****
+    * USER POLYGON:
+    */
+   if($_REQUEST["measured_x_values"] != ""
+      && $_REQUEST["measured_y_values"] != ""
+        && is_file($legendFilenameUserPolygon)) {
+     // load image
+       $myY = $pdf->ezText("<b>temporary Object</b>", 11);
+       $pdf->ezSetDy(-15);
+       $pdf->ezImage($legendFilenameUserPolygon, 5, 17, 'none', 'left');
+       if($unlink == true){
+       		unlink($legendFilenameUserPolygon);
+       }
+       $pdf->ezSetY($myY - 7);
+       
+        $pdf->ezText("Element", 11, array("left" => 25));
+             // deletes image
+	    
+	    $pdf->ezSetDy(-15);             
+                    
+   } 
+	
+$pdf->ezText($legendFooter, 11);
+}//legend true
+/* ------------------------ 
+    end of legend  
+   ------------------------ */
+
+ob_clean();
+if($download == false){
+	$pdf->ezStream();
+}
+else{
+	$content = $pdf->ezOutput();
+
+	$fp = fopen($downloadFile,'w');
+	fwrite($fp,$content);
+	fclose($fp);
+	echo "<html><head></head><body><a href='".$downloadFile."'>".$downloadText."</a></body></html>";
+}
+?>

Modified: branches/print_dev/http/sld/sld_function_getusersld.php
===================================================================
--- branches/print_dev/http/sld/sld_function_getusersld.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/sld/sld_function_getusersld.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -31,6 +31,7 @@
 
 include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
 include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+include_once(dirname(__FILE__)."/../../core/globalSettings.php");
 include_once(dirname(__FILE__)."/sld_parse.php");
 
 /**

Modified: branches/print_dev/http/tools/mapbender_setup.php
===================================================================
--- branches/print_dev/http/tools/mapbender_setup.php	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/http/tools/mapbender_setup.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -22,6 +22,7 @@
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
  
 ?>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
@@ -57,7 +58,7 @@
 		if (phpversion()<'5.2.0') $check .="<td width=\"10\"></td><td><font color=#0000FF>Version: " . phpversion() . "! You should think about upgrade to the current php version (get it <a href='http://www.php.net/downloads.php' target='_blank'>here</a>)</td></tr>";
 		else $check .="<td width=\"10\">X</td><td><font color=#00D000>Version: " . phpversion() . "</td></tr>";
 	}
-	else $check .="<td width=\"10\"></td><td><font color=#FF0000>Version: " . phpversion() . "! Your PHP Version is very old, please upgrade to version >=5.1.0 to use full mapbender functionality and reduce problems!</td></tr>";
+	else $check .="<td width=\"10\"></td><td><font color=#FF0000>Version: " . phpversion() . "! Your PHP Version is very old, please upgrade to version >=5.1.0 to use full mapbender functionality and reduce problems! PHP >= 5.2 is recommended.</td></tr>";
 #php-schnittstelle 
 	if(php_sapi_name() == 'cgi') $check.="<tr><td >interface</td><td>X</td><td><font color=#00D000>CGI-PHP</td></tr>";
 	else $check.="<tr><td >interface</td><td>X</td><td><font color=#00D000>Modul-PHP</td></tr>";
@@ -97,6 +98,10 @@
 	$check .="<tr ><td>short_open_tag</td>"; 
 	if (get_cfg_var('short_open_tag')!='1') $check .= "<td>X</td><td><font color=#00D000>Off</font></td></tr>";
 	else $check .= "<td></td><td><font color=#FF0000>On => Displaying XML files will not work properly</font></td></tr>";
+# json
+	$check .="<tr ><td>JSON support</td>"; 
+	if (Mapbender_JSON::usesNative()) $check .= "<td>X</td><td><font color=#00D000>Native PHP</font></td></tr>";
+	else $check .= "<td></td><td><font color=#FF0000>PEAR library, think about uprading to PHP >=5.2 </font><font color=#0000FF>(the library is error prone with huge data sets; some things like WMC load/save might not work properly)</font></td></tr>";
 	echo $check;
 #################################################
 #PHP Extensioncheck
@@ -252,7 +257,7 @@
 	} 			    	
 	else $check .="<tr><td>AUTO_UPDATE</td><td></td><td><font color=#FF0000>AUTO_UPDATE not defined </font><font color=#0000FF>(for the wms monitoring 	functionality you have to define this constant)</font></td></tr>";
 # ERROR LOGGING
-	$testLog = new mb_notice("This is a test run by the Mapbender setup script.");
+	$testLog = new mb_exception("This is a test run by the Mapbender setup script.");
 	if ($testLog->result) {
 		$check .="<tr><td>ERROR LOGGING</td><td>X</td><td><font color=#00D000>" . $testLog->message . "</font></td></tr>";		
 	}

Modified: branches/print_dev/lib/ajax.js
===================================================================
--- branches/print_dev/lib/ajax.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/ajax.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -12,7 +12,8 @@
  */
 /**
  * A wrapper for an AJAX request via GET 
- *
+ * 
+ * @deprecated
  * @param {String} url the URL of a (presumably a server side) script.
  * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
  * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
@@ -30,6 +31,7 @@
 /**
  * A wrapper for an AJAX request via POST 
  *
+ * @deprecated
  * @param {String} url the URL of a (presumably a server side) script.
  * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
  * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
@@ -47,6 +49,7 @@
 /**
  * A wrapper for an AJAX request via GET 
  *
+ * @deprecated
  * @param {String} url the URL of a (presumably a server side) script.
  * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
  * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error". 
@@ -61,3 +64,201 @@
 	}
 }	
 
+Mapbender.Ajax = {
+	requestCount: 0,
+	Messages: {
+		"fatalError": "A fatal error occured.",
+		"idMismatchError": "The ID of the response is not equal to the ID of the request."
+	}
+};
+
+Mapbender.Ajax.Notification = function () {
+	/**
+	 * The method to call on the server
+	 */
+	var method = "";
+
+	/**
+	 * The parameters to pass to the above method
+	 */
+	var parameters = {};
+	 
+	this.setMethod = function (aMethod) {
+		method = aMethod.toString();
+	};
+	
+	this.setParameter = function (key, value) {
+		parameters[key] = value;
+		return true;
+	};
+
+	this.send = function (type, url) {
+		switch (type.toUpperCase()) {
+			case "POST" :
+				$.post(url, getParameters(), function () {
+				});
+				break;
+			case "GET" :
+				$.get(url, getParameters(), function () {
+				});
+				break;
+			default:
+				return false;
+		}
+		return true;
+	};
+
+	var getParameters = function () {
+		return {
+			"method": method,
+			"params": $.toJSON([parameters]),
+			"id": null
+		};
+	}
+	
+}
+Mapbender.Ajax.Request = function (options) {
+	/**
+	 * "POST" or "GET"
+	 */
+	var type = (typeof(options) == "object" && options.type) ? options.type.toUpperCase() : "POST";
+	
+	/**
+	 * result of request will be logged as Mb_notice
+	 */
+	var log = (typeof(options) == "object" && options.log) ? options.log : false;
+	
+	/**
+	 * The method to call on the server
+	 */
+	var method = (typeof(options) == "object" && options.method) ? options.method : "";
+
+	/**
+	 * The parameters to pass to the above method
+	 */
+	var parameters = (typeof(options) == "object" && options.parameters) ? options.parameters : {};
+
+	/**
+	 * A unique identifier for this Ajax request
+	 */
+	var id = ++Mapbender.Ajax.requestCount;
+	
+	/**
+	 * The result object, coming from the server
+	 */
+	var result = {};
+
+	/**
+	 * A message coming from the server
+	 */
+	var message = "";
+
+	/**
+	 * Did the request succeed?
+	 */
+	var success = false;
+	
+	/**
+	 * Did an internal error occur
+	 */
+	var internalError = false;
+	
+	/**
+	 * Checks if the response is valid.
+	 * 
+	 * @param {String} json
+	 * @param {String} status
+	 */
+	var receive = function (json, status) {
+		if (!json) {
+			message = Mapbender.Ajax.Messages.fatalError;
+			new Mb_warning(message);
+			internalError = true;
+			return;
+		}
+		var resultObj = eval('(' + json + ')');
+		// some severe error has occured
+		if (typeof(resultObj) != "object" || status != "success") {
+			message = Mapbender.Ajax.Messages.fatalError;
+			new Mb_warning(message);
+			internalError = true;
+			return;
+		}
+		if (resultObj.error !== null) {
+			// the ajax request reports failure  
+			if (resultObj.error.message) {
+				message = resultObj.error.message;
+			}
+			else {
+				message = Mapbender.Ajax.Messages.fatalError;
+			}
+			if (resultObj.error.code == -1) {
+				internalError = true;
+			}
+			new Mb_warning(message);
+			return;
+		}
+
+		// the ajax request reports success
+		if (resultObj.result && typeof(resultObj.result) == "object" &&
+			resultObj.result.data && typeof(resultObj.result.data) == "object") {
+			if (id != resultObj.id) {
+				message = Mapbender.Ajax.Messages.idMismatchError;
+				new Mb_warning(message);
+				internalError = true;
+				return;
+			}
+
+			success = true;
+
+			if (resultObj.result.data.message) {
+				message = resultObj.data.message;
+				status = resultObj.data.message;
+			}
+			result = resultObj.result.data;
+		}
+		return;
+	}
+
+	this.send = function (url, callback, scope) {
+		internalError = false;
+		success = false;
+		
+		var callbackWrapper = function (json, status) {
+			receive(json, status);
+			if (!internalError) {
+				new Mb_notice("REQUEST #" + id + ": " + url + "\n\n" + 
+					"RESULT: " + $.toJSON(result) + "\n\n" + 
+					"SUCCESS: " + success + "\n\n" + 
+					"MESSAGE: " + message);
+				
+				if (scope !== undefined) {
+					callback.apply(scope, [result, success, message]);
+				}
+				else {
+					callback(result, success, message);
+				}
+			}
+		};
+		switch (type) {
+			case "POST" :
+				$.post(url, getParameters(), callbackWrapper);
+				break;
+			case "GET" :
+				$.get(url, getParameters(), callbackWrapper);
+				break;
+			default:
+				return false;
+		}
+		return true;
+	};
+
+	var getParameters = function () {
+		return {
+			"method": method,
+			"params": $.toJSON(parameters),
+			"id": id
+		};
+	}
+};
+Mapbender.Ajax.Request.prototype = new Mapbender.Ajax.Notification();

Added: branches/print_dev/lib/ajax.php
===================================================================
--- branches/print_dev/lib/ajax.php	                        (rev 0)
+++ branches/print_dev/lib/ajax.php	2009-01-13 13:32:45 UTC (rev 3436)
@@ -0,0 +1,202 @@
+<?php
+# $Id:database-pgsql.php 2619 2008-07-08 15:46:11Z christoph $
+# http://www.mapbender.org/index.php/database-pgsql.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__) . "/../http/classes/class_json.php");
+
+/**
+ * Represents an incoming JSON-RPC. It will NOT send a response to the client!
+ * (Use AjaxResponse if you also want to send a response.)
+ * 
+ * Usually called like this
+ * 
+ * $incomingAjax = new AjaxRequest($_REQUEST)
+ * 
+ * get parameters of request via
+ * 
+ * echo $incomingAjax->getParameter("someAttribute");
+ */
+class AjaxRequest {
+
+	protected $method = "";
+	protected $json = null;
+	protected $id = null;
+	protected $paramObject = array();
+	
+	public function __construct ($requestArray) {
+		$this->json = new Mapbender_JSON();
+		
+		if (is_array($requestArray)) {
+			$this->initializeFromArray($requestArray);
+		}
+	}
+
+	protected function initializeFromArray ($requestArray) {
+		if ($requestArray["id"]) {
+			$this->id = $requestArray["id"];
+		}
+		
+		if ($requestArray["method"]) {
+			$this->method = $requestArray["method"];
+			
+			if ($requestArray["params"]) {
+				
+				$obj = $this->json->decode(stripslashes($requestArray["params"]));
+				$this->paramObject = $obj;
+			}
+		}
+	}
+
+	public function getMethod () {
+		return $this->method;
+	}
+
+	public function getParameter ($key) {
+		if (is_object($this->paramObject) && $this->paramObject->$key) {
+			return $this->paramObject->$key;
+		}
+		return null;
+	}
+	
+	public function getId () {
+		return $this->id;
+	}
+}
+
+/**
+ * Represents an incoming JSON-RPC, which will send a response to the client.
+ * 
+ * Usually called like this
+ * 
+ * $ajaxResponse = new AjaxResponse($_REQUEST)
+ * 
+ * 
+ * get parameters of request via
+ * 
+ * echo $ajaxResponse->getParameter("someAttribute");
+ * 
+ * 
+ * set data to be sent back to the client
+ * 
+ * $ajaxResponse->setResult("key", "value");
+ * 
+ * or
+ * 
+ * $ajaxResponse->setResult($assocArray);
+ * 
+ * 
+ * set the status of this RPC
+ * 
+ * $ajaxResponse->setSuccess(false);
+ * 
+ * and supply a message
+ * 
+ * $ajaxResponse->setMessage("I didn't do it.");
+ * 
+ * 
+ * Finally send the response
+ * 
+ * $ajaxResponse->send();
+ */
+class AjaxResponse extends AjaxRequest {
+	private $data = array();
+	private $success = true;
+	private $error = null;
+	private $message = "";
+	
+	public function __construct ($ajaxRequest) {
+		$this->json = new Mapbender_JSON();
+
+		if (is_array($ajaxRequest)) {
+			$this->initializeFromArray($ajaxRequest);
+		}		
+
+		// in addition to AjaxRequest, immediately send an
+		// error message to the client, if the request
+		// could not be identified
+		if ($this->id === null) {
+			$this->success = false;
+			$this->message = _mb("Fatal error: Could not detect ID of AJAX request.");
+			$this->send();
+		}
+	}
+	
+	/**
+	 * Set a message to be sent back to the client.
+	 * 
+	 * @param $aMessage String
+	 */
+	public function setMessage ($aMessage) {
+		$this->message = $aMessage;
+	}
+	
+	/**
+	 * Set status of the RPC.
+	 * 
+	 * @param $trueOrFalse Boolean
+	 */
+	public function setSuccess ($trueOrFalse) {
+		$this->success = $trueOrFalse;
+	}
+	
+	/**
+	 * Compose data to be sent back to the client.
+	 * Either by key and value, or by passing the complete associative array.
+	 */
+	public function setResult () {
+		if (func_num_args() == 1) {
+			$this->data = func_get_arg(0);
+		}
+		else if (func_num_args() == 2) {
+			$key = func_get_arg(0);
+			$value = func_get_arg(1);
+			$this->data[$key] = $value;
+		}
+	}
+	
+	/**
+	 * Send the response to the client.
+	 */
+	public function send () {
+		header("Content-type:application/json; charset=" . CHARSET);
+		echo $this->getData();
+		die;
+	}
+	
+	private function getData () {
+		$dataObject = array();
+		$dataObject["data"] = $this->data;
+		if ($this->success) {
+			$dataObject["success"] = true;
+			$dataObject["message"] = $this->message;
+		}
+		else {
+			$this->error = array(
+				"code" => -1,
+				"message" => $this->message
+			);
+		}
+		$obj = array(
+			"result" => $dataObject,
+			"error" => $this->error,
+			"id" => $this->id
+		);
+		return $this->json->encode($obj);
+	}
+}
+?>
\ No newline at end of file

Modified: branches/print_dev/lib/basic.js
===================================================================
--- branches/print_dev/lib/basic.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/basic.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -37,6 +37,7 @@
 
 function mb_showHighlight(frameName,x,y){
    var pos = makeRealWorld2mapPos(frameName,x, y);
+//TODO frame des Mapobjekts frameName nehmen
    mb_arrangeElement(frameName,"highlight",pos[0]-7, pos[1]-7);
    window.frames[frameName].document.getElementById("highlight").style.visibility = 'visible';
 }

Modified: branches/print_dev/lib/button.js
===================================================================
--- branches/print_dev/lib/button.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/button.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -7,21 +7,37 @@
 var mb_button = [];
 
 function mb_regButton_frame(wii, frameName, param){
+
 	var ind = mb_button.length;
 	mb_button[ind] = new mb_conButton(wii, ind);
 	if (frameName === null) {
 		if (param === null) {
-			eval(wii+"("+ind+")");
+			if (typeof(wii) == "string") {
+				eval(wii+"("+ind+")");
+			}
+			else {
+				wii(ind);
+			}
 		}
 		else {
-			eval(wii+"("+ind+", "+param+")");
+			if (typeof(wii) == "string") {
+				eval(wii + "(" + ind + ", " + param + ")");
+			}
+			else {
+				wii(ind, param);
+			}
 		}
 	}
 	else if (param === null) {
 		eval("window.frames['" + frameName + "']."+wii+"("+ind+")");
 	}
 	else {
-		eval("window.frames['" + frameName + "']."+wii+"("+ind+", "+param+")");
+		if (typeof(wii) == "string") {
+			eval("window.frames['" + frameName + "']."+ wii + "(" + ind + ", " + param + ")");
+		}
+		else {
+			wii(ind, param);
+		}
 	}
 	mb_button[ind].prev = mb_button[ind].src;
 	mb_button[ind].src = mb_button[ind].img_off;
@@ -122,23 +138,27 @@
       }
    }
 }
-function updateButtonTooltips(obj) {
+function updateButtonTooltips(obj, result, message) {
+	if (!result) {
+		alert(message);
+		return;
+	}
+	var buttonArray = obj;
 	// this one only changes those in the main frame
 	var imageArray = document.getElementsByTagName("img");
 	for (var i = 0; i < imageArray.length; i++) {
-		for(var j=0; j<obj.length; j++){
-			if (imageArray[i].id == obj[j].id) {
-				document.getElementById(imageArray[i].id).title = obj[j].title;
+		for(var j=0; j<buttonArray.length; j++){
+			if (imageArray[i].id == buttonArray[j].id) {
+				document.getElementById(imageArray[i].id).title = buttonArray[j].title;
 			}
 		}
 	}
 }
 
 function mb_localizeButtons(){
-	mb_ajax_json("../php/mod_button_tooltips.php", function(obj, status){
-		updateButtonTooltips(obj);
-	});
-}
+	var req = new Mapbender.Ajax.Request();
+	req.send("../php/mod_button_tooltips.php", updateButtonTooltips);
+};
 
 eventLocalize.register(function () {
 	mb_localizeButtons();

Modified: branches/print_dev/lib/buttonNew.js
===================================================================
--- branches/print_dev/lib/buttonNew.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/buttonNew.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -8,7 +8,7 @@
 	
 	this.add = function (button) {
 		if (!button.constructor == "Button") {
-			console.log("not a button, but a %s", button.constructor);
+//			console.log("not a button, but a %s", button.constructor);
 			return false;
 		}
 		if (button.type == "toggle") {

Modified: branches/print_dev/lib/core.js
===================================================================
--- branches/print_dev/lib/core.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/core.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -28,11 +28,6 @@
 var eventBeforeMapRequest = new MapbenderEvent();
 
 /**
- * Triggered before the scale is calculated.
- */
-var eventBeforeGetScale = new MapbenderEvent();
-
-/**
  * Triggered before a feature info is requested.
  */
 var eventBeforeFeatureInfo = new MapbenderEvent();
@@ -47,6 +42,11 @@
 var eventInit = new MapbenderEvent();
 
 /**
+ * Triggered before eventInit.
+ */
+var eventBeforeInit = new MapbenderEvent();
+
+/**
  * Triggered after Mapbender is loaded and has been initialised.
  * Used to trigger initial map requests
  */
@@ -128,15 +128,6 @@
  * deprecated wrapped function
  * @deprecated
  */
-function mb_registerGetScalePreFunctions(stringFunction){
-//	mb_GetScalePreFunctions[mb_GetScalePreFunctions.length] = stringFunction;
-	eventBeforeGetScale.register(stringFunction);
-}
-
-/**
- * deprecated wrapped function
- * @deprecated
- */
 function mb_registerloadWmsSubFunctions(stringFunction){
 //	mb_loadWmsSubFunctions[mb_loadWmsSubFunctions.length] = stringFunction;
 	eventAfterLoadWMS.register(stringFunction);
@@ -185,6 +176,8 @@
 	// creates the map objects (mapframe1, overview...)
 	eventInitMap.trigger();
 
+	eventBeforeInit.trigger();
+
 	// initialisation
 	eventInit.trigger();
 	

Modified: branches/print_dev/lib/event.js
===================================================================
--- branches/print_dev/lib/event.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/event.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -23,9 +23,9 @@
 	 * A function that needs to be executed, when the event occurs, has to be 
 	 * registered via this function.
 	 */
-	this.register = function(aFunction) {
+	this.register = function(aFunction, scope) {
 
-		var mpbnFunction = new MapbenderFunction(aFunction);
+		var mpbnFunction = new MapbenderFunction(aFunction, scope);
 		functionArray.push(mpbnFunction);
 	};
 
@@ -101,6 +101,9 @@
 			case "OR":
 				result = false;
 				break;
+			case "CAT":
+				result = "";
+				break;
 			default:
 				result = true;
 				break;
@@ -120,6 +123,9 @@
 				case "OR":
 					result = result || functionArray[i].execute(properties);
 					break;
+				case "CAT":
+					result += functionArray[i].execute(properties);
+					break;
 				default:
 					result = functionArray[i].execute(properties);
 					break;
@@ -145,7 +151,7 @@
 /**
  * A MapbenderFunction is a function with a priority.
  */
-var MapbenderFunction = function (aFunction) {
+var MapbenderFunction = function (aFunction, aScope) {
 	
 	// public
 	/**
@@ -160,6 +166,9 @@
 	 */
 	this.execute = function (argumentObj) {
 		if (typeof(aFunction) == "function") {
+			if (scope) {
+				return aFunction.call(scope, argumentObj);
+			}
 			return func(argumentObj);
 		}
 
@@ -190,4 +199,5 @@
 	
 	// private
 	var func = aFunction;
+	var scope = aScope;
 };
\ No newline at end of file

Modified: branches/print_dev/lib/exception.js
===================================================================
--- branches/print_dev/lib/exception.js	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/lib/exception.js	2009-01-13 13:32:45 UTC (rev 3436)
@@ -16,7 +16,7 @@
  *
  * @constructor
  */
-var Mb_log = function() {
+function Mb_log () {
 	var that = this;
 	
 	var levelArray = global_log_levels.split(",");
@@ -72,7 +72,7 @@
  * @param message the message that is being logged
  */	
 function Mb_exception(message) {
-	 var level = "error";
+	var level = "error";
 	this.throwException(message, level);
 }
 Mb_exception.prototype = new Mb_log();

Modified: branches/print_dev/resources/db/update/update_2.6.sql
===================================================================
--- branches/print_dev/resources/db/update/update_2.6.sql	2009-01-13 13:24:57 UTC (rev 3435)
+++ branches/print_dev/resources/db/update/update_2.6.sql	2009-01-13 13:32:45 UTC (rev 3436)
@@ -39,3 +39,72 @@
 	height: 18px;
 	width: 32px;
 }' WHERE fkey_e_id = 'digitize' AND var_name = 'text css';
+
+-- http://trac.osgeo.org/mapbender/ticket/336
+UPDATE gui_element SET e_js_file = 'wfs.php', e_target='mapframe1,overview' WHERE e_id = 'wfs';
+
+
+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');
+
+
+--
+-- scope
+-- ticket #
+--
+
+-- remove event handlers, are now in the script
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'forward';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'back';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'zoomIn1';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'zoomOut1';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'measure';
+
+-- remove event handlers, are now in the script
+UPDATE gui_element SET e_content = '<div id="mbN" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_n" style="position:relative;top:0;left:0" src="../img/arrows/arrow_n.gif" width="15" height="10">
+</div> 
+<div id="mbNE" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_ne" style="position:relative;top:0;left:0" src="../img/arrows/arrow_ne.gif" width="10" height="10">
+</div> 
+<div id="mbE" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_e" style="position:relative;top:0;left:0" src="../img/arrows/arrow_e.gif" width="10" height="15">
+</div> 
+<div id="mbSE" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_se" style="position:relative;top:0;left:0" src="../img/arrows/arrow_se.gif" width="10" height="10">
+</div> 
+<div id="mbS" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_s" style="position:relative;top:0;left:0" src="../img/arrows/arrow_s.gif" width="15" height="10">
+</div> 
+<div id="mbSW" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_sw" style="position:relative;top:0;left:0" src="../img/arrows/arrow_sw.gif" width="10" height="10">
+</div>
+<div id="mbW" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_w" style="position:relative;top:0;left:0" src="../img/arrows/arrow_w.gif" width="10" height="15">
+</div> 
+<div id="mbNW" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_nw" style="position:relative;top:0;left:0" src="../img/arrows/arrow_nw.gif" width="10" height="10">
+</div>' WHERE e_id = 'navFrame';
+
+
+UPDATE gui_element SET e_pos = 1, e_element = 'div', e_src = '', e_attributes = '', e_more_styles = 'overflow:hidden;', e_content = '<div id="mapframe1_maps" style="position:absolute;left:0px;right:0px;"></div>', e_closetag = 'div', e_js_file = 'mapnf.php' WHERE e_id = 'mapframe1';
+UPDATE gui_element SET e_element = 'div', e_src = '', e_attributes = '', e_more_styles = 'overflow:hidden;', e_content = '<div id="overview_maps" style="position:absolute;left:0px;right:0px;"></div>', e_closetag = 'div', e_js_file = 'ovnf.php', e_target = 'mapframe1', e_requires = 'mapframe1' WHERE e_id = 'overview';
+INSERT INTO gui_element_vars select fkey_gui_id,'overview' as fkey_e_id, 'overview_wms' as var_name, '0' as var_value, 'wms that shows up as overview' as context, 'var' as var_type from gui_element where e_id = 'overview';
+UPDATE gui_element SET e_pos = 2, e_element = 'div', e_more_styles = 'visibility:visible;overflow:scroll', e_content = '', e_closetag = 'div', e_js_file = '../html/mod_treefolderPlain.php', e_mb_mod = 'jsTree.js', e_requires = 'mapframe1' WHERE e_id = 'treeGDE';
+INSERT INTO gui_element_vars select fkey_gui_id,'body' as fkey_e_id, 'treeGDE_css' as var_name, '../css/treeGDE2.css' as var_value, 'cssfile for TreeGDE' as context, 'file/css' as var_type from gui_element where e_id = 'treeGDE';
+UPDATE gui_element SET e_element = 'select', e_src = '', e_attributes = '', e_content = '<option value="">undefined</option>
+<option value="EPSG:4326">EPSG:4326</option>
+<option value="EPSG:31466">EPSG:31466</option>
+<option value="EPSG:31467">EPSG:31467</option>
+<option value="EPSG:31468">EPSG:31468</option>
+<option value="EPSG:31469">EPSG:31469</option>', e_closetag = 'select', e_js_file = 'mod_changeEPSG.php' WHERE e_id = 'changeEPSG';
+
+DELETE FROM gui_element WHERE e_id = 'closePolygon';
+DELETE FROM gui_element WHERE e_id = 'rubber';
+DELETE FROM gui_element WHERE e_id = 'getArea';
+
+UPDATE gui_element SET e_element = 'div', e_src = '', e_attributes = '', e_more_styles = 'overflow:hidden;', e_content = '', e_closetag = 'div', e_js_file = 'mod_zoomCoords.php', e_target = 'mapframe1,overview', e_requires = 'mapframe1' WHERE e_id = 'zoomCoords';
+
+ 
+-- a demo splash screen for gui1
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'body', 'use_load_message', 'true', '' ,'php_var');
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'body', 'includeWhileLoading', '../include/gui1_splash.php', '' ,'php_var');



More information about the Mapbender_commits mailing list