More ui-lib conversion

This commit is contained in:
Jamie Cameron
2024-03-15 15:35:45 -07:00
parent b02f0ef96b
commit 5c533916ff
2 changed files with 24 additions and 28 deletions

View File

@@ -5,41 +5,38 @@ require 'fetchmail-lib.pl';
# Output HTML for editing security options for the fetchmail module
sub acl_security_form
{
print "<tr> <td valign=top><b>$text{'acl_users'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=mode value=0 %s> $text{'acl_all'}<br>\n",
$_[0]->{'mode'} == 0 ? "checked" : "";
printf "<input type=radio name=mode value=3 %s> $text{'acl_this'}<br>\n",
$_[0]->{'mode'} == 3 ? "checked" : "";
printf "<input type=radio name=mode value=1 %s> $text{'acl_only'}\n",
$_[0]->{'mode'} == 1 ? "checked" : "";
printf "<input name=userscan size=40 value='%s'> %s<br>\n",
$_[0]->{'mode'} == 1 ? $_[0]->{'users'} : "",
&user_chooser_button("userscan", 1);
printf "<input type=radio name=mode value=2 %s> $text{'acl_except'}\n",
$_[0]->{'mode'} == 2 ? "checked" : "";
printf "<input name=userscannot size=40 value='%s'> %s</td> </tr>\n",
$_[0]->{'mode'} == 2 ? $_[0]->{'users'} : "",
&user_chooser_button("userscannot", 1);
my ($o) = @_;
print "<tr> <td valign=top><b>$text{'acl_cron'}</b></td> <td>\n";
print &ui_radio("cron", $_[0]->{'cron'},
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td>\n";
print &ui_table_row($text{'acl_users'},
&ui_radio_table("mode", $o->{'mode'},
[ [ 0, $text{'acl_all'} ],
[ 3, $text{'acl_this'} ],
[ 1, $text{'acl_only'},
&ui_users_textbox("userscan",
$o->{'mode'} == 1 ? $o->{'users'} : "") ],
[ 2, $text{'acl_except'},
&ui_users_textbox("userscannot",
$o->{'mode'} == 2 ? $o->{'users'} : "") ],
]));
print "<td valign=top><b>$text{'acl_daemon'}</b></td> <td>\n";
print &ui_radio("daemon", $_[0]->{'daemon'},
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
print &ui_table_row($text{'acl_cron'},
&ui_yesno_radio("cron", $o->{'cron'}));
print &ui_table_row($text{'acl_daemon'},
&ui_yesno_radio("daemon", $o->{'daemon'}));
}
# acl_security_save(&options)
# Parse the form for security options for the fetchmail module
sub acl_security_save
{
$_[0]->{'mode'} = $in{'mode'};
$_[0]->{'users'} = $in{'mode'} == 0 || $in{'mode'} == 3 ? "" :
$in{'mode'} == 1 ? $in{'userscan'}
: $in{'userscannot'};
$_[0]->{'cron'} = $in{'cron'};
$_[0]->{'daemon'} = $in{'daemon'};
my ($o) = @_;
$o->{'mode'} = $in{'mode'};
$o->{'users'} = $in{'mode'} == 0 || $in{'mode'} == 3 ? "" :
$in{'mode'} == 1 ? $in{'userscan'} :
$in{'userscannot'};
$o->{'cron'} = $in{'cron'};
$o->{'daemon'} = $in{'daemon'};
}

View File

@@ -39,7 +39,6 @@ if ($config{'config_file'}) {
}
# Show the fetchmail daemon form
print "<tr><td>\n";
if (&is_fetchmail_running()) {
# daemon is running - offer to stop it
print &ui_buttons_row("stop.cgi", $text{'index_stop'},