[Mapbender-commits] r1017 - in trunk/mapbender/http: css html img img/tree_new javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Jan 21 20:25:39 EST 2007


Author: nimix
Date: 2007-01-21 20:25:00 -0500 (Sun, 21 Jan 2007)
New Revision: 1017

Added:
   trunk/mapbender/http/css/treeGDE2.css
   trunk/mapbender/http/html/mod_treefolder2.php
   trunk/mapbender/http/img/tree_new/
   trunk/mapbender/http/img/tree_new/branch.png
   trunk/mapbender/http/img/tree_new/closed.png
   trunk/mapbender/http/img/tree_new/closed_folder.png
   trunk/mapbender/http/img/tree_new/delete_wms.png
   trunk/mapbender/http/img/tree_new/delete_wmsmy.png
   trunk/mapbender/http/img/tree_new/error.png
   trunk/mapbender/http/img/tree_new/error_folder.png
   trunk/mapbender/http/img/tree_new/expanded.png
   trunk/mapbender/http/img/tree_new/expanded_error.png
   trunk/mapbender/http/img/tree_new/expanded_folder.png
   trunk/mapbender/http/img/tree_new/hide.png
   trunk/mapbender/http/img/tree_new/info.png
   trunk/mapbender/http/img/tree_new/last_closed.png
   trunk/mapbender/http/img/tree_new/last_expanded.png
   trunk/mapbender/http/img/tree_new/last_leaf.png
   trunk/mapbender/http/img/tree_new/leaf.png
   trunk/mapbender/http/img/tree_new/loading_folder.gif
   trunk/mapbender/http/img/tree_new/menu.png
   trunk/mapbender/http/img/tree_new/move_down.png
   trunk/mapbender/http/img/tree_new/move_downmy.png
   trunk/mapbender/http/img/tree_new/move_up.png
   trunk/mapbender/http/img/tree_new/move_upmy.png
   trunk/mapbender/http/img/tree_new/zoom.png
   trunk/mapbender/http/javascripts/jsTree.js
Modified:
   trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js
Log:
add TreeGDE2

Added: trunk/mapbender/http/css/treeGDE2.css
===================================================================
--- trunk/mapbender/http/css/treeGDE2.css	2007-01-22 01:17:20 UTC (rev 1016)
+++ trunk/mapbender/http/css/treeGDE2.css	2007-01-22 01:25:00 UTC (rev 1017)
@@ -0,0 +1,52 @@
+a {
+	text-decoration:none;
+	color:black;
+}
+a.node
+{
+	vertical-align:middle;
+}
+a:link
+{
+	color: #000000;
+}
+a:visited
+{
+	color: #000000;
+}
+a:hover
+{
+	color: #8080FF;
+	text-decoration:underline;
+}
+table
+{
+	font-size:8pt;
+	line-height:8pt;
+}
+table.menu
+{
+	background-color: #ffffff;
+	border: 1px solid #999999
+}
+td
+{
+	color: #000000;
+	font-family: Verdana
+}
+img
+{
+	border:none;
+	padding:0px;
+	margin:0px;
+	vertical-align:middle;		
+}
+input
+{
+	margin-top:0px;
+	margin-bottom:0px;
+	margin-left:0px;
+	margin-right:3px;
+	padding:0px;
+	vertical-align:middle;
+}

Added: trunk/mapbender/http/html/mod_treefolder2.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolder2.php	2007-01-22 01:17:20 UTC (rev 1016)
+++ trunk/mapbender/http/html/mod_treefolder2.php	2007-01-22 01:25:00 UTC (rev 1017)
@@ -0,0 +1,578 @@
+<?php
+session_start();
+require_once("../../conf/mapbender.conf");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+$gui_id = $_SESSION["mb_user_gui"];
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<TITLE>Treefolder</TITLE>
+<?php
+ include '../include/dyn_css.php';
+?>
+<script language='JavaScript'>
+/* Treefolder2, written 2006 by Melchior Moos*/
+
+function openwindow(Adresse) {
+Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+Fenster1.focus();
+}
+</script>
+<script src="../javascripts/jsTreeID.js" type="text/javascript" language="JavaScript"></script>
+<?php
+echo "<script language='JavaScript'>";
+   $sql = "SELECT e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2";
+   $v = array($_REQUEST['e_id_css'],$_SESSION["mb_user_gui"]);
+   $t = array('s','s');
+   $res = db_prep_query($sql,$v,$t);
+   $e_target = db_result($res,0,"e_target");   
+   echo "mod_treeGDE_map = '".$e_target."';";   
+echo "</script>";
+?>
+<SCRIPT language="JavaScript" type="text/javascript">
+
+var jst_container = "document.getElementById('treeContainer')";
+var jst_image_folder = imagedir;
+var jst_display_root = false;
+var defaultTarget = 'examplemain';
+var lock=false;
+var selectedMap=-1;
+var selectedWMS=-1;
+var selectedLayer=-1;
+var init=false;
+var errors = 0;
+var state=Array();
+var arrNodes = 
+[
+	['root_id', ['Layer','javascript:_foo()']
+
+	]
+];
+function _foo(){}
+
+// some defaults
+try{if (switchwms){}}catch(e){switchwms = 'true';}
+try{if (ficheckbox){}}catch(e){ficheckbox = 'false';}
+try{if (metadatalink){}}catch(e){metadatalink = 'false';}
+try{if (wmsbuttons){}}catch(e){wmsbuttons = 'false';}
+try{if (showstatus){}}catch(e){showstatus = 'false';}
+try{if (alerterror){}}catch(e){alerterror = 'false';}
+try{if (openfolder){}}catch(e){openfolder = 'false';}
+try{if (menu){}}catch(e){menu = '';}
+
+menu="wms_up,wms_down,remove,layer_up,layer_down,metainfo,zoom,hide";
+//menu elements
+var menu_move_up = ['menu_move_up', ['Move up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_move_down = ['menu_move_down', ['Move down&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_delete = ['menu_delete', ['Remove&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
+var menu_metalink = ['menu_metalink', ['Information&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
+var menu_zoom = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
+var menu_hide = ['menu_hide', ['Hide menu&nbsp;', 'javascript:hideMenu()',,'hide.png']];
+//var menu_wms_switch = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_layer_switch = ['menu_zoom', ['Zjjj&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_info_switch = ['menu_zoom', ['Zmn&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+
+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(parent.mb_getScale(mod_treeGDE_map));	
+	if(scale < parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_name, '#999999');
+	}
+	else if(scale > parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_name, '#999999');
+	}
+	else{
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_name, '');
+	}
+
+	selectedMap=i;
+	selectedWMS=ii;
+	selectedLayer=iii;
+}
+
+function updateScale()
+{
+	if(!init)return;
+	for(var i=0; i<parent.mb_mapObj.length; i++){
+		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+					if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){                    
+						if(iii==0)
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
+						else
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name, '#999999');
+					}
+					else if(scale > parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
+						if(iii==0)
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
+						else
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name, '#999999');
+					}
+					else{
+						if(iii==0)
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '');
+						else
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name, '');
+					}
+				}
+			}
+		}
+	}	
+}
+
+function operaLoad()
+{
+	initArray();
+	renderTree();
+	setTimeout('initWmsCheckboxen();updateScale();',100);	
+}
+
+function loadTree()
+{
+	if(window.opera)
+	{
+		setTimeout('operaLoad()',200);	
+		return;
+	}
+	initArray();
+	renderTree();
+	initWmsCheckboxen();
+	updateScale();
+}
+
+function reloadTree()
+{
+	if(!init) return;
+	selectedMap=-1;
+	selectedWMS=-1;
+	selectedLayer=-1;
+	init=false;
+	arrNodes = [['root_id', ['Layer','javascript:_foo()']]];
+	initArray();
+	if(showstatus=='true'||alerterror=='true')
+		init_mapcheck();
+	renderTree();
+	if(window.opera)
+		setTimeout('initWmsCheckboxen();updateScale();',100);	
+	else
+	{
+		initWmsCheckboxen();
+		updateScale();
+	}
+}
+
+parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].reloadTree();");
+parent.mb_registerInitFunctions("window.frames['treeGDE'].loadTree();");
+if(showstatus=='true'||alerterror=='true')
+{
+	parent.mb_registerSubFunctions("window.frames['treeGDE'].init_mapcheck();");
+	init_mapcheck();
+}
+parent.mb_registerSubFunctions("window.frames['treeGDE'].updateScale();");
+
+function imgerror()
+{
+	var map=parent.getMapObjIndexByName(mod_treeGDE_map);
+	var wms=Number(this.id.substr(4));
+	this.onerror=null;
+	this.onabort=null;
+	if(state[wms]!=-1 && alerterror=='true')
+	{
+		state[wms]=-1;	
+		if(confirm('Failed to Load WMS "'+parent.mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+parent.mb_mapObj[map].wms[wms].wms_getmap.substr(0,parent.mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?'))
+		{
+			window.open(this.src,"");
+		}
+	}
+	state[wms]=-1;
+	errors++;
+	if(showstatus=='true')
+		setNodeImage(arrNodes[0][0]+"|"+parent.mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
+}
+
+function checkComplete(wms, map, img, first)
+{
+	if(parent.frames[mod_treeGDE_map].document.getElementById(map).complete)
+	{
+		if(state[wms]!=-1)
+		{
+			var ind=parent.getMapObjIndexByName(mod_treeGDE_map);
+			for(var i=1;i<parent.mb_mapObj[ind].wms[wms].objLayer.length;i++)
+			{
+				if(parent.mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1)
+				{
+					state[wms]=1;
+					if(showstatus=='true')
+						setNodeImage(img);
+					break;
+				}
+			}
+		}
+	}
+	else
+	{
+		if(first)
+		{
+			state[wms]=0;
+			parent.frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
+			parent.frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
+	
+			if(showstatus=='true')
+				setNodeImage(img, "loading_folder.gif");
+		}
+
+		if(state[wms]!=-1)
+			setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);		
+	}
+}
+
+function init_mapcheck(){
+	if(!init)return;
+	errors = 0;
+	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
+	if(!parent.mb_mapObj[ind]||!init)
+	{
+		setTimeout("init_mapcheck();",100);
+		return;
+	}
+	for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++)
+	{
+		var wmsimgid="map_"+wms;
+		if(parent.frames[mod_treeGDE_map].document.getElementById(wmsimgid))
+		{
+			checkComplete(wms, wmsimgid, arrNodes[0][0]+'|'+parent.mb_mapObj[ind].wms[wms].wms_id, true);
+		}
+	}
+}
+
+function handleSelectedLayer(mapObj,wms_id,layername,type,status)
+{
+	var mywms = new Array();
+	mywms[0] = wms_id;
+	var mylayername = new Array();
+	mylayername[0] = layername;
+	parent.handleSelectedLayer_array(mapObj, mywms, mylayername, type, status);
+}
+
+function zoomToLayer(j,k,l)
+{
+	if(!j&&!k&&!l)
+	{
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	var my=parent.mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
+	for(var i=0;i<my.length-1;i++)
+	{
+		if(my[i]["epsg"]==parent.mb_mapObj[j].epsg)
+		{
+			parent.mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
+			var arrayExt = parent.mb_mapObj[j].extent.split(",");
+			parent.mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+			break;
+		}
+	}
+}
+
+function move_up(j,k,l)
+{
+	if(!j&&!k&&!l)
+	{
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1)
+	{
+		alert("You have to select the WMS you want to move up!")		
+		return;
+	}
+	if(l!=0)
+	{
+		if(l==1)
+		{
+			alert("The Layer you selected is already on top of the WMS");
+			return;
+		}
+			
+		var my = parent.mb_mapObj[j];
+		var upperLayers = my.wms[k].objLayer[l-1];
+		my.wms[k].objLayer[l-1] = my.wms[k].objLayer[l];
+		my.wms[k].objLayer[l] = upperLayers;
+
+		//Reload the mapframe by calling zoom function with factor one
+		parent.zoom(my.frameName, true, 1.0);
+		parent.mb_execloadWmsSubFunctions();	
+		return;
+	}
+	var previousWMS=-1;
+	for(var i=k-1;i>=0;i--)
+		if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
+		{
+			previousWMS=i;
+			break;
+		}
+	if(previousWMS==-1)
+	{
+		alert("The selected WMS is already on top!")
+		return;
+	}
+	if (parent.mb_swapWmsByIndex(j, previousWMS, k) == true) 
+	{
+		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
+		parent.mb_execloadWmsSubFunctions();	
+		select(j, previousWMS, 0);
+		selectNode(arrNodes[0][0]+"|"+parent.mb_mapObj[j].wms[previousWMS].wms_id);
+	}
+}
+
+function move_down(j,k,l)
+{
+	if(!j&&!k&&!l)
+	{
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}	
+	if(j==-1||k==-1||l==-1)
+	{
+		alert("You have to select the WMS you want to move down!")		
+		return;
+	}
+	if(l!=0)
+	{
+		var my = parent.mb_mapObj[j];
+		if(selectedLayer==my.wms[k].objLayer.length-1)
+		{
+			alert("The Layer you selected is already on bottom of the WMS");
+			return;
+		}
+			
+		var nextLayers = my.wms[k].objLayer[l+1];
+		my.wms[k].objLayer[l+1] = my.wms[k].objLayer[l];
+		my.wms[k].objLayer[l] = nextLayers;
+
+		//Reload the mapframe by calling zoom function with factor one
+		parent.zoom(my.frameName, true, 1.0);
+		parent.mb_execloadWmsSubFunctions();	
+		return;
+	}
+	var nextWMS=-1;
+	for(var i=k+1;i<parent.mb_mapObj[j].wms.length;i++)
+	{
+		if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
+		{
+			nextWMS=i;
+			break;
+		}
+	}
+	if(nextWMS==-1)
+	{
+		alert("The selected WMS is already on bottom!")
+		return;
+	}
+	if (parent.mb_swapWmsByIndex(j, k, nextWMS) == true) 
+	{
+		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
+		parent.mb_execloadWmsSubFunctions();	
+		select(j, nextWMS, 0);	
+		selectNode(arrNodes[0][0]+"|"+parent.mb_mapObj[j].wms[nextWMS].wms_id);
+	}
+}
+
+function remove_wms(j,k,l)
+{
+	if(!j&&!k&&!l)
+	{
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1)
+	{
+		alert("You have to select the WMS you want to delete!")		
+		return;
+	}
+	if(l!=0)
+	{
+		alert("It is not possible to delete a single layer, please select a WMS!")
+		return;
+	}
+	var visibleWMS=0;
+	for(var i=0;i<parent.mb_mapObj[j].wms.length;i++)
+		if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
+			visibleWMS++;
+	if(visibleWMS<=1)
+	{
+		alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
+		return;
+	}
+	if(confirm('Are you sure you want to remove "'+parent.mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?'))
+	{
+  		parent.mb_mapObjremoveWMS(j,k); 
+		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
+		parent.mb_execloadWmsSubFunctions();	
+	}
+}
+
+function updateParent(path)
+{
+	if(lock)return;
+	lock=true;
+	var state=getChildrenCheckState(path, 0);
+	//enableCheckbox(path, (state!=-1)); //3rd state
+	checkNode(path, 0, (state==1));
+	if(state==0 && showstatus=='true')
+	{
+/*		var arrPath = path.split(jst_delimiter[0])
+		var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
+		for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++)
+		{
+			if(parent.mb_mapObj[ind].wms[wms].wms_id==arrPath[arrPath.length-1])
+				break;
+		}
+*/		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+//		state[wms]=-1;
+	}	
+	lock=false;
+}
+
+function handleSelectedWMS(path)
+{
+	if(lock)return;
+	lock=true;
+	var bChk = IsChecked(path, 0);	
+	enableCheckbox(path, 0, true);
+	checkChildren(path, 0, bChk);
+	if(ficheckbox)checkChildren(path, 1, bChk);
+	if(bChk==false && showstatus=='true')
+		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+	lock=false;
+}
+
+function initArray()
+{
+	var parentObj = "";
+	var controls="";
+	if(parent.mb_mapObj.length > 0){
+		for(var i=0; i<parent.mb_mapObj.length; i++){
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){          
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];     
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){  
+								var c_menu="[";
+								if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
+								if(menu.indexOf("wms_down")!=-1 && ii!=parent.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("hide")!=-1)c_menu+="menu_hide,";
+								c_menu+="]";
+								if(switchwms=='true')
+									addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,"javascript:select("+i+","+ii+","+iii+");",,,,eval(c_menu),'<INPUT type="checkbox" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />',[i,ii,iii]]],false,false);
+								else
+									addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,"javascript:select("+i+","+ii+","+iii+");",,,,eval(c_menu),[i,ii,iii]]],false,false);
+								parentObj = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;              
+							}
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == "0"){
+								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
+									var c_menu="[";
+									if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
+									if(menu.indexOf("layer_down")!=-1 && iii!=parent.mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
+									if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
+									if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
+//									if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
+//									if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
+									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide,";
+									c_menu+="]";
+									
+									controls='<input type="checkbox" '+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);updateParent('"+parentObj+"');"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)":"")+"\" />";
+									if(ficheckbox == 'true')controls+='<input type="checkbox" '+(temp.gui_layer_querylayer=='1'?'checked ':'')+(temp.gui_layer_queryable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)\" />";
+									if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+(temp.layer_metadataurl!=''?temp.layer_metadataurl:'../metadata/'+temp.layer_name+".html")+'" target="'+defaultTarget+'"><img src="'+imagedir+'/info.png" /></a>';
+									if(temp.layer_metadataurl!=''){
+										addNode(parentObj, [temp.layer_name,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?temp.layer_metadataurl:"javascript:select("+i+","+ii+","+iii+");"),((metadatalink=='true'&&wmsbuttons != 'true')?defaultTarget:null),(c_menu!='[]'?'menu.png':null),,eval(c_menu),controls,[i,ii,iii]]],false,false);
+									}else{
+										addNode(parentObj, [temp.layer_name,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?'../metadata/'+temp.layer_name+".html":"javascript:select("+i+","+ii+","+iii+");"),((metadatalink=='true'&&wmsbuttons != 'true')?defaultTarget:null),(c_menu!='[]'?'menu.png':null),,eval(c_menu),controls,[i,ii,iii]]],false, false);
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	init=true;   
+}
+
+function initWmsCheckboxen()
+{
+	var hidden=0;
+	if(parent.mb_mapObj.length > 0){
+		for(var i=0; i<parent.mb_mapObj.length; i++){
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){          
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];     
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){                    
+								updateParent(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id);                  
+							}
+						}
+					}
+					else if(ii<=parent.parseInt(openfolder)+hidden)
+						hidden++;
+				}
+				closeAll()
+				if(openfolder!='false')
+					setState(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[parent.parseInt(openfolder)+hidden].wms_id);
+			}
+		}
+	}
+}
+//-->  
+  </SCRIPT>
+</HEAD>
+<BODY VLINK="#000000" ALINK="#000000" LINK="#000000" BGCOLOR="#ffffff" TEXT="#000000"
+ MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">
+<SCRIPT language="JavaScript" type="text/javascript">
+if(wmsbuttons=='true')
+{
+	document.writeln("<div>"); 
+	document.writeln('<a href="javascript:move_up()"><img src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>'); 
+	document.writeln('<a href="javascript:move_down()"><img src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>'); 
+	document.writeln('<a href="javascript:remove_wms()"><img src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>'); 
+	document.writeln("</div>"); 
+}
+</SCRIPT>
+<DIV id="treeContainer"></DIV>
+</BODY>
+</HTML>

Added: trunk/mapbender/http/img/tree_new/branch.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/branch.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/closed.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/closed.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/closed_folder.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/closed_folder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/delete_wms.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/delete_wms.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/delete_wmsmy.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/delete_wmsmy.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/error.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/error.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/error_folder.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/error_folder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/expanded.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/expanded.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/expanded_error.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/expanded_error.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/expanded_folder.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/expanded_folder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/hide.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/hide.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/info.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/info.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/last_closed.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/last_closed.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/last_expanded.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/last_expanded.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/last_leaf.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/last_leaf.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/leaf.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/leaf.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/loading_folder.gif
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/loading_folder.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/menu.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/menu.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/move_down.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/move_down.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/move_downmy.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/move_downmy.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/move_up.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/move_up.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/move_upmy.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/move_upmy.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/img/tree_new/zoom.png
===================================================================
(Binary files differ)


Property changes on: trunk/mapbender/http/img/tree_new/zoom.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/mapbender/http/javascripts/jsTree.js
===================================================================
--- trunk/mapbender/http/javascripts/jsTree.js	2007-01-22 01:17:20 UTC (rev 1016)
+++ trunk/mapbender/http/javascripts/jsTree.js	2007-01-22 01:25:00 UTC (rev 1017)
@@ -0,0 +1,670 @@
+/***************************************************************
+*  $Id: jsTree.js 855 2006-11-20 14:06:28Z 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) || !isExpanded(tr))
+						tr.firstChild.firstChild.onclick()
+						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;
+					}
+					return true
+					
+					
+				}else{
+					ps = ps + "[" + d + "][2]"
+				}
+				break
+
+			}
+	}
+	return false
+}
+
+function addNode(path, nd, sel, refresh){
+	if(_editDataNode("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; 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 tr = getDomNode(jst_state_paths[p])
+		
+		if(tr){
+			var f1 = tr.firstChild
+			if(f1){
+				var f2 = f1.firstChild
+				if(!isExpanded(tr) && f2)
+					if(f2.onclick)
+						f2.onclick()
+			}
+		}
+	}
+}
+
+function rebuildNode(path, parent){
+	if(parent){
+		var arrPath = path.split(jst_delimiter[0])
+		arrPath.pop()
+		path = arrPath.join(jst_delimiter[0])
+	}
+	
+	if(path == ""){
+		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;
+
+	for(var p = 0; p < parts.length; p++){
+		arrData = eval(ps);
+		for(var d = 0; d < arrData.length; d++){
+			if(parts[p] == arrData[d][0]){
+				if(p == parts.length - 1){
+					eval(ps)[d][1][3]=Img;
+					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(eval(ps)[d][2]){
+								if(childExists(nd)){
+									var s = nd.nextSibling.style
+									if(s.display == ""){
+										cb.src = jst_image_folder + "/expanded_folder.png";
+									}else{
+										cb.src = jst_image_folder + "/closed_folder.png";
+									}
+								}else{
+									cb.src = jst_image_folder + "/expanded_folder.png";
+								}
+							}
+							else
+								rebuildNode(path, true);
+						}
+						else 
+							rebuildNode(path, true);
+					}
+					return true
+				}else{
+					ps = ps + "[" + d + "][2]"
+				}
+				break;
+			}
+		}
+	}
+	return false
+}
+
+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))nd.firstChild.firstChild.onclick();
+	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))nd.firstChild.firstChild.onclick();
+	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();}	
+//TODO DataNode anpassen
+		}		
+	}
+	return true;
+}
+
+function checkNode(path, ctrlNr, bChk){
+	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.checked = bChk;
+			if(cb.onclick)cb.onclick();
+//TODO DataNode anpassen
+			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;
+//TODO DataNode anpassen
+			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){
+	try{
+		return tr.nextSibling.childNodes[1].firstChild.nodeName == "TABLE"
+	}catch(e){
+		return false
+	}
+}
+
+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 ? "" : "last_")
+
+			if(s.display == ""){
+				s.display = "none"
+				ctlImg.src = img1 + "closed.png"
+				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 + "/closed_folder.png";
+			}else{
+				s.display = ""
+				ctlImg.src = img1 + "expanded.png"
+				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 + "/expanded_folder.png";
+			}
+			return
+		}else{
+			ctlImg.src = jst_image_folder + "/" + (tr.nextSibling ? "" : "last_") + "expanded.png"
+			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 + "/expanded_folder.png";
+		}
+	}
+
+	var newTr = tr.parentNode.insertRow((tr.rowIndex?tr.rowIndex:0) + 1)
+
+	newTr.appendChild(document.createElement('td'))
+	newTr.appendChild(document.createElement('td'))
+		
+	if(newTr.nextSibling)
+		newTr.firstChild.setAttribute("background", jst_image_folder + "/branch.png", "false")
+	
+	newTr.childNodes[1].innerHTML = renderChildren(strData)
+
+	jst_loaded = true
+}
+
+function renderChildren(strData, tblCls, menu){
+
+	var code = Array()
+
+	code.push('<table 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 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 ? "last_leaf" : "leaf") + '.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" onClick="showMenu(\'' + strData + '[' + n + ']\', this, event)"' : '') + ' src="' + jst_image_folder + '/' + (n1 ? (n0[1][3]?n0[1][3]:"closed_folder") : n0[1][3] ? n0[1][3] : "node") + '" alt="">':'')+((n0[1][6]&&((strData != jst_data)||jst_display_root))?n0[1][6]:'')+'<a class="node"'  + (((strData == jst_data)&&!jst_display_root) ? ' style="display:none"' : '')+ (n0[1][4] ? ' title="' + n0[1][4] + '"' : '') + ' 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]  + '</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)
+	
+	jst_cm.style.top = offY + event.clientY
+	jst_cm.style.left = offX + event.clientX
+	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);
+}

Modified: trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js	2007-01-22 01:17:20 UTC (rev 1016)
+++ trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js	2007-01-22 01:25:00 UTC (rev 1017)
@@ -4,6 +4,5 @@
 
 function mod_addWMS_refresh(){
 	mb_mapObjaddWMS('mapframe1')
-	window.frames['treeGDE'].document.location.reload();
 	zoom('mapframe1', true, 0.999);
 }
\ No newline at end of file



More information about the Mapbender_commits mailing list