2 # Show the LDAP server's data tree
4 require './ldap-client-lib.pl';
5 &ui_print_header(undef, $text{'browser_title'}, "", "browser");
8 # Connect to LDAP server, or die trying
9 $ldap = &ldap_connect(1);
11 print &text('browser_econn', $ldap),"<p>\n";
12 &ui_print_footer("", $text{'index_return'});
16 # Work out the base (current navigation level)
17 if ($in{'goparent'}) {
18 $base = $in{'parent'};
20 elsif (!$in{'base'}) {
21 $conf = &get_config();
22 $base = &find_value("base", $conf);
28 # Show current base (with option to change), and parent button
29 print &ui_form_start("browser.cgi"),"\n";
30 print "<b>$text{'browser_base'}</b>\n";
31 print &ui_textbox("base", $base, 60)," ",&ui_submit($text{'browser_ok'}),"\n";
33 $parent =~ s/^[^,]+,\s*//;
34 if ($parent =~ /\S/) {
35 print &ui_hidden("parent", $parent),"\n";
36 print " \n";
37 print &ui_submit($text{'browser_parent'}, "goparent"),"\n";
41 # Show list of objects under the base, and its attributes
42 $rv = $ldap->search(base => $base,
43 filter => '(objectClass=*)',
47 print &text('browser_esearch', $rv->error),"<p>\n";
50 print "<table width=100%><tr>\n";
51 print "<td width=50%><b>$text{'browser_subs'}</b></td>\n";
52 print "<td width=50%><b>$text{'browser_attrs'}</b></td>\n";
53 print "</tr> <tr><td width=50% valign=top>\n";
56 foreach $dn (sort { lc($a->dn()) cmp lc($b->dn()) } $rv->all_entries) {
57 print "<a href='browser.cgi?base=".&urlize($dn->dn())."'>".
58 &html_escape($dn->dn())."</a><br>\n";
60 if (!$rv->all_entries) {
61 print "<i>$text{'browser_none'}</i><br>\n";
64 print "</td><td width=50% valign=top>\n";
68 $rv2 = $ldap->search(base => $base,
69 filter => '(objectClass=*)',
71 ($bo) = $rv2->all_entries;
72 foreach $a (sort { lc($a) cmp lc($b) } $bo->attributes()) {
73 @v = $bo->get_value($a);
74 print "<tr> <td>$a</td> <td>:</td> <td>",
75 join(" , ", @v),"</td> </tr>\n";
77 if (!$bo->attributes()) {
78 print "<tr> <td><i>$text{'browser_none'}</i></td> </tr>\n";
82 print "</td></tr></table>\n";
86 &ui_print_footer("", $text{'index_return'});