From 792a4c93e6f7fc6b0bb50b8ff0298e3c0a2f6694 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 24 Jan 2021 13:40:45 -0800 Subject: [PATCH] Convert to proper UI functions https://github.com/virtualmin/virtualmin-gpl/issues/246 --- at/acl_security.pl | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/at/acl_security.pl b/at/acl_security.pl index 2a9e18084..ab8894362 100755 --- a/at/acl_security.pl +++ b/at/acl_security.pl @@ -8,34 +8,31 @@ require 'at-lib.pl'; # Output HTML for editing security options for the at module sub acl_security_form { -print " $text{'acl_users'} \n"; -printf " $text{'acl_all'}
\n", - $_[0]->{'mode'} == 0 ? "checked" : ""; -printf " $text{'acl_this'}
\n", - $_[0]->{'mode'} == 3 ? "checked" : ""; -printf " $text{'acl_only'}\n", - $_[0]->{'mode'} == 1 ? "checked" : ""; -printf " %s
\n", - $_[0]->{'mode'} == 1 ? $_[0]->{'users'} : "", - &user_chooser_button("userscan", 1); -printf " $text{'acl_except'}\n", - $_[0]->{'mode'} == 2 ? "checked" : ""; -printf " %s \n", - $_[0]->{'mode'} == 2 ? $_[0]->{'users'} : "", - &user_chooser_button("userscannot", 1); +my ($o) = @_; -print " $text{'acl_allow'} \n"; -print &ui_yesno_radio("allow", $_[0]->{'allow'})," \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_textbox("userscan", $o->{'mode'} == 1 ? $o->{'users'} : "", 40)." ".&user_chooser_button("userscan", 1) ], + [ 2, $text{'acl_except'}, + &ui_textbox("userscannot", $o->{'mode'} == 2 ? $o->{'users'} : "", 40)." ".&user_chooser_button("userscannot", 1) ], + ]), 3); + +print &ui_table_row($text{'acl_allow'}, + &ui_yesno_radio("allow", $o->{'allow'})); } # acl_security_save(&options) # Parse the form for security options for the cron 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]->{'allow'} = $in{'allow'}; +my ($o) = @_; +$o->{'mode'} = $in{'mode'}; +$o->{'users'} = $in{'mode'} == 0 || $in{'mode'} == 3 ? "" : + $in{'mode'} == 1 ? $in{'userscan'} + : $in{'userscannot'}; +$o->{'allow'} = $in{'allow'}; }