Show upload and unzip progress
authorJamie Cameron <jcameron@webmin.com>
Mon, 8 Nov 2010 05:09:17 +0000 (21:09 -0800)
committerJamie Cameron <jcameron@webmin.com>
Mon, 8 Nov 2010 05:09:17 +0000 (21:09 -0800)
updown/lang/en
updown/upload.cgi

index 6fee16a..c37e7a0 100644 (file)
@@ -60,6 +60,10 @@ upload_extracted=, and extracted files ..
 upload_deleted=, and extracted files before deleting archive ..
 upload_notcomp=Not a ZIP or TAR file
 upload_eemail=Missing email address to notify
+upload_saving=Saving file $1 ..
+upload_saved=.. wrote $1
+upload_unzipping=Extracting file $1 ..
+upload_unzipdone=.. $1
 
 download_err=Failed to save download
 download_enone=No URLs to download entered
@@ -116,6 +120,7 @@ email_downpath=Destination filename: $1
 email_downsize=Downloaded size: $1
 email_subjectd=Download complete
 email_eextract=Failed : $1
+email_extfailed=extraction failed : $1
 email_extdone_zip=ZIP file extracted
 email_extdone_tar=TAR file extracted
 email_extdone_tgz=Gzipped TAR file extracted
index 7264bd2..a9c835d 100755 (executable)
@@ -48,7 +48,9 @@ if (!-d $in{'dir'} && $in{'mkdir'}) {
        mkdir($in{'dir'}, 0755) || &error(&text('upload_emkdir', $!));
        }
 
-# Save the actual files
+&ui_print_header(undef, $text{'upload_title'}, "");
+
+# Save the actual files, showing progress
 $msg = undef;
 for($i=0; defined($d = $in{"upload$i"}); $i++) {
        $f = $in{"upload${i}_filename"};
@@ -60,6 +62,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) {
        else {
                $path = $in{'dir'};
                }
+       print &text('upload_saving', "<tt>$path</tt>"),"<br>\n";
        if (!&open_tempfile(FILE, ">$path", 1)) {
                &error(&text('upload_eopen', "<tt>$path</tt>", $!));
                }
@@ -67,9 +70,11 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) {
        &close_tempfile(FILE);
        push(@uploads, $path);
        @st = stat($path);
+       print &text('upload_saved', &nice_size($st[7])),"<p>\n";
 
        $estatus = undef;
        if ($in{'zip'}) {
+               print &text('upload_unzipping', "<tt>$path</tt>"),"<br>\n";
                local ($err, $out);
                $path =~ /^(\S*\/)/;
                local $dir = $1;
@@ -175,6 +180,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) {
                        }
                $estatus = $err ? &text('email_extfailed', $err)
                                : &text('email_extdone_'.$fmt);
+               print &text('upload_unzipdone', $estatus),"<p>\n";
                }
 
        # Add to email message
@@ -190,16 +196,6 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) {
 # Switch back to root
 &switch_uid_back();
 
-&ui_print_header(undef, $text{'upload_title'}, "");
-
-print "<p>$text{'upload_done'}<p>\n";
-foreach $u (@uploads) {
-       @st = stat($u);
-       print "<tt>$u</tt> ",@st ? "($st[7] bytes)" : "",
-             $ext{$u} ? " $ext{$u}" : "","<p>\n";
-       }
-print "<p>\n";
-
 # Save the settings
 if ($module_info{'usermin'}) {
        &lock_file("$user_module_config_directory/config");