3 # A form for editing or creating http_access directives
5 require './squid-lib.pl';
6 $access{'othercaches'} || &error($text{'eicp_ecannot'});
10 if (!defined($in{'index'})) {
11 &ui_print_header(undef, $text{'always_create'}, "",
12 undef, 0, 0, 0, &restart_button());
15 &ui_print_header(undef, $text{'always_edit'}, "",
16 undef, 0, 0, 0, &restart_button());
17 @always = @{$conf->[$in{'index'}]->{'values'}};
20 print "<form action=always_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{'always_header'}</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 $always[0] eq "allow" ? "checked" : "";
31 printf "<input type=radio name=action value=deny %s> $text{'ahttp_d'}</td> </tr>\n",
32 $always[0] eq "allow" ? "" : "checked";
34 for($i=1; $i<@always; $i++) { $match{$always[$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><br>\n";
58 print "<input type=submit value=$text{'buttsave'}>\n";
59 if (@always) { print "<input type=submit value=$text{'buttdel'} name=delete>\n"; }
62 &ui_print_footer("edit_acl.cgi", $text{'ahttp_return'});