2 # Show a table of simple actions
4 require './filter-lib.pl';
5 &foreign_require("mailbox", "mailbox-lib.pl");
6 &ui_print_header(undef, $text{'index_title'}, "", undef, 0, 1);
8 if (&get_product_name() eq 'webmin') {
9 &ui_print_endpage($text{'index_nowebmin'});
12 # Warn if procmail is not installed
13 if ($config{'warn_procmail'} && !&has_command("procmail")) {
14 print "$text{'index_warn'}<p>\n";
17 # Check for an override alias
18 $alias = &get_override_alias();
20 # Got one .. but does it deliver locally
23 @values = @{$alias->{'values'}};
24 ($tome) = grep { $_ eq "\\$remote_user" ||
25 $_ eq "\\$noat" } @values;
27 @values = grep { $_ ne $tome } @values;
28 $msg = 'index_aliasme';
33 print "<b>$text{$msg}</b><br>\n";
35 foreach $dest (&describe_alias_dest(\@values)) {
41 # Check if /etc/procmailrc forces local delivery
42 if (&no_user_procmailrc()) {
43 print "<b>",$text{'index_force'},"</b><p>\n";
46 @filters = &list_filters();
49 push(@links, &select_all_link("d"), &select_invert_link("d"));
51 push(@links, "<a href='edit.cgi?new=1'>$text{'index_add'}</a>");
52 ($auto) = grep { $_->{'actionreply'} } @filters;
53 if (&can_simple_autoreply() && !$auto) {
54 push(@links, "<a href='edit_auto.cgi'>$text{'index_addauto'}</a>");
56 ($fwd) = grep { $_->{'actiontype'} eq '!' } @filters;
57 if (&can_simple_forward() && !$fwd) {
58 push(@links, "<a href='edit_forward.cgi'>$text{'index_addfwd'}</a>");
61 @folders = &mailbox::list_folders();
62 if (@filters || &get_global_spamassassin()) {
63 # Show table of filters
64 print &ui_form_start("delete.cgi", "post");
65 @tds = ( "width=5", "width=50%", "width=50%", "width=32" );
66 print &ui_links_row(\@links);
67 print &ui_columns_start([ "",
68 $text{'index_condition'},
69 $text{'index_action'},
70 @filters > 1 ? ( $text{'index_move'} ) : ( ),
73 # Add a magic non-editable row(s) for global spamassassin run
74 if (&get_global_spamassassin()) {
75 print &ui_columns_row(
76 [ "", $text{'index_calways'}, $text{'index_aspam'},
77 @filters > 1 ? ( "" ) : ( ) ],
80 $spamlevel = &get_global_spam_delete();
82 print &ui_columns_row(
83 [ "", &text('index_clevel', $spamlevel),
84 $text{'index_athrow'},
85 @filters > 1 ? ( "" ) : ( ) ],
89 $spamfile = &get_global_spam_path();
91 $folder = &file_to_folder($spamfile, \@folders, 0, 1);
92 $id = &mailbox::folder_name($folder);
93 if ($folder->{'fake'}) {
94 $sflink = "<u>$folder->{'name'}</u>";
98 "<a href='../mailbox/index.cgi?id=$id'>".
99 "$folder->{'name'}</a>";
101 print &ui_columns_row(
102 [ "", $text{'index_cspam'},
103 &text('index_afolder', $sflink),
104 @filters > 1 ? ( "" ) : ( ) ],
110 foreach $f (@filters) {
111 # Work out nice condition and action descriptions
113 ($cond, $lastalways) = &describe_condition($f);
114 $cond = "<a href='edit.cgi?idx=$f->{'index'}'>$cond</a>";
115 local $action = &describe_action($f, \@folders);
119 if ($f eq $filters[0]) {
120 $mover .= "<img src=images/gap.gif alt=' '>";
123 $mover .= "<a href='up.cgi?idx=$f->{'index'}'>".
124 "<img src=images/up.gif border=0 alt='Up'></a>";
126 if ($f eq $filters[$#filters]) {
127 $mover .= "<img src=images/gap.gif alt=' '>";
130 $mover .= "<a href='down.cgi?idx=$f->{'index'}'>".
131 "<img src=images/down.gif border=0 alt='Down'></a>";
135 print &ui_checked_columns_row(
138 @filters > 1 ? ( $mover ) : ( ) ],
139 \@tds, "d", $f->{'index'}
144 # Add a magic non-editable row for default delivery
146 print &ui_columns_row(
147 [ "", $text{'index_calways'}, $text{'index_adefault'},
148 @filters > 1 ? ( "" ) : ( ) ],
152 print &ui_columns_end();
153 print &ui_links_row(\@links);
154 print &ui_form_end([ [ "delete", $text{'index_delete'} ] ]);
157 # Tell the user there are none
158 @pmrc = &procmail::get_procmailrc();
160 print "<b>$text{'index_none2'}</b><p>\n";
163 print "<b>$text{'index_none'}</b><p>\n";
165 print &ui_links_row(\@links);
168 &ui_print_footer("/", $text{'index'});