Handle hostnames with upper-case letters
[webmin.git] / fdisk / acl_security.pl
1
2 require 'fdisk-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the fdisk module
6 sub acl_security_form
7 {
8 local @dlist = &list_disks_partitions();
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         printf "<option value='%s' %s>%s\n",
19                 $d->{'device'},
20                 $dcan{$d->{'device'}} ? "selected" : "",
21                 &text('select_device', uc($d->{'type'}), uc(substr($d->{'device'}, -1))).($d->{'model'} ? " ($d->{'model'})" : "");
22         }
23 print "</select></td> </tr>\n";
24
25 print "<tr> <td><b>$text{'acl_view'}</b></td>\n";
26 printf "<td><input type=radio name=view value=1 %s> %s\n",
27         $_[0]->{'view'} ? 'checked' : '', $text{'yes'};
28 printf "<input type=radio name=view value=0 %s> %s</td> </tr>\n",
29         $_[0]->{'view'} ? '' : 'checked', $text{'no'};
30 }
31
32 # acl_security_save(&options)
33 # Parse the form for security options for the fdisk module
34 sub acl_security_save
35 {
36 if ($in{'disks_def'}) {
37         $_[0]->{'disks'} = "*";
38         }
39 else {
40         $_[0]->{'disks'} = join(" ", split(/\0/, $in{'disks'}));
41         }
42 $_[0]->{'view'} = $in{'view'};
43 }
44