3 # Display a list of SMTP routes
5 require './qmail-lib.pl';
7 &ui_print_header(undef, $text{'routes_title'}, "");
9 @routes = &list_routes();
10 ($defroute) = grep { !$_->{'from'} } @routes;
11 @routes = grep { $_ ne $defroute } @routes;
15 # Restrict to search results
16 @routes = grep { $_->{'from'} =~ /$in{'search'}/ } @routes;
18 elsif ($config{'max_records'} && @routes > $config{'max_records'}) {
20 print $text{'routes_toomany'},"<br>\n";
21 print "<form action=list_routes.cgi>\n";
22 print "<input type=submit value='$text{'routes_go'}'>\n";
23 print "<input name=search size=20></form>\n";
29 if ($config{'sort_mode'} == 1) {
30 @routes = sort { lc($a->{'from'}) cmp lc($b->{'from'}) }
35 print &ui_form_start("delete_routes.cgi", "post");
36 print &select_all_link("d", 1),"\n";
37 print &select_invert_link("d", 1),"<br>\n";
38 if ($config{'columns'} == 2) {
39 $mid = int((@routes+1)/2);
40 print "<table width=100%> <tr><td width=50% valign=top>\n";
41 &routes_table(@routes[0..$mid-1]);
42 print "</td><td width=50% valign=top>\n";
43 if ($mid < @routes) { &routes_table(@routes[$mid..$#routes]); }
44 print "</td></tr> </table><br>\n";
47 &routes_table(@routes);
49 print &select_all_link("d", 1),"\n";
50 print &select_invert_link("d", 1),"<br>\n";
51 print &ui_form_end([ [ "delete", $text{'routes_delete'} ] ]);
55 print "<form action=save_defroute.cgi>\n";
56 print "<input type=hidden name=idx value='$defroute->{'idx'}'>\n"
58 print "<b>$text{'routes_defroute'}</b>\n";
59 printf "<input type=radio name=direct value=1 %s> %s\n",
60 $defroute ? "" : "checked", $text{'routes_direct'};
61 printf "<input type=radio name=direct value=0 %s> %s\n",
62 $defroute ? "checked" : "";
63 printf "<input name=defroute size=30 value='$defroute->{'to'}'>\n";
64 print "<input type=submit value='$text{'save'}'></form>\n";
66 &ui_print_footer("", $text{'index_return'});
70 print "<table border width=100%>\n";
71 print "<tr $tb> <td width=5><br></td> <td><b>$text{'routes_from'}</b></td> ",
72 "<td><b>$text{'routes_to'}</b></td> </tr>\n";
75 print "<td width=5>",&ui_checkbox("d", $r->{'from'}),"</td>\n";
76 print "<td valign=top><a href=\"edit_route.cgi?idx=$r->{'idx'}\">",
77 &html_escape($r->{'from'}),"</a></td>\n";
78 print "<td>",$r->{'port'} ? &html_escape("$r->{'to'}:$r->{'port'}") :
79 $r->{'to'} ? &html_escape($r->{'to'}) :
80 "<i>$text{'routes_direct'}</i>","</td> </tr>\n";