diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 9ed4006ca0..9779bc3682 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -1049,4 +1049,119 @@ class html } return $html; } + + /** + * tree widget using dhtmlXtree + * + * Code inspired by Lars's Felamimail uiwidgets::createFolderTree() + * + * @author Lars Kneschke original code in felamimail + * @param array $_folders array of folders: pairs path => node (string label or array with keys: label, (optional) image, (optional) title, (optional) checked) + * @param string $_selected path of selected folder + * @param mixed $_topFolder=false node of topFolder or false for none + * @param string $_onNodeSelect='alert' js function to call if node gets selected + * @param string $_divId='foldertree' id of the div + * @param string $_divClass='' css class of the div + * @param string $_leafImage='' default image of a leaf-node, ''=default of foldertree, set it eg. 'folderClosed.gif' to show leafs as folders + * @param boolean/string $_onCheckHandler=false string with handler-name to display a checkbox for each folder, or false (default) + * @param string $delimiter='/' path-delimiter, default / + * + * @return string the html code, to be added into the template + */ + function tree($_folders,$_selected,$_topFolder=false,$_onNodeSelect="null",$_divId='foldertree',$_divClass='',$_leafImage='',$_onCheckHandler=false,$delimiter='/') + { + $folderImageDir = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/default/images/'; + + $html = $this->div("\n",'id="'.$_divId.'"',$_divClass); + + static $tree_initialised=false; + if (!$tree_initialised) + { + $html .= ''."\n"; + $html .= "\n"; + $html .= "\n"; + $tree_initialised = true; + } + $html .= "\n"; + + return $html; + } }