#!/usr/local/bin/perl # Show the LDAP tree in a popup browser window, for selecting something $trust_unknown_referers = 1; require './ldap-client-lib.pl'; &popup_header($text{'browser_title'}); &ReadParse(); # Connect to LDAP server, or die trying $ldap = &ldap_connect(1); if (!ref($ldap)) { print &text('browser_econn', $ldap),"
\n"; &popup_footer(); exit; } # Work out the base (current navigation level) if ($in{'parent'}) { $base = $in{'parent'}; } elsif (!$in{'base'}) { $conf = &get_config(); $base = &find_value("base", $conf); } else { $base = $in{'base'}; } # Javascript to update original field print "\n"; # Find the actual base object $rv2 = $ldap->search(base => $base, filter => '(objectClass=*)', score => 'base'); if (!$rv2->code) { ($bo) = $rv2->all_entries; ($top) = grep { $_ eq "top" } $bo->get_value("objectClass"); } # Show current base (with option to change), and parent button print &ui_form_start("popup_browser.cgi"),"\n"; print &ui_hidden("node", $in{'node'}),"\n"; print "$text{'browser_base'}\n"; print &ui_textbox("base", $base, 40)," ",&ui_submit($text{'browser_ok'}),"\n"; $parent = $base; $parent =~ s/^[^,]+,\s*//; # Show the OK button only if the object type is appropriatye if ($in{'node'} == 0 && $top || $in{'node'} == 1 && !$top || $in{'node'} == 2) { print "\n"; } print &ui_form_end(); # Find sub-objects $rv = $ldap->search(base => $base, filter => '(objectClass=*)', scope => 'one'); if ($rv->code) { # Search failed print &text('browser_esearch', $rv->error),"
\n"; &popup_footer(); exit; } print "
", &html_escape($parent)," | ||
dn()). "'>", " ",&html_escape($dn->dn())," | ||
$a | : | ", join(" , ", @v)," |