[Mapbender-commits] r2975 - branches/nimix_dev/http/html

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Sep 18 08:58:42 EDT 2008


Author: nimix
Date: 2008-09-18 08:58:42 -0400 (Thu, 18 Sep 2008)
New Revision: 2975

Modified:
   branches/nimix_dev/http/html/mod_treefolder2.php
Log:
precise some comments

Modified: branches/nimix_dev/http/html/mod_treefolder2.php
===================================================================
--- branches/nimix_dev/http/html/mod_treefolder2.php	2008-09-18 12:37:07 UTC (rev 2974)
+++ branches/nimix_dev/http/html/mod_treefolder2.php	2008-09-18 12:58:42 UTC (rev 2975)
@@ -80,13 +80,15 @@
 $sql = "SELECT * FROM gui_treegde WHERE fkey_gui_id = $1 ORDER BY lft;";
 $v = array($_SESSION["mb_user_gui"]);
 $t = array("s");
-$nr = array();
-$str = array();
-$categories = array();
-$path = array();
-$rights = array();
-$cnt = 0;
 $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
@@ -103,7 +105,7 @@
 		array_pop($path);
 	}
 
-	//set path for each wms that is referenced in this leaf
+	//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']!=""){
@@ -111,11 +113,13 @@
 			array_push($categories, "'wms_".$wms."':\"root_id|".implode("|", $path)."\"");
 		}
 	}
-	$cnt++;
 }
 //if we have a configured structure output it
-if($cnt>0){
+if(count($str)>0){
+	//order js array elements
 	array_multisort($nr, $str);
+	
+	//output javascript vars
 	echo "var arrNodesStr = \"[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];\";\n";
 	echo "var categories = {".implode(",", $categories)."};\n";
 }



More information about the Mapbender_commits mailing list