Upload tracket
authorJamie Cameron <jcameron@webmin.com>
Tue, 26 Feb 2008 17:45:49 +0000 (17:45 +0000)
committerJamie Cameron <jcameron@webmin.com>
Tue, 26 Feb 2008 17:45:49 +0000 (17:45 +0000)
custom/CHANGELOG
custom/form.cgi
custom/index.cgi
custom/lang/en
custom/run.cgi

index d4aec5c..bb3f9db 100644 (file)
@@ -18,3 +18,5 @@ Removed the Module Config option to control if a shell is used when executing a
 ---- Changes since 1.390 ----
 Re-designed the user interface somewhat, and converted all code to use the new Webmin UI library.
 When commands are shown in a table and no parameters are needed, the names now link directly to run the command.
+---- Changes since 1.400 ----
+Added a popup progress tracker to commands with file upload fields.
index d691357..401bcd7 100755 (executable)
@@ -11,12 +11,17 @@ $cmd = $cmds[$in{'idx'}];
 # Display form for command parameters
 &ui_print_header(undef, $text{'form_title'}, "");
 @a = @{$cmd->{'args'}};
-($up) = grep { $_->{'type'} == 10 } @a;
+@up = grep { $_->{'type'} == 10 } @a;
 if ($cmd->{'edit'}) {
        print &ui_form_start("view.cgi");
        }
-elsif ($up) {
-       print &ui_form_start("run.cgi", "form-data");
+elsif (@up) {
+       # Has upload fields
+       @ufn = map { $_->{'name'} } @up;
+       $upid = time().$$;
+       $html .= &ui_form_start("run.cgi?id=$upid",
+         "form-data", undef,
+         &read_parse_mime_javascript($upid, \@ufn));
        }
 elsif (@a) {
        print &ui_form_start("run.cgi", "post");
index 614f35c..408ba90 100755 (executable)
@@ -36,9 +36,14 @@ elsif ($config{'display_mode'} == 0) {
                        $html .= &ui_form_start("sql.cgi");
                        }
                else {
-                       local ($up) = grep { $_->{'type'} == 10 } @a;
-                       if ($up) {
-                               $html .= &ui_form_start("run.cgi", "form-data");
+                       local @up = grep { $_->{'type'} == 10 } @a;
+                       if (@up) {
+                               # Has upload fields
+                               @ufn = map { $_->{'name'} } @up;
+                               $upid = time().$$;
+                               $html .= &ui_form_start("run.cgi?id=$upid",
+                                 "form-data", undef,
+                                 &read_parse_mime_javascript($upid, \@ufn));
                                }
                        elsif (@a) {
                                $html .= &ui_form_start("run.cgi", "post");
index 3178fc2..bb642c8 100644 (file)
@@ -76,6 +76,7 @@ run_out2on=Output from command on $2 ..
 run_noout=No output generated
 run_ecmduser=User '$1' to run command as does not exist
 run_eopt=Invalid option selected
+run_eupload=No file to upload selected
 run_timeout=Command terminated after $1 second timeout.
 
 log_modify=Modified command $1
index 4840d43..fd916d9 100755 (executable)
@@ -5,7 +5,8 @@
 require './custom-lib.pl';
 $theme_no_table = 1;
 if ($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/i) {
-       &ReadParseMime();
+       &ReadParse(\%getin, "GET");
+       &ReadParseMime(undef, \&read_parse_mime_callback, [ $getin{'id'} ]);
        }
 else {
        &ReadParse();