More ui-lib conversion

This commit is contained in:
Jamie Cameron
2008-09-02 00:05:28 +00:00
parent 70ad2650cb
commit fa103d6b57
4 changed files with 37 additions and 87 deletions

View File

@ -6,25 +6,18 @@ $access{'bcc'} || &error($text{'bcc_ecannot'});
&ui_print_header(undef, $text{'bcc_title'}, "", "bcc"); &ui_print_header(undef, $text{'bcc_title'}, "", "bcc");
&ReadParse(); &ReadParse();
# alias general options # Start of BCC form
print &ui_form_start("save_opts_bcc.cgi");
print &ui_table_start($text{'bcc_title'}, "width=100%", 2);
print "<form action=save_opts_bcc.cgi>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'bcc_title'}</b></td></tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<tr>\n";
&option_mapfield("sender_bcc_maps", 60); &option_mapfield("sender_bcc_maps", 60);
print "</tr>\n";
print "<tr>\n";
&option_mapfield("recipient_bcc_maps", 60); &option_mapfield("recipient_bcc_maps", 60);
print "</tr>\n";
print "</table></td></tr></table><p>\n"; print &ui_table_end();
print "<input type=submit value=\"$text{'opts_save'}\"></form>\n"; print &ui_form_end([ [ undef, $text{'opts_save'} ] ]);
print "<p>\n";
# Map contents
print &ui_hr(); print &ui_hr();
print &ui_tabs_start([ [ "sender", $text{'bcc_sender'} ], print &ui_tabs_start([ [ "sender", $text{'bcc_sender'} ],
[ "recipient", $text{'bcc_recipient'} ] ], [ "recipient", $text{'bcc_recipient'} ] ],
"mode", $in{'mode'} || 'sender', 1); "mode", $in{'mode'} || 'sender', 1);
@ -34,12 +27,12 @@ print &ui_tabs_start_tab("mode", "sender");
print $text{'bcc_senderdesc'},"<p>\n"; print $text{'bcc_senderdesc'},"<p>\n";
if (&get_current_value("sender_bcc_maps") eq "") if (&get_current_value("sender_bcc_maps") eq "")
{ {
print ($text{'no_map'}."<br><br>"); print $text{'no_map'},"<p>\n";
} }
else else
{ {
&generate_map_edit("sender_bcc_maps", $text{'map_click'}." ". &generate_map_edit("sender_bcc_maps", $text{'map_click'}." ".
"<font size=\"-1\">".&hlink("$text{'help_map_format'}", "virtual")."</font>\n<br>\n"); &hlink($text{'help_map_format'}, "virtual"));
} }
print &ui_tabs_end_tab("mode", "sender"); print &ui_tabs_end_tab("mode", "sender");
@ -48,12 +41,12 @@ print &ui_tabs_start_tab("mode", "recipient");
print $text{'bcc_recipientdesc'},"<p>\n"; print $text{'bcc_recipientdesc'},"<p>\n";
if (&get_current_value("recipient_bcc_maps") eq "") if (&get_current_value("recipient_bcc_maps") eq "")
{ {
print ($text{'no_map'}."<br><br>"); print $text{'no_map'},"<p>\n";
} }
else else
{ {
&generate_map_edit("recipient_bcc_maps", $text{'map_click'}." ". &generate_map_edit("recipient_bcc_maps", $text{'map_click'}." ".
"<font size=\"-1\">".&hlink("$text{'help_map_format'}", "virtual")."</font>\n<br>\n"); &hlink($text{'help_map_format'}, "virtual"));
} }
print &ui_tabs_end_tab("mode", "recipient"); print &ui_tabs_end_tab("mode", "recipient");

View File

@ -369,10 +369,9 @@ sub option_freefield
my $v = &get_current_value($name); my $v = &get_current_value($name);
my $key = 'opts_'.$name; my $key = 'opts_'.$name;
printf "<td>".&hlink("<b>$text{$key}</b>", "opt_".$name)."</td> <td %s nowrap>\n", print &ui_table_row(&hlink($text{$key}, "opt_".$name),
$length > 20 ? "colspan=3" : ""; &ui_textbox($name."_def", $v, $length),
$length > 20 ? 3 : 1);
print &ui_textbox($name."_def", $v, $length),"</td>\n";
} }
@ -384,14 +383,11 @@ sub option_yesno
my $v = &get_current_value($name); my $v = &get_current_value($name);
my $key = 'opts_'.$name; my $key = 'opts_'.$name;
defined($_[1]) ? print &ui_table_row(defined($_[1]) ? &hlink($text{$key}, "opt_".$name)
print "<td>".&hlink("<b>$text{$key}</b>", "opt_".$name)."</td> <td nowrap>\n" : $text{$key},
: &ui_radio($name."_def", lc($v),
print "<td><b>$text{$key}</b></td> <td nowrap>\n"; [ [ "yes", $text{'yes'} ],
[ "no", $text{'no'} ] ]));
print &ui_radio($name."_def", lc($v),
[ [ "yes", $text{'yes'} ], [ "no", $text{'no'} ] ]);
print "</td>\n";
} }
# option_select(name_of_option, &options, [help]) # option_select(name_of_option, &options, [help])

View File

@ -10,65 +10,48 @@ $default = $text{'opts_default'};
$none = $text{'opts_none'}; $none = $text{'opts_none'};
$no_ = $text{'opts_no'}; $no_ = $text{'opts_no'};
print "<form action=save_sasl.cgi>\n"; # Form start
print "<table border width=100%>\n"; print &ui_form_start("save_sasl.cgi");
print "<tr $tb> <td><b>$text{'sasl_title'}</b></td></tr>\n"; print &ui_table_start($text{'sasl_title'}, "width=100%", 4);
print "<tr $cb> <td><table width=100%>\n";
# Enabled, accept broken clients # Enabled, accept broken clients
print "<tr>\n";
&option_yesno("smtpd_sasl_auth_enable"); &option_yesno("smtpd_sasl_auth_enable");
&option_yesno("broken_sasl_auth_clients"); &option_yesno("broken_sasl_auth_clients");
print "</tr>\n";
# Anonymous and plain-text options # Anonymous and plain-text options
print "<tr>\n";
%opts = map { $_, 1 } %opts = map { $_, 1 }
split(/[\s,]+/, &get_current_value("smtpd_sasl_security_options")); split(/[\s,]+/, &get_current_value("smtpd_sasl_security_options"));
print "<td valign=top>","<b>$text{'sasl_opts'}</b>", @cbs = ( );
"</td> <td colspan=3 nowrap>\n";
foreach $o ("noanonymous", "noplaintext") { foreach $o ("noanonymous", "noplaintext") {
print &ui_checkbox("sasl_opts", $o, $text{'sasl_'.$o}, $opts{$o}), push(@cbs, &ui_checkbox("sasl_opts", $o, $text{'sasl_'.$o}, $opts{$o}));
"<br>\n";
} }
print "</td> </tr>\n"; print &ui_table_row($text{'sasl_opts'}, join("<br>\n", @cbs), 3);
# SASL-related relay restrictions # SASL-related relay restrictions
%recip = map { $_, 1 } %recip = map { $_, 1 }
split(/[\s,]+/, &get_current_value("smtpd_recipient_restrictions")); split(/[\s,]+/, &get_current_value("smtpd_recipient_restrictions"));
print "<td valign=top>","<b>$text{'sasl_recip'}</b>", @cbs = ( );
"</td> <td colspan=3 nowrap>\n";
foreach $o (&list_smtpd_restrictions()) { foreach $o (&list_smtpd_restrictions()) {
print &ui_checkbox("sasl_recip", $o, $text{'sasl_'.$o}, $recip{$o}), push(@cbs, &ui_checkbox("sasl_recip", $o, $text{'sasl_'.$o},
"<br>\n"; $recip{$o}));
} }
print "</td> </tr>\n"; print &ui_table_row($text{'sasl_recip'}, join("<br>\n", @cbs), 3);
# Delay bad logins # Delay bad logins
print "<tr>\n";
&option_yesno("smtpd_delay_reject"); &option_yesno("smtpd_delay_reject");
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n"; print &ui_table_hr();
# SMTP TLS options # SMTP TLS options
print "<tr>\n";
&option_yesno("smtpd_use_tls"); &option_yesno("smtpd_use_tls");
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtpd_tls_cert_file", 60, $none); &option_radios_freefield("smtpd_tls_cert_file", 60, $none);
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtpd_tls_key_file", 60, $none); &option_radios_freefield("smtpd_tls_key_file", 60, $none);
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtpd_tls_CAfile", 60, $none); &option_radios_freefield("smtpd_tls_CAfile", 60, $none);
print "</tr>\n";
print "</table></td></tr></table><p>\n"; print &ui_table_end();
print "<input type=submit value=\"$text{'opts_save'}\"></form>\n"; print &ui_form_end([ [ undef, $text{'opts_save'} ] ]);
&ui_print_footer("", $text{'index_return'}); &ui_print_footer("", $text{'index_return'});

View File

@ -26,60 +26,38 @@ $default = $text{'opts_default'};
$none = $text{'opts_none'}; $none = $text{'opts_none'};
$no_ = $text{'opts_no'}; $no_ = $text{'opts_no'};
print "<form action=save_opts.cgi>\n"; # Start of form
print "<table border width=100%>\n"; print &ui_form_start("save_opts.cgi");
print "<tr $tb> <td><b>$text{'smtpd_title'}</b></td></tr>\n"; print &ui_table_start($text{'smtpd_title'}, "width=100%", 4);
print "<tr $cb> <td><table width=100%>\n";
print "<tr>\n";
&option_radios_freefield("best_mx_transport", 25, $text{'opts_best_mx_transport_default'}); &option_radios_freefield("best_mx_transport", 25, $text{'opts_best_mx_transport_default'});
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("fallback_relay", 60, $default); &option_radios_freefield("fallback_relay", 60, $default);
print "</tr>\n";
print "<tr>\n";
&option_yesno("ignore_mx_lookup_error", 'help'); &option_yesno("ignore_mx_lookup_error", 'help');
&option_yesno("smtp_skip_4xx_greeting", 'help'); &option_yesno("smtp_skip_4xx_greeting", 'help');
print "</tr>\n";
print "<tr>\n";
&option_yesno("smtp_skip_quit_response", 'help'); &option_yesno("smtp_skip_quit_response", 'help');
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtp_destination_concurrency_limit", 15, $default); &option_radios_freefield("smtp_destination_concurrency_limit", 15, $default);
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtp_destination_recipient_limit", 15, $default); &option_radios_freefield("smtp_destination_recipient_limit", 15, $default);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_connect_timeout", 15); &option_freefield("smtp_connect_timeout", 15);
&option_freefield("smtp_helo_timeout", 15); &option_freefield("smtp_helo_timeout", 15);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_mail_timeout", 15); &option_freefield("smtp_mail_timeout", 15);
&option_freefield("smtp_rcpt_timeout", 15); &option_freefield("smtp_rcpt_timeout", 15);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_data_init_timeout", 15); &option_freefield("smtp_data_init_timeout", 15);
&option_freefield("smtp_data_xfer_timeout", 15); &option_freefield("smtp_data_xfer_timeout", 15);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_data_done_timeout", 15); &option_freefield("smtp_data_done_timeout", 15);
&option_freefield("smtp_quit_timeout", 15); &option_freefield("smtp_quit_timeout", 15);
print "</tr>\n";
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'opts_save'} ] ]);
print "</table></td></tr></table><p>\n";
print "<input type=submit value=\"$text{'opts_save'}\"></form>\n";
&ui_print_footer("", $text{'index_return'}); &ui_print_footer("", $text{'index_return'});