X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fprogress-init.html;h=de3c6b761393cbb397b75043a2d9eb9c923ebb75;hp=1c96a54ac9ed6fcc74b1cd546f9212a03467b48f;hb=ac3296dc4d9c1c7ff3646df6496a4f49d9e07b9b;hpb=c648976f0b7975f2328ebd7ba8c711fad0ca4195 diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html index 1c96a54ac..de3c6b761 100644 --- a/httemplate/elements/progress-init.html +++ b/httemplate/elements/progress-init.html @@ -1,17 +1,80 @@ -% -% my( $formname, $fields, $action, $url_or_message, $key ) = @_; -% $key = '' unless defined $key; -% -% my $url_or_message_link; -% if ( ref($url_or_message) ) { #its a message or something -% $url_or_message_link = -% 'message='. uri_escape( $url_or_message->{'message'} ) -% } else { -% $url_or_message_link = "url=$url_or_message"; -% } -% +<%doc> +Example: +In misc/something.html: +
+ + + <% include( '/elements/progress-init.html', + 'MyForm', + [ 'recordnum', 'what_to_do' ], + $p.'misc/process_something.html', + { url => $p.'where_to_go_next.html' }, + #or { message => 'Finished!' }, + #or { url => $p.'where_to_go.html', + message => 'Finished' }, + # which recirects to the URL and displays the message as a status + #or { popup_url => $p.'popup_contents.html' } + # which loads that URL into the popup after completion + #or { url => $p.'where_to_go.html', + error_url => $p.'where_we_just_were.html' } + # to redirect somewhere different on error + ) %> +
+ - + +<& /elements/init_overlib.html &> + + +<%init> + +my( $formname, $fields, $action, $url_or_message, $key ) = @_; +$key = '' unless defined $key; + +my %dest_info; +if ( ref($url_or_message) ) { #its a message or something + %dest_info = map { $_ => $url_or_message->{$_} } + grep { $url_or_message->{$_} } + qw( message url popup_url error_url reload_with_error ); +} else { + # it can also just be a url + %dest_info = ( 'url' => $url_or_message ); +} + +my $progress_url = URI->new($fsurl.'misc/progress-popup.html'); +$progress_url->query_form( + 'jobnum' => '_JOBNUM_', + 'formname' => $formname, + %dest_info, +); + +my $all_fields = 0; +my %copy_fields; +if (grep '/^ALL$/', @$fields) { + $all_fields = 1; +} else { + %copy_fields = map { $_ => 1 } @$fields; +} + +#stupid safari is caching the "location" of popup iframs, and submitting them +#instead of displaying them. this should prevent that. +my $popup_name = 'popup-'.random_id(); + +