3 # A form for editing or creating a proxy access restriction
5 require './squid-lib.pl';
6 $access{'actrl'} || &error($text{'eacl_ecannot'});
10 if (!defined($in{'index'})) {
11 &ui_print_header(undef, $text{'ahttp_header'}, "",
12 undef, 0, 0, 0, &restart_button());
15 &ui_print_header(undef, $text{'ahttp_header1'}, "",
16 undef, 0, 0, 0, &restart_button());
17 @http = @{$conf->[$in{'index'}]->{'values'}};
20 print "<form action=http_access_save.cgi>\n";
22 print "<input type=hidden name=index value=$in{'index'}>\n";
24 print "<table border>\n";
25 print "<tr $tb> <td><b>$text{'ahttp_pr'}</b></td> </tr>\n";
26 print "<tr $cb> <td><table>\n";
28 print "<tr> <td><b>$text{'ahttp_a'}</b></td> <td colspan=3>\n";
29 printf "<input type=radio name=action value=allow %s> $text{'ahttp_a1'}\n",
30 $http[0] eq "allow" ? "checked" : "";
31 printf "<input type=radio name=action value=deny %s> $text{'ahttp_d'}</td> </tr>\n",
32 $http[0] eq "allow" ? "" : "checked";
34 for($i=1; $i<@http; $i++) { $match{$http[$i]}++; }
35 @acls = grep { !$done{$_->{'values'}->[0]}++ } &find_config("acl", $conf);
36 unshift(@acls, { 'values' => [ 'all' ] }) if ($squid_version >= 3);
37 $r = @acls; $r = 10 if ($r > 10);
39 print "<tr> <td valign=top><b>$text{'ahttp_ma'}</b></td>\n";
40 print "<td valign=top><select name=yes multiple size=$r width=100>\n";
42 printf "<option %s>%s\n",
43 $match{$a->{'values'}->[0]} ? "selected" : "",
46 print "</select></td>\n";
48 print "<td valign=top><b>$text{'ahttp_dma'}</b></td>\n";
49 print "<td valign=top><select name=no multiple size=$r width=100>\n";
51 printf "<option %s>%s\n",
52 $match{"!$a->{'values'}->[0]"} ? "selected" : "",
55 print "</select></td> </tr>\n";
57 print "</table></td></tr></table>\n";
58 print "<input type=submit value='$text{'buttsave'}'>\n";
60 print "<input type=submit value='$text{'buttdel'}' name=delete>\n";
64 &ui_print_footer("edit_acl.cgi?mode=http", $text{'ahttp_return'},
65 "", $text{'index_return'});