print &text('setup_desc_webmin', "<tt>$pmrc</tt>"),"<p>\n";
}
-print "<form action=setup.cgi>\n";
-print "<table>\n";
+print &ui_form_start("setup.cgi", "post");
+print &ui_table_start(undef, undef, 2);
+print $form_hiddens;
# Spam destination inputs
-print "<tr> <td rowspan=6 valign=top><b>$text{'setup_to'}</b></td>\n";
-
-print "<td><input type=radio name=to value=0> $text{'setup_null'}</td> </tr>\n";
-
-print "<td><input type=radio name=to value=4> $text{'setup_default'}</td> </tr>\n";
-
-print "<td><input type=radio name=to value=1 checked> $text{'setup_file'}</td>\n";
-printf "<td><input name=file size=30 value='%s'></td> </tr>\n",
- $module_info{'usermin'} ? "mail/spam" : "\$HOME/spam";
-
-print "<td><input type=radio name=to value=2> $text{'setup_maildir'}</td>\n";
-print "<td><input name=maildir size=30></td> </tr>\n";
-
-print "<td><input type=radio name=to value=3> $text{'setup_mhdir'}</td>\n";
-print "<td><input name=mhdir size=30></td> </tr>\n";
-
-print "<td><input type=radio name=to value=5> $text{'setup_email'}</td>\n";
-print "<td><input name=email size=30></td> </tr>\n";
+$mbox = $module_info{'usermin'} ? "mail/spam" : "\$HOME/spam";
+print &ui_table_row($text{'setup_to'},
+ &ui_radio_table("to", 1,
+ [ [ 0, $text{'setup_null'} ],
+ [ 4, $text{'setup_default'} ],
+ [ 1, $text{'setup_file'},
+ &ui_textbox("mbox", $mbox, 40) ],
+ [ 2, $text{'setup_maildir'},
+ &ui_textbox("maildir", "", 40) ],
+ [ 3, $text{'setup_mhdir'},
+ &ui_textbox("mhdir", "", 40) ],
+ [ 5, $text{'setup_email'},
+ &ui_textbox("email", "", 40) ] ]));
# Run mode input
if (!$module_info{'usermin'}) {
- print "<tr> <td valign=top><b>$text{'setup_drop'}</b></td> <td>\n";
- print "<input type=radio name=drop value=1 checked> ",
- "$text{'setup_drop1'}\n";
- print "<input type=radio name=drop value=0> ",
- "$text{'setup_drop0'}</td> </tr>\n";
+ print &ui_table_row($text{'setup_drop'},
+ &ui_radio("drop", 1, [ [ 1, $text{'setup_drop1'} ],
+ [ 0, $text{'setup_drop0'} ] ]));
}
-print "</td></tr></table><br>\n";
-
+# Message about path
if ($module_info{'usermin'}) {
- print "$text{'setup_rel'}<p>\n";
+ $msg = "$text{'setup_rel'}<p>\n";
}
else {
- print "$text{'setup_home'}<p>\n";
+ $msg = "$text{'setup_home'}<p>\n";
}
-print "$text{'setup_head'}<p>\n";
+$msg .= "$text{'setup_head'}<p>\n";
+print &ui_table_row(undef, $msg, 2);
-print "<input type=submit value='$text{'setup_ok'}'></form>\n";
+print &ui_table_end();
+print &ui_form_end([ [ undef, $text{'setup_ok'} ] ]);
&ui_print_footer("", $text{'index_return'});
$conf = &get_config();
print "$text{'white_desc'}<p>\n";
-&start_form("save_white.cgi", $text{'white_header'});
+print &ui_form_start("save_white.cgi", "post");
+print $form_hiddens;
-print "<tr> <td width=50%><b>$text{'white_from'}</b></td> ",
- "<td width=50%><b>$text{'white_unfrom'}</b></td> </tr>\n";
-print "<tr> <td width=50%>\n";
+# Start of tabs
+$url = "edit_white.cgi?file=".&urlize($in{'file'}).
+ "&title=".&urlize($in{'title'});
+print &ui_tabs_start("mode", $in{'mode'} || "ham",
+ map { [ $_, $text{'white_tab'.$_}, $url."&mode=$_" ] }
+ ( 'ham', 'spam', 'some', 'import' ));
+
+# Start of ham addresses tab
+print &ui_tabs_start_tab("mode", "ham");
+print $text{'white_hamdesc'},"<p>\n";
+print &ui_table_start(undef, undef, 2);
+
+# Addresses to always whitelist
@from = &find("whitelist_from", $conf);
-&edit_textbox("whitelist_from", [ map { @{$_->{'words'}} } @from ], 40, 5);
-print "</td> <td width=50%>\n";
+print &ui_table_row($text{'white_from'},
+ &edit_textbox("whitelist_from",
+ [ map { @{$_->{'words'}} } @from ], 60, 10));
+
+# Exceptions to whitelist
@un = &find("unwhitelist_from", $conf);
-&edit_textbox("unwhitelist_from", [ map { @{$_->{'words'}} } @un ], 40, 5);
-print "</td> </tr>\n";
+print &ui_table_row($text{'white_unfrom'},
+ &edit_textbox("unwhitelist_from",
+ [ map { @{$_->{'words'}} } @un ], 60, 5));
if ($config{'show_global'}) {
- print "<tr> <td width=50%><b>$text{'white_gfrom'}</b></td> ",
- "<td width=50%><b>$text{'white_gunfrom'}</b></td> </tr>\n";
+ # Global white and blacklists
$gconf = &get_config($config{'global_cf'}, 1);
- print "<tr> <td width=50%>\n";
@gfrom = &find("whitelist_from", $gconf);
- &edit_textbox("gwhitelist_from", [ map { @{$_->{'words'}} } @gfrom ], 40, 5);
- print "</td> <td width=50%>\n";
+ print &ui_table_row($text{'white_gfrom'},
+ &edit_textbox("gwhitelist_from",
+ [ map { @{$_->{'words'}} } @gfrom ], 40, 5, 1));
+
@gun = &find("unwhitelist_from", $gconf);
- &edit_textbox("gunwhitelist_from", [ map { @{$_->{'words'}} } @gun ], 40, 5);
- print "</td> </tr>\n";
- print "<script>\n";
- print "document.forms[0].gwhitelist_from.disabled = true;\n";
- print "document.forms[0].gunwhitelist_from.disabled = true;\n";
- print "</script>\n";
+ print &ui_table_row($text{'white_gunfrom'},
+ &edit_textbox("gunwhitelist_from",
+ [ map { @{$_->{'words'}} } @gun ], 40, 5));
}
-else {
- print "<tr> <td colspan=2><b>$text{'white_rcvd'}</b></td> </tr>\n";
- print "<tr> <td colspan=2>\n";
- @rcvd = &find("whitelist_from_rcvd", $conf);
+
+# Whitelist by received header
+@rcvd = &find("whitelist_from_rcvd", $conf);
+print &ui_table_row($text{'white_rcvd2'},
&edit_table("whitelist_from_rcvd",
- [ $text{'white_addr'}, $text{'white_rcvdhost'} ],
- [ map { $_->{'words'} } @rcvd ], [ 40, 30 ], undef, 3);
- print "</td> </tr>\n";
- }
+ [ $text{'white_addr'}, $text{'white_rcvdhost'} ],
+ [ map { $_->{'words'} } @rcvd ], [ 40, 30 ], undef, 3));
-print "<tr> <td colspan=2><hr></td> </tr>\n";
+print &ui_tabs_end_tab("mode", "ham");
print "<tr> <td><b>$text{'white_black'}</b></td> ",
"<td><b>$text{'white_unblack'}</b></td> </tr>\n";
white_title=Allowed and Denied Addresses
white_desc=The tables on this page allow you to specify From: and To: addresses for email that is always or never categorized as spam. Any other email will be processed as normal by SpamAssassin's rules. All email addresses can contain wildcards, like *@foo.com or *.foo.com to match entire domains.
-white_header=Email addresses to categorize as spam
-white_from=From: addresses to never classify as spam
-white_gfrom=System-wide addresses to never classify as spam
-white_addr=Address
-white_rcvd=From: addresses to never classify as spam, depending on Received: domain
-white_rcvdhost=Source domain
-white_unfrom=Exceptions for From: addresses to never classify as spam
-white_gunfrom=System-wide exceptions for addresses to never classify as spam
-white_black=From: addresses to always classify as spam
-white_gblack=System-wide addresses to always classify as spam
-white_unblack=Exceptions for From: addresses to always classify as spam
-white_gunblack=System-wide exceptions for addresses to always classify as spam
+white_from=Senders to never classify as spam
+white_gfrom=System-wide senders to never classify as spam
+white_unfrom=Exceptions for senders to never classify as spam
+white_addr=Sender's address
+white_rcvd2=Sender to never classify as spam
+white_rcvdhost=Domain in Received header
+white_gunfrom=System-wide exceptions for senders to never classify as spam
+white_black=Senders to always classify as spam
+white_gblack=System-wide senders to always classify as spam
+white_unblack=Exceptions for senders always classify as spam
+white_gunblack=System-wide exceptions for senders to always classify as spam
white_to=To: or Cc: addresses to allow some or all spam to
white_level=Allow
white_level0=Some spam
$file = "/dev/null";
}
elsif ($in{'to'} == 1) {
- $in{'file'} =~ /^\S+$/ || &error($text{'setup_efile'});
- $file = $in{'file'};
+ $in{'mbox'} =~ /^\S+$/ || &error($text{'setup_efile'});
+ $file = $in{'mbox'};
}
elsif ($in{'to'} == 2) {
$in{'maildir'} =~ /^\S+$/ || &error($text{'setup_emaildir'});
}
}
-# edit_textbox(name, &values, width, height)
+# edit_textbox(name, &values, width, height, [disabled])
sub edit_textbox
{
-return &ui_textarea($_[0], join("\n", @{$_[1]}), $_[3], $_[2]);
+return &ui_textarea($_[0], join("\n", @{$_[1]}), $_[3], $_[2], undef, $_[4]);
}
# parse_textbox(&config, name)