From a9d755c3cee7542d3ca552174af0b7b71693ae58 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 14 Aug 2008 11:56:12 +0000 Subject: customer import: add progress bar & redirect to a search of the imported customers, #3475 --- httemplate/elements/form-file_upload.html | 93 +++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 httemplate/elements/form-file_upload.html (limited to 'httemplate/elements/form-file_upload.html') diff --git a/httemplate/elements/form-file_upload.html b/httemplate/elements/form-file_upload.html new file mode 100644 index 000000000..f398ba42d --- /dev/null +++ b/httemplate/elements/form-file_upload.html @@ -0,0 +1,93 @@ +<%doc> + +Example: + + <% include( '/elements/form-file_upload.html', + + 'name' => 'form_name', + 'action' => 'process/target.cgi', #progress-init target + 'fields' => [ 'other', 'form', 'fields' ], + 'num_files' => 1, #or more + + 'url' => $url + #OR + 'message' => 'Message', + + #optional + 'key' => 'unique_key', #for using more than once on a page + ) + +% #... + +% # num_files=>1 + include( '/elements/file-upload.html', + 'field' => 'element', + 'label' => 'Label', + ) + +% # OR + +% # num_files=>2 # or more + include( '/elements/file-upload.html', + 'field' => [ 'element', 'element2', ], #etc. + 'label' => [ 'Label', 'Label2', ], #etc. + ) + + +%> + + + +<% include( '/elements/progress-init.html', + $opt{name}, + $opt{fields}, + $opt{action}, + $msg_or_url, + $opt{key}, + ) +%> + + + +
+ +
+ +<%init> + +#my( $formname, $fields, $action, $url_or_message, $key ) = @_; +my %opt = ref($_[0]) ? %{ $_[0] } : @_; + +my $key = exists $opt{key} ? $opt{key} : ''; + +push @{ $opt{fields} }, 'uploaded_files'; + +my $msg_or_url = $opt{message} + ? { 'message' => $opt{message}, + 'url' => $opt{url}, + } + : $opt{url}; + + -- cgit v1.2.1