[Mapbender-commits] r2925 - in branches/nimix_dev/http: html javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Sep 11 10:35:05 EDT 2008


Author: nimix
Date: 2008-09-11 10:35:05 -0400 (Thu, 11 Sep 2008)
New Revision: 2925

Modified:
   branches/nimix_dev/http/html/mod_treefolder2.php
   branches/nimix_dev/http/javascripts/jsTree.js
Log:
add update of checkboxes after each map request and speedup jstree lib to handle it

Modified: branches/nimix_dev/http/html/mod_treefolder2.php
===================================================================
--- branches/nimix_dev/http/html/mod_treefolder2.php	2008-09-11 14:33:48 UTC (rev 2924)
+++ branches/nimix_dev/http/html/mod_treefolder2.php	2008-09-11 14:35:05 UTC (rev 2925)
@@ -137,6 +137,8 @@
 	init_mapcheck();
 }
 parent.eventAfterMapRequest.register(updateScale);
+parent.eventAfterMapRequest.register(updateCheckState);
+
 if(wmsbuttons != "true")
 	jst_highlight = false;
 
@@ -206,6 +208,27 @@
 	}	
 }
 
+function updateCheckState(){
+	if(!init||lock_check)return;
+	lock_check=true;
+	for(var i=0; i<parent.mb_mapObj.length; i++){
+		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+					if(!parent.mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
+						path = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id;
+						checkNode(path, 0, parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible=='1', false);
+						if(ficheckbox == 'true')
+							checkNode(path, 1, parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer=='1', false);	
+					}
+				}
+			}
+		}
+	}
+	lock_check=false;
+}
+
 function operaLoad(){
 	initArray();
 	renderTree();
@@ -478,9 +501,9 @@
 		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
 	if(reset_lock)
 	{
-		lock_check=false;
 		parent.mb_restateLayers(mod_treeGDE_map,t[t.length-1]);
 		parent.setSingleMapRequest(mod_treeGDE_map,t[t.length-1]);
+		lock_check=false;
 	}
 }
 
@@ -493,10 +516,10 @@
 	checkChildren(path, box, bChk);
 	if(reset_lock){
 		var t = path.split("|");
-		lock_check=false;
 		parent.mb_restateLayers(mod_treeGDE_map,t[1]);
 		if(box==0)
 			parent.setSingleMapRequest(mod_treeGDE_map,t[1]);
+		lock_check=false;
 	}
 }
 

Modified: branches/nimix_dev/http/javascripts/jsTree.js
===================================================================
--- branches/nimix_dev/http/javascripts/jsTree.js	2008-09-11 14:33:48 UTC (rev 2924)
+++ branches/nimix_dev/http/javascripts/jsTree.js	2008-09-11 14:35:05 UTC (rev 2925)
@@ -422,15 +422,17 @@
 	return true;
 }
 
-function checkNode(path, ctrlNr, bChk){
+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)cb.onclick();
+			if(cb.onclick&&triggerOnclick)cb.onclick();
 //TODO DataNode anpassen
 			return true;
 		}
@@ -519,12 +521,12 @@
 }
 
 function childExists(tr){
-	try{
-		return tr.nextSibling.childNodes[1].firstChild.nodeName == "TABLE"
-	}catch(e){
-		return false
+	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){



More information about the Mapbender_commits mailing list