require 'servers-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the servers module
sub acl_security_form
{
print "
$text{'acl_servers'} \n";
print "\n";
printf " %s\n",
$_[0]->{'servers'} eq '*' ? 'checked' : '', $text{'acl_sall'};
printf " %s \n",
$_[0]->{'servers'} eq '*' ? '' : 'checked', $text{'acl_ssel'};
print "\n";
local @servers = sort { $a->{'host'} cmp $b->{'host'} } &list_servers();
local ($z, %zcan);
map { $zcan{$_}++ } split(/\s+/, $_[0]->{'servers'});
foreach $z (sort { $a->{'value'} cmp $b->{'value'} } @servers) {
printf "%s \n",
$z->{'id'},
$zcan{$z->{'host'}} || $zcan{$z->{'id'}} ? "selected" : "",
$z->{'host'} ;
}
print " \n";
print " $text{'acl_edit'} \n";
print &ui_yesno_radio("edit", $_[0]->{'edit'})," \n";
print "$text{'acl_find'} \n";
print &ui_yesno_radio("find", $_[0]->{'find'})," \n";
print " $text{'acl_auto'} \n";
print &ui_yesno_radio("auto", $_[0]->{'auto'})," \n";
print "$text{'acl_add'} \n";
print &ui_yesno_radio("add", $_[0]->{'add'})," \n";
print " $text{'acl_forcefast'} \n";
print &ui_yesno_radio("forcefast", $_[0]->{'forcefast'})," \n";
print "$text{'acl_forcetype'} \n";
print &ui_yesno_radio("forcetype", $_[0]->{'forcetype'})," \n";
print " $text{'acl_forcelink'} \n";
print &ui_yesno_radio("forcelink", $_[0]->{'forcelink'})," \n";
print "$text{'acl_links'} \n";
print &ui_yesno_radio("links", $_[0]->{'links'})," \n";
}
# acl_security_save(&options)
# Parse the form for security options for the servers module
sub acl_security_save
{
if ($in{'servers_def'}) {
$_[0]->{'servers'} = "*";
}
else {
$_[0]->{'servers'} = join(" ", split(/\0/, $in{'servers'}));
}
$_[0]->{'edit'} = $in{'edit'};
$_[0]->{'find'} = $in{'find'};
$_[0]->{'auto'} = $in{'auto'};
$_[0]->{'add'} = $in{'add'};
$_[0]->{'forcefast'} = $in{'forcefast'};
$_[0]->{'forcetype'} = $in{'forcetype'};
$_[0]->{'forcelink'} = $in{'forcelink'};
$_[0]->{'links'} = $in{'links'};
}