X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fprogress-init.html;h=2a62c5e9975e5a323a18344ce57e0175379d4ff6;hp=2ec248e322c01545e29f644d06c8943989dba79a;hb=978a10cd56e76e763b15f21c533d507d5bc84dec;hpb=daf98ce13817230ffb103daf413190da3ed0f217 diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html index 2ec248e32..2a62c5e99 100644 --- a/httemplate/elements/progress-init.html +++ b/httemplate/elements/progress-init.html @@ -13,10 +13,12 @@ In misc/something.html: #or { message => 'Finished!' }, #or { url => $p.'where_to_go.html', message => 'Finished' }, - # which displays the message, then waits for confirmation before - # redirecting to the URL. + # 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 ) %> -<%once> -my $noinit = 0; - <%init> my( $formname, $fields, $action, $url_or_message, $key ) = @_; $key = '' unless defined $key; -my $url_or_message_link; +my %dest_info; if ( ref($url_or_message) ) { #its a message or something - $url_or_message_link = 'message='. uri_escape( $url_or_message->{'message'} ); - $url_or_message_link .= ';url='. uri_escape( $url_or_message->{'url'} ) - if $url_or_message->{'url'}; - $url_or_message_link = 'popup_url=' .uri_escape( $url_or_message->{'popup_url'} ) - if $url_or_message->{'popup_url'}; + %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 { - $url_or_message_link = "url=$url_or_message"; + %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-'.time. "-$$-". rand() * 2**32; +my $popup_name = 'popup-'.random_id();