Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / list_times.cgi
1 #!/usr/bin/perl
2 # list_times.cgi
3 # Display a list of time ranges that can be used in rules
4
5 require './itsecur-lib.pl';
6 &can_use_error("times");
7 &header($text{'times_title'}, "",
8         undef, undef, undef, undef, &apply_button());
9 print "<hr>\n";
10
11 @times = &list_times();
12 $edit = &can_edit("times");
13 if (@times) {
14         print "<a href='edit_time.cgi?new=1'>$text{'times_add'}</a><br>\n"
15                 if ($edit);
16         print "<table border>\n";
17         print "<tr $tb> <td><b>$text{'times_name'}</b></td> ",
18               "<td><b>$text{'times_hours'}</b></td> ",
19               "<td><b>$text{'times_days'}</b></td> </tr>\n";
20         foreach $t (@times) {
21                 print "<tr $cb>\n";
22                 print "<td><a href='edit_time.cgi?idx=$t->{'index'}'>",
23                       "$t->{'name'}</a></td>\n";
24                 print "<td>",$t->{'hours'} eq "*" ? $text{'times_all'} :
25                                                     $t->{'hours'},"</td>\n";
26                 print "<td>",$t->{'days'} eq "*" ? $text{'times_all'} :
27                         join(" ", map { $text{'sday_'.$_} } split(/,/, $t->{'days'})),"</td>\n";
28                 print "</tr>\n";
29                 }
30         print "</table>\n";
31         }
32 else {
33         print "<b>$text{'times_none'}</b><p>\n";
34         }
35 print "<a href='edit_time.cgi?new=1'>$text{'times_add'}</a><p>\n"
36         if ($edit);
37
38 print "<hr>\n";
39 &footer("", $text{'index_return'});
40