2 # Defines editors for CGI actions
4 sub mod_actions_directives
6 $rv = [ [ 'Action', 1, 11, 'virtual directory htaccess', undef, 5 ],
7 [ 'Script', 1, 11, 'virtual directory' ] ];
8 return &make_directives($rv, $_[0], "mod_actions");
11 sub mod_actions_handlers
14 foreach $d (&find_all_directives($_[0], "Action")) {
15 if ($d->{'words'}->[0] =~ /^[A-z0-9\-\_]+$/) {
16 push(@rv, $d->{'words'}->[0]);
24 local($rv, $len, $i, $type, $cgi);
25 $rv = "<table border>\n".
26 "<tr $tb> <td><b>$text{'mod_actions_mime'}</b></td> <td><b>$text{'mod_actions_cgiurl'}</b></td> </tr>";
28 for($i=0; $i<$len; $i++) {
29 if ($_[0]->[$i]->{'value'} =~ /^(\S+)\s+(\S+)$/) {
30 $type = $1; $cgi = $2;
32 else { $type = $cgi = ""; }
34 $rv .= "<td><input name=Action_type_$i size=20 value=\"$type\"></td>\n";
35 $rv .= "<td><input name=Action_cgi_$i size=40 value=\"$cgi\"></td>\n";
39 return (2, "$text{'mod_actions_mimecgi'}", $rv);
43 local($i, $cgi, $type, @rv);
44 for($i=0; defined($in{"Action_type_$i"}); $i++) {
45 $type = $in{"Action_type_$i"}; $cgi = $in{"Action_cgi_$i"};
46 if ($type !~ /\S/ && $cgi !~ /\S/) { next; }
47 $type =~ /^(\S+)$/ || &error(&text('mod_actions_emime', $type));
48 $cgi =~ /^\/(\S+)$/ || &error(&text('mod_actions_ecgi', $cgi));
49 push(@rv, "$type $cgi");
56 local($rv, $len, $i, $meth, $cgi, $m, $found);
57 $rv = "<table border>\n".
58 "<tr $tb> <td><b>$text{'mod_actions_http'}</b></td> <td><b>$text{'mod_actions_cgi'}</b></td> </tr>";
60 for($i=0; $i<$len; $i++) {
61 if ($_[0]->[$i]->{'value'} =~ /^(\S+)\s+(\S+)$/) {
62 $meth = $1; $cgi = $2;
64 else { $meth = $cgi = ""; }
65 $rv .= "<tr $cb><td><select name=Script_meth_$i>\n";
66 foreach $m ("", "GET", "POST", "PUT", "DELETE") {
67 $rv .= sprintf "<option %s>$m\n", $meth eq $m ? "selected" : "";
68 $found++ if ($meth eq $m);
70 printf "<option selected>$meth\n" if (!$found);
71 $rv .= "</select></td>\n";
72 $rv .= "<td><input name=Script_cgi_$i size=40 value=\"$cgi\"></td>\n";
76 return (2, "$text{'mod_actions_httpcgi'}", $rv);
80 local($i, @rv, $meth, $cgi);
81 for($i=0; defined($in{"Script_meth_$i"}); $i++) {
82 $meth = $in{"Script_meth_$i"}; $cgi = $in{"Script_cgi_$i"};
83 if (!$meth && $cgi !~ /\S/) { next; }
84 $meth || &error(&text('mod_actions_enometh', $cgi));
85 $cgi =~ /^\/(\S+)$/ || &error(&text('mod_actions_ecgi', $cgi));
86 push(@rv, "$meth $cgi");