
require 'syslog-lib.pl';

# acl_security_form(&options)
# Output HTML for editing security options for the syslog module
sub acl_security_form
{
print "<tr> <td><b>$text{'acl_noedit'}</b></td>\n";
printf "<td><input type=radio name=noedit value=1 %s> %s\n",
	$_[0]->{'noedit'} ? "checked" : "", $text{'yes'};
printf "<input type=radio name=noedit value=0 %s> %s</td> </tr>\n",
	$_[0]->{'noedit'} ? "" : "checked", $text{'no'};

print "<tr> <td valign=top nowrap><b>$text{'acl_logs'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=radio name=logs_def value=1 %s> %s\n",
	$_[0]->{'logs'} ? "" : "checked", $text{'acl_all'};
printf "<input type=radio name=logs_def value=0 %s> %s<br>\n",
	$_[0]->{'logs'} ? "checked" : "", $text{'acl_sel'};
print "<textarea name=logs rows=5 cols=50>",
	join("\n", split(/\t+/, $_[0]->{'logs'})),"</textarea></td> </tr>\n";
}

# acl_security_save(&options)
# Parse the form for security options for the syslog module
sub acl_security_save
{
$_[0]->{'noedit'} = $in{'noedit'};
$in{'logs'} =~ s/\r//g;
$_[0]->{'logs'} = $in{'logs_def'} ? undef :
			join("\t", split(/\n/, $in{'logs'}));
}

