diff --git a/burner/acl_security.pl b/burner/acl_security.pl index 09d7aba8c..f01137ddc 100755 --- a/burner/acl_security.pl +++ b/burner/acl_security.pl @@ -5,58 +5,39 @@ do 'burner-lib.pl'; # Output HTML for editing security options for the acl module sub acl_security_form { -print " $text{'acl_create'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'create'} ? 'checked' : ''; -printf " $text{'no'}\n", - $_[0]->{'create'} ? '' : 'checked'; +my ($o) = @_; +print &ui_table_row($text{'acl_create'}, + &ui_yesno_radio("create", $o->{'create'})); -print "$text{'acl_edit'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'edit'} ? 'checked' : ''; -printf " $text{'no'} \n", - $_[0]->{'edit'} ? '' : 'checked'; +print &ui_table_row($text{'acl_edit'}, + &ui_yesno_radio("edit", $o->{'edit'})); -print " $text{'acl_global'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'global'} ? 'checked' : ''; -printf " $text{'no'}\n", - $_[0]->{'global'} ? '' : 'checked'; -print "\n"; +print &ui_table_row($text{'acl_global'}, + &ui_yesno_radio("global", $o->{'global'})); -print " $text{'acl_profiles'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'profiles'} eq "*" ? "checked" : "", $text{'acl_all'}; -printf " %s
\n", - $_[0]->{'profiles'} eq "*" ? "" : "checked", $text{'acl_sel'}; -print " \n"; +print &ui_table_row($text{'acl_profiles'}, + &ui_radio("all", $o->{'profiles'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_all'} ], + [ 0, $text{'acl_sel'}."
" ] ])."\n". + &ui_select("profiles", + [ split(/\s+/, $o->{'profiles'}) ], + [ map { [ $_->{'id'}, $text{'index_type'.$_->{'type'}} ] } + &list_profiles() ], + 5, 1), 3); -print " $text{'acl_dirs'} \n"; -printf " \n", - $_[0]->{'dirs'}; +print &ui_table_row($text{'acl_dirs'}, + &ui_textbox("dirs", $o->{'dirs'}, 60), 3); } # acl_security_save(&options) # Parse the form for security options for the acl module sub acl_security_save { -$_[0]->{'create'} = $in{'create'}; -$_[0]->{'edit'} = $in{'edit'}; -$_[0]->{'global'} = $in{'global'}; -$_[0]->{'profiles'} = $in{'all'} ? "*" : - join(" ", split(/\0/, $in{'profiles'})); -$_[0]->{'dirs'} = $in{'dirs'}; +my ($o) = @_; +$o->{'create'} = $in{'create'}; +$o->{'edit'} = $in{'edit'}; +$o->{'global'} = $in{'global'}; +$o->{'profiles'} = $in{'all'} ? "*" : join(" ", split(/\0/, $in{'profiles'})); +$o->{'dirs'} = $in{'dirs'}; } diff --git a/fdisk/acl_security.pl b/fdisk/acl_security.pl index 540d58568..12bcddbe6 100755 --- a/fdisk/acl_security.pl +++ b/fdisk/acl_security.pl @@ -5,40 +5,33 @@ require 'fdisk-lib.pl'; # Output HTML for editing security options for the fdisk module sub acl_security_form { -local @dlist = &list_disks_partitions(); -local ($d, %dcan); -map { $dcan{$_}++ } split(/\s+/, $_[0]->{'disks'}); -print " $text{'acl_disks'} \n"; -printf " %s\n", - $_[0]->{'disks'} eq '*' ? 'checked' : '', $text{'acl_dall'}; -printf " %s
\n", - $_[0]->{'disks'} eq '*' ? '' : 'checked', $text{'acl_dsel'}; -print " \n"; +my ($o) = @_; +my @dlist = &list_disks_partitions(); -print " $text{'acl_view'}\n"; -printf " %s\n", - $_[0]->{'view'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'view'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_disks'}, + &ui_radio("disks_def", $o->{'disks'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_dall'} ], + [ 0, $text{'acl_dsel'} ] ])."
\n". + &ui_select("disks", + [ split(/\s+/, $o->{'disks'}) ], + [ map { [ $_->{'device'}, &text('select_device', uc($_->{'type'}), uc(substr($_->{'device'}, -1))).($_->{'model'} ? " ($_->{'model'})" : "") ] } @dlist ], + 4, 1), 3); + +print &ui_table_row($text{'acl_view'}, + &ui_yesno_radio("view", $o->{'view'})); } # acl_security_save(&options) # Parse the form for security options for the fdisk module sub acl_security_save { +my ($o) = @_; if ($in{'disks_def'}) { - $_[0]->{'disks'} = "*"; + $o->{'disks'} = "*"; } else { - $_[0]->{'disks'} = join(" ", split(/\0/, $in{'disks'})); + $o->{'disks'} = join(" ", split(/\0/, $in{'disks'})); } -$_[0]->{'view'} = $in{'view'}; +$o->{'view'} = $in{'view'}; } diff --git a/init/acl_security.pl b/init/acl_security.pl index 615ac8dff..c1cb68e78 100755 --- a/init/acl_security.pl +++ b/init/acl_security.pl @@ -5,40 +5,31 @@ require 'init-lib.pl'; # Output HTML for editing security options for the init module sub acl_security_form { -if ($config{'local_script'}) { - print " $text{'acl_script'} \n"; - } -else { - print " $text{'acl_actions'} \n"; - } -printf " $text{'yes'}\n", - $_[0]->{'bootup'} == 1 ? "checked" : ""; +my ($o) = @_; + +my $msg = $config{'local_script'} ? $text{'acl_script'} : $text{'acl_actions'}; +my @opts = ( [ 1, $text{'yes'} ] ); if (!$config{'local_script'}) { - printf " $text{'acl_runonly'}\n", - $_[0]->{'bootup'} == 2 ? "checked" : ""; + push(@opts, [ 2, $text{'acl_runonly'} ]); } -printf " $text{'no'} \n", - $_[0]->{'bootup'} == 0 ? "checked" : ""; +push(@opts, [ 0, $text{'no'} ]); +print &ui_table_row($msg, + &ui_radio("bootup", $o->{'bootup'}, \@opts)); -print " $text{'acl_reboot'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'reboot'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'reboot'} ? "" : "checked"; +print &ui_table_row($text{'acl_reboot'}, + &ui_yesno_radio("reboot", $o->{'reboot'})); -print "$text{'acl_shutdown'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'shutdown'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'shutdown'} ? "" : "checked"; +print &ui_table_row($text{'acl_shutdown'}, + &ui_yesno_radio("shutdown", $o->{'shutdown'})); } # acl_security_save(&options) # Parse the form for security options for the init module sub acl_security_save { -$_[0]->{'bootup'} = $in{'bootup'}; -$_[0]->{'reboot'} = $in{'reboot'}; -$_[0]->{'shutdown'} = $in{'shutdown'}; +my ($o) = @_; +$o->{'bootup'} = $in{'bootup'}; +$o->{'reboot'} = $in{'reboot'}; +$o->{'shutdown'} = $in{'shutdown'}; }