From b8c65845ea4ba6f7502119365fed146e3f2b3127 Mon Sep 17 00:00:00 2001 From: Marc Jones Date: Mon, 22 Jan 2018 13:13:00 -0700 Subject: [PATCH] updates --- cmd.cgi | 67 +++++++++++++++++++++++------------------------ lang/en | 42 ++++++++++++++++++++++++++--- zfsmanager-lib.pl | 1 - 3 files changed, 71 insertions(+), 39 deletions(-) diff --git a/cmd.cgi b/cmd.cgi index 9d3a456..8b85c67 100755 --- a/cmd.cgi +++ b/cmd.cgi @@ -7,7 +7,7 @@ ui_print_header(undef, $text{'cmd_title'}, "", undef, 1, 1); if ($text{$in{'cmd'}."_desc"}) { print ui_table_start($text{$in{'cmd'}."_cmd"}, "width=100%", "10", ['align=left'] ); - print ui_table_row("Command Description:", $text{$in{'cmd'}."_desc"}); + print ui_table_row($text{'cmd_dscpt'}, $text{$in{'cmd'}."_desc"}); print ui_table_end(); }; @@ -33,15 +33,15 @@ elsif ($in{'cmd'} =~ "snapshot") { } elsif ($in{'cmd'} =~ "send") { if (!$in{'dest'}) { - print "Send snapshot: $in{'snap'} to gzip file
"; + print $text{'cmd_send'}." ".$in{'snap'}." ".$text{'cmd_gzip'}."
"; print "
"; print ui_form_start('cmd.cgi', 'post'); print ui_hidden('cmd', $in{'cmd'}); print ui_hidden('snap', $in{'snap'}); my $newfile = $in{'snap'} =~ s![/@]!_!gr; - print "Destination: ".ui_filebox('dest', $config{'last_send'}, 35, undef, undef, undef, 1)."
"; - print "Filename: ".ui_textbox('file', $newfile.'.gz', 50)."
"; - print ui_submit("Continue", undef, undef); + print "$text{'destination'} ".ui_filebox('dest', $config{'last_send'}, 35, undef, undef, undef, 1)."
"; + print "$text{'filename'} ".ui_textbox('file', $newfile.'.gz', 50)."
"; + print ui_submit($text{'continue'}, undef, undef); print ui_form_end(); } else { $in{'confirm'} = "yes"; @@ -49,7 +49,6 @@ elsif ($in{'cmd'} =~ "send") { ui_cmd($in{'snap'}, $cmd); $config{'last_send'} = $in{'dest'}; save_module_config(); - #print "
"; print `ls -al $in{'dest'}'."/".$in{'file'}`; } } @@ -156,21 +155,21 @@ elsif ($in{'cmd'} =~ "zfsdestroy") { my $cmd = ($config{'zfs_destroy'} =~ /1/) ? "zfs destroy $in{'force'} $in{'zfs'}" : undef; if (!$in{'confirm'}) { - print "Attempting to destroy $in{'zfs'}...
"; + print $text{'cmd_destroy'}." $in{'zfs'}...
"; print "
"; print ui_form_start('cmd.cgi', 'post'); print ui_hidden('cmd', $in{'cmd'}); print ui_hidden('zfs', $in{'zfs'}); - print "This action will affect the following:
"; + print "$text{'cmd_affect'}
"; ui_zfs_list('-r '.$in{'zfs'}); ui_list_snapshots('-r '.$in{'zfs'}); if (($config{'zfs_destroy'} =~ /1/) && ($config{'snap_destroy'} =~ /1/)) { print ui_checkbox('force', '-r', 'Click to destroy all child dependencies (recursive)', undef ), "
"; } - print "

Warning, this action will result in data loss, do you really want to continue?

"; - print ui_checkbox('confirm', 'yes', 'I understand', undef ); + print "

$text{'cmd_warning'}

"; + print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef ); print ui_hidden('checked', 'no'); - if ($in{'checked'} =~ /no/) { print " -- checkbox must be selected"; } + if ($in{'checked'} =~ /no/) { print " -- $text{'cmd_checkbox'}"; } print "

"; - print ui_submit("Continue", undef, undef); + print ui_submit($text{'continue'}, undef, undef); print ui_form_end(); } else { ui_cmd($in{'zfs'}, $cmd); @@ -181,19 +180,19 @@ elsif ($in{'cmd'} =~ "snpdestroy") { my $cmd = ($config{'snap_destroy'} =~ /1/) ? "zfs destroy $in{'force'} $in{'snapshot'}" : undef; if (!$in{'confirm'}) { - print "Attempting to destroy $in{'snapshot'}...
"; + print $text{'cmd_destroy'}." $in{'snapshot'}...
"; print ui_form_start('cmd.cgi', 'post'); print ui_hidden('cmd', 'snpdestroy'); print ui_hidden('snapshot', $in{'snapshot'}); - print "This action will affect the following:
"; + print "$text{'cmd_affect'}
"; ui_list_snapshots('-r '.$in{'snapshot'}); if (($config{'zfs_destroy'} =~ /1/) && ($config{'snap_destroy'} =~ /1/)) { print ui_checkbox('force', '-r', 'Click to destroy all child dependencies (recursive)', undef ), "
"; } - print "

Warning, this action will result in data loss, do you really want to continue?

"; - print ui_checkbox('confirm', 'yes', 'I understand', undef ); + print "

$text{'cmd_warning'}

"; + print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef ); print ui_hidden('checked', 'no'); - if ($in{'checked'} =~ /no/) { print " -- checkbox must be selected"; } + if ($in{'checked'} =~ /no/) { print " -- $text{'cmd_checkbox'}"; } print "

"; - print ui_submit("Continue", undef, undef),; + print ui_submit($text{'continue'}, undef, undef),; print ui_form_end(); } else { @@ -207,19 +206,19 @@ elsif ($in{'cmd'} =~ "pooldestroy") { my $cmd = ($config{'pool_destroy'} =~ /1/) ? "zpool destroy $in{'pool'}" : undef; if (!$in{'confirm'}) { - print "Attempting to destroy $in{'pool'}...
"; + print $text{'cmd_destroy'}." $in{'pool'}...
"; print ui_form_start('cmd.cgi', 'post'); print ui_hidden('cmd', 'pooldestroy'); print ui_hidden('pool', $in{'pool'}); - print "This action will affect the following:
"; + print "$text{'cmd_affect'}
"; ui_zfs_list('-r '.$in{'pool'}); ui_list_snapshots('-r '.$in{'pool'}); - print "

Warning, this action will result in data loss, do you really want to continue?

"; - print ui_checkbox('confirm', 'yes', 'I understand', undef ); + print "

$text{'cmd_warning'}

"; + print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef ); print ui_hidden('checked', 'no'); - if ($in{'checked'} =~ /no/) { print " -- checkbox must be selected"; } + if ($in{'checked'} =~ /no/) { print " -- $text{'cmd_checkbox'}"; } print "

"; - print ui_submit("Continue", undef, undef); + print ui_submit($text{'continue'}, undef, undef); } else { ui_cmd($in{'pool'}, $cmd); } @@ -228,8 +227,8 @@ my $cmd = ($config{'pool_destroy'} =~ /1/) ? "zpool destroy $in{'pool'}" : undef elsif ($in{'cmd'} =~ "multisnap") { %snapshot = (); @select = split(/;/, $in{'select'}); - print "

Destroy

"; - print "Attempting to destroy multiple snapshots...
"; + print "

$text{'destroy'}

"; + print $text{'cmd_multisnap'}."
"; print ui_form_start('cmd.cgi', 'post'); print ui_hidden('cmd', 'multisnap'); print ui_hidden('select', $in{'select'}); @@ -246,30 +245,30 @@ elsif ($in{'cmd'} =~ "multisnap") { print ui_columns_end(); if (!$in{'confirm'}) { - print "

Commands to be issued:

"; + print "

$text{'cmd_issue'}

"; foreach $key (keys %results) { print $results{$key}, "
"; } - print "

Warning, this action will result in data loss, do you really want to continue?

"; - print ui_checkbox('confirm', 'yes', 'I understand', undef ); + print "

$text{'cmd_warning'}

"; + print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef ); print ui_hidden('checked', 'no'); - if ($in{'checked'} =~ /no/) { print " -- checkbox must be selected"; } + if ($in{'checked'} =~ /no/) { print " -- $text{'cmd_checkbox'}"; } print "

"; - print ui_submit("Continue", undef, undef), " | Cancel"; + print ui_submit($text{'continue'}, undef, undef), " | Cancel"; } else { - print "

Results from commands:

"; + print "

$text{'cmd_results'}

"; foreach $key (keys %results) { my @result = (`$results{$key} 2>&1`); if (($result[1] eq undef)) { print $results{$key}, "
"; - print "Success!
"; + print "$text{'cmd_success'}
"; } else { print $results{$key}, "
"; - print "error: ", $result[0], "
"; + print "$text{'cmd_error'} ", $result[0], "
"; } } } diff --git a/lang/en b/lang/en index a2937dd..4a57b9d 100755 --- a/lang/en +++ b/lang/en @@ -5,6 +5,32 @@ index_return=pool list snapshot_return=snapshot list zfs_return=file system list +#general use +destination=Destination: +filename=Filename: +continue=Continue +create=Create +destroy=Destroy + +#tasks +tasks=Tasks +differences=Differences: +differences_desc=Show differences in +rename=Rename: +rename_desc=Rename +clone=Clone: +clone_desc: Clone +destroy=Destroy: +destroy_pool=Destroy pool +destroy_filesystem=Destroy filesystem +destroy_snap=Destroy snapshot +snapshot=Snapshot: +snapshot_desc=Create new snapshot based on filesystem: +send=Send: +send_desc=Send +rollback=Rollback: +rollback_desc=Rollback + status_title=Zpool Status vdev_title=Manage Virtual Device @@ -15,11 +41,15 @@ diff_title=Snapshot Differences about_title=About ZFS Manager cmd_title=Issuing Command +cmd_dscpt=Command Description: +cmd_issue=Commands to be issued: +cmd_results=Results from commands: cmd_with=with command... cmd_setzfs=Attempting to set zfs property cmd_setpool=Attempting to set pool property cmd_snapshot=Attempting to create snapshot -cmd_send=Attempting to send snapshot +cmd_send=Send snapshot +cmd_gzip=to gzip file cmd_createzfs=Attempting to create filesystem cmd_clone=Attempting to clone cmd_rename=Attempting to rename @@ -31,10 +61,14 @@ cmd_upgrade=Attempting to upgrade pool cmd_export=Attempting to export pool cmd_import=Attempting to import pool cmd_zfsact=Attempting to -cmd_zfsdestroy=Attempting to destroy filesystem -cmd_snpdestroy=Attempting to destroy snapshot -cmd_pooldestroy=Attempting to destroy pool +cmd_destroy=Attempting to destroy +cmd_affect=This action will affect the following: +cmd_warning=Warning, this action will result in data loss, do you really want to continue? +cmd_understand=I understand +cmd_checkbox=checkbox must be selected cmd_multisnap=Attempting to destroy multiple snapshots... +cmd_success=Success! +cmd_error=error: snapshot_title=Snapshot snapshot_create=Create Snapshot diff --git a/zfsmanager-lib.pl b/zfsmanager-lib.pl index eb7f118..e674352 100755 --- a/zfsmanager-lib.pl +++ b/zfsmanager-lib.pl @@ -101,7 +101,6 @@ sub list_zfs sub list_snapshots { my ($snap) = @_; -#my %hash=null; $list=`zfs list -t snapshot -H -o name,$config{'list_snap'} -s creation $snap`; $idx = 0; open my $fh, "<", \$list;