Handle hostnames with upper-case letters
[webmin.git] / sendmail / list_features.cgi
1 #!/usr/local/bin/perl
2 # list_features.cgi
3 # Display a list of all sendmail features from the M4 file
4
5 require './sendmail-lib.pl';
6 require './features-lib.pl';
7
8 $features_access || &error($text{'features_ecannot'});
9 &ui_print_header(undef, $text{'features_title'}, "");
10
11 @features = &list_features() if (-r $config{'sendmail_mc'} &&
12                                  -r "$config{'sendmail_features'}/feature");
13 if (@features) {
14         # Show table of features
15         print &text('features_desc', "<tt>$config{'sendmail_mc'}</tt>",
16                     "<tt>$config{'sendmail_cf'}</tt>"),"<p>\n";
17         print "<form action=edit_feature.cgi>\n";
18         print "<input type=hidden name=new value=1>\n";
19         print "<table cellpadding=0 cellspacing=0 width=100%>\n";
20         print "<tr $tb> <td><b>$text{'features_type'}</b></td>\n";
21         print "<td><b>$text{'features_value'}</b></td>\n";
22         print "<td><b>$text{'features_move'}</b></td> </tr>\n";
23         local $i = 0;
24         foreach $f (@features) {
25                 print "<tr $cb>\n";
26                 print "<td><a href='edit_feature.cgi?idx=$f->{'index'}'>";
27                 print "<b>" if ($f->{'type'});
28                 print $text{"features_type".$f->{'type'}};
29                 print "</b>" if ($f->{'type'});
30                 print "</a></td>\n";
31                 print "<td><tt>",$f->{'text'} ? &html_escape($f->{'text'})
32                                               : "<br>","</tt></td>\n";
33                 print "</tt></td>\n";
34                 print "<td>";
35                 if ($i == @features-1) {
36                         print "<img src=images/gap.gif>";
37                         }
38                 else {
39                         print "<a href='move.cgi?idx=$i&down=1'>",
40                               "<img border=0 src=images/down.gif></a>";
41                         }
42                 if ($i == 0) {
43                         print "<img src=images/gap.gif>";
44                         }
45                 else {
46                         print "<a href='move.cgi?idx=$i&up=1'>",
47                               "<img border=0 src=images/up.gif></a>";
48                         }
49                 print "</td>\n";
50                 print "</tr>\n";
51                 $i++;
52                 }
53         print "</table>\n";
54         print "<table width=100%><tr><td>\n";
55         print "<input type=submit value='$text{'features_add'}'>\n";
56         print "<select name=type>\n";
57         foreach $i (0, 1, 2, 4, 5) {
58                 print "<option value=$i>",$text{'features_type'.$i},"\n";
59                 }
60         print "</select></td>\n";
61         print "<td align=right><input type=submit name=manual ",
62               "value='$text{'features_manual'}'></td>\n";
63         print "</tr></table></form>\n";
64
65         # Show button to rebuild sendmail.cf
66         print &ui_hr();
67         print "<form action=build.cgi>\n";
68         print "<table width=100%><tr>\n";
69         print "<td><input type=submit value='$text{'features_build'}'></td>\n";
70         print "<td>",&text('features_buildmsg', "<tt>$config{'sendmail_cf'}</tt>"),
71               "</td>\n";
72         print "</tr></table>\n";
73         }
74 else {
75         # Features file is not setup yet ..
76         if (!$config{'sendmail_mc'} || !$config{'sendmail_features'}) {
77                 print "<p>",&text('features_econfig',
78                                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
79                 }
80         elsif (!-r $config{'sendmail_mc'}) {
81                 print "<p>",&text('features_emc', "$gconfig{'webprefix'}/config.cgi?$module_name",
82                                   "<tt>$config{'sendmail_mc'}</tt>"),"<p>\n";
83                 }
84         elsif (!-r "$config{'sendmail_features'}/feature") {
85                 print "<p>",&text('features_efeatures', "$gconfig{'webprefix'}/config.cgi?$module_name",
86                                   "<tt>$config{'sendmail_features'}</tt>"),"<p>\n";
87                 }
88         }
89
90 &ui_print_footer("", $text{'index_return'});
91