[Mapbender-commits] r1086 - trunk/mapbender/http/html

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 29 16:12:46 EST 2007


Author: nimix
Date: 2007-01-29 16:12:45 -0500 (Mon, 29 Jan 2007)
New Revision: 1086

Modified:
   trunk/mapbender/http/html/mod_treefolder2.php
Log:
correct menu element_var handeling and implement correct resetting of the tree state after moving a layer/WMS

Modified: trunk/mapbender/http/html/mod_treefolder2.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolder2.php	2007-01-29 14:10:20 UTC (rev 1085)
+++ trunk/mapbender/http/html/mod_treefolder2.php	2007-01-29 21:12:45 UTC (rev 1086)
@@ -1,5 +1,5 @@
 <?php
-# $Id:
+# $Id$
 # http://www.mapbender.org/index.php/Mod_treefolder2.php
 # Copyright (C) 2007 Melchior Moos
 # 
@@ -64,6 +64,7 @@
 var init=false;
 var errors = 0;
 var state=Array();
+var treeState = "";
 var arrNodes = 
 [
 	['root_id', ['Layer','javascript:_foo()']
@@ -82,7 +83,6 @@
 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']];
@@ -313,8 +313,11 @@
 		my.wms[k].objLayer[l] = upperLayers;
 
 		//Reload the mapframe by calling zoom function with factor one
+		treeState = getState();
 		parent.zoom(my.frameName, true, 1.0);
 		parent.mb_execloadWmsSubFunctions();	
+		select(j, k, l-1);
+		selectNode(arrNodes[0][0]+"|"+my.wms[k].wms_id+"|"+my.wms[k].objLayer[l-1].layer_name);
 		return;
 	}
 	var previousWMS=-1;
@@ -328,6 +331,7 @@
 		return;
 	}
 	if (parent.mb_swapWmsByIndex(j, previousWMS, k) == true){
+		treeState = getState();
 		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
 		parent.mb_execloadWmsSubFunctions();	
 		select(j, previousWMS, 0);
@@ -357,8 +361,11 @@
 		my.wms[k].objLayer[l] = nextLayers;
 
 		//Reload the mapframe by calling zoom function with factor one
+		treeState = getState();
 		parent.zoom(my.frameName, true, 1.0);
-		parent.mb_execloadWmsSubFunctions();	
+		parent.mb_execloadWmsSubFunctions();
+		select(j, k, l+1);
+		selectNode(arrNodes[0][0]+"|"+my.wms[k].wms_id+"|"+my.wms[k].objLayer[l+1].layer_name);
 		return;
 	}
 	var nextWMS=-1;
@@ -373,6 +380,7 @@
 		return;
 	}
 	if (parent.mb_swapWmsByIndex(j, k, nextWMS) == true){
+		treeState = getState();
 		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
 		parent.mb_execloadWmsSubFunctions();	
 		select(j, nextWMS, 0);	
@@ -514,7 +522,9 @@
 						hidden++;
 				}
 				closeAll()
-				if(openfolder!='false')
+				if(treeState!='')
+					setState(treeState);
+				else if(openfolder!='false')
 					setState(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[parent.parseInt(openfolder)+hidden].wms_id);
 			}
 		}



More information about the Mapbender_commits mailing list