require 'fdisk-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the fdisk module
sub acl_security_form
{
local @dlist = &list_disks_partitions();
local ($d, %dcan);
map { $dcan{$_}++ } split(/\s+/, $_[0]->{'disks'});
print "
$text{'acl_disks'} \n";
printf " %s\n",
$_[0]->{'disks'} eq '*' ? 'checked' : '', $text{'acl_dall'};
printf " %s \n",
$_[0]->{'disks'} eq '*' ? '' : 'checked', $text{'acl_dsel'};
print "\n";
foreach $d (@dlist) {
printf "%s \n",
$d->{'device'},
$dcan{$d->{'device'}} ? "selected" : "",
&text('select_device', uc($d->{'type'}), uc(substr($d->{'device'}, -1))).($d->{'model'} ? " ($d->{'model'})" : "");
}
print " \n";
print " $text{'acl_view'} \n";
printf " %s\n",
$_[0]->{'view'} ? 'checked' : '', $text{'yes'};
printf " %s \n",
$_[0]->{'view'} ? '' : 'checked', $text{'no'};
}
# acl_security_save(&options)
# Parse the form for security options for the fdisk module
sub acl_security_save
{
if ($in{'disks_def'}) {
$_[0]->{'disks'} = "*";
}
else {
$_[0]->{'disks'} = join(" ", split(/\0/, $in{'disks'}));
}
$_[0]->{'view'} = $in{'view'};
}