Handle hostnames with upper-case letters
[webmin.git] / majordomo / acl_security.pl
1
2 require 'majordomo-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the majordomo module
6 sub acl_security_form
7 {
8 local $conf = &get_config();
9 local @lists = &list_lists($conf);
10 print "<tr> <td valign=top rowspan=3><b>$text{'acl_lists'}</b></td>\n";
11 print "<td rowspan=3 valign=top>\n";
12 printf "<input type=radio name=lists_def value=1 %s> %s\n",
13         $_[0]->{'lists'} eq '*' ? 'checked' : '', $text{'acl_lall'};
14 printf "<input type=radio name=lists_def value=0 %s> %s<br>\n",
15         $_[0]->{'lists'} eq '*' ? '' : 'checked', $text{'acl_lsel'};
16 print "<select name=lists multiple size=3 width=150>\n";
17 local (%lcan, $l);
18 map { $lcan{$_}++ } split(/\s+/, $_[0]->{'lists'});
19 foreach $l (@lists) {
20         printf "<option %s>%s\n",
21                 $lcan{$l} ? "selected" : "", $l;
22         }
23 print "</select></td>\n";
24
25 print "<td><b>$text{'acl_global'}</b></td> <td>\n";
26 printf "<input type=radio name=global value=1 %s> $text{'yes'}\n",
27         $_[0]->{'global'} ? "checked" : "";
28 printf "<input type=radio name=global value=0 %s> $text{'no'}</td> </tr>\n",
29         $_[0]->{'global'} ? "" : "checked";
30
31 print "<tr> <td><b>$text{'acl_create'}</b></td> <td>\n";
32 printf "<input type=radio name=create value=1 %s> $text{'yes'}\n",
33         $_[0]->{'create'} ? "checked" : "";
34 printf "<input type=radio name=create value=0 %s> $text{'no'}</td> </tr>\n",
35         $_[0]->{'create'} ? "" : "checked";
36
37 print "<tr> <td><b>$text{'acl_edit'}</b></td> <td>\n";
38 printf "<input type=radio name=edit value=1 %s> $text{'yes'}\n",
39         $_[0]->{'edit'} ? "checked" : "";
40 printf "<input type=radio name=edit value=0 %s> $text{'no'}</td> </tr>\n",
41         $_[0]->{'edit'} ? "" : "checked";
42 }
43
44 # acl_security_save(&options)
45 # Parse the form for security options for the majordomo module
46 sub acl_security_save
47 {
48 if ($in{'lists_def'}) {
49         $_[0]->{'lists'} = "*";
50         }
51 else {
52         $_[0]->{'lists'} = join(" ", split(/\0/, $in{'lists'}));
53         }
54 $_[0]->{'global'} = $in{'global'};
55 $_[0]->{'create'} = $in{'create'};
56 $_[0]->{'edit'} = $in{'edit'};
57 }
58