3 # A form for editing options for communication with other caches
5 require './squid-lib.pl';
6 $access{'othercaches'} || &error($text{'eicp_ecannot'});
7 &ui_print_header(undef, $text{'eicp_header'}, "", "edit_icp", 0, 0, 0, &restart_button());
9 $cache_host = $squid_version >= 2 ? "cache_peer" : "cache_host";
11 @ch = &find_config($cache_host, $conf);
12 @links = ( &select_all_link("d"),
13 &select_invert_link("d"),
14 "<a href='edit_cache_host.cgi?new=1'>$text{'eicp_aac'}</a>" );
16 #print &ui_subheading($text{'eicp_opcs'});
17 $mid = int((@ch+1)/2);
18 print &ui_form_start("delete_icps.cgi", "post");
19 print &ui_links_row(\@links);
20 print "<table width=100%><tr> <td width=50% valign=top>\n";
21 &cache_table(0, $mid-1);
22 print "</td><td width=50% valign=top>\n";
23 if ($mid < @ch) { &cache_table($mid, $#ch); }
24 print "</td> </tr></table>\n";
25 print &ui_links_row(\@links);
26 print &ui_form_end([ [ "delete", $text{'eicp_delete'} ] ]);
29 print "<b>$text{'eicp_nocd'}</b>.<p>\n";
30 print &ui_links_row([ $links[2] ]);
34 print "<form action=save_icp.cgi>\n";
35 print "<table border width=100%>\n";
36 print "<tr $tb> <td><b>$text{'eicp_cso'}</b></td> </tr>\n";
37 print "<tr $cb> <td><table width=100%>\n";
39 if ($squid_version < 2) {
41 print &list_input($text{'eicp_fdfd'}, "local_domain", $conf);
42 print &address_input($text{'eicp_fdfi'}, "local_ip", $conf);
46 print &list_input($text{'eicp_dif'}, "inside_firewall", $conf);
47 print &address_input($text{'eicp_iif'}, "firewall_ip", $conf);
52 print &list_input($text{'eicp_dfuc'}, "hierarchy_stoplist",
53 $conf, 1, $text{'default'});
56 if ($squid_version < 2) {
58 print &choice_input($text{'eicp_bpfsp'},
59 "single_parent_bypass",
60 $conf, "off", $text{'yes'}, "on", $text{'no'}, "off");
61 print &choice_input($text{'eicp_ssip'}, "source_ping", $conf, "off",
62 $text{'yes'}, "on", $text{'no'}, "off");
66 print &opt_input($text{'eicp_crt'}, "neighbor_timeout", $conf,
67 $text{'default'}, 4, $text{'eicp_secs'});
72 print &opt_input($text{'eicp_iqt'}, "icp_query_timeout", $conf,
73 $text{'default'}, 8, "ms");
74 print &opt_input($text{'eicp_mit'}, "mcast_icp_query_timeout",
75 $conf, $text{'default'}, 8, "ms");
79 print &opt_input($text{'eicp_dpt'}, "dead_peer_timeout", $conf,
80 $text{'default'}, 8, $text{'eicp_secs'});
84 if ($squid_version >= 2.3) {
85 # Display always/never_direct options
86 print "<tr> <td colspan=4><hr></td> </tr>\n";
88 print "<tr> <td colspan=2 valign=top width=50%>\n";
89 @always = &find_config("always_direct", $conf);
91 print "<b>$text{'eicp_always'}</b><p>\n";
92 print "<table border>\n";
93 print "<tr $tb><td width=10%><b>$text{'eacl_act'}</b></td>\n";
94 print "<td><b>$text{'eacl_acls1'}</b></td>\n";
95 print "<td width=10%><b>$text{'eacl_move'}</b></td> </tr>\n";
97 foreach $h (@always) {
98 @v = @{$h->{'values'}};
99 if ($v[0] eq "allow") {
100 $v[0] = $text{'eacl_allow'};
102 $v[0] = $text{'eacl_deny'};
105 print "<td><a href=\"always.cgi?index=$h->{'index'}\">",
107 print "<td>",&html_escape(join(' ', @v[1..$#v])),
110 if ($hc != @always-1) {
111 print "<a href=\"move_always.cgi?$hc+1\">",
112 "<img src=images/down.gif border=0></a>";
114 else { print "<img src=images/gap.gif>"; }
116 print "<a href=\"move_always.cgi?$hc+-1\">",
117 "<img src=images/up.gif border=0></a>";
119 print "</td></tr>\n";
125 print "<b>$text{'eicp_noalways'}</b><p>\n";
127 print "<a href=always.cgi?new=1>$text{'eicp_addalways'}</a>\n";
129 print "</td> <td colspan=2 valign=top width=50%>\n";
130 @never = &find_config("never_direct", $conf);
132 print "<b>$text{'eicp_never'}</b><p>\n";
133 print "<table border>\n";
134 print "<tr $tb><td width=10%><b>$text{'eacl_act'}</b></td>\n";
135 print "<td><b>$text{'eacl_acls1'}</b></td>\n";
136 print "<td width=10%><b>$text{'eacl_move'}</b></td> </tr>\n";
138 foreach $h (@never) {
139 @v = @{$h->{'values'}};
140 if ($v[0] eq "allow") {
141 $v[0] = $text{'eacl_allow'};
143 $v[0] = $text{'eacl_deny'};
146 print "<td><a href=\"never.cgi?index=$h->{'index'}\">",
148 print "<td>",&html_escape(join(' ', @v[1..$#v])),
151 if ($hc != @never-1) {
152 print "<a href=\"move_never.cgi?$hc+1\">",
153 "<img src=images/down.gif border=0></a>";
155 else { print "<img src=images/gap.gif>"; }
157 print "<a href=\"move_never.cgi?$hc+-1\">",
158 "<img src=images/up.gif border=0></a>";
160 print "</td></tr>\n";
166 print "<b>$text{'eicp_nonever'}</b><p>\n";
168 print "<a href=never.cgi?new=1>$text{'eicp_addnever'}</a>\n";
169 print "</td> </tr>\n";
172 print "</table></td></tr></table>\n";
173 print "<input type=submit value=$text{'buttsave'}></form>\n";
175 &ui_print_footer("", $text{'eicp_return'});
177 # cache_table(start, end)
180 local @tds = ( "width=5" );
181 print &ui_columns_start([ "",
184 $text{'eicp_tpport'},
185 $text{'eicp_tiport'} ], 100, 0, \@tds);
186 for($i=$_[0]; $i<=$_[1]; $i++) {
187 @chv = @{$ch[$i]->{'values'}};
188 print &ui_checked_columns_row([
189 "<a href=\"edit_cache_host.cgi?num=$i\">".
190 &html_escape($chv[0])."</a>",
191 &html_escape($chv[1]),
192 &html_escape($chv[2]),
193 &html_escape($chv[3])
196 print &ui_columns_end();