Ejemplo n.º 1
0
function browse_groups_for_ou()
{
    $DN = url_decode_special_tool($_GET["browse-dn"]);
    $t = $_GET["t"];
    $function = $_GET["function"];
    $field_user = $_GET["field-user"];
    $tpl = new templates();
    $ad = new external_ad_search();
    $ous = $ad->SearchOuSimple($DN);
    $id_root = md5($DN . "1");
    $style = " style='font-size:13px' OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    if (count($ous) > 0) {
        $f[] = "<ul id='ou-{$id_root}' class='jqueryFileTree'>";
        while (list($dn, $ounameArray) = each($ous)) {
            $CLASS = "ou";
            $ouname = $ounameArray["NAME"];
            if (isset($ounameArray["objectClass"]["container"])) {
                $CLASS = "container";
            }
            $id = md5("{$ouname}{$dn}");
            $js = texttooltip("{$ouname}", $ouname, "TreeOuExpand{$t}('{$id}','{$dn}');");
            $f[] = "<li class={$CLASS} collapsed id='{$id}' {$style}>{$js}</li>";
        }
        $f[] = "</ul>";
    }
    $groups = $ad->searchGroupSimple($DN);
    if (count($groups) > 0) {
        $f[] = "<ul id='group-{$id_root}' class='jqueryFileTree'>";
        ksort($groups);
        $group = $tpl->_ENGINE_parse_body("{group2}");
        while (list($dnsearch, $groupname) = each($groups)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$num} -> {$groupname}<br>\n";
            }
            $id = md5($dnsearch);
            $CLASS = "group";
            $f[] = "<li class={$CLASS} collapsed id='{$id}' >\n\t\t\t<a href=\"#\" \n\t\t\tOnClick=\"javascript:DirectPan('{$dnsearch}');\"\n\t\t\t{$style}>{$groupname}</a>\n\t\t\t</li>";
        }
        $f[] = "</ul>";
    }
    echo @implode("\n", $f);
}