3 # Display the current list of procmail recipes
5 require './procmail-lib.pl';
6 if ($minfo{'usermin'}) {
7 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
10 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
13 # Make sure procmail is installed
14 if (!$module_info{'usermin'} && !&has_command($config{'procmail'})) {
15 print &text('index_ecmd', "<tt>$config{'procmail'}</tt>",
16 "../config.cgi?$module_name"),"<p>\n";
18 &foreign_require("software", "software-lib.pl");
19 $lnk = &software::missing_install_link(
20 "procmail", $text{'index_procmail'},
21 "../$module_name/", $text{'index_title'});
22 print $lnk,"<p>\n" if ($lnk);
24 &ui_print_footer("/", $text{'index_return'});
28 # Tell user when procmail will be used
29 if ($module_info{'usermin'}) {
30 print &text('index_desc', "<tt>$procmailrc</tt>"),"<p>\n";
33 ($ms, $mserr) = &check_mailserver_config();
35 print "<b>",&text('index_mserr', $mserr),"</b><p>\n";
38 print &text('index_desc_other', "<tt>$procmailrc</tt>"),"<p>\n";
42 # Build links for adding things
43 @links = ( "<a href='edit_recipe.cgi?new=1'>$text{'index_add'}</a>",
44 "<a href='edit_recipe.cgi?new=1&block=1'>$text{'index_badd'}</a>",
45 "<a href='edit_env.cgi?new=1'>$text{'index_eadd'}</a>" );
46 push(@links, "<a href='edit_inc.cgi?new=1'>$text{'index_iadd'}</a>")
49 @conf = &get_procmailrc();
52 print &ui_form_start("delete_recipes.cgi", "post");
53 unshift(@links, &select_all_link("d"),
54 &select_invert_link("d") );
55 print &ui_links_row(\@links);
56 print &ui_columns_start([
58 $text{'index_action'},
61 $text{'index_ba'} ], 100, 0, \@tds);
64 local @tds = ( "width=5" );
66 # Environment variable assignment
67 local $v = length($c->{'value'}) > 80 ?
68 substr($c->{'value'}, 0, 80)." ..." :
70 push(@cols, "<a href='edit_env.cgi?idx=$c->{'index'}'>".
72 "<tt>".&html_escape($c->{'name'})."</tt>",
73 "<tt>".&html_escape($v)."</tt>")."</a>");
74 push(@tds, "width=100% colspan=2");
76 elsif ($c->{'include'}) {
78 push(@cols, "<a href='edit_inc.cgi?idx=$c->{'index'}'>".
79 &text('index_include',
80 "<tt>".&html_escape($c->{'include'})."</tt>").
82 push(@tds, "width=100% colspan=2");
86 local ($t, $a) = &parse_action($c);
88 "<a href='edit_recipe.cgi?idx=$c->{'index'}'>".
90 "<tt>".&html_escape($a)."</tt>")."</a>");
91 push(@tds, "valign=top width=50%");
93 local @c = @{$c->{'conds'}};
95 push(@cols, $text{'index_noconds'});
100 local $he ="<tt>".&html_escape($n->[1]).
103 $c .= &text('index_re', $he);
105 elsif ($n->[0] eq '!') {
106 $c .= &text('index_nre', $he);
108 elsif ($n->[0] eq '$') {
109 $c .= &text('index_shell', $he);
111 elsif ($n->[0] eq '?') {
112 $c .= &text('index_exit', $he);
114 elsif ($n->[0] eq '<') {
115 $c .= &text('index_lt',$n->[1]);
117 elsif ($n->[0] eq '>') {
118 $c .= &text('index_gt',$n->[1]);
124 push(@tds, "width=50%");
129 if ($c eq $conf[@conf-1] ||
130 $c->{'file'} ne $conf[$c->{'index'}+1]->{'file'}) {
131 $mover .= "<img src=images/gap.gif>";
134 $mover .= "<a href='down.cgi?idx=$c->{'index'}'>".
135 "<img src=images/down.gif border=0></a>";
137 if ($c eq $conf[0] ||
138 $c->{'file'} ne $conf[$c->{'index'}-1]->{'file'}) {
139 $mover .= "<img src=images/gap.gif>";
142 $mover .= "<a href='up.cgi?idx=$c->{'index'}'>".
143 "<img src=images/up.gif border=0></a>";
146 push(@tds, "width=32");
148 # Add before/after links
149 push(@cols, "<a href='edit_recipe.cgi?new=1&before=$c->{'index'}'><img src=images/before.gif border=0></a><a href='edit_recipe.cgi?new=1&after=$c->{'index'}'><img src=images/after.gif border=0></a>");
150 print &ui_checked_columns_row(\@cols, \@tds, "d",$c->{'index'});
152 print &ui_columns_end();
153 print &ui_links_row(\@links);
154 print &ui_form_end([ [ "delete", $text{'index_delete'} ] ]);
157 print "<b>$text{'index_none'}</b><p>\n";
158 print &ui_links_row(\@links);
163 print &ui_buttons_start();
164 print &ui_buttons_row("manual_form.cgi",
165 $text{'index_man'}, $text{'index_mandesc'});
166 print &ui_buttons_end();
168 print "<a href='manual_form.cgi'>$text{'index_manual'}</a>\n";
171 &ui_print_footer("/", $text{'index'});