[Mapbender-commits] r10247 - in trunk/mapbender/http: css html javascripts plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Sep 13 03:57:55 PDT 2019


Author: armin11
Date: 2019-09-13 03:57:55 -0700 (Fri, 13 Sep 2019)
New Revision: 10247

Added:
   trunk/mapbender/http/css/jquery.ui.autocomplete.2019.css
   trunk/mapbender/http/css/wfsconftree2.css
   trunk/mapbender/http/html/mod_treefolderPlain2019.php
   trunk/mapbender/http/javascripts/jsTree2019.js
   trunk/mapbender/http/javascripts/mod_scalebar_test.js
   trunk/mapbender/http/plugins/mb_print_woKml_woOv.php
   trunk/mapbender/http/plugins/mb_scaleContainer.js
   trunk/mapbender/http/plugins/mb_toolbar_cont.js
   trunk/mapbender/http/plugins/mb_toolbar_tree.js
   trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer2019.php
   trunk/mapbender/http/plugins/wfsConfTree_single.js
Log:
New options to build nicer guis ;-) - thanx to karl owesny

Added: trunk/mapbender/http/css/jquery.ui.autocomplete.2019.css
===================================================================
--- trunk/mapbender/http/css/jquery.ui.autocomplete.2019.css	                        (rev 0)
+++ trunk/mapbender/http/css/jquery.ui.autocomplete.2019.css	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,124 @@
+/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }	
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.16
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+
+	/*SUCHSCHLITZ ANPASSEN*/
+#symbolForInputCloseId {
+	display:none;
+	margin-top: 16px;
+	padding-right:15px;	
+}
+#symbolForClearInputId {
+	display:none;
+	padding-right:22px;
+	padding-bottom:1px;
+}
+
+
+#geographicName {display:none;}
+#geographicName {
+       float:left;
+       height: 37px;
+       padding: 0px 31px 0px 10px;
+       font-family: Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;
+       font-size:15px;
+       letter-spacing:1px;
+	background-color:whitesmoke;
+	overflow: auto;
+	border: 1px solid #aaa;
+	border-radius: 0;
+	margin-right: -34px;
+	margin-top: 6px;
+	}
+#geographicName:focus {
+	border: 1px solid #d62029;
+}
+
+	/*Have to be edited in mod_jsonAutocompleteGazetteer_light.php*/
+  
+#symboldForInputId {
+    font-family: Helvetica,Roboto,Arial,sans-serif;
+    color: #777;
+    font-weight: 700;
+    letter-spacing: 1px;
+    border-left: 2px solid #DDD;
+    padding: 0px 15px 0px 35px;
+    line-height: 51px;
+    display:inline-block;
+    text-decoration: none;
+    background-image: url(../img/search.svg);
+    background-repeat: no-repeat;
+    background-position: left+15px center;
+	cursor:pointer;
+}
+
+#symboldForInputId:hover {
+    background-image: url(../img/search_over.svg);
+    color:#333;
+    background-color: #EEE;
+}
+
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+	float: left;
+	box-shadow: 0 5px 10px -2px rgb(201, 202, 202); /*neu*/
+}
+.ui-menu .ui-menu {
+	margin-top: 0.6em;       /*angepasst - vorher -3px*/
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:2.0;        /*angepasst - vorher 1.5*/
+	zoom:1;
+	font-family: Verdana,Arial,sans-serif;       /*neu*/
+	font-size: 12px;       /*neu*/
+	border-bottom: solid 1px #efefef;       /*neu*/
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: 0px;       /*angepasst - vorher -1px*/
+	font-family: Verdana,Arial,sans-serif;       /*neu*/
+	font-size: 12px;       /*neu*/
+	background-color: #efefef;       /*neu*/
+	background-image: none;       /*neu*/
+	border-top:none;       /*neu*/
+	border-left:none;       /*neu*/
+	border-right:none;	       /*neu*/
+	border-bottom: solid 1px #efefef;       /*neu*/
+	padding:.2em .4em;       /*neu*/
+	
+}

Added: trunk/mapbender/http/css/wfsconftree2.css
===================================================================
--- trunk/mapbender/http/css/wfsconftree2.css	                        (rev 0)
+++ trunk/mapbender/http/css/wfsconftree2.css	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,6 @@
+ul.conftree, ul.conftree ul {
+    list-style-type: none;
+    margin-left: 0;
+    padding-left: 0;
+    margin-top: 0;
+}

Added: trunk/mapbender/http/html/mod_treefolderPlain2019.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolderPlain2019.php	                        (rev 0)
+++ trunk/mapbender/http/html/mod_treefolderPlain2019.php	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,1159 @@
+<?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, width, height) {
+	Fenster1 = window.open(Adresse, '<?php echo _mb("Information");?>', "width="+width+",height="+height+",left=100,top=100,scrollbars=yes,resizable=yes");
+	Fenster1.focus();
+}
+<?php
+	echo "mod_treeGDE_map = '".$e_target[0]."';";
+?>
+// <script language="JavaScript">
+var msgObj = {};
+msgObj.tooltipHandleWms = '<?php echo _mb("(De)activate this service");?>';
+msgObj.tooltipLayerVisible = '<?php echo _mb("Toggles the visibility of this service");?>';
+msgObj.tooltipLayerQuerylayer = '<?php echo _mb("Toggles the queryability of this service");?>';
+msgObj.tooltipLayerContextMenu = '<?php echo _mb("Opens the layer context menu");?>';
+msgObj.tooltipWmsContextMenu = '<?php echo _mb("Opens the WMS context menu");?>';
+msgObj.tooltipRemoveWms = '<?php echo _mb("Removes the selected WMS");?>';
+msgObj.tooltipMoveSelectionUp = '<?php echo _mb("Moves the selection up");?>';
+msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
+msgObj.tooltipMetadata = '<?php echo _mb("Show metadata");?>';
+msgObj.tooltipDownload = '<?php echo _mb("Download dataset");?>';
+msgObj.tooltipFeaturetypeCoupling = '<?php echo _mb("Coupled featuretypes");?>';
+
+if (typeof(localizetree) === 'undefined')localizetree = 'false';
+
+function localizeTree () {
+	var treefolderTitleArray = [];
+	var map = Mapbender.modules[mod_treeGDE_map];
+
+	if (map === null) {
+		return;
+	}
+	for(var i = 0; i < map.wms.length; i++) {
+		var currentWms = map.wms[i];
+
+		treefolderTitleArray.push({
+			title : currentWms.objLayer.length > 0 ?
+				currentWms.objLayer[0].gui_layer_title :
+				currentWms.wms_title,
+			layer : []
+		});
+
+		for (var j = 0; j < currentWms.objLayer.length; j++) {
+			var currentLayer = currentWms.objLayer[j];
+			treefolderTitleArray[treefolderTitleArray.length-1].layer.push({
+				title : currentLayer.gui_layer_title
+			});
+		}
+	}
+
+	var req = new Mapbender.Ajax.Request({
+		url: "../php/mod_treefolder2_l10n.php",
+		method: "translateServiceData",
+		parameters: {
+			data: treefolderTitleArray
+		},
+		callback: function (obj, success, message) {
+			var translatedTitleArray = obj;
+			for (var i = 0; i < translatedTitleArray.length; i++) {
+				var currentWms = map.wms[i];
+				currentWms.wms_currentTitle = translatedTitleArray[i].title;
+
+				for(var j = 0; j < currentWms.objLayer.length; j++) {
+					var currentLayer = currentWms.objLayer[j];
+					if (translatedTitleArray[i].layer.length > j) {
+						currentLayer.layer_currentTitle = translatedTitleArray[i].layer[j].title;
+					}
+				}
+			}
+			reloadTree();
+		}
+	});
+	req.send();
+}
+/*
+eventInit.register(function () {
+	localizeTree();
+});
+*/
+
+if (localizetree == 'true') {
+	eventLocalize.register(function () {
+		localizeTree();
+	});
+}
+
+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 lock_maprequest = false; //global var to prohibit multiple saving states as wmc to session when loading wmc 
+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 AND NOT lft = 1 ORDER BY lft;";
+$v = array(Mapbender::session()->get("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
+	$arrNodesStr = "[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];";
+	$arrNodesStr = str_replace(array("[]", ",]"),array("","]"),$arrNodesStr);
+	echo "var arrNodesStr = \"".$arrNodesStr."\";\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(enlargetreewidth) === 'undefined') enlargetreewidth = 'false';
+if (typeof(enlargetreewidthopacity) === 'undefined') enlargetreewidthopacity = 'false';
+if (typeof(menu) === 'undefined')menu = '';
+if (typeof(redirectToMetadataUrl) !== 'undefined' && redirectToMetadataUrl == "false") {
+	redirectToMetadataUrl = false;
+}
+else {
+	redirectToMetadataUrl = true;
+}
+
+if (typeof(datalink) === 'undefined')datalink = 'false';
+if (typeof(featuretypeCoupling) === 'undefined')featuretypeCoupling = 'false';
+if (typeof(metadataWidth) === 'undefined')metadataWidth = '500';
+if (typeof(metadataHeight) === 'undefined')metadataHeight = '500';
+if (typeof(activatedimension) === 'undefined')activatedimension = 'false';
+
+var defaultMetadataUrl = '../php/mod_showMetadata.php?resource=layer&layout=tabs&';
+if (redirectToMetadataUrl) {
+	defaultMetadataUrl += 'redirectToMetadataUrl=1';
+}
+else {
+	defaultMetadataUrl += 'redirectToMetadataUrl=0';
+}
+
+//menu elements
+var menu_move_up = ['menu_move_up', ['<?php echo _mb("Move up");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'up.svg']];
+var menu_move_down = ['menu_move_down', ['<?php echo _mb("Move down");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'down.svg']];
+var menu_delete = ['menu_delete', ['<?php echo _mb("Remove");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'trash.svg']];
+var menu_opacity_down = ['menu_opacity_down', ['<?php echo _mb("Opacity down");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'up.svg']];
+var menu_opacity_up = ['menu_opacity_up', ['<?php echo _mb("Opacity up");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'down.svg']];
+var menu_metalink = ['menu_metalink', ['<?php echo _mb("Information");?> ', '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'+','+metadataWidth+','+metadataHeight+');',,'info.svg']];
+var menu_zoom = ['menu_zoom', ['<?php echo _mb("Zoom");?> ', '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', ['<?php echo _mb("Hide menu");?> ', 'javascript:hideMenu()',,'clear_white.svg']];
+var menu_style = ['menu_style', ['<?php echo _mb("Change style");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openStyleDialog(ids[0],ids[1],ids[2])',,'styling.svg']];
+var menu_legend = ['menu_legend', ['<?php echo _mb("Legende öffnen");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openLegendHtml(ids[0],ids[1],ids[2])',,'legend_tree.png']];
+//var menu_wms_switch = ['menu_zoom', ['<?php echo _mb("Zoom");?> ', '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'+','+metadataWidth+','+metadataHeight+');',,'info.png']];
+//var menu_layer_switch = ['menu_zoom', ['Zjjj ', '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'+','+metadataWidth+','+metadataHeight+');',,'info.png']];
+//var menu_info_switch = ['menu_zoom', ['Zmn ', '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'+','+metadataWidth+','+metadataHeight+');',,'info.png']];
+
+//parent.eventMapRequestFailed.register(function(t){imgerror(t)});
+
+eventAfterLoadWMS.register(reloadTree);
+
+eventInit.register(registerInitMapCheck);
+
+Mapbender.events.init.register(function () {
+	$("#" + mod_treeGDE_map).mapbender().events.afterMoveWms.register(reloadTree);
+});
+eventInit.register(loadTree);
+if(showstatus=='true'||alerterror=='true'){
+	//eventAfterMapRequest.register(init_mapcheck);
+	//init_mapcheck();
+}
+eventAfterMapRequest.register(updateScale);
+eventAfterMapRequest.register(updateCheckState);
+
+function registerInitMapCheck() {
+	if(showstatus=='true'||alerterror=='true'){
+		//console.log("Registrierung init_mapcheck an eventAfterMapRequest");
+		eventAfterMapRequest.register(init_mapcheck);
+	}
+}
+
+if (enlargetreewidth) {
+    eventAfterInit.register(function(){
+
+        var initialWidth = parseInt($('#treeGDE').css("width"));
+        $('#treeGDE').bind("mouseenter", function(){
+            $(this).css({
+                'width': initialWidth + enlargetreewidth,
+            });
+		if (enlargetreewidthopacity) {
+			$(this).css({
+				'-moz-opacity': '1',
+				'opacity': '1',
+				'filter': 'alpha(opacity=100)'
+            		});
+		}
+            $(this).mousewheel();
+        });
+        $('#treeGDE').bind("mouseleave", function(){
+            $(this).css({
+                'width': initialWidth,
+            });
+		if (enlargetreewidthopacity) {
+			$(this).css({
+				'-moz-opacity': '1',
+				'opacity': '1',
+				'filter': 'alpha(opacity=100)'
+            		});
+		}
+        });
+    });
+}
+
+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( myMapObj.getScale());
+		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;
+	var map = getMapObjByName(mod_treeGDE_map);
+	for(var i=0; i< mb_mapObj.length; i++){
+		var scale = parseInt( map.getScale());
+		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'||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+'/up.svg" alt="move up" style="position:relative;top:0px;left:0px;"/></a><a href="javascript:move_down()"><img title="'+msgObj.tooltipMoveSelectionDown+'" src="'+imagedir+'/down.svg" 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();
+	}
+	Mapbender.events.treeReloaded.trigger();
+}
+
+function imgerror(wms, path, imgObj){
+	var map= getMapObjIndexByName(mod_treeGDE_map);
+	//t.onerror=null;
+	//t.onabort=null;
+	if(state[wms]!=-1 && alerterror=='true'){
+		state[wms]=-1;
+		
+		var errorMsg = '<?php echo _mb("Failed to load WMS");?> ' + mb_mapObj[map].wms[wms].objLayer[0].layer_currentTitle;
+		$('<div id="imgErrorDialog">' + errorMsg + ':<iframe style="width:90%;height:90%;" src="' + imgObj.attr("src") + '"></iframe></div>').dialog();
+		
+		checkNode(path, 0, false);
+		
+		/*if(confirm('<?php echo _mb("Failed to load WMS");?> ' +
+			mb_mapObj[map].wms[wms].objLayer[0].layer_currentTitle +
+			'\n<?php echo _mb("Do you want to try to load it in a new window?");?>')) {
+			window.open(imgObj.attr("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) ||
+		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||mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==="1"){
+					state[wms]=1;
+					if(showstatus=='true')
+						setNodeImage(img);
+						//Removes the previous Maprequest image from dom
+						var prevlastRequestDiv = $("#"+mod_treeGDE_map+"_maps > div:last").prev().attr("id");
+						var prevWmsgid=prevlastRequestDiv+"_map_"+wms;
+						var $prevWmsgid=$("#"+prevWmsgid);
+						$prevWmsgid.remove();	
+					break;
+				}
+			}
+		}
+	}
+	else{
+		if(first){
+			state[wms]=0;
+			$("#" + map).error(function () {
+				imgerror(wms, img, $(this));
+			});
+			//$(map).onabort=imgerror;
+
+			if(showstatus=='true')
+				setNodeImage(img, "clock.svg");
+		}
+
+		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 lastRequestDiv = $("#"+mod_treeGDE_map+"_maps > div:last" ).attr("id");
+		var wmsimgid=lastRequestDiv+"_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 local_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.toString().split(",");
+			mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+			//mb_repaint(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
+			break;
+		}
+	}
+}
+
+function openLegendHtml(j,k,l){
+	if(!j && !k&& !l){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	var my= mb_mapObj[j].wms[k].objLayer[l];
+	var legendWindow = window.open("../metadata/"+my.layer_name+".html", '<?php echo _mb("Legend");?>', "width=800,height=800,left=100,top=100,scrollbars=yes,resizable=no");
+	legendWindow.focus();
+}
+
+function openStyleDialog(j,k,l){
+	if(!j && !k&& !l){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	var my= mb_mapObj[j].wms[k].objLayer[l];
+	var dialogHtml = "<select id='styleSelect'>";
+	for (var i=0;i < my.layer_style.length;i++) {
+		dialogHtml += "<option value='" + my.layer_style[i].name + "'";
+		if(my.layer_style[i].name == my.gui_layer_style) {
+			dialogHtml += " selected";
+		}
+		dialogHtml += ">" + my.layer_style[i].title + "</option>";
+	}
+	dialogHtml += "</select>";
+
+	if(my.layer_style.length > 1) {
+		$("<div id='changeStyleDialog' title='<?php echo _mb('Change layer style');?>'><?php echo _mb('Please select a style');?>: </div>").dialog(
+			{
+				bgiframe: true,
+				autoOpen: true,
+				modal: false,
+				buttons: {
+					"<?php echo _mb('Close');?>": function(){
+						$(this).dialog('close').remove();
+					}
+				}
+			}
+		);
+		$(dialogHtml).appendTo("#changeStyleDialog");
+		$("#styleSelect").change(function() {
+			my.gui_layer_style = this.options[this.selectedIndex].value;
+			Mapbender.modules[mod_treeGDE_map].setMapRequest();
+		});
+	}
+	else {
+		alert("<?php echo _mb('There is no different style available for this layer.');?>");
+	}
+
+}
+
+//---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();
+	Mapbender.modules[mod_treeGDE_map].setMapRequest();
+}
+
+//---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("<?php echo _mb('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("<?php echo _mb('Illegal move operation');?>");
+		return;
+	}
+	treeState = getState();
+	 mb_mapObj[j].zoom(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("<?php echo _mb('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("<?php echo _mb('Illegal move operation');?>");
+		return;
+	}
+	treeState = getState();
+	 mb_mapObj[j].zoom(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("<?php echo _mb('You have to select the WMS you want to delete!');?>")
+		return;
+	}
+	if(l!=0){
+		alert("<?php echo _mb('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 ("<?php echo _mb('Last WMS can not be removed.');?>");
+		return;
+	}
+	if(confirm('<?php echo _mb("Are you sure you want to remove");?>' + ' "'+ mb_mapObj[j].wms[k].objLayer[l].layer_currentTitle+'"?')){
+  		 mb_mapObjremoveWMS(j,k);
+		 mb_mapObj[j].zoom(true, 1.0);
+		 lock_maprequest = true; //done to prohibit save wmc for each wms
+		 mb_execloadWmsSubFunctions();
+		 lock_maprequest = false;
+	}
+}
+
+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+'", "eye_off.svg");', 100);
+	}
+	else{
+		setTimeout('setNodeImage("'+path+'", "verticaldots.svg");', 100);
+	}
+	if(reset_lock){
+		lock_update=false;
+	}
+	handleSelectedWMS(path, true);
+}
+
+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);
+
+	// in this case, only the root layer visibility/querylayer
+	// needs to be adjusted, without cascading the changes to
+	// its children
+	if (arguments.length === 2 && arguments[1]) {
+		var l = mb_mapObj[ind].wms[wms].getLayerByLayerName(layername);
+		l.gui_layer_visible = bChk ? 1 : 0;
+		l.gui_layer_querylayer = bChk ? 1 : 0;
+
+		mb_restateLayers(mod_treeGDE_map,wms_id);
+		if (!lock_maprequest) {
+			setSingleMapRequest(mod_treeGDE_map,wms_id);
+		}		
+		return;
+	}
+	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+'", "eye_off.svg");', 100);
+	}
+	else{
+		setTimeout('setNodeImage("'+path+'", "verticaldots.svg");', 100);
+	}
+	if(reset_lock)
+	{
+		mb_restateLayers(mod_treeGDE_map,wms_id);
+		if (!lock_maprequest) {
+			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 setDimensionUserValue(j,k,l,dimensionIndex,userValue) {
+	if(!j && !k&& !l){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	var my = mb_mapObj[j].wms[k].objLayer[l];
+	var myWms = mb_mapObj[j].wms[k];
+	//delete all userValues from other layers of this wms
+	for (var k=0;k< myWms.objLayer.length;k++) {
+		for (var i=0;i< myWms.objLayer[k].layer_dimension.length;i++) {
+			myWms.objLayer[k].layer_dimension[i].userValue = "";
+		}
+	}
+	my.layer_dimension[dimensionIndex].userValue = userValue;
+	//openfolder = true;
+	treeState = getState();
+	reloadTree();
+}
+
+//function for buggy servers which do not support real iso8601 patterns for UTC :-(
+function makeDateTimeBetter(dateTimeIso) {
+	return dateTimeIso.replace('+00:00','Z');
+}
+
+function snapToDiscreteValue(userValue,extent) {
+	//call it via sync ajax call :-(
+	transformUrl = '../php/mod_transformTimeDimension.php?operation=snapToGrid&userValue='+encodeURIComponent(userValue);
+	var response = $.ajax({
+		url: transformUrl,
+		type: "POST",
+        	async: false,
+		data: {
+			'extent':extent,
+		},
+    		success: function (data) {
+			return data;
+		},
+		error: function() {
+			alert("An error occured!");
+		}
+	}).responseText;
+	var jsonValue = JSON.parse(response);
+	return jsonValue.data[0].value;
+}
+
+function openDimensionSelectHtml(j,k,l,dimensionIndex) {
+	if(!j && !k&& !l){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	$("#selectDimensionDialog").remove();
+	var my = mb_mapObj[j].wms[k].objLayer[l];
+	var myWms = mb_mapObj[j].wms[k];
+	//extract/calculate discrete values for time!
+	var userValue = mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].userValue; //not already defined in mapobj!!
+	var extent = mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].extent;
+	var dimdefault = mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].default;
+	var dialogHtml = "<div id='timeline'></div>";
+	$("<div id='selectDimensionDialog' title='<?php echo _mb('Select layer dimension');?>'><?php echo _mb('Please select a value for TIME. One single element can be dragged on timeline after selection. Scale may be altered by scrolling.');?>: </div>").dialog(
+		{
+			bgiframe: true,
+			autoOpen: true,
+			modal: false,
+			width: 400,
+			closeOnEscape: false,
+			open: function(event, ui) { $( "div[aria-labelledby='ui-dialog-title-selectDimensionDialog']" ).children().children(".ui-dialog-titlebar-close").hide()}, //hide closing x - but only for element with special id!!!
+			buttons: {
+				"<?php echo _mb('Close');?>": function(){
+					$('selectDimensionDialog').remove();
+					$(this).dialog('close').remove();
+					//delete container, items, timeline
+				}
+			}
+		}
+	);	
+	$(dialogHtml).appendTo("#selectDimensionDialog");
+	//fill timeline into div
+	if (userValue !== undefined && userValue !== false && userValue !== "" && userValue !== "undefined") {
+		userValue = makeDateTimeBetter(userValue);
+		transformUrl = '../php/mod_transformTimeDimension.php?userValue='+encodeURIComponent(userValue)+'&default='+encodeURIComponent(dimdefault);
+	} else {
+		transformUrl = '../php/mod_transformTimeDimension.php?default='+encodeURIComponent(dimdefault);
+	}
+	  $.ajax({
+		url: transformUrl,
+		type: "POST",
+		data: {
+			'extent': extent,
+		},
+    		success: function (data) {
+      			// hide the "loading..." message
+     			//document.getElementById('loading').style.display = 'none';
+
+      			// DOM element where the Timeline will be attached
+     			var container = document.getElementById('timeline');
+
+      			// Create a DataSet (allows two way data-binding)
+      			var items = new vis.DataSet(data.data);
+
+      			// Configuration for the Timeline
+      			var options = data.options;
+
+			//check if onclick or onmove should be enabled
+			if (data.options.editable.updateTime !== 'undefined' && data.options.editable.updateTime == true) {
+				options.onMove = function (item,callback) {
+					//calculate new value for item start based on snapping to period from extent
+					item.start = new Date(snapToDiscreteValue(item.start.toISOString(),extent));
+					item.content = item.start.toISOString();
+					myWms.gui_wms_dimension_time = makeDateTimeBetter(item.start.toISOString());
+					setDimensionUserValue(j,k,l,dimensionIndex,myWms.gui_wms_dimension_time);
+					Mapbender.modules[mod_treeGDE_map].setSingleMapRequest(mod_treeGDE_map,mb_mapObj[j].wms[k].wms_id);
+					callback(item);
+				};
+			} else {
+				options.editable = false;
+				
+			}
+      			// Create a Timeline
+      			var timeline = new vis.Timeline(container, items, options);
+			//if (data.options.editable.updateTime == 'undefined' || data.options.editable.updateTime == false) {
+				timeline.on('select', function (properties) {
+					if (properties.event.type == "tap") {
+						myWms.gui_wms_dimension_time = makeDateTimeBetter(timeline.itemsData._data[timeline.getSelection()].content);
+						setDimensionUserValue(j,k,l,dimensionIndex,myWms.gui_wms_dimension_time);
+						Mapbender.modules[mod_treeGDE_map].setSingleMapRequest(mod_treeGDE_map,mb_mapObj[j].wms[k].wms_id);
+					}
+				});
+			//}	
+    		},
+    		error: function (err) {
+      			//console.log('Error', err);
+      			if (err.status === 0) {
+        			alert('Failed to load json for configuration of timeline from server.\nPlease contact your portal administrator!');
+      			}
+      			else {
+        			alert('Failed to load json from server.');
+      			}
+    		}
+  	});
+}
+
+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='';
+								if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '"  onclick="handleSelectedWMS(\''+parentNode+'|wms_'+ mb_mapObj[i].wms[ii].wms_id+'\');" />';
+								if(metadatalink == 'true'){
+									controls+='<a class="metadata_link" href="'+defaultMetadataUrl + '&id='+temp.layer_uid+'"'+' target=\'_blank\' onclick="metadata_window = window.open(this.href,\'Metadata\',\'Width=700, Height=550,scrollbars=yes,menubar=yes,toolbar=yes\'); metadata_window.focus(); return false;"><img alt="'+msgObj.tooltipMetadata+'" title="'+msgObj.tooltipMetadata+'" src="'+imagedir+'/info.svg" /></a>';
+								}
+								addNode(parentNode,["wms_"+ mb_mapObj[i].wms[ii].wms_id,[temp.layer_currentTitle,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\",'+metadataWidth+','+metadataHeight+');'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_currentTitle,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,";
+									if(menu.indexOf("change_style")!=-1)c_menu+="menu_style,";
+									if(menu.indexOf("legend")!=-1)c_menu+="menu_legend";
+									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' ||temp.gui_layer_visible===1){
+										controls.push('checked ');
+									}
+									if(temp.gui_layer_selectable!='1')
+										controls.push('disabled ');
+									controls.push("onclick=\"local_handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);");
+									if(ficheckbox == 'false')
+										controls.push("local_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=\"local_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="'+defaultMetadataUrl + '&id='+temp.layer_uid+'"'+' target=\'_blank\' onclick="metadata_window = window.open(this.href,\'Metadata\',\'Width=700, Height=550,scrollbars=yes,menubar=yes,toolbar=yes\');metadata_window.focus(); return false;"><img alt="'+msgObj.tooltipMetadata+'" title="'+msgObj.tooltipMetadata+'" src="'+imagedir+'/info.svg" /></a>');
+									}
+									if(datalink == 'true' && mb_mapObj[i].wms[ii].objLayer[iii].layer_dataurl != ''){
+										controls.push('<a href="'+mb_mapObj[i].wms[ii].objLayer[iii].layer_dataurl+'"'+' target=\'_blank\' onclick="download_window = window.open(this.href,\'Download Data\',\'Width=450, Height=350,scrollbars=yes,menubar=yes,toolbar=yes\'); download_window.focus(); return false;"><img class="treegde2019" width="18" height="18" alt="'+msgObj.tooltipDownload+'" title="'+msgObj.tooltipDownload+'" src="'+imagedir+'/download.svg" /></a>');
+									//
+}
+//if (typeof mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling == 'undefined') {				
+//alert(mb_mapObj[i].wms[ii].objLayer[iii].layer_title+': '+JSON.stringify(mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling));
+//}
+									if(featuretypeCoupling == 'true' && mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling != ''){
+//alert(mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling);
+										//controls.push('<a href="'+mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling+'"'+' target=\'_blank\' onclick="featuretype_window = window.open(this.href,\'Featuretype Data\',\'Width=450, Height=350,scrollbars=yes,menubar=yes,toolbar=yes\'); featuretype_window.focus(); return false;"><img width="18" height="18" alt="'+msgObj.tooltipFeaturetypeCoupling+'" title="'+msgObj.tooltipFeaturetypeCoupling+'" src="'+imagedir+'/../gnome/accessories-dictionary.png" /></a>');
+										controls.push('<img width="18" height="18" coupling="'+btoa(mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling)+'" onclick="alert(atob(this.getAttribute(\'coupling\')))" alt="'+msgObj.tooltipFeaturetypeCoupling+'" title="'+msgObj.tooltipFeaturetypeCoupling+'" src="'+imagedir+'/../osgeo_graphics/geosilk/application_view_columns.png" />');
+										//controls.push('<img width="18" height="18" onclick="alert('+mb_mapObj[i].wms[ii].objLayer[iii].layer_featuretype_coupling+');" alt="'+msgObj.tooltipFeaturetypeCoupling+'" title="'+msgObj.tooltipFeaturetypeCoupling+'" src="'+imagedir+'/../osgeo_graphics/geosilk/application_view_columns.png" />');
+									}
+									//dimension buttons
+									if (activatedimension == 'true') {
+										timeDimensionAvailable = false;
+										timeDimensionIndex = false;
+										elevationDimensionAvailable = false;
+										elevationDimensionIndex = false;
+										//check for existence of time and/or elevation name attribute in dimension
+										for (dimensionIndex = 0; dimensionIndex < mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension.length; ++dimensionIndex) {
+											switch (mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension[dimensionIndex].name) {
+												case "time":
+													timeDimensionAvailable = true;
+													timeDimensionIndex = dimensionIndex;
+													timeUserValue = mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension[dimensionIndex].userValue;
+													break;
+												case "elevation":
+													elevationDimensionAvailable = true;
+													elevationDimensionIndex = dimensionIndex;
+													elevationUserValue = mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension[dimensionIndex].userValue;
+													break;
+											} 
+										}
+										if (timeDimensionAvailable === true) {
+											text = JSON.stringify(mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension[timeDimensionIndex]);
+											controls.push('<img onclick="openDimensionSelectHtml('+i+','+ii+','+iii+','+timeDimensionIndex+');" width="16" height="16" alt="'+msgObj.tooltipTimeDimension+'" title="Zeitpunkt wählen" style="cursor:pointer;margin:8px 5px -5px 0px" src="'+imagedir+'/clock.svg" />');	
+											if (timeUserValue !== undefined && timeUserValue !== false && timeUserValue !== "" && timeUserValue !== "undefined") {
+											controls.push('<b>'+timeUserValue+'</b>');
+											//set gui_wms_dimension_time to value of layer - only one layer of a wms should have the userValue defined - if more have this, the last one will overwrite all earlier!
+											mb_mapObj[i].wms[ii].gui_wms_dimension_time = timeUserValue;
+											}
+										}
+									}
+						
+									var groupedImageStyle ='';
+									if (temp.has_childs == true){
+										groupedImageStyle ='verticaldots.svg';
+									}
+									else{
+										groupedImageStyle ='verticaldots.svg';
+									}
+									addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_currentTitle,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\",'+metadataWidth+','+metadataHeight+');'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?groupedImageStyle:null),temp.layer_currentTitle,eval(c_menu),controls.join(""),[i,ii,iii]]],false,false,reverse=="true");
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	initialized=true;
+}
+
+//https://stackoverflow.com/questions/4253367/how-to-escape-a-json-string-containing-newline-characters-using-javascript
+// implement JSON stringify serialization
+JSON.stringify = JSON.stringify || function (obj) {
+    var t = typeof (obj);
+    if (t != "object" || obj === null) {
+        // simple data type
+        if (t == "string") obj = '"'+obj+'"';
+        return String(obj);
+    }
+    else {
+        // recurse array or object
+        var n, v, json = [], arr = (obj && obj.constructor == Array);
+        for (n in obj) {
+            v = obj[n]; t = typeof(v);
+            if (t == "string") v = '"'+v+'"';
+            else if (t == "object" && v !== null) v = JSON.stringify(v);
+            json.push((arr ? "" : '"' + n + '":') + String(v));
+        }
+        var rawString = (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
+       return rawString;
+    }
+};
+function escape (key, val) {
+    if (typeof(val)!="string") return val;
+
+    var replaced = encodeURIComponent(val);
+    return replaced;
+}
+
+JSON.stringifyEscaped = function(obj){
+    return JSON.stringify(obj,escape);
+}
+
+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]+"|wms_"+ mb_mapObj[i].wms[ii].wms_id);
+							}
+						}
+					}
+					else if(ii<= parseInt(openfolder, 10)+hidden)
+						hidden++;
+				}
+				closeAll();
+				var openFolderIndex = parseInt(openfolder, 10) + hidden;
+				if(treeState!='') {
+					setState(treeState);
+				}
+				else if(openfolder!=='false' && openFolderIndex < mb_mapObj[i].wms.length && openFolderIndex >= 0) {
+
+					setState(arrNodes[0][0]+"|wms_"+ mb_mapObj[i].wms[ openFolderIndex].wms_id);
+				}
+			}
+		}
+	}
+}

Added: trunk/mapbender/http/javascripts/jsTree2019.js
===================================================================
--- trunk/mapbender/http/javascripts/jsTree2019.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/jsTree2019.js	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,727 @@
+/***************************************************************
+# $Id: jsTree.js 6673 2010-08-02 13:52:19Z christoph $
+*  http://www.mapbender.org/index.php/Mod_treefolder2.php
+*
+*  Copyright notice
+*  (c) 2003-2004 Tobias Bender (tobias at phpXplorer.org)
+*  All rights reserved
+*
+*  This script is part of the jsTree project. The jsTree project 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 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt distributed with these scripts.
+*
+*  This script 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.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+var jst_cm
+var jst_cmT
+var jst_activeNode
+var jst_reload_strData = ""
+var jst_reload_ctlImage
+var jst_reload_halt = false
+var jst_any_expanded
+var jst_expandAll_int
+var jst_loaded = false
+var jst_state_paths = new Array()
+
+var jst_delimiter = ["|", "<|>"]
+var jst_id = "jsTree"
+var jst_container = "document.body"
+var jst_data = "arrNodes"
+var jst_expandAll_warning = "Expanding all nodes can take a while depending on your hardware! Continue?"
+var jst_target
+var jst_context_menu
+var jst_display_root = true
+var jst_highlight = true
+var jst_highlight_color = "white"
+var jst_highlight_bg = "navy"
+var jst_highlight_padding = "1px"
+var jst_image_folder = "./images"
+var jst_reloading = false
+var jst_reload_frame = "reLoader"
+var jst_reload_script = "tree_jsTree_reload.php"
+var jst_reloading_status = "loading tree nodes ..."
+
+function absTop(nd){
+	return nd.offsetParent ? nd.offsetTop + absTop(nd.offsetParent) : nd.offsetTop
+}
+
+function nodeClick(nd){
+	if(jst_highlight){
+		if(jst_activeNode){
+			jst_activeNode.style.color = ""
+			jst_activeNode.style.backgroundColor = ""
+			nd.style.padding = ""
+		}
+		nd.style.color = jst_highlight_color
+		nd.style.backgroundColor = jst_highlight_bg
+		nd.style.padding = jst_highlight_padding
+		jst_activeNode = nd
+	}
+//	if(childExists(nd.parentNode.parentNode))
+//		window.scrollTo(0, absTop(nd) - 5)
+}
+
+function _getDefinition(data, depth){
+
+	var d = new Array()
+
+	if(!data)
+		return ""
+
+	var sD = ""
+	for(var i = 0; i < depth; i++)
+		sD += '\t'
+
+	if(data != eval(jst_data))
+		d.push(",")
+
+	d.push("\n" + sD + "[")
+
+	var nodes = new Array()
+
+	for(var n1 in data){
+
+		var infos = new Array()
+
+		for(var i = 0; i < 5; i++)
+			infos.push(data[n1][1][i] ? "'" + data[n1][1][i].replace(/\n/g, '\\' + 'n') + "'" : null)
+
+		infos.push(null);
+		
+		if(data[n1][1][6]){
+			infos.push("'"+data[n1][1][6]+"'");
+//TODO checked and disabled state
+		}else{
+			infos.push(null);
+		}
+
+		for(var i = 6; i > 0; i--)
+			if(!infos[i]){
+				infos.pop()
+			}else{
+				break
+			}
+
+		nodes.push("\n" + sD + "\t['" + data[n1][0].replace(/\'/g, '\\' + "'") + "', [" + infos.join(",") + "]" + _getDefinition(data[n1][2], depth + 1) + "]")
+	}
+	
+	d.push(nodes.join(",") + "\n" + sD + "]")
+
+	return d.join("")
+}
+
+function getDefinition(){
+	return jst_data + "=" + _getDefinition(eval(jst_data), 0)
+}
+
+function getDomNode(path){
+	var parts = path.split(jst_delimiter[0]);
+	var tr = document.getElementById(parts[parts.length-1]);	
+	if(tr)
+		return tr;
+	var tBody = get1stTBody()
+	for(var p = 0; p < parts.length; p++){
+		for(var c = 0; c < tBody.childNodes.length; c++){
+			var tr = tBody.childNodes[c]
+			if(tr.id == parts[p]){
+				if(p == parts.length - 1){
+					return tr
+				}else{
+					if(!childExists(tr))
+						return null;
+					tBody = tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild
+
+					if(!tBody)
+						return null
+				}
+				break
+			}
+		}
+	}
+	return null
+}
+
+function delArrItem(a, p){
+	var b = a.slice(0, p)
+	var e = a.slice(p + 1)
+	return b.concat(e)
+}
+function addArrItem(a, p, v){
+	var b = a.slice(0, p)
+	var e=a.slice(p)
+	b[b.length] = v
+	return b.concat(e)
+}
+
+function _editDataNode(action, path, nd){
+	var ps = jst_data
+	var parts = path.split(jst_delimiter[0])
+
+	for(var p = 0; p < parts.length; p++){
+		var arrData = eval(ps)
+		
+	  for(var d = 0; d < arrData.length; d++)
+			if(parts[p] == arrData[d][0]){
+
+				if(p == parts.length - 1){
+
+					switch(action){
+						case "d":
+							if(ps != jst_data)
+								eval(ps + "=delArrItem(" + ps + "," + d + ")")
+						break;
+						case "a":
+							if(!eval(ps)[d][2])
+								eval(ps)[d].push(new Array())
+							eval(ps)[d][2].push(nd)
+						break;
+						case "u":
+							if(!eval(ps)[d][2])
+								eval(ps)[d].push(new Array())
+							eval(ps)[d][2].unshift(nd)
+						break;
+					}
+					return true
+					
+					
+				}else{
+					ps = ps + "[" + d + "][2]"
+				}
+				break
+
+			}
+	}
+	return false
+}
+
+function addNode(path, nd, sel, refresh, begining){
+	if(_editDataNode((begining?"u":"a"), path, nd)){
+		if(refresh){	
+			rebuildNode(path, true)
+			rebuildNode(path)
+		}
+
+		if(sel)
+			nodeClick(getDomNode(path + jst_delimiter[0] + nd[0]).childNodes[1].childNodes[1])
+	}
+}
+
+
+function deleteNode(path){
+	if(_editDataNode("d", path))
+		rebuildNode(path, true)
+}
+
+function _getState(tBody, path){
+	var hasSub = false
+	
+	for(var c = 0; tBody!=null  && c < tBody.childNodes.length; c++){
+		var tr = tBody.childNodes[c]
+		if(childExists(tr) && isExpanded(tr)){
+			_getState(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, path + (path != "" ? jst_delimiter[0] : "") + tr.id)
+			hasSub = true
+		}
+	}
+	if(!hasSub)
+		jst_state_paths.push(path)
+}
+
+function getState(){
+	jst_state_paths = new Array()
+	_getState(get1stTBody(), "")
+	return jst_state_paths.join(jst_delimiter[1])
+}
+
+function setState(data){
+	jst_state_paths = data.split(jst_delimiter[1])
+	for(var p in jst_state_paths){
+		var path="";
+		var pathElements = jst_state_paths[p].split(jst_delimiter[0]);
+		for(i in pathElements){
+			path += pathElements[i];
+			var tr = getDomNode(path)
+			
+			if(tr){
+				var f1 = tr.firstChild
+				if(f1){
+					var f2 = f1.firstChild
+					if(!isExpanded(tr) && f2)
+						if(f2.onclick)
+							f2.onclick()
+				}
+			}
+			path+=jst_delimiter[0];
+		}
+	}
+}
+
+function rebuildNode(path, parent){
+	if(parent){
+		var arrPath = path.split(jst_delimiter[0])
+		arrPath.pop()
+		path = arrPath.join(jst_delimiter[0])
+	}
+	
+	if(path.split(jst_delimiter[0]).length<=1){
+		renderTree()
+	}else{
+	
+		var nd = getDomNode(path)
+	
+		if(nd){
+			var nn = nd.nextSibling
+
+			if(nn){
+				var nCh = nn.childNodes[1].firstChild
+				if(nCh.nodeName == "TABLE")
+					nd.parentNode.parentNode.deleteRow(nn.rowIndex)
+			}
+			if(nd.firstChild.firstChild.onclick)
+				nd.firstChild.firstChild.onclick()
+		}
+	}
+}
+
+function setNodeColor(path, color){
+	var nd = getDomNode(path)
+	if(nd){
+		nd.childNodes[1].childNodes[nd.childNodes[1].childNodes.length-1].style.color=color;
+	}
+}
+
+function setNodeImage(path, Img){
+	var ps = jst_data;
+	var parts = path.split(jst_delimiter[0])
+	var arrData = null;
+
+	var nd = getDomNode(path);
+	if(nd){
+		var cb = nd.childNodes[1].childNodes[0];
+		if(cb && cb.nodeName=="IMG"){
+			if(Img)
+				cb.src=jst_image_folder+"/"+Img;
+			else if(childExists(nd)){
+				var s = nd.nextSibling.style
+				if(s.display == ""){
+					cb.src = jst_image_folder + "/verticaldots.svg";
+				}else{
+					cb.src = jst_image_folder + "/verticaldots.svg";
+				}
+			}
+		}
+	}
+	return true
+}
+
+function selectNode(path){
+	var nd = getDomNode(path)
+	if(nd){
+		nodeClick(nd.childNodes[1].childNodes[nd.childNodes[1].childNodes.length-1])
+		return true
+	}else{
+		return false
+	}
+}
+
+function IsChecked(path, ctrlNr){
+	var nd = getDomNode(path)
+	if(nd){
+		var fc = nd.childNodes[1].firstChild;
+		if(fc && fc.nodeName=="IMG")ctrlNr++;
+		var cb = nd.childNodes[1].childNodes[ctrlNr];
+		if(cb && cb.nodeName=="INPUT"){
+			return cb.checked;
+		}
+	}
+	return false;
+}
+
+//getChildrenCheckState returns:
+//	1:if each child with checkbox ctrlNr is checked
+//	0:if none is checked
+// -1:if states are different or ctrlNr is no checkbox or any other error
+function getChildrenCheckState(path, ctrlNr){
+	var state = -1;
+	var plus=0;
+	var nd = getDomNode(path);
+
+	if(!nd)return -1;
+	if(!childExists(nd))return -1;
+	var tBody = nd.nextSibling.childNodes[1].firstChild.firstChild;
+	if(!tBody)return -1;
+	for(var i = 0;i < tBody.childNodes.length; i++){
+		var fc = tBody.childNodes[i].childNodes[1].firstChild;
+		plus=0;
+		if(fc && fc.nodeName=="IMG")plus++;
+		var cb = tBody.childNodes[i].childNodes[1].childNodes[ctrlNr+plus];
+		if(cb && cb.nodeName=="INPUT"){
+			if(state == -1) 
+				state = cb.checked?1:0;
+			else{
+				if(state != cb.checked?1:0)
+					return -1;
+			}
+			
+		}		
+	}
+	return state;
+}
+
+function checkChildren(path, ctrlNr, bChk){
+	var nd = getDomNode(path);
+	var plus;
+	
+	if(!nd)return false;
+	if(!childExists(nd))return false;
+	var tBody = nd.nextSibling.childNodes[1].firstChild.firstChild;
+	if(!tBody)return false;
+	for(var i = 0;i < tBody.childNodes.length; i++){
+		var fc = tBody.childNodes[i].childNodes[1].firstChild;
+		plus=0;
+		if(fc && fc.nodeName=="IMG")plus++;
+		var cb = tBody.childNodes[i].childNodes[1].childNodes[ctrlNr+plus];
+		if(cb && cb.nodeName=="INPUT"&&!cb.disabled){
+			cb.checked = bChk;	
+			if(cb.onclick){cb.onclick();}
+		}		
+	}
+	return true;
+}
+
+function checkNode(path, ctrlNr, bChk, triggerOnclick){
+	var nd = getDomNode(path)
+	if(typeof(triggerOnclick)=='undefined')
+		triggerOnclick = true;
+	if(nd){
+		var fc = nd.childNodes[1].firstChild;
+		if(fc && fc.nodeName=="IMG")ctrlNr++;
+		var cb = nd.childNodes[1].childNodes[ctrlNr];
+		if(cb && cb.nodeName=="INPUT"){
+			cb.checked = bChk;
+			if(cb.onclick&&triggerOnclick)cb.onclick();
+			return true;
+		}
+	}
+	return false;
+}
+
+function enableCheckbox(path, ctrlNr, pEnabled){
+	var nd = getDomNode(path)
+	if(nd){
+		var fc = nd.childNodes[1].firstChild;
+		if(fc && fc.nodeName=="IMG")ctrlNr++;
+		var cb = nd.childNodes[1].childNodes[ctrlNr];
+		if(cb && cb.nodeName=="INPUT"){
+			cb.disabled = !pEnabled;
+			return true;
+		}
+	}
+	return false;	
+}
+
+
+
+function get1stTBody(){
+	return eval(jst_container).firstChild.firstChild.childNodes[1].childNodes[1].firstChild.firstChild
+}
+
+function __switchAll(tBody, expand){
+	if(!tBody)
+		return false
+
+	for(var c = 0; c < tBody.childNodes.length; c++){
+		var tr = tBody.childNodes[c]
+		var img = tr.firstChild.firstChild
+
+		if(img)
+			if(img.onclick){
+				if((expand && !childExists(tr)) || ((expand && !isExpanded(tr)) || (!expand && isExpanded(tr)))){
+					if(img.id != "rootImage")
+						img.onclick()
+						
+					jst_any_expanded = true
+				}
+				
+				if(tBody.childNodes[c + 1])
+					__switchAll(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, expand)
+			}
+	}
+}
+
+function _switchAll(expand){
+	if(jst_reload_halt)
+		return
+
+	__switchAll(get1stTBody(), expand)
+	
+	if(jst_reloading){
+		if(!jst_any_expanded)
+			cancelExpandAll()
+
+		jst_any_expanded = null
+	}
+}
+
+function expandAll(){
+	if(jst_expandAll_warning ? confirm(jst_expandAll_warning) : true)	
+		if(jst_reloading){
+			jst_expandAll_int = window.setInterval("if(!jst_reload_halt)_switchAll(true)", 100)
+		}else{
+			_switchAll(true)
+		}
+}
+
+function cancelExpandAll(){
+	if(jst_expandAll_int)
+		window.clearInterval(jst_expandAll_int)
+}
+
+function closeAll(){
+	_switchAll(false)
+}
+
+function isExpanded(tr){
+	return childExists(tr) ? tr.nextSibling.style.display != "none" : false
+}
+
+function childExists(tr){
+	var n = tr.nextSibling;
+	if(!n||n.childNodes.length<2)return false;
+	n=n.childNodes[1].firstChild;
+	if(!n)return false;
+	return n.nodeName == "TABLE";
+}
+
+function getPath(strData){
+	if(strData.indexOf("[") > 0){
+		
+		var sub3 = strData.substr(0, strData.lastIndexOf("["))
+		var sub6 = sub3.substr(0, sub3.lastIndexOf("["))
+		
+		return (getPath(sub6) != "" ? getPath(sub6) + jst_delimiter[0] : "") + eval(sub3 + "[0]")
+	}else{
+		return ""
+	}
+}
+
+function reloadCallback(){
+
+	eval(jst_reload_strData + "=window.frames['" + jst_reload_frame + "']." + jst_data)
+	
+	renderNode(jst_reload_strData, jst_reload_ctlImage, null, true)
+	
+	window.status = ""
+	
+	jst_reload_halt = false
+	jst_reload_strData = ""
+	jst_reload_ctlImage = null
+}
+
+function renderNode(strData, ctlImg, event, reload){
+
+	if(event)
+		event.cancelBubble = true
+
+	if(jst_reload_halt && !reload)
+		return
+
+	jst_loaded = false
+
+	if(jst_reloading && !reload && eval(strData).length == 0){
+		jst_reload_strData = strData
+		jst_reload_ctlImage = ctlImg
+		jst_reload_halt = true
+		if(jst_reloading_status)
+			window.status = jst_reloading_status
+
+		window.frames[jst_reload_frame].document.location.href = "./" + jst_reload_script + (jst_reload_script.indexOf("?") > -1 ? "&" : "?") + "path=" + getPath(strData)
+		return
+	}
+
+	var tr = ctlImg.parentNode.parentNode
+
+	if(ctlImg.id != "rootFolder"){
+		var fldImg = tr.childNodes[1].firstChild
+
+		if(childExists(tr)){
+			var s = tr.nextSibling.style
+			var img1 = jst_image_folder + "/" + (tr.nextSibling.nextSibling ? "" : "")
+
+			if(s.display == ""){
+				s.display = "none"
+				ctlImg.src = img1 + "roundplus.svg"
+				if(String(fldImg.src).indexOf("expanded")!=-1)
+					fldImg.src = jst_image_folder + "/verticaldots.svg";
+			}else{
+				s.display = ""
+				ctlImg.src = img1 + "roundminus.svg"
+				if(String(fldImg.src).indexOf("closed")!=-1)
+					fldImg.src = jst_image_folder + "/verticaldots.svg";
+			}
+			return
+		}else{
+			ctlImg.src = jst_image_folder + "/" + (tr.nextSibling ? "" : "") + "roundplus.svg"
+			if(eval(strData.substr(0, strData.length-3)+"[1][3]"))
+				fldImg.src = jst_image_folder + "/" + eval(strData.substr(0, strData.length-3)+"[1][3]");
+			else
+				fldImg.src = jst_image_folder + "/verticaldots.svg";
+		}
+	}
+
+	var newTr = tr.parentNode.insertRow((tr.rowIndex?tr.rowIndex:0) + 1)
+
+	if(ctlImg.id != "rootFolder"){
+		newTr.style.display = "none";
+	}
+
+	newTr.appendChild(document.createElement('td'))
+	newTr.appendChild(document.createElement('td'))
+		
+	if(newTr.nextSibling)
+		newTr.firstChild.setAttribute("background", jst_image_folder + "/branch_empty.png", "false")
+	
+	newTr.childNodes[1].innerHTML = renderChildren(strData)
+	
+	var nodes = eval(strData)
+
+	var ndWithChildren = 0;
+	for(var n in nodes){
+		var n0 = nodes[n]
+		var n1 = n0[2]
+
+		if(n1){
+			renderNode(strData + "[" + n + "][2]" ,newTr.childNodes[1].firstChild.firstChild.childNodes[parseInt(n)+ndWithChildren].firstChild.firstChild);
+			ndWithChildren++;
+		}
+	}
+	
+	jst_loaded = true
+}
+
+function renderChildren(strData, tblCls, menu){
+
+	var code = Array()
+
+	code.push('<table style="border-collapse:collapse;" cellspacing="0" cellpadding="0" border="0" class="' + tblCls + '">')
+	
+	var nodes = eval(strData)
+
+	for(var n in nodes){
+		var n0 = nodes[n]
+		var n1 = n0[2]
+
+		code.push('<tr class="treeGDE3_tr" id="' + n0[0] + '"><td><img' + (strData == jst_data ? ' style="display:none" id="rootImage"' : '') + ' src="' + jst_image_folder + '/')
+
+		if(n1){
+			code.push((n == nodes.length - 1 ? "last_closed" : "closed") + '.png" onClick="renderNode(' + "'" + strData + "[" + n + "][2]" + "'" + ',this,event)" class="action"')
+		}else{
+			code.push((n == nodes.length - 1 ? "branch_empty" : "branch_empty") + '.png"')
+		}
+		
+		if(jst_context_menu && !n0[1][5] && !menu)
+			n0[1][5] = jst_context_menu
+	
+		code.push(
+			' alt=""></td><td nowrap>'+
+			((n1||n0[1][3]) ? 
+				'<img'  + (
+					((strData == jst_data)&&!jst_display_root) ? 
+						' style="display:none"' : ''
+					) +  
+				(n0[1][5] ? 
+					' class="action" title="Optionen" onClick="showMenu(\'' + 
+					strData + '[' + n + ']\', this, event)"' : ''
+				) + 
+				' src="' + jst_image_folder + '/' + 
+				(n1 ? 
+					(n0[1][3]?
+						n0[1][3]:"verticaldots.svg"
+					) : n0[1][3] ? 
+						n0[1][3] : "node.png"
+				) + '" alt="">':''
+			)+
+			(
+				(n0[1][6] && ((strData != jst_data)||jst_display_root)) ?
+					n0[1][6]:''
+			) + 
+			(typeof n0[0] === "string" && n0[0].match(/folder_/) ? '<span class="node"' : '<a class="node"')  + 
+//			'<a class="node"'  + 
+			(
+				((strData == jst_data)&&!jst_display_root) ? 
+					' style="display:none"' : ''
+			)+ 
+			(n0[1][4] ? 
+				' title="' + n0[1][4] + '"' : ''
+			) + 
+			(typeof n0[0] === "string" && n0[0].match(/folder_/) ? ' ' : ' onClick="nodeClick(this)" ')  + 			
+			'href=' + "'" + 
+			(menu ? 
+				String(n0[1][1]).replace(/{@strData}/g, strData) : n0[1][1] 
+			) + "'" + 
+			(n0[1][2] ? 
+				' target="' + n0[1][2] + '"' : jst_target ? 
+					' target="' + jst_target + '"' : ''
+			) + '>' + n0[1][0]  + 
+			(typeof n0[0] === "string" && n0[0].match(/folder_/) ? '</span>' : '</a>') + 
+//			'</a>' + 
+			'</td></tr>'
+		);
+	}
+	code.push('</table>')
+	
+	
+	return code.join("")
+}
+
+function showMenu(strData, img, event){
+	var o = window.pageYOffset
+	var offY = o ? o : document.body.scrollTop
+	var offX = o ? window.pageXOffset : document.body.scrollLeft
+	
+	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, 10);
+		offY -= parseInt(treeGDE.style.top, 10);
+		if(treeGDE.scrollTop)
+			offY += treeGDE.scrollTop;
+		if(treeGDE.scrollLeft)
+			offX += treeGDE.scrollLeft;
+	}
+	
+	jst_cm.style.top = (offY + event.clientY) + "px";
+	jst_cm.style.left = (offX + event.clientX) + "px";
+	jst_cm.style.visibility = ""
+	
+	event.cancelBubble = true
+}
+
+function hideMenu(){
+	jst_cm.style.visibility = "hidden"
+}
+
+function renderTree(){
+//	TestDate = new Date();TestStartZeit=TestDate.getTime();
+	eval(jst_container).innerHTML = '<table cellspacing="0" cellpadding="0" border="0"><tr id="'+eval(jst_data + "[0][0]")+'"><td colspan="2"><span id="rootFolder"></span></td></tr></table><div /*style="position:absolute;top:-100;left:-100"*/ id="contextMenu"></div>'
+	renderNode(jst_data, document.getElementById("rootFolder"))
+	renderNode(jst_data + "[0][2]", document.getElementById("rootImage"))
+	
+	jst_cm = document.getElementById("contextMenu")
+	document.body.onclick = hideMenu
+	jst_loaded = true
+//	TestDate=new Date();TestStopZeit=TestDate.getTime();alert(TestStopZeit-TestStartZeit);
+}

Added: trunk/mapbender/http/javascripts/mod_scalebar_test.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_scalebar_test.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_scalebar_test.js	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,152 @@
+/**
+ * Package: scalebar
+ *
+ * Description:
+ * Displays scalebar in the map. The position currently is hard coded to the 
+ * lower left corner of the map frame. 
+ * 
+ * Files:
+ *  - http/javascripts/mod_scalebar.php
+ *
+ * SQL:
+ * > INSERT INTO gui_element (fkey_gui_id, e_id, e_pos, e_public, e_comment, 
+ * > e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, 
+ * > e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, 
+ * > e_mb_mod, e_target, e_requires, e_url) VALUES ('<gui_id>','scalebar',
+ * > 2,1,'scalebar','Scalebar','div','','',0,0,0,0,0,'','','div',
+ * > 'mod_scalebar.php','','mapframe1','','');
+ *
+ * Help:
+ * http://www.mapbender.org/Scalebar
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Christoph_Baudson
+ * 
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License 
+ * and Simplified BSD license.  
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+
+var mod_scalebar_target = options.target;
+
+var mod_scalebar_left = 5;
+var mod_scalebar_bottom = 17;
+
+var mod_scalebar_color1 = "white";
+var mod_scalebar_color2 = "black";
+var mod_scalebar_font = "Arial, Helvetica, sans-serif";
+var mod_scalebar_fontsize = "9px";
+
+eventAfterMapRequest.register(function () {
+	mod_scalebar();
+});
+
+var mod_scalebar = function () {
+	var scale = Mapbender.modules[mod_scalebar_target].getScale();
+	var ind = getMapObjIndexByName(mod_scalebar_target);
+	if(scale < 10){
+		var unit = '10 cm';
+		var factor = 10/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale >= 10 && scale < 100){
+		var unit = '1 m';
+		var factor = 100/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale < 1000 && scale >= 100){
+		var unit = '10 m';
+		var factor = 1000/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale < 10000 && scale >= 1000){
+		var unit = '100 m';
+		var factor = 10000/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale < 100000 && scale >= 10000){
+		var unit = '1 km';
+		var factor = 100000/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale < 1000000 && scale >= 100000){
+		var unit = '10 km';
+		var factor = 1000000/scale;
+	var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale < 10000000 && scale >= 1000000){
+		var unit = '100 km';
+		var factor = 10000000/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale < 100000000 && scale >= 10000000){
+		var unit = '1000 km';
+		var factor = 100000000/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	if(scale >= 100000000){
+		var unit = '1000 km';
+		var factor = 100000000/scale;
+		var img_width = Math.round(factor * mb_resolution);
+	}
+	var scalebarTag = "<img src='../img/scalebar_bw.gif' width='"+ img_width  +"' height='6'>  ";
+	scalebarTag += "<div style='position:absolute;left:"+(img_width + 4)+"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 + 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>";
+	scalebarTag += "<div id='actualscale' style='position:absolute;left:"+(img_width + 40)+"px;top:6px;color:"+mod_scalebar_color2+";font-family:"+mod_scalebar_font+";font-size:"+mod_scalebar_fontsize+";'>Maßstab: 1 : " + scale + "</div>";
+
+	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 = "100%";*/
+		el_top.style.overflow = "hidden";
+		el_top.style.zIndex = "100";
+		el_top.style.paddingRight = "137px";
+		el_top.style.paddingBottom = "40px";
+		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);
+
+}
+var $selectScale = $(this);
+
+var SelectScaleApi = function () {
+        var that = this;
+
+        this.set = function (scale) {
+        // IE call this with empty scale for some convoluted reason
+        if(!scale){ return; }
+        options.$target.mapbender().repaintScale(null,null,scale);
+        };
+
+        var init = function () {
+                $selectScale.change(function () {
+                        that.set(this.value);
+                });
+
+                Mapbender.events.init.register(function () {
+                        options.$target.mapbender(function () {
+                                var map = this;
+                                map.events.afterMapRequest.register(function () {
+                                        var scale = map.getScale();
+                                        $selectScale.html("1 : " + scale);
+
+                                });
+                        });
+                });
+        };
+        init();
+};
+
+$selectScale.mapbender(new SelectScaleApi());
+
+

Added: trunk/mapbender/http/plugins/mb_print_woKml_woOv.php
===================================================================
--- trunk/mapbender/http/plugins/mb_print_woKml_woOv.php	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_print_woKml_woOv.php	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,916 @@
+/**
+ * Package: printPDF
+ *
+ * Description:
+ * Mapbender print PDF with PDF templates module.
+ * 
+ * Files:
+ *  - http/plugins/mb_print.php
+ *  - http/print/classes
+ *  - http/print/printFactory.php
+ *  - http/print/printPDF_download.php
+ *  - lib/printbox.js
+ *
+ * SQL:
+ * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, 
+ * > e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, 
+ * > e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, 
+ * > e_mb_mod, e_target, e_requires, e_url) VALUES('<appId>','printPDF',
+ * > 2,1,'pdf print','Print','div','','',1,1,2,2,5,'',
+ * > '<div id="printPDF_working_bg"></div><div id="printPDF_working"><img src="../img/indicator_wheel.gif" style="padding:10px 0 0 10px">Generating PDF</div><div id="printPDF_input"><form id="printPDF_form" action="../print/printFactory.php"><div id="printPDF_selector"></div><div class="print_option"><input type="hidden" id="map_url" name="map_url" value=""/><input type="hidden" id="legend_url" name="legend_url" value=""/><input type="hidden" id="overview_url" name="overview_url" value=""/><input type="hidden" id="map_scale" name="map_scale" value=""/><input type="hidden" name="measured_x_values" /><input type="hidden" name="measured_y_values" /><input type="hidden" name="map_svg_kml" /><input type="hidden" name="svg_extent" /><input type="hidden" name="map_svg_measures" /><br /></div><div class="print_option" id="printPDF_formsubmit"><input id="submit" type="submit" value="Print"><br /></div></form><div id="printPDF_result"></div></div>',
+ * > 'div','../plugins/mb_print.php',
+ * > '../../lib/printbox.js,../extensions/jquery-ui-1.7.2.custom/development-bundle/external/bgiframe/jquery.bgiframe.js,../extensions/jquery.form.min.js',
+ * > 'mapframe1','','http://www.mapbender.org/index.php/Print');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, 
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF', 
+ * > 'mbPrintConfig', '{"Standard": "mapbender_template.json"}', '' ,'var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'unlink', 'true', 'delete print pngs after pdf creation' ,'php_var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'logRequests', 'false', 'log wms requests for debugging' ,'php_var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'logType', 'file', 'log mode can be set to file or db' ,'php_var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'timeout', '90000', 'define maximum milliseconds to wait for print request finished' ,'var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'body',
+ * > 'print_css', '../css/print_div.css', '' ,'file/css');
+* >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'legendColumns', '2', 'define number of columns on legendpage' ,'php_var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'printLegend', 'true', 'define whether the legend should be printed or not' ,'php_var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'secureProtocol', 'true', 'define if https should be used even if the server don''t
+ * > know anything about the requested protocol' ,'php_var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
+ * > 'reverseLegend', 'true', 'Define if order of legend should be reversed' ,'var');
+ * 
+ * Help:
+ * http://www.mapbender.org/PrintPDF_with_template
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Michael_Schulz
+ * http://www.mapbender.org/User:Christoph_Baudson
+ * 
+ * Parameters:
+ * mbPrintConfig      - *[optional]* object with name and filename of template,
+ * 							like 	{
+ * 										"Standard": "a_template.json",
+ * 										"Different": "another_template.json"
+ * 									}
+ *
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License 
+ * and Simplified BSD license.  
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+
+var myTarget = options.target ? options.target[0] : "mapframe1";
+var myId = options ? options.id : "printPDF";
+
+var mbPrintConfig = options.mbPrintConfig;
+
+/* the array of json print config files */
+
+if (typeof mbPrintConfig === "object") {
+	mbPrintConfigFilenames = [];
+	mbPrintConfigTitles = [];
+	for (var i in mbPrintConfig) {
+		mbPrintConfigFilenames.push(mbPrintConfig[i]);
+		mbPrintConfigTitles.push(i);
+	}
+}
+if (typeof mbPrintConfigFilenames === "undefined") {
+	mbPrintConfigFilenames = ["mapbender_template.json"];
+}
+
+if (typeof mbPrintConfigTitles === "undefined") {
+	mbPrintConfigTitles = ["Default"];
+}
+
+
+var mbPrintConfigPath = "../print/";
+
+
+/* ------------- printbox addition ------------- */
+
+var PrintPDF = function (options) {
+
+	var that = this;
+	
+	/**
+ 	 * Property: actualConfig
+	 * 
+	 * object, holds the actual configuration after loading the json file
+	 */
+	var actualConfig;
+
+	/**
+ 	 * constructor
+	 */
+	eventInit.register(function () {
+		mod_printPDF_init();
+	});
+	
+	/**
+ 	 * Property: printBox
+	 * 
+	 * the movable printframe
+	 */	
+	var printBox = null;
+	
+	eventAfterMapRequest.register(function () {
+		if (printBox !== null) {
+			printBox.repaint();
+			
+			if(!printBox.isVisible()) {
+				//$("#printboxScale").val("");
+           		//$("#printboxCoordinates").val("");
+           		//$("#printboxAngle").val("");
+           		
+           		$("#printPDF_form #scale").val("");
+				$("#printPDF_form #coordinates").val("");
+				$("#printPDF_form #angle").val("");
+			}
+		}
+	});
+	/**
+ 	 * Method: createPrintBox
+	 * 
+	 * creates a printBox in the current view, calculates the scale 
+	 * (tbd. if not set from the config) so that the printbox fits in the mapframe.
+	 * Width and height are taken from the configuration.
+	 */
+	this.createPrintBox = function () {
+		size = "A4";
+		//document.form1.size.value = size;
+		format = "portrait";
+		var w, h;
+		//validate();
+		var map = getMapObjByName(myTarget);
+		var map_el = map.getDomElement();
+		var jqForm = $("#"+myId+"_form");
+		var $scaleInput = $("#scale");
+
+		if (printBox !== null) {
+        	destroyPrintBox();
+			jqForm[0].scale.value = "";
+			jqForm[0].coordinates.value = "";
+			jqForm[0].angle.value = "";
+		}
+		else {
+        	printBox = new Mapbender.PrintBox({
+				target : myTarget,
+				printWidth : getPDFMapSize("width")/10,
+				printHeight : getPDFMapSize("height")/10,
+				scale : $scaleInput.size() > 0 && !isNaN(parseInt($scaleInput.val(), 10)) ? 
+					parseInt($scaleInput.val(), 10) : 
+					Math.pow(10, Math.floor(Math.log(map.getScale())/Math.LN10)),
+				afterChangeAngle : function (obj) {
+					if (typeof(obj) == "object") {
+						if (typeof(obj.angle) == "number") {
+                            if(typeof(jqForm[0].angle) != "undefined") {
+								jqForm[0].angle.value = obj.angle;
+	                        }
+						}
+						if (obj.coordinates) {
+                           	if(typeof(jqForm[0].coordinates) != "undefined") {
+								jqForm[0].coordinates.value = String(obj.coordinates);
+                            }
+						}
+					}
+				},
+				afterChangeSize : function (obj) {
+					if (typeof(obj) == "object") {
+						if (obj.scale) {
+    						if($("#scale").is("input")) {
+    							jqForm[0].scale.value = parseInt(obj.scale, 10);
+    						}
+    						else {
+    							//$("#scale .addedScale").remove();
+    							//$("#scale").append("<option selected class='addedScale' value='"+parseInt(obj.scale / 10, 10) * 10+"'>1 : " + parseInt(obj.scale / 10, 10) * 10 + "</option>");
+    							
+    							var currentScale = parseInt($("#scale").val(), 10);
+    							var objScale = parseInt(obj.scale / 10, 10) * 10;
+			    				
+			    				if(obj.scale != currentScale) {
+			    					var scaleOptions = [];
+	 								$("#scale option").each( function() {
+										scaleOptions.push(parseInt(this.value, 10));
+	 								});
+	 								
+	 								var closest = getClosestNum(objScale,scaleOptions);
+			    					$("#scale option[value='"+closest+"']").attr('selected', 'selected');
+			    					if(printBox) {
+			    						if(objScale != closest) {
+			    							printBox.setScale(closest);
+			    						}	
+			    					}
+			    				}
+			    				
+		    					
+			    			}
+						}
+						if (obj.coordinates) {
+	                        if(typeof(jqForm[0].coordinates) != "undefined") {
+								jqForm[0].coordinates.value = String(obj.coordinates);
+                            }
+						}
+					}
+				}
+			});
+			printBox.paintPoints();
+			printBox.paintBox();
+			printBox.show();
+		}
+	};
+	
+	function getClosestNum(num, ar) {
+	    var i = 0, closest, closestDiff, currentDiff;
+	    if(ar.length)
+	    {
+	        closest = ar[0];
+	        for(i;i<ar.length;i++)
+	        {           
+	            closestDiff = Math.abs(num - closest);
+	            currentDiff = Math.abs(num - ar[i]);
+	            if(currentDiff < closestDiff)
+	            {
+	                closest = ar[i];
+	            }
+	            closestDiff = null;
+	            currentDiff = null;
+	        }
+	        //returns first element that is closest to number
+	        return closest;
+	    }
+	    //no length
+	    return false;
+	}
+
+	/**
+ 	 * Method: getPDFMapSize
+	 * 
+	 * checks the actual config for the size w/h values.
+	 *
+	 * Parameters:
+	 * key      - string, the key which value to retrieve (currently width or height)
+	 */	
+	var getPDFMapSize = function (key) {
+		for (var page in actualConfig.pages) {
+			for (var pageElement in actualConfig.pages[page].elements) {
+				if (actualConfig.pages[page].elements[pageElement].type == "map") {
+					return actualConfig.pages[page].elements[pageElement][key];
+				}
+			}
+		} 
+	};
+
+	/**
+ 	 * Method: destroyPrintBox
+	 * 
+	 * removes an existing printBox.
+	 */	
+	var destroyPrintBox = function () {
+		if (printBox) {
+			printBox.destroy();
+            printBox = null;
+            $("#printboxScale").val("");
+           	$("#printboxCoordinates").val("");
+           	$("#printboxAngle").val("");
+		}
+	};
+	
+	/**
+	 * Change status of printbox
+	 *
+	 * @param {String} newStatus either "hide or "show"
+	 */
+	var showHidePrintBox = function (newStatus) {
+		if (newStatus=="hide") {
+	    	printBox.hide();
+		}
+	    else {
+	    	printBox.show();	
+		}
+	};
+	
+	/**
+ 	 * Method: mod_printPDF_init
+	 * 
+	 * initializes the print modules, generates template chooser and loads first configuration.
+	 */	
+	var mod_printPDF_init = function () {
+		/* first we'd need to build the configuration selection */
+		buildConfigSelector();	
+		/* second we'd need to read the json configuration */
+		that.loadConfig(mbPrintConfigFilenames[0]);
+		/* than we need the translation of the print button */
+		$("#submit").val("<?php echo htmlentities(_mb("print"), ENT_QUOTES, "UTF-8");?>");
+
+                //show printBox for first entry in printTemplate selectbox
+                $("."+myId+"-dialog").bind("dialogopen", function () {
+                    printObj.createPrintBox();
+                });
+
+                //destroy printBox if printDialog is closed
+                $("."+myId+"-dialog").bind("dialogclose", function () {
+                    destroyPrintBox();
+                });
+	};
+
+	/**
+ 	 * Method: loadConfig
+	 * 
+	 * GETs the config, build corresponding form, remove an existing printBox
+	 */		
+	this.loadConfig = function (configFilename, callback) {
+        	// the dataType to $.get is given explicitely, because there were instances of Mapbender that were returning 
+		// either json or a string, which trips up $.parseJSON which was being used in the callback
+		$.get(mbPrintConfigPath + configFilename, function(json, status){
+		    actualConfig = json;
+		    buildForm(); 
+		    hookForm();
+			if (typeof callback === "function") {
+				printBox = null;
+                                callback();
+                        }
+		},"json");
+		destroyPrintBox();
+                
+	};
+
+	/**
+ 	 * Method: hookForm
+	 * 
+	 * utility method to connect the form plugin to the print form.
+	 */	
+	var hookForm = function () {
+		var o = {
+	   		url:			'../print/printFactory.php?e_id='+myId,
+	   		type:			'post',
+	   		dataType:		'json',
+	   		beforeSubmit: 	validate,
+	   		success:    	showResult,
+                        timeout:        options.timeout ? options.timeout : 90000,
+                        error:          function() {
+                                showHideWorking("hide");
+                                alert("An error occured or timeout of " + Math.round(options.timeout/1000) + " seconds reached. Print was aborted.");
+                        }
+		};
+		$("#"+myId+"_form").ajaxForm(o);
+	};
+	
+	/**
+	 * Change status of the working elements. These should begin with "$myId_working" 
+	 *
+	 * @param {String} newStatus either "hide or "show"
+	 */
+	var showHideWorking = function (newStatus) {
+		if (newStatus=="hide") {
+	    	$("[id^='"+myId+"_working']").hide();
+		}
+	    else {
+	    	$("[id^='"+myId+"_working']").show();	
+		}
+	};
+	
+	/**
+	 * update form values helper function
+	 *
+	 */
+	var updateFormField = function (formData, key, value) {
+		for(var j=0; j < formData.length; j++){
+			if (formData[j].name == key) {
+				formData[j].value = value;
+				break;
+			}
+		}	
+	};
+
+	var getCurrentResolution = function (type) {
+
+		// default resolution is 72 dpi
+		var dpi = 72;
+
+		// set resolution according to map configuration in template
+		for (var i in actualConfig.pages) {
+			var page = actualConfig.pages[i];
+			for (var j in page.elements) {
+				var el = page.elements[j];
+				if (type === el.type && typeof el.res_dpi === "number") {
+					dpi = el.res_dpi;
+				}
+			}
+		}
+		// set resolution according to resolution select box (if present)
+
+		// check if hq print is requested
+		var resolutionControl = null;
+		for (var i in actualConfig.controls) {
+			var c = actualConfig.controls[i];
+			try {
+				for (var j in c.pageElementsLink) {
+					if (c.pageElementsLink[j] === "res_dpi") {
+						resolutionControl = typeof c.id === "string" &&
+							c.id.length > 0 ? $("#" + c.id) : null;
+					}
+				}
+			}
+			catch (e) {
+			}
+		}
+		if (resolutionControl !== null && resolutionControl.size() === 1) {
+			dpi = resolutionControl.val();
+		}
+		return parseInt(dpi, 10);
+	};
+
+	var replaceMapFileForHighQualityPrint = function (currentMapUrl, type) {
+		var dpi = getCurrentResolution(type);
+		// replace map file with hq map file (if configured)
+		var hqmapfiles = $.isArray(options.highqualitymapfiles) ?
+			options.highqualitymapfiles : [];
+		for (var i = 0; i < hqmapfiles.length; i++) {
+			var exp = new RegExp(hqmapfiles[i].pattern);
+			if (hqmapfiles[i].pattern && typeof currentMapUrl === "string" && currentMapUrl.match(exp)) {
+				// check if mapping in current resolution exists
+				var resolutions = hqmapfiles[i].replacement;
+				var resolutionExists = false;
+				for (var r in resolutions) {
+					if (parseInt(r, 10) === dpi) {
+						resolutionExists = true;
+					}
+				}
+				if (resolutionExists) {
+					// replace with hqmapfile
+					var hqmapfile = resolutions[dpi];
+					currentMapUrl = currentMapUrl.replace(exp, hqmapfile);
+				}
+			}
+		}
+		return currentMapUrl;
+	};
+
+	/**
+	 * Validates and updates form data values.
+	 * Adds the elements before the submit button.
+	 *
+	 * @see jquery.forms#beforeSubmitHandler
+	 */
+	var validate = function (formData, jqForm, params) {
+		showHideWorking("show");
+		
+		// map urls
+		var ind = getMapObjIndexByName(myTarget);
+		var f = jqForm[0];
+		f.map_url.value = '';
+        f.opacity.value = "";
+		
+		var scale = f.scale.value || mb_mapObj[ind].getScale();
+		scale = parseInt(scale, 10);
+		
+		var legendUrlArray = [];
+		var legendUrlArrayReverse = [];
+		f.overview_url.value = '';
+		
+		if(options.reverseLegend == 'true') {
+			for(var i=mb_mapObj[ind].wms.length-1; i>=0; i--){
+				var currentWms = mb_mapObj[ind].wms[i];
+				if(mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+					if (mb_mapObj[ind].wms[i].mapURL != false && mb_mapObj[ind].wms[i].mapURL != 'false' && mb_mapObj[ind].wms[i].mapURL != ''){   
+						var wmsLegendObj = [];
+						
+						var layers = currentWms.getLayers(mb_mapObj[ind], scale);
+						for (var j = 0; j < layers.length; j++) {
+							var currentLayer = currentWms.getLayerByLayerName(layers[j]);
+							// TODO: add only visible layers
+							var isVisible = (currentLayer.gui_layer_visible === 1);
+							var hasNoChildren = (!currentLayer.has_childs);
+							if (isVisible && hasNoChildren){
+								var layerLegendObj = {};
+								layerLegendObj.name = currentLayer.layer_name;
+								layerLegendObj.title = currentWms.getTitleByLayerName(currentLayer.layer_name);
+								var layerStyle = currentWms.getCurrentStyleByLayerName(currentLayer.layer_name);
+								if (layerStyle === false || layerStyle === "") {
+									layerStyle = "default";
+								}
+								layerLegendObj.legendUrl = currentWms.getLegendUrlByGuiLayerStyle(currentLayer.layer_name, layerStyle);
+								if (layerLegendObj.legendUrl !== false) {
+									wmsLegendObj.push(layerLegendObj);
+								}
+							}
+						}
+						if (wmsLegendObj.length > 0) {
+							var tmpObj = {};
+							tmpObj[currentWms.wms_currentTitle] = wmsLegendObj;
+							legendUrlArrayReverse.push(tmpObj);
+						}
+					}
+				}
+			}
+		}
+		
+		for(var i=0; i < mb_mapObj[ind].wms.length; i++){
+			var currentWms = mb_mapObj[ind].wms[i];
+			if(mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+				if (mb_mapObj[ind].wms[i].mapURL != false && mb_mapObj[ind].wms[i].mapURL != 'false' && mb_mapObj[ind].wms[i].mapURL != ''){   
+					if(f.map_url.value != ""){
+						f.map_url.value += '___';
+					}      
+					if(f.opacity.value != ""){
+						f.opacity.value += '___';
+					}   
+					var currentMapUrl = mb_mapObj[ind].getMapUrl(i, mb_mapObj[ind].getExtentInfos(), scale);
+					
+					currentMapUrl = replaceMapFileForHighQualityPrint(currentMapUrl, "map");
+					f.map_url.value += currentMapUrl;
+					f.opacity.value += mb_mapObj[ind].wms[i].gui_wms_mapopacity;
+
+					var wmsLegendObj = [];
+					
+					var layers = currentWms.getLayers(mb_mapObj[ind], scale);
+					for (var j = 0; j < layers.length; j++) {
+						var currentLayer = currentWms.getLayerByLayerName(layers[j]);
+						// TODO: add only visible layers
+						var isVisible = (currentLayer.gui_layer_visible === 1);
+						var hasNoChildren = (!currentLayer.has_childs);
+						if (isVisible && hasNoChildren){
+							var layerLegendObj = {};
+							layerLegendObj.name = currentLayer.layer_name;
+							layerLegendObj.title = currentWms.getTitleByLayerName(currentLayer.layer_name);
+							var layerStyle = currentWms.getCurrentStyleByLayerName(currentLayer.layer_name);
+							if (layerStyle === false || layerStyle === "") {
+								layerStyle = "default";
+							}
+							layerLegendObj.legendUrl = currentWms.getLegendUrlByGuiLayerStyle(currentLayer.layer_name, layerStyle);
+							if (layerLegendObj.legendUrl !== false) {
+								wmsLegendObj.push(layerLegendObj);
+							}
+						}
+					}
+					if (wmsLegendObj.length > 0) {
+						var tmpObj = {};
+						tmpObj[currentWms.wms_currentTitle] = wmsLegendObj;
+						if(options.reverseLegend == 'true') {
+							legendUrlArray = legendUrlArrayReverse; 
+						}
+						else {
+							legendUrlArray.push(tmpObj);
+						}
+					}
+				}
+			}
+		}
+	
+		var legendUrlArrayJson =  $.toJSON(legendUrlArray);
+		updateFormField(formData, "legend_url", legendUrlArrayJson);
+		updateFormField(formData, "map_url", f.map_url.value);
+		updateFormField(formData, "scale", scale);
+		updateFormField(formData, "opacity",f.opacity.value);		
+		
+		//overview_url
+		//var ind_overview = getMapObjIndexByName('overview');
+		//if(mb_mapObj[ind_overview].mapURL != false ){
+		//    var overviewUrl = mb_mapObj[ind_overview].mapURL;
+		//	overviewUrl = $.isArray(overviewUrl) ? overviewUrl[0] : overviewUrl;
+
+		//    f.overview_url.value = replaceMapFileForHighQualityPrint(overviewUrl, "overview");
+
+		//	updateFormField(formData, "overview_url", f.overview_url.value);
+		//}
+		
+		updateFormField(formData, "map_scale", mb_getScale(myTarget));
+		// write the measured coordinates
+		if (typeof(mod_measure_RX) !== "undefined") {
+			var tmp_x = '';
+			var tmp_y = '';
+			for(i = 0; i < mod_measure_RX.length; i++) {
+				if(tmp_x != '') {
+					tmp_x += ',';
+				}
+				tmp_x += mod_measure_RX[i];
+			}
+			for(i = 0; i < mod_measure_RY.length; i++) {
+				if(tmp_y != '') {
+					tmp_y += ',';
+				}
+				tmp_y += mod_measure_RY[i];
+			}
+			updateFormField(formData, "measured_x_values", tmp_x);
+			updateFormField(formData, "measured_y_values", tmp_y);
+		}
+
+                //write the permanent highlight image, if defined
+
+                var markers = [];
+                var pixelpos= null;
+                var realpos= [null,null];
+                var feature = null;
+
+                if(typeof GlobalPrintableGeometries != "undefined"){
+
+                    for(var idx = 0; idx < GlobalPrintableGeometries.count(); idx++ ) {
+                        feature = GlobalPrintableGeometries.get(idx);
+                        realpos = feature.get(0).get(0);
+                        path =  feature.e.getElementValueByName("Mapbender:icon");
+                        // The offsets are set to 40, meaning that images will need to be 80 x 80 with the tip of the marker- pixel being in the middle
+                        markers.push({
+                            position: [realpos.x,realpos.y],
+                            path: path,
+                            width: 40 * 2,
+                            height: 40 * 2,
+                            offset_x: 40,
+                            offset_y: 40 
+                        });
+                    }
+                    var permanentImage = JSON.stringify(markers);
+                    updateFormField(formData, "mypermanentImage", permanentImage);
+
+                }
+                //var $jqForm = $(jqForm);
+                //if($jqForm.find('[name="svg_extent"]').length){
+                //    var ext = $("#mapframe1:maps").mapbender().extent;
+                //    updateFormField(formData, "svg_extent", ext.min.x + ',' + ext.min.y + ',' + ext.max.x + ',' + ext.max.y);
+                //    if($jqForm.find('[name="map_svg_kml"]').length){
+                //        var kml = $('#mapframe1').data('kml');
+                //        updateFormField(formData, "map_svg_kml", "");
+                //        if(kml._kmls && $('#kml-rendering-pane svg:first').length){
+                //            for(var key in kml._kmls){ // object exists -> add svg
+                //                var svgStr = $($('#kml-rendering-pane').get(0)).html();
+                //                /* TODO start bug fix: multiple attributes xmlns="http://www.w3.org/2000/svg" by root svg at IE 9,10,11*/
+                //                var root = svgStr.match(/^<svg[^>]+/g);
+                //                if(root[0].match(/xmlns=["']http:\/\/www.w3.org\/2000\/svg["']/g).length > 1){
+                //                    var svg1 = root[0].replace(/ xmlns=["']http:\/\/www.w3.org\/2000\/svg["']/g,'');
+                //                    updateFormField(formData, "map_svg_kml", svg1 + ' xmlns="http://www.w3.org/2000/svg"' + svgStr.substring(root[0].length));
+                //                } else {
+                //                    updateFormField(formData, "map_svg_kml", svgStr);
+                //                }
+                //                /* end bug fix */
+                //                break;
+                //            }
+                //        }
+                //    }
+                //    if($jqForm.find('[name="map_svg_measures"]').length > 0){
+                //        if($('#measure_canvas svg:first').length){
+                //                var svgStr = $('#measure_canvas').html();
+                //                /* TODO start bug fix: multiple attributes xmlns="http://www.w3.org/2000/svg" by root svg at IE 9,10,11*/
+                //                var root = svgStr.match(/^<svg[^>]+/g);
+                //                if(root[0].match(/xmlns=["']http:\/\/www.w3.org\/2000\/svg["']/g).length > 1){
+                //                    var svg1 = root[0].replace(/ xmlns=["']http:\/\/www.w3.org\/2000\/svg["']/g,'');
+                //                    updateFormField(formData, "map_svg_measures", svg1 + ' xmlns="http://www.w3.org/2000/svg"' + svgStr.substring(root[0].length));
+                //                } else {
+                //                    updateFormField(formData, "map_svg_measures", svgStr);
+                //                }
+                //        } else {
+                //                updateFormField(formData, "map_svg_measures", '');
+                //        }
+                //    }
+                //}
+		if (f.map_url.value!="" && typeof f.map_url.value != 'undefined' && f.map_url.value != false && f.map_url.value != 'false') {
+			//all fields are ok wait for pdf
+		} else {
+		    	showHideWorking("hide");
+			alert('<?php echo _mb('No active maplayers in current print extent, please choose another extent/position for your template frame!'); ?>');
+			return false;
+		}
+	};
+
+	/**
+ 	 * Method: showResult
+	 * 
+	 * load the generated PDF from the returned URL as an attachment, 
+	 * that triggers a download popup or is displayed in PDF plugin.
+	 */		
+	var showResult = function (res, text) {
+		if (text == 'success') {
+			var $downloadFrame = $("#" + myId + "_frame");
+			if ($downloadFrame.size() === 0) {
+				$downloadFrame = $(
+					"<iframe id='" + myId + "_frame' name='" + 
+					myId + "_frame' width='0' height='0' style='display:none'></iframe>"
+				).appendTo("body");
+			}
+			if ($.browser.msie) {
+ 				$('<div></div>')
+					.attr('id', 'ie-print')
+					.append($('<p>Ihr PDF wurde erstellt und kann nun heruntergeladen werden:</p>'))
+					.append($('<a>Zum Herunterladen hier klicken</a>')
+						.attr('href', stripslashes(res.outputFileName))
+						.click(function() { $(this).parent().dialog('destroy');	}))
+					.appendTo('body')
+					.dialog({
+						title: 'PDF-Druck'
+					});
+			}
+			else {
+				window.frames[myId + "_frame"].location.href = 
+					stripslashes(res.outputFileName);
+			}
+			showHideWorking("hide");
+            //remove printbox after successful print
+            //destroyPrintBox();
+		}
+		else {
+			/* something went wrong */
+			$("#"+myId+"_result").html(text);
+		}
+	};
+	
+	/**
+	 * Generates form elements as specified in the config controls object.
+	 * Adds the elements before the submit button.
+	 * 
+	 * @param {Object} json the config object in json
+	 */
+	var buildForm = function () {
+		$(".print_option_dyn").remove();
+		$("#printboxScale").remove();
+		$("#printboxCoordinates").remove();
+		$("#printboxAngle").remove();
+		var str = "";
+		str += '<input type="hidden" name="printboxScale" id="printboxScale">\n';
+		str += '<input type="hidden" name="printboxCoordinates" id="printboxCoordinates">\n';
+		str += '<input type="hidden" name="printboxAngle" id="printboxAngle">\n';
+		for (var item in actualConfig.controls) {
+			var element = actualConfig.controls[item];
+			var element_id = myId + "_" + element.id;
+			if (element.type != "hidden") {
+				str += '<div class="print_option_dyn">\n';	
+				str += '<label class="print_label" for="'+element.id+'">'+element.label+'</label>\n';
+			} else {
+				str += '<div class="print_option_dyn" style="display:none;">\n';	
+			}
+			
+			if(element.maxCharacter) {
+				var maxLength = 'maxlength="'+element.maxCharacter+'"';
+				
+			}
+			else {
+				var maxLength = "";
+			}
+			switch (element.type) {
+				case "text":
+					str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'" size="'+element.size+'" '+maxLength+'><br>\n';
+					break;
+				case "hidden":
+					str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'">\n';
+					break;				
+				case "textarea":
+					str += '<textarea id="'+element.id+'" name="'+element.id+'" size="'+element.size+'" '+maxLength+'></textarea><br>\n';
+					break;				
+				case "select":
+					str += '<select id="'+element.id+'" name="'+element.id+'" size="1">\n';
+					for (var option_index in element.options) {
+						option = element.options[option_index];
+						var selected = option.selected ? option.selected : "";
+						str += '<option '+selected+' value="'+option.value+'">'+option.label+'</option>\n';
+					}
+					str += '</select><br>\n';
+					break;
+			}
+			str += '</div>\n';
+		}
+		if (str) {
+			$('textarea[maxlength]').live('keyup change', function() {
+              	var str = $(this).val()
+              	var mx = parseInt($(this).attr('maxlength'))
+              	if (str.length > mx) {
+                 	$(this).val(str.substr(0, mx))
+                 	return false;
+              	}
+            });
+			$("#" + myId + "_formsubmit").before(str);
+			if($("#scale").is("input")) {
+    			$("#scale").keydown(function (e) {
+    				if (e.keyCode === 13) {
+    					return false;
+    				}
+    			}).keyup(function (e) {
+    				if (e.keyCode === 13) {
+    					return false;
+    				}
+                                    
+                    var scale = parseInt(this.value, 10);
+    				if (isNaN(scale) || typeof printBox === "undefined") {
+    					return true;
+    				}
+    
+                    if(scale < 10) {
+                    	return true;
+                    }
+    				printBox.setScale(scale);
+    				return true;
+    			});
+			}
+			else {
+				$("#scale").change(function (e) {
+	                var scale = parseInt(this.value, 10);
+					if (isNaN(scale) || typeof printBox === "undefined") {
+						return true;
+					}
+	
+	                if(scale < 10) {
+		                return true;
+		            }
+					printBox.setScale(scale);
+					return true;
+				});
+			}
+
+			$("#angle").keydown(function (e) {
+				if (e.keyCode === 13) {
+					return false;
+				}
+			}).keyup(function (e) {
+				if (e.keyCode === 13) {
+					return false;
+				}
+				var angle = parseInt(this.value, 10);
+				if (isNaN(angle) || typeof printBox === "undefined") {
+					return true;
+				}
+				printBox.setAngle(angle);
+				return true;
+			});
+		}
+	};
+	
+	/**
+	 * Generates the configuration select element from the gui element vars
+	 * mbPrintConfigFilenames and mbPrintConfigTitles
+	 */
+	var buildConfigSelector = function () {
+		var str = "";
+		str += '<label class="print_label" for="printPDF_template">Vorlage</label>\n';
+		str += '<select id="printPDF_template" name="printPDF_template" size="1">\n';
+		for (var i = 0; i < mbPrintConfigFilenames.length; i++) {
+			str += '<option value="'+mbPrintConfigFilenames[i]+'">'+mbPrintConfigTitles[i]+'</option>\n';
+		}
+		str += '</select><img id="printPDF_handle" src="../print/img/shape_handles.png" title="<?php echo htmlentities(_mb("use print box"), ENT_QUOTES, "UTF-8");?>">\n';
+		if (str) {
+			$("#printPDF_selector").append(str).find("#printPDF_template").change(function () {
+				printObj.loadConfig(mbPrintConfigFilenames[this.selectedIndex], function () {
+				    printObj.createPrintBox()
+				});			
+			});
+                       
+			$("#printPDF_handle").click(function () {
+				if (printBox) {
+					if(printBox.isVisible()) {
+						showHidePrintBox("hide");
+						$("#printboxScale").val($("#printPDF_form #scale").val());
+						$("#printboxCoordinates").val($("#printPDF_form #coordinates").val());
+						$("#printboxAngle").val($("#printPDF_form #angle").val());
+						
+						$("#printPDF_form #scale").val("");
+						$("#printPDF_form #coordinates").val("");
+						$("#printPDF_form #angle").val("");
+					}
+					else {
+						showHidePrintBox("show");
+						$("#printPDF_form #scale").val($("#printboxScale").val());
+						$("#printPDF_form #coordinates").val($("#printboxCoordinates").val());
+						$("#printPDF_form #angle").val($("#printboxAngle").val());
+					}
+				}
+				else {
+					printObj.createPrintBox();
+				}
+				
+			});
+			$("#printPDF_working").bgiframe({ 
+				src: "BLOCKED SCRIPT'<html></html>';",
+				width: 200,
+				height: 200
+			});
+		}
+	};
+	
+	var stripslashes = function ( str ) {
+	    return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
+	};
+
+};
+
+var printObj = new PrintPDF(options);
+

Added: trunk/mapbender/http/plugins/mb_scaleContainer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_scaleContainer.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_scaleContainer.js	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,23 @@
+var $toolbar = $(this);
+
+var ToolbarApi = function (o) {
+	var that = this;
+	
+	var $list = $("<ul id='scaleContainer' />").appendTo($toolbar);
+	o.$target.each(function () {
+		if (this === undefined) {
+			return;
+		}
+		$list.append($(this).wrap("<li />").parent());
+	});
+};
+
+$toolbar.mapbender(new ToolbarApi(options));
+
+/*$(document).ready(function(){ $("#tree2Container").hide(); });*/
+$(document).ready(function(){
+         $('.scaleDivClosed').click(function(){
+		$('#scaleContainer').toggle('fast');
+		$('#scaleContainer').hide();
+	 })
+});

Added: trunk/mapbender/http/plugins/mb_toolbar_cont.js
===================================================================
--- trunk/mapbender/http/plugins/mb_toolbar_cont.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_toolbar_cont.js	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,22 @@
+var $toolbar = $(this);
+
+var ToolbarApi = function (o) {
+	var that = this;
+	
+	var $list = $("<ul id='toolsContainer' />").appendTo($toolbar);
+	o.$target.each(function () {
+		if (this === undefined) {
+			return;
+		}
+		$list.append($(this).wrap("<li />").parent());
+	});
+};
+
+$toolbar.mapbender(new ToolbarApi(options));
+
+$(document).ready(function(){ $("#toolsContainer").hide(); });
+$(document).ready(function(){
+         $('.toggleToolsContainer').click(function(){
+                $('#toolsContainer').toggle('fast') && $('a.toggleToolsContainer').toggleClass('activeToggle');
+		$('#tree2Container').hide() && $('.toggleLayerTree').removeClass('activeToggle'); })
+});

Added: trunk/mapbender/http/plugins/mb_toolbar_tree.js
===================================================================
--- trunk/mapbender/http/plugins/mb_toolbar_tree.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_toolbar_tree.js	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,23 @@
+var $toolbar = $(this);
+
+var ToolbarApi = function (o) {
+	var that = this;
+	
+	var $list = $("<ul id='tree2Container' />").appendTo($toolbar);
+	o.$target.each(function () {
+		if (this === undefined) {
+			return;
+		}
+		$list.append($(this).wrap("<li />").parent());
+	});
+};
+
+$toolbar.mapbender(new ToolbarApi(options));
+
+$(document).ready(function(){ $("#tree2Container").hide(); });
+$(document).ready(function(){
+         $('.toggleLayerTree').click(function(){
+		$('#tree2Container').toggle('fast') && $('a.toggleLayerTree').toggleClass('activeToggle');
+		$('#toolsContainer').hide() && $('a.toggleToolsContainer').removeClass('activeToggle');
+	 })
+});

Added: trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer2019.php
===================================================================
--- trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer2019.php	                        (rev 0)
+++ trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer2019.php	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,342 @@
+<?php
+/**
+ * Package: mod_jsonAutocompleteGazetteer
+ *
+ * Description:
+ * This module is a client for a json gazetteer webservice as used by http://www.geonames.org. The default 
+ * service is the service from geonames.org which allows searching for 
+ * 
+ * 
+ * Files:
+ *  - http/plugins/mod_jsonAutocompleteGazetteer.php
+ *
+ * SQL:
+ * >
+ * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src,
+ * > e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag,
+ * > e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('<app_id>','jq_ui_autocomplete',5,1,
+ * > 'Module to manage jQuery UI autocomplete module','','div','','',-1,-1,15,15,NULL ,'','','div',
+ * > '','../extensions/jquery-ui-1.8.16.custom/development-bundle/ui/jquery.ui.autocomplete.js',
+ * > '','jq_ui,jq_ui_widget,jq_ui_position','');
+ * >
+ * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element,
+ * > e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content,
+ * > e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('<app_id>',
+ * > 'jsonAutocompleteGazetteer',12,1,'Client for json webservices like geonames.org','Gazetteer',
+ * > 'div','','',230,30,NULL ,NULL ,999,'','','div','../plugins/mod_jsonAutocompleteGazetteer.php',
+ * > '','mapframe1','','http://www.mapbender.org/index.php/mod_jsonAutocompleteGazetteer');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) 
+ * > VALUES('<app_id>', 'jsonAutocompleteGazetteer', 'gazetteerUrl', 'http://10.176.178.10/mapbender/geoportal/gaz_geom_mobile.php',
+ * >  '' ,'var');
+ * > 
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type)
+ * >  VALUES('<app_id>', 'jsonAutocompleteGazetteer', 'isGeonames', 'true', '' ,'var');
+ * > 
+ * Help:
+ * http://www.mapbender.org/mod_jsonAutocompleteGazetteer
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Armin_Retterath
+ * 
+ * Parameters:
+ * none
+ * 
+ *
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License 
+ * and Simplified BSD license.  
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+?>
+
+var standingHighlight = null;
+Mapbender.events.afterMapRequest.register( function(){
+	if(standingHighlight){
+		standingHighlight.paint();
+	}
+});
+
+//initialize modul
+if (options.gazetteerUrl === undefined) {
+	options.gazetteerUrl = 'http://ws.geonames.org/searchJSON?lang=de&';
+}
+if (options.isGeonames === undefined) {
+	options.isGeonames = true;
+}
+else {
+	options.isGeonames = false;
+}
+if (options.latLonZoomExtension === undefined) {
+	options.latLonZoomExtension = 0.1;
+}
+if (options.minLength === undefined) {
+	options.minLength = 3;
+}
+if (options.delay === undefined) {
+	options.delay = 400;
+}
+if (options.isDraggable === undefined) {
+	options.isDraggable = true;
+}
+if (options.maxResults === undefined) {
+	options.maxResults = 15;
+}
+if (options.inputWidth === undefined) {
+	options.inputWidth = 400;
+}
+if (options.searchEpsg === undefined) {
+	options.searchEpsg = "4326";
+}
+if (options.drawCentrePoint === undefined) {
+	options.drawCentrePoint = true;
+}
+if (options.gazetteerFrontImageOn === undefined) {
+	options.gazetteerFrontImageOn = "../img/geoportal2019/search.svg";
+}
+if (options.gazetteerFrontImageOff === undefined) {
+	options.gazetteerFrontImageOff = "../img/geoportal2019/search.svg";
+}
+if (options.helpText === undefined) {
+	options.helpText = "";
+}
+
+var JsonAutocompleteGazetteer = function() {
+	var that = this;	
+	var targetName = options.target;
+	var ind = getMapObjIndexByName(targetName);
+	var my = mb_mapObj[ind];
+
+	this.zoomToExtent = function(fromSrs,minx,miny,maxx,maxy) {
+		var parameters = {
+			fromSrs: fromSrs,
+			toSrs: Mapbender.modules[targetName].epsg 
+		};
+
+		parameters.bbox = parseFloat(minx)+ "," +parseFloat(miny)+ "," +parseFloat(maxx)+ "," +parseFloat(maxy);
+			
+		//function to transform from one crs to another
+		var req = new Mapbender.Ajax.Request({
+			url: "../php/mod_coordsLookup_server.php",
+			method: "transform",
+			parameters: parameters,
+			callback: function (obj, success, message) {
+				if (!success) {
+					new Mapbender.Exception(message);
+					return;
+				}
+				if (options.drawCentrePoint) {
+					//generate layer for visualization of point
+					if(standingHighlight !== null){ 
+						standingHighlight.clean();
+					}else{
+						standingHighlight = new Highlight(
+							[options.target],
+							"standingHighlight", 
+							{"position":"absolute", "top":"0px", "left":"0px", "z-index":999}, 
+							2);
+					}
+					var point0 = new Point(obj.points[0].x,obj.points[0].y);
+					var point1 = new Point(obj.points[1].x,obj.points[1].y);	
+					var x = point0.x + (point1.x - point0.x)/2;
+					var y = point0.y + (point1.y - point0.y)/2;
+					var point = new Point(x,y);
+					var ga = new GeometryArray();
+					ga.importPoint({
+						coordinates:[x,y,null]
+					},Mapbender.modules[targetName].epsg)
+					var m = ga.get(-1,-1);
+					standingHighlight.add(m, "#ff0000");
+					//alert(m);
+					standingHighlight.paint();
+				}
+				if (obj.points) {
+					if (obj.points.length === 2) {
+						var newExtent = new Extent(
+							obj.points[0].x,
+							obj.points[0].y,
+							obj.points[1].x,
+							obj.points[1].y
+						);
+						my.calculateExtent(newExtent);
+					}
+					my.setMapRequest();
+				}
+			} 
+		});
+		req.send();
+	};
+	this.showSearchHelp = function(){
+
+
+	}
+	this.toggleInput = function(){
+		if ($("#geographicName").css("display") == 'none' && $("#symbolForClearInputId").css("display") == 'none' && $("#symbolForInputCloseId").css("display") == 'none') {
+			$("#geographicName").show();
+			$("#geographicName").focus();
+			$("#helpSymbolId").show();
+			$("#symboldForInputId").attr({'src':options.gazetteerFrontImageOn}).hide();
+			$("#symbolForClearInputId").show();
+			$("#symbolForInputCloseId").show();
+		} else {
+			$("#geographicName").hide();
+			$("#helpSymbolId").hide();
+			$("#symboldForInputId").attr({'src':options.gazetteerFrontImageOff}).show();
+			$("#symbolForClearInputId").hide();
+			$("#symbolForInputCloseId").hide();
+		}
+	}
+
+	this.initForm = function() {
+		epsg = Mapbender.modules[targetName].epsg.replace('EPSG:', '');
+		this.formContainer = $(document.createElement('form')).attr({'id':'json-autocomplete-gazetteer'}).appendTo('#' + options.id);
+		this.formContainer.submit(function() {
+			return false;
+		});
+		if (options.isDraggable){
+			//this.formContainer.draggable();//problem with print module
+		}
+		this.symbolForInput = $(document.createElement('a')).appendTo(this.formContainer);
+		this.symbolForInput.text('Adressen');
+		this.symbolForInput.attr({'id':'symboldForInputId'});
+		this.symbolForInput.attr({'title':'<?php echo _mb('Address'); ?>'});
+		$("#symboldForInputId").click(function() {
+			that.toggleInput();
+		});
+		this.inputAddress = $(document.createElement('input')).appendTo(this.formContainer);
+
+		this.symbolForClearInput = $(document.createElement('img')).appendTo(this.formContainer);
+                this.symbolForClearInput.attr({'src':'../img/geoportal2019/empty2.svg'});
+                this.symbolForClearInput.attr({'id':'symbolForClearInputId'});
+                this.symbolForClearInput.attr({'style':'cursor:pointer'});
+                $("#symbolForClearInputId").click(function() {
+                        $("#geographicName").val('');
+			$("#geographicName").focus();
+                });
+
+		this.symbolForInputClose = $(document.createElement('img')).appendTo(this.formContainer);
+                this.symbolForInputClose.attr({'src':'../img/geoportal2019/clear.svg'});
+                this.symbolForInputClose.attr({'id':'symbolForInputCloseId'});
+                this.symbolForInputClose.attr({'style':'cursor:pointer'});
+		$("#symbolForInputCloseId").click(function() {
+                        that.toggleInput();
+                });
+		
+
+		//do the following things only if 
+		if (options.helpText != '') {
+			this.helpSymbol = $(document.createElement('img')).appendTo(this.formContainer);
+			this.helpSymbol.attr('style','display: def !important');
+			this.helpText = $(document.createElement('div')).appendTo(this.formContainer);
+			this.helpText.attr({'id':'helpTextId'});
+			$("#helpTextId").hide();
+			$("#helpTextId").append(options.helpText);
+			
+			this.helpSymbol.attr({'id':'helpSymbolId'});
+			this.helpSymbol.attr({'src':'../img/questionmark.png'});
+			this.helpSymbol.attr({'width':'22'});
+                        this.helpSymbol.attr({'height':'22'});
+                        this.helpSymbol.attr({'style':'margin:0 5px -6px 2px'});
+		
+			$("#helpSymbolId").hover(
+				function () {
+    					//create dialog
+					$("#helpTextId").dialog({ title: "<?php echo _mb('Help for address search'); ?>" });
+  				},
+				function () {
+    					//create dialog
+					$("#helpTextId").dialog('close');
+  				}
+			);
+		}
+		this.inputAddress.attr({'id':'geographicName'});
+//		this.inputAddress.attr({'autofocus':'autofocus'});
+		//that.toggleInput();	
+		//INSERTED BY BENZ----
+		this.inputAddress.attr({'placeholder':'<?php echo _mb('Search for addresses'); ?>'});
+		//-------------------
+		//default value
+		//this.inputAddress.val('<?php echo _mb('Search for addresses'); ?>');
+		/*this.inputAddress.click(function() {
+			that.inputAddress.val('');
+		});*/
+		
+		this.inputAddress.css('width',options.inputWidth);
+		$('.ui-menu').css('width','100px');
+		$('.ui-menu-item').css('width','100px');
+		//set the loading symbol for autoloader class
+		//$('.ui-autocomplete-loading').css('background','white url("../img/indicator_wheel.gif") right center no-repeat');
+		//http://stackoverflow.com/questions/622122/how-can-i-change-the-css-class-rules-using-jquery
+		//$("<style type='text/css'> .ui-autocomplete { position: absolute; cursor: default; background:black; color:white} </style>").appendTo("head");
+		$(function() {
+			$( "#geographicName" ).autocomplete({
+				source: function( request, response ) {
+					$.ajax({
+						url: options.gazetteerUrl,
+						dataType: "jsonp",
+						data: {
+							outputFormat: 'json',
+							resultTarget: 'web',
+							searchEPSG: options.searchEpsg,
+							maxResults: options.maxResults,
+							maxRows: options.maxResults,
+							searchText: request.term,
+							featureClass: "P",
+							style: "full",
+							name_startsWith: request.term
+
+						},
+						success: function( data ) {
+							if (options.isGeonames) {
+								response( $.map( data.geonames, function( item ) {
+									return {
+										label: item.name+" - "+item.fclName+" - "+item.countryName,
+										minx: item.lng-options.latLonZoomExtension,
+										miny: item.lat-options.latLonZoomExtension,
+										maxx: item.lng+options.latLonZoomExtension,
+										maxy: item.lat+options.latLonZoomExtension
+									}
+								}));
+							} else {
+								response( $.map( data.geonames, function( item ) {
+									return {
+										label: item.title,
+										minx: item.minx,
+										miny: item.miny,
+										maxx: item.maxx,
+										maxy: item.maxy
+									}
+								}));
+							}
+						}
+					});
+				},
+				minLength: options.minLength,
+				delay: options.delay,
+				select: function( event, ui ) {
+					that.zoomToExtent("EPSG:"+options.searchEpsg,ui.item.minx,ui.item.miny,ui.item.maxx,ui.item.maxy);
+				},
+				open: function() {
+					$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
+				},
+				close: function() {
+					$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
+				}
+
+			});
+		});
+	}
+	this.initForm();
+}
+Mapbender.events.init.register(function() {
+	Mapbender.modules[options.id] = $.extend(new JsonAutocompleteGazetteer(),Mapbender.modules[options.id]);	
+});
+
+
+
+
+

Added: trunk/mapbender/http/plugins/wfsConfTree_single.js
===================================================================
--- trunk/mapbender/http/plugins/wfsConfTree_single.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/wfsConfTree_single.js	2019-09-13 10:57:55 UTC (rev 10247)
@@ -0,0 +1,214 @@
+/*
+ *  default wfsConfIdString is taken from the elementVar "wfsConfIdString" of the mapframe1 element!
+ *
+ *  */
+//some things for i18
+var originalI18nObject = {
+	"labelNoWfsConfAvailable": "No geometry modules are available. You can load those from the Search.",
+	"labelClose": "close"
+};
+
+var translatedI18nObject = Mapbender.cloneObject(originalI18nObject);
+
+if(Mapbender.modules.i18n){	
+	Mapbender.modules.i18n.queue(options.id, originalI18nObject, function (translatedObject) {
+		if (typeof translatedObject !== "object") {
+			return;
+		}
+		translatedI18nObject = translatedObject;
+	});
+	//Mapbender.modules.i18n.localize(Mapbender.languageId);
+}
+
+var $confTree = $(this);
+var ConfTree = function(o){
+	var that = this;
+	var wfsConfIdString = o.wfsConfIdString || "";
+	var wfsconfs = wfsConfIdString.split(',');
+	// getParams is a global variable that contains the Querystring as a json object
+	var getwfsConfIdString = getParams['FEATURETYPE'] || "";
+	if(getwfsConfIdString !== ""){
+		wfsconfs = wfsconfs.concat(getwfsConfIdString.split(','));
+	}
+	wfsConfIdString = wfsconfs.join(',');
+	var currentWFSConf = {};
+	if(Mapbender.modules.loadwmc){
+		Mapbender.modules.loadwmc.events.loaded.register(function (obj) {
+			if (obj.extensionData && obj.extensionData.WFSCONFIDSTRING) {
+				var req = Mapbender.Ajax.Request({
+					url: 	"../php/mod_wfs_conf_server.php",
+					method:	"getWfsConfsFromId",
+					parameters: {
+						wfsConfIdString: obj.extensionData.WFSCONFIDSTRING
+					},
+					callback: function(result,success,message){
+						reset(result);
+					}
+				});
+				req.send();
+			}
+		});
+	}
+	var $wfsConfDialog = $("<div></div>").dialog({
+		width: 240,
+		height: 390,
+		position: [o.$target.offset().left+20, o.$target.offset().top+80],
+		autoOpen: false,
+		close: function() {$("#menuitem_flst").removeClass("menuitem_flst_on");}
+	});
+	$("button.toggle",$confTree).live('click', function(){
+		if($(this).parent().hasClass("open")){
+			$(this).parent().removeClass("open");
+			$(this).parent().addClass("closed");
+		}else{
+			$(this).parent().removeClass("closed");
+			$(this).parent().addClass("open");
+
+		}
+	});
+	var reset = function(aWFSConf){
+		wfsconfs = [];
+		$confTree.children().remove();
+		$confTree.append("<li class='emptymessage'>"+translatedI18nObject.labelNoWfsConfAvailable+"</li>");
+		$confTree.addClass('conftree');
+
+		var $WFSConffolder = $('<li class="open wfsconf" style="margin:0;padding:0;"><ul style="margin:0;padding:0;"></ul></li>');
+		$confTree.append($WFSConffolder);
+		for(var i in  aWFSConf){
+			// remove default "no wfs conf"message
+			if(i == 0){ $confTree.find(".emptymessage").remove();}
+			// group by featyretype
+			$featuretypeFolder = $WFSConffolder.find("li.featuregroup_"+aWFSConf[i].featureTypeId);
+			wfsconfs.push(aWFSConf[i].id);
+			if($featuretypeFolder.size() == 0){
+				$featuretypeFolder = $('<li style="margin:0;padding:0;" class="open featuregroup_'+ aWFSConf[i].featureTypeId + '"><ul style="margin:0;padding:0;"></ul></li>');
+				$WFSConffolder.find(" > ul").append($featuretypeFolder);
+				$featuretypeList = $featuretypeFolder.find("ul");
+			}else{
+				$featuretypeList = $featuretypeFolder.find("ul");
+			};
+			//parseInt because one version of wfsConf creates this as a string, the other as an int 
+			switch(parseInt(aWFSConf[i].type,10)){
+					/* search */
+					case 0: 
+						$wfsconfEntry = $('<li style="margin:0;padding:0;" class="search" > <a id="menuitem_flst" href="#" class="dialogopen">'+ aWFSConf[i].label +'</a></li>');
+					break;
+					
+					/* digitize */
+					case 1:
+						$wfsconfEntry = $('<li class="digitize" ><img src="../img/pencil.png" /><button class="remove">remo</button><img class="meta" src="../img/button_blue_red/getArea_over.png" />  <a href="#" class="dialogopen">'+ aWFSConf[i].label +'</a></li>');
+					break;
+
+					/* download */
+					case 2: 
+						$wfsconfEntry = $('<li class="download" ><img src="../img/gnome/document-save.png" /><button class="remove">remo</button><img class="meta" src="../img/button_blue_red/getArea_over.png" />  <a href="#" class="dialogopen">'+ aWFSConf[i].label +'</a></li>');
+					break;
+
+			}
+			$wfsconfEntry.data("wfsconfId",aWFSConf[i].id);
+			$featuretypeList.append($wfsconfEntry);
+
+			$wfsconfEntry.find("img.meta").click((function(wfsConf){ 
+				return function(){
+
+				var querystring = 'resource=wfs-conf&id='+wfsConf.id;
+				var $iframe = $('<iframe name="'+o.id+'_" style="border:none; width: 100%; height: 100%;" src="../php/mod_showMetadata.php?'+querystring+'"></iframe>');
+				$wfsConfDialog.empty();
+				$wfsConfDialog.append($iframe);	
+				$wfsConfDialog.dialog("open");
+				};
+			})(aWFSConf[i]));
+
+			$wfsconfEntry.find("a.dialogopen").click((function(wfsConf){ 
+				return function(){
+
+				var querystring = 'wfsConfId='+wfsConf.id+'&e_id_css='+o.id+'&e_target='+o.target;
+				switch(parseInt(wfsConf.type,10)){
+
+					/* search */
+					case 0:
+						$("#menuitem_flst").addClass('menuitem_flst_on');
+						$('#toolsContainer').hide() && $('a.toggleToolsContainer').removeClass('activeToggle'); 
+					/* download */
+					case 2: 
+						var $iframe = $('<iframe name="'+o.id+'_" style="border:none; width: 100%; height: 100%;" src="../javascripts/mod_wfsGazetteerEditor_client_flst.php?'+querystring+'"></iframe>');
+						$wfsConfDialog.empty();
+						$wfsConfDialog.append($iframe);	
+						$wfsConfDialog.dialog("open");
+					break;
+
+					/* digitize */
+					case 1:
+					break;
+				}
+
+				};
+			})(aWFSConf[i]));
+			$wfsconfEntry.find("button.remove").click(function(){
+			
+				
+				var wfsconfId = $(this).parent().data("wfsconfId");
+				// if this was the last entry in the featuregroup, remove it completely	...
+//				if($(this).parent().siblings().size() == 0){
+//					$(this).parent().parent().parent().remove();
+//				}else{
+//					$(this).parent().remove();
+//				}
+				
+				var newWFSConf = [];
+				for (var i in currentWFSConf){
+					if(currentWFSConf[i].id != wfsconfId){
+						newWFSConf.push(currentWFSConf[i]);
+					}
+				}
+				reset(newWFSConf);
+					
+			});
+		}
+		if(Mapbender.modules.savewmc){
+			Mapbender.modules.savewmc.setExtensionData({ WFSCONFIDSTRING: wfsconfs.join(',') });
+			Mapbender.modules.savewmc.save({session: true});
+		}
+	
+		// need this so we have a reference to the currently active wfsConfs
+		currentWFSConf = aWFSConf;
+	};
+
+
+	if(wfsConfIdString){
+		var req = Mapbender.Ajax.Request({
+			url: 	"../php/mod_wfs_conf_server.php",
+			method:	"getWfsConfsFromId",
+			parameters: {
+				wfsConfIdString: wfsConfIdString
+			},
+			callback: function(result,success,message){
+				reset(result);
+			}
+		});
+		req.send();
+	}
+
+
+	// addFeaturetypeConf should take precedence
+	$('#body').bind('addFeaturetypeConfs',function(evt,obj){
+		if(!obj.wfsConfIdString){ return; }
+		var req = Mapbender.Ajax.Request({
+			url: 	"../php/mod_wfs_conf_server.php",
+			method:	"getWfsConfsFromId",
+			parameters: {
+				wfsConfIdString: obj.wfsConfIdString
+			},
+			callback: function(result,success,message){
+				reset(result);
+			}
+		});
+		req.send();
+	});
+
+
+};
+
+Mapbender.events.init.register(function(){
+	$confTree.mapbender(new ConfTree(options));
+});



More information about the Mapbender_commits mailing list