Handle hostnames with upper-case letters
[webmin.git] / format / acl_security.pl
1
2 require 'format-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the format module
6 sub acl_security_form
7 {
8 local @dlist = &list_disks();
9 local ($d, %dcan);
10 map { $dcan{$_}++ } split(/\s+/, $_[0]->{'disks'});
11 print "<tr> <td valign=top><b>$text{'acl_disks'}</b></td> <td>\n";
12 printf "<input type=radio name=disks_def value=1 %s> %s\n",
13         $_[0]->{'disks'} eq '*' ? 'checked' : '', $text{'acl_dall'};
14 printf "<input type=radio name=disks_def value=0 %s> %s<br>\n",
15         $_[0]->{'disks'} eq '*' ? '' : 'checked', $text{'acl_dsel'};
16 print "<select name=disks size=4 multiple>\n";
17 foreach $d (@dlist) {
18         $d->{'device'} =~ s/^.*\///;
19         printf "<option value='%s' %s>%s\n",
20                 $d->{'device'},
21                 $dcan{$d->{'device'}} ? "selected" : "",
22                 "$d->{'desc'} ($d->{'type'})";
23         }
24 print "</select></td> </tr>\n";
25
26 print "<tr> <td><b>$text{'acl_view'}</b></td>\n";
27 print "<td>",&ui_radio("view", $access{'view'}, 
28                [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"</td> </tr>\n";
29 }
30
31 # acl_security_save(&options)
32 # Parse the form for security options for the format module
33 sub acl_security_save
34 {
35 if ($in{'disks_def'}) {
36         $_[0]->{'disks'} = "*";
37         }
38 else {
39         $_[0]->{'disks'} = join(" ", split(/\0/, $in{'disks'}));
40         }
41 $_[0]->{'view'} = $in{'view'};
42 }
43