# mod_actions.pl
# Defines editors for CGI actions
sub mod_actions_directives
{
$rv = [ [ 'Action', 1, 11, 'virtual directory htaccess', undef, 5 ],
[ 'Script', 1, 11, 'virtual directory' ] ];
return &make_directives($rv, $_[0], "mod_actions");
}
sub mod_actions_handlers
{
local($d, @rv);
foreach $d (&find_all_directives($_[0], "Action")) {
if ($d->{'words'}->[0] =~ /^[A-z0-9\-\_]+$/) {
push(@rv, $d->{'words'}->[0]);
}
}
return @rv;
}
sub edit_Action
{
local($rv, $len, $i, $type, $cgi);
$rv = "
\n";
return (2, "$text{'mod_actions_mimecgi'}", $rv);
}
sub save_Action
{
local($i, $cgi, $type, @rv);
for($i=0; defined($in{"Action_type_$i"}); $i++) {
$type = $in{"Action_type_$i"}; $cgi = $in{"Action_cgi_$i"};
if ($type !~ /\S/ && $cgi !~ /\S/) { next; }
$type =~ /^(\S+)$/ || &error(&text('mod_actions_emime', $type));
$cgi =~ /^\/(\S+)$/ || &error(&text('mod_actions_ecgi', $cgi));
push(@rv, "$type $cgi");
}
return ( \@rv );
}
sub edit_Script
{
local($rv, $len, $i, $meth, $cgi, $m, $found);
$rv = "\n";
return (2, "$text{'mod_actions_httpcgi'}", $rv);
}
sub save_Script
{
local($i, @rv, $meth, $cgi);
for($i=0; defined($in{"Script_meth_$i"}); $i++) {
$meth = $in{"Script_meth_$i"}; $cgi = $in{"Script_cgi_$i"};
if (!$meth && $cgi !~ /\S/) { next; }
$meth || &error(&text('mod_actions_enometh', $cgi));
$cgi =~ /^\/(\S+)$/ || &error(&text('mod_actions_ecgi', $cgi));
push(@rv, "$meth $cgi");
}
return ( \@rv );
}
1;