diff --git a/fsdump/acl_security.pl b/fsdump/acl_security.pl index 992b3b9ea..ad120e0e7 100644 --- a/fsdump/acl_security.pl +++ b/fsdump/acl_security.pl @@ -5,40 +5,25 @@ do 'fsdump-lib.pl'; # Output HTML for editing security options for the acl module sub acl_security_form { -print " $text{'acl_edit'} \n"; -printf " %s\n", - $_[0]->{'edit'} ? "checked" : "", $text{'yes'}; -printf " %s\n", - $_[0]->{'edit'} ? "" : "checked", $text{'no'}; +print &ui_table_row($text{'acl_edit'}, + &ui_yesno_radio('edit', $_[0]->{'edit'})); -print "$text{'acl_restore'} \n"; -printf " %s\n", - $_[0]->{'restore'} ? "checked" : "", $text{'yes'}; -printf " %s \n", - $_[0]->{'restore'} ? "" : "checked", $text{'no'}; +print &ui_table_row($text{'acl_restore'}, + &ui_yesno_radio('restore', $_[0]->{'restore'})); -print " $text{'acl_cmds'} \n"; -printf " %s\n", - $_[0]->{'cmds'} ? "checked" : "", $text{'yes'}; -printf " %s\n", - $_[0]->{'cmds'} ? "" : "checked", $text{'no'}; - -print "$text{'acl_extra'} \n"; -printf " %s\n", - $_[0]->{'extra'} ? "checked" : "", $text{'yes'}; -printf " %s \n", - $_[0]->{'extra'} ? "" : "checked", $text{'no'}; - -print " $text{'acl_dirs'} \n"; -printf " %s\n", - $_[0]->{'dirs'} eq "*" ? "checked" : "", $text{'acl_all'}; -printf " %s
\n", - $_[0]->{'dirs'} eq "*" ? "" : "checked", $text{'acl_list'}; -print " \n"; +print &ui_table_row($text{'acl_cmds'}, + &ui_yesno_radio('cmds', $_[0]->{'cmds'})); +print &ui_table_row($text{'acl_extra'}, + &ui_yesno_radio('extra', $_[0]->{'extra'})); +print &ui_table_row($text{'acl_dirs'}, + &ui_radio("dirs_def", $_[0]->{'dirs'} eq "*" ? 1 : 0, + [ [ 1, $text{'acl_all'} ], + [ 0, $text{'acl_list'} ] ])."
\n". + &ui_textarea("dirs", $_[0]->{'dirs'} eq "*" ? "" : + join("\n", split(/\t/, $_[0]->{'dirs'})), + 5, 50), 3); } # acl_security_save(&options) diff --git a/fsdump/freebsd-lib.pl b/fsdump/freebsd-lib.pl index 935294fa6..b80de9106 100644 --- a/fsdump/freebsd-lib.pl +++ b/fsdump/freebsd-lib.pl @@ -23,113 +23,78 @@ $tar_command = &has_command("gtar") || &has_command("tar"); sub dump_form { # Display common options -print " ",&hlink($text{'dump_dest'}, "dest"), - " \n"; -printf " %s\n", - $_[0]->{'host'} ? '' : 'checked', $text{'dump_file'}; -printf " %s
\n", - $_[0]->{'host'} ? '' : $_[0]->{'file'}, - &file_chooser_button("file"); -printf "\n", - $_[0]->{'host'} ? 'checked' : ''; -print &text('dump_host', - "", - "", - ""), - " \n"; +print &ui_table_row(&hlink($text{'dump_dest'}, "dest"), + &ui_radio("mode", $_[0]->{'host'} ? 1 : 0, + [ [ 0, $text{'dump_file'}." ". + &ui_textbox("file", $_[0]->{'file'}, 50). + " ".&file_chooser_button("file")."
" ], + [ 1, &text('dump_host', + &ui_textbox("host", $_[0]->{'host'}, 15), + &ui_textbox("huser", $_[0]->{'huser'}, 8), + &ui_textbox("hfile", $_[0]->{'hfile'}, 20)) ] ]), 3); if ($_[0]->{'fs'} eq 'tar') { # Display gnutar options - print " ",&hlink($text{'dump_rsh'},"rsh"), - "\n"; - print "", - &rsh_command_input("rsh_def", "rsh", $_[0]->{'rsh'}), - " \n"; + print &ui_table_row(&hlink($text{'dump_rsh'},"rsh"), + &rsh_command_input("rsh_def", "rsh", $_[0]->{'rsh'}), 3); # Password option for SSH - print " ",&hlink($text{'dump_pass'},"pass"), - "\n"; - print "",&ui_password("pass", $_[0]->{'pass'}, 20), - " \n"; + print &ui_table_row(&hlink($text{'dump_pass'},"pass"), + &ui_password("pass", $_[0]->{'pass'}, 20), 3); } } sub dump_options_form { +local ($dump, $tds) = @_; if ($_[0]->{'fs'} eq 'tar') { # Display gnutar options - print " ",&hlink($text{'dump_label'},"label"),"\n"; - printf " \n", - $_[0]->{'label'}; + print &ui_table_row(&hlink($text{'dump_label'},"label"), + &ui_textbox("label", $_[0]->{'label'}, 15), + 1, $tds); - print " ",&hlink($text{'dump_blocks'},"blocks"), - " \n"; - printf " %s\n", - $_[0]->{'blocks'} ? '' : 'checked', $text{'dump_auto'}; - printf "\n", - $_[0]->{'blocks'} ? 'checked' : ''; - printf " kB \n", - $_[0]->{'blocks'}; + print &ui_table_row(&hlink($text{'dump_blocks'},"blocks"), + &ui_opt_textbox("blocks", $_[0]->{'blocks'}, 8, + $text{'dump_auto'})." kB", + 3, $tds); - print "",&hlink($text{'dump_gzip'},"gzip"),"\n"; - printf " %s\n", - $_[0]->{'gzip'} ? 'checked' : '', $text{'yes'}; - printf " %s\n", - $_[0]->{'gzip'} ? '' : 'checked', $text{'no'}; + print &ui_table_row(&hlink($text{'dump_gzip'},"gzip"), + &ui_select("gzip", int($_[0]->{'gzip'}), + [ [ 0, $text{'no'} ], + [ 1, $text{'dump_gzip1'} ] ]), 1, $tds); - print "",&hlink($text{'dump_multi'},"multi"),"\n"; - printf " %s\n", - $_[0]->{'multi'} ? 'checked' : '', $text{'yes'}; - printf " %s \n", - $_[0]->{'multi'} ? '' : 'checked', $text{'no'}; + print &ui_table_row(&hlink($text{'dump_multi'},"multi"), + &ui_yesno_radio("multi", int($_[0]->{'multi'})), + 1, $tds); - print "",&hlink($text{'dump_links'},"links"),"\n"; - printf " %s\n", - $_[0]->{'links'} ? 'checked' : '', $text{'yes'}; - printf " %s\n", - $_[0]->{'links'} ? '' : 'checked', $text{'no'}; + print &ui_table_row(&hlink($text{'dump_links'},"links"), + &ui_yesno_radio("links", int($_[0]->{'links'})), + 1, $tds); - print "",&hlink($text{'dump_xdev'},"xdev"),"\n"; - printf " %s\n", - $_[0]->{'xdev'} ? 'checked' : '', $text{'yes'}; - printf " %s \n", - $_[0]->{'xdev'} ? '' : 'checked', $text{'no'}; + print &ui_table_row(&hlink($text{'dump_xdev'},"xdev"), + &ui_yesno_radio("xdev", int($_[0]->{'xdev'})), + 1, $tds); } else { # Display ufs backup options - print " ",&hlink($text{'dump_update'},"update"), - "\n"; - printf " %s\n", - $_[0]->{'update'} ? 'checked' : '', $text{'yes'}; - printf " %s\n", - $_[0]->{'update'} ? '' : 'checked', $text{'no'}; + print &ui_table_row(&hlink($text{'dump_update'},"update"), + &ui_yesno_radio("update", int($_[0]->{'update'})), + 1, $tds); - print "",&hlink($text{'dump_level'},"level"),"\n"; - print " \n"; + print &ui_table_row(&hlink($text{'dump_level'},"level"), + &ui_select("level", int($_[0]->{'level'}), + [ map { [ $_, $text{'dump_level_'.$_} ] } + (0 .. 9) ]), 1, $tds); - print " ",&hlink($text{'dump_blocks'},"blocks"), - " \n"; - printf " %s\n", - $_[0]->{'blocks'} ? '' : 'checked', $text{'dump_auto'}; - printf "\n", - $_[0]->{'blocks'} ? 'checked' : ''; - printf " kB \n", - $_[0]->{'blocks'}; + print &ui_table_row(&hlink($text{'dump_blocks'},"blocks"), + &ui_opt_textbox("blocks", $_[0]->{'blocks'}, 8, + $text{'dump_auto'})." kB", + 3, $tds); - print "",&hlink($text{'dump_honour'},"honour"),"\n"; - printf " %s\n", - $_[0]->{'honour'} ? 'checked' : '', $text{'yes'}; - printf " %s\n", - $_[0]->{'honour'} ? '' : 'checked', $text{'no'}; + print &ui_table_row(&hlink($text{'dump_honour'},"honour"), + &ui_yesno_radio("honour", int($_[0]->{'honour'})), + 1, $tds); } - -print "\n"; } # parse_dump(&dump) @@ -284,90 +249,75 @@ return &has_command("restore") ? undef : $cmd; # restore_form(filesystem, [&dump]) sub restore_form { +local ($fs, $dump, $tds) = @_; + # common options -print " ",&hlink($text{'restore_src'}, "rsrc"), - "\n"; -printf " %s\n", - $_[1]->{'host'} ? "" : "checked", $text{'dump_file'}; -printf " %s
\n", - $_[1]->{'host'} ? "" : $_[1]->{'file'}, &file_chooser_button("file"); -printf "\n", - $_[1]->{'host'} ? "checked" : ""; -print &text('dump_host', - "", - "", - ""), - " \n"; +print &ui_table_row(&hlink($text{'restore_src'}, "rsrc"), + &ui_radio("mode", $_[1]->{'host'} ? 1 : 0, + [ [ 0, $text{'dump_file'}." ". + &ui_textbox("file", $_[1]->{'file'}, 50). + " ".&file_chooser_button("file")."
" ], + [ 1, &text('dump_host', + &ui_textbox("host", $_[1]->{'host'}, 15), + &ui_textbox("huser", $_[1]->{'huser'}, 8), + &ui_textbox("hfile", $_[1]->{'hfile'}, 20)) ] ]), 3, $tds); if ($_[0] eq 'tar') { # tar restore options - print " ",&hlink($text{'restore_rsh'},"rrsh"), - "\n"; - print "", - &rsh_command_input("rsh_def", "rsh", $_[1]->{'rsh'}), - " \n"; + print &ui_table_row(&hlink($text{'restore_rsh'},"rrsh"), + &rsh_command_input("rsh_def", "rsh", $_[1]->{'rsh'}), + 3, $tds); # Password option for SSH - print " ",&hlink($text{'dump_pass'},"pass"), - "\n"; - print "",&ui_password("pass", $_[0]->{'pass'}, 20), - " \n"; + print &ui_table_row(&hlink($text{'dump_pass2'},"passs"), + &ui_password("pass", $_[1]->{'pass'}, 20), + 3, $tds); - print " ",&hlink($text{'restore_files'},"rfiles"), - "\n"; - print " ", - "$text{'restore_all'}\n"; - print " $text{'restore_sel'}\n"; - print " \n"; + # Files to restore + print &ui_table_row(&hlink($text{'restore_files'},"rfiles"), + &ui_opt_textbox("files", undef, 40, $text{'restore_all'}, + $text{'restore_sel'}), 3, $tds); - print " ",&hlink($text{'restore_dir'},"rdir"), - " \n"; - print " ",&file_chooser_button("dir", 1), - " \n"; + # Target dir + print &ui_table_row(&hlink($text{'restore_dir'},"rdir"), + &ui_textbox("dir", undef, 50)." ". + &file_chooser_button("dir", 1), 3, $tds); - print " ",&hlink($text{'restore_perms'},"perms"),"\n"; - print " $text{'yes'}\n"; - print " $text{'no'}\n"; + # Restore permissions? + print &ui_table_row(&hlink($text{'restore_perms'},"perms"), + &ui_yesno_radio("perms", 1), 1, $tds); - print "",&hlink($text{'restore_gzip'},"rgzip"),"\n"; - print " $text{'yes'}\n"; - print " $text{'no'} \n"; + # Uncompress? + print &ui_table_row(&hlink($text{'restore_gzip'},"rgzip"), + &ui_select("gzip", $_[1]->{'gzip'}, + [ [ 0, $text{'no'} ], + [ 1, $text{'dump_gzip1'} ] ]), 1, $tds); - print " ",&hlink($text{'restore_keep'},"keep"),"\n"; - print " $text{'yes'}\n"; - print " $text{'no'}\n"; + print &ui_table_row(&hlink($text{'restore_keep'},"keep"), + &ui_yesno_radio("keep", 0), 1, $tds); - print "",&hlink($text{'restore_multi'},"rmulti"), - "\n"; - print " $text{'yes'}\n"; - print " $text{'no'} \n"; - - print " ",&hlink($text{'restore_test'},"rtest"),"\n"; - print " $text{'yes'}\n"; - print " $text{'no'} \n"; + # Multiple files + print &ui_table_row(&hlink($text{'restore_multi'},"rmulti"), + &ui_yesno_radio("multi", 0), 1, $tds); + # Show only + print &ui_table_row(&hlink($text{'restore_test'},"rtest"), + &ui_yesno_radio("test", 1), 1, $tds); } else { - # ufs restore options - print " ",&hlink($text{'restore_files'},"rfiles"), - "\n"; - print " ", - "$text{'restore_all'}\n"; - print " $text{'restore_sel'}\n"; - print " \n"; + # ufs restore options, files to restore + print &ui_table_row(&hlink($text{'restore_files'},"rfiles"), + &ui_opt_textbox("files", undef, 40, $text{'restore_all'}, + $text{'restore_sel'}), 3, $tds); - print " ",&hlink($text{'restore_dir'},"rdir"),"\n"; - print " ", - &file_chooser_button("dir", 1)," \n"; + # Target dir + print &ui_table_row(&hlink($text{'restore_dir'},"rdir"), + &ui_textbox("dir", undef, 50)." ". + &file_chooser_button("dir", 1), 3, $tds); - print " ",&hlink($text{'restore_nothing'},"rnothing"), - "\n"; - print " $text{'yes'}\n"; - print " $text{'no'}\n"; - - print "",&hlink($text{'restore_test'},"rtest"),"\n"; - print " $text{'yes'}\n"; - print " $text{'no'} \n"; + # Show only + print &ui_table_row(&hlink($text{'restore_nothing'},"rnothing"), + &ui_yesno_radio("nothing", 1), 1, $tds); } } diff --git a/fsdump/index.cgi b/fsdump/index.cgi index be6c349cc..0e9adca1d 100755 --- a/fsdump/index.cgi +++ b/fsdump/index.cgi @@ -88,23 +88,27 @@ print "\n"; if ($access{'restore'}) { # Display restore button print &ui_hr(); - print "
\n"; - print "\n"; - print "\n"; + print &ui_buttons_row("restore_form.cgi", + $text{'index_restore'}, + $text{'index_restoremsg'}, + undef, + &ui_select("fs", undef, + [ map { [ $_, uc($_) ] } @fstypes ])); } else { - print &ui_submit($text{'index_restore2'}); - print &ui_hidden("fs", $fstypes[0]),"\n"; - print "\n"; + print &ui_buttons_row("restore_form.cgi", + $text{'index_restore2'}, + $text{'index_restoremsg'}, + &ui_hidden("fs", $fstypes[0])); } - print "
\n"; + print &ui_buttons_start(); + @fstypes = ( ); push(@fstypes, &supported_filesystems()) if (!$config{'always_tar'}); push(@fstypes, "tar") if ($supports_tar); if (@fstypes > 1) { - print &ui_submit($text{'index_restore'}); - print &ui_select("fs", undef, - [ map { [ $_, uc($_) ] } @fstypes ]),"$text{'index_restoremsg'}$text{'index_restoremsg2'}
\n"; + + print &ui_buttons_end(); } # Display running backup jobs list, if any