Handle hostnames with upper-case letters
[webmin.git] / hpuxexports / index.cgi
1 #!/usr/local/bin/perl
2 # index.cgi
3 # Display a list of directories and their client(s)
4
5 $| = 1;
6 require './exports-lib.pl';
7 &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1);
8
9 if (!&has_nfs_commands()) {
10         print "<p>",$text{'index_eprog'},"<p>\n";
11         &ui_print_footer("/", $text{'index'});
12         exit;
13         }
14
15 @exps = &list_exports();
16 if (@exps) {
17         @dirs = &unique(map { $_->{'dir'} } @exps);
18         if ($access{'icons'}) {
19                 # Display icons for exports
20                 foreach $d (@dirs) {
21                         @cl = grep { $_->{'dir'} eq $d } @exps;
22                         foreach $c (@cl) {
23                                 push(@icons, "images/export.gif");
24                                 local $desc = &describe_host($c->{'host'});
25                                 if ($c->{'active'}) {
26                                         push(@titles, $d.'<br>'.$desc);
27                                         }
28                                 else {
29                                         push(@titles, '<font color=#ff0000>'.
30                                              $d.'<br>'.$desc.'</font>');
31                                         }
32                                 push(@links,
33                                      "edit_export.cgi?idx=$c->{'index'}");
34                                 }
35                         }
36                 &icons_table(\@links, \@titles, \@icons);
37                 }
38         else {
39                 # Display table of exports and clients
40                 print "<table border width=100%>\n";
41                 print "<tr $tb> <td><b>$text{'index_dir'}</b></td> ",
42                       "<td><b>$text{'index_to'}</b></td> </tr>\n";
43                 foreach $d (@dirs) {
44                         print "<tr $cb> <td valign=top>$d</td>\n";
45                         print "<td>\n";
46                         @cl = grep { $_->{'dir'} eq $d } @exps;
47                         $ccount = 0;
48                         foreach $c (@cl) {
49                                 print "&nbsp;|&nbsp; " if ($ccount++);
50                                 print "<a href=\"edit_export.cgi?idx=$c->{'index'}\">",&describe_host($c->{'host'}),"</a>\n";
51                                 print "<font color=#ff0000>($text{'index_inactive'})","</font>\n" if (!$c->{'active'});
52                                 }
53                         print "</td> </tr>\n";
54                         }
55                 print "</table>\n";
56                 }
57         }
58 else {
59         print "<b>$text{'index_none'}</b> <p>\n";
60         }
61 print "<a href=\"edit_export.cgi?new=1\">$text{'index_add'}</a> <p>\n";
62
63 print &ui_hr();
64 print "<table width=100%> <tr>\n";
65 print "<td><form action=restart_mountd.cgi>\n";
66 print "<input type=submit value=\"$text{'index_apply'}\">\n";
67 print "</form></td>\n";
68 print "<td valign=top>$text{'index_applymsg'}</td>\n";
69 print "</tr> <tr> </table>\n";
70
71 &ui_print_footer("/", $text{'index'});
72