Handle hostnames with upper-case letters
[webmin.git] / majordomo / edit_subs.cgi
1 #!/usr/local/bin/perl
2 # edit_subs.cgi
3 # Edit subscription options
4
5 require './majordomo-lib.pl';
6 &ReadParse();
7 %access = &get_module_acl();
8 &can_edit_list(\%access, $in{'name'}) || &error($text{'edit_ecannot'});
9 $list = &get_list($in{'name'}, &get_config());
10 $conf = &get_list_config($list->{'config'});
11 $desc = &text('edit_for', "<tt>".&html_escape($in{'name'})."</tt>");
12 &ui_print_header($desc, $text{'subs_title'}, "");
13
14 print "<form action=save_subs.cgi>\n";
15 print "<input type=hidden name=name value='$in{'name'}'>\n";
16 print "<table border width=100%>\n";
17 print "<tr $tb> <td><b>$text{'subs_header'}</b></td> </tr>\n";
18 print "<tr $cb> <td><table>\n";
19
20 $pol = &find_value("subscribe_policy", $conf);
21 if ($pol =~ /(\S+)\+confirm/) { $pol = $1; $confirm = 1; }
22 print "<tr> <td><b>$text{'subs_sub'}</b></td> <td colspan=3 nowrap>\n";
23 printf "<input name=subscribe_policy type=radio value=open %s> %s\n",
24         $pol eq "open" ? "checked" : "", $text{'subs_sopen'};
25 printf "<input name=subscribe_policy type=radio value=auto %s> %s\n",
26         $pol eq "auto" ? "checked" : "", $text{'subs_sauto'};
27 printf "<input name=subscribe_policy type=radio value=closed %s> %s\n",
28         $pol eq "closed" ? "checked" : "", $text{'subs_closed'};
29 print "</td> </tr>\n";
30
31 $upol = &find_value("unsubscribe_policy", $conf);
32 print "<tr> <td><b>$text{'subs_unsub'}</b></td> <td colspan=3 nowrap>\n";
33 printf "<input name=unsubscribe_policy type=radio value=open %s> %s\n",
34         $upol eq "open" ? "checked" : "", $text{'subs_uopen'};
35 printf "<input name=unsubscribe_policy type=radio value=auto %s> %s\n",
36         $upol eq "auto" ? "checked" : "", $text{'subs_uauto'};
37 printf "<input name=unsubscribe_policy type=radio value=closed %s> %s\n",
38         $upol eq "closed" ? "checked" : "", $text{'subs_closed'};
39 print "</td> </tr>\n";
40
41 print "<tr> <td><b>$text{'subs_confirm'}</b></td> <td>\n";
42 printf "<input name=subscribe_policy_c type=radio value='+confirm' %s> %s\n",
43         $confirm ? "checked" : "", $text{'yes'};
44 printf "<input name=subscribe_policy_c type=radio value='' %s> %s</td>\n",
45         $confirm ? "" : "checked", $text{'no'};
46 print &choice_input("welcome", $text{'subs_welcome'}, $conf,
47                     "yes", $text{'yes'}, "no", $text{'no'});
48 print "</tr>\n";
49
50 print "<tr>\n";
51 print &choice_input("strip", $text{'subs_strip'}, $conf,
52                     "yes", $text{'yes'}, "no", $text{'no'});
53 print &choice_input("announcements", $text{'subs_announcements'},
54                     $conf, "yes", $text{'yes'}, "no", $text{'no'});
55 print "</tr>\n";
56
57 print "<tr>\n";
58 print &choice_input("administrivia", $text{'subs_administrivia'},
59                     $conf, "yes", $text{'yes'}, "no", $text{'no'});
60 print &opt_input("admin_passwd", $text{'subs_passwd'}, $conf,
61                  $text{'default'}, 10);
62 print "</tr>\n";
63
64 print "<tr> <td colspan=4><hr></td> </tr>\n";
65 print "<tr>\n";
66 print &choice_input("moderate", $text{'subs_moderate'}, $conf,
67                     "yes", $text{'yes'}, "no", $text{'no'});
68 print &opt_input("moderator", $text{'subs_moderator'}, $conf,
69                  $text{'subs_maint'}, 20);
70 print "</tr>\n";
71
72 print "<tr>\n";
73 print &opt_input("approve_passwd", $text{'subs_mpasswd'}, $conf,
74                  $text{'default'}, 10);
75 print "</tr>\n";
76
77 print "<tr> <td colspan=4><hr></td> </tr>\n";
78 $aliases_files = &get_aliases_file();
79 @aliases = &foreign_call($aliases_module, "list_aliases", $aliases_files);
80 foreach $a (@aliases) {
81         $owner = $a->{'value'}
82                 if (lc($a->{'name'}) eq lc("$in{'name'}-owner") ||
83                     lc($a->{'name'}) eq lc("owner-$in{'name'}"));
84         $approval = $a->{'value'}
85                 if (lc($a->{'name'}) eq lc("$in{'name'}-approval"));
86         }
87 print "<tr> <td><b>$text{'subs_owner'}</b></td>\n";
88 print "<td><input name=owner size=20 value='$owner'></td>\n";
89
90 print "<td><b>$text{'subs_approval'}</b></td>\n";
91 print "<td><input name=approval size=20 value='$approval'></td> </tr>\n";
92
93 print "</table></td></tr></table>\n";
94 print "<input type=submit value=\"$text{'save'}\"></form>\n";
95
96 &ui_print_footer("edit_list.cgi?name=$in{'name'}", $text{'edit_return'});
97