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");
&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);
print "</tr>\n";
print "<tr>\n";
&option_mapfield("recipient_bcc_maps", 60);
print "</tr>\n";
print "</table></td></tr></table><p>\n";
print "<input type=submit value=\"$text{'opts_save'}\"></form>\n";
print "<p>\n";
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'opts_save'} ] ]);
# Map contents
print &ui_hr();
print &ui_tabs_start([ [ "sender", $text{'bcc_sender'} ],
[ "recipient", $text{'bcc_recipient'} ] ],
"mode", $in{'mode'} || 'sender', 1);
@ -34,12 +27,12 @@ print &ui_tabs_start_tab("mode", "sender");
print $text{'bcc_senderdesc'},"<p>\n";
if (&get_current_value("sender_bcc_maps") eq "")
{
print ($text{'no_map'}."<br><br>");
print $text{'no_map'},"<p>\n";
}
else
{
&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");
@ -48,12 +41,12 @@ print &ui_tabs_start_tab("mode", "recipient");
print $text{'bcc_recipientdesc'},"<p>\n";
if (&get_current_value("recipient_bcc_maps") eq "")
{
print ($text{'no_map'}."<br><br>");
print $text{'no_map'},"<p>\n";
}
else
{
&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");

View File

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

View File

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

View File

@ -26,60 +26,38 @@ $default = $text{'opts_default'};
$none = $text{'opts_none'};
$no_ = $text{'opts_no'};
print "<form action=save_opts.cgi>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'smtpd_title'}</b></td></tr>\n";
print "<tr $cb> <td><table width=100%>\n";
# Start of form
print &ui_form_start("save_opts.cgi");
print &ui_table_start($text{'smtpd_title'}, "width=100%", 4);
print "<tr>\n";
&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);
print "</tr>\n";
print "<tr>\n";
&option_yesno("ignore_mx_lookup_error", 'help');
&option_yesno("smtp_skip_4xx_greeting", 'help');
print "</tr>\n";
print "<tr>\n";
&option_yesno("smtp_skip_quit_response", 'help');
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtp_destination_concurrency_limit", 15, $default);
print "</tr>\n";
print "<tr>\n";
&option_radios_freefield("smtp_destination_recipient_limit", 15, $default);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_connect_timeout", 15);
&option_freefield("smtp_helo_timeout", 15);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_mail_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_xfer_timeout", 15);
print "</tr>\n";
print "<tr>\n";
&option_freefield("smtp_data_done_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'});