X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fprogress-init.html;h=2ec248e322c01545e29f644d06c8943989dba79a;hb=b431ece7b4a71aa5771f44393da582692f668817;hp=3894feef93a68b2a54ab75c7caa1959c7b551250;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e;p=freeside.git diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html index 3894feef9..2ec248e32 100644 --- a/httemplate/elements/progress-init.html +++ b/httemplate/elements/progress-init.html @@ -1,17 +1,51 @@ -% -% 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 displays the message, then waits for confirmation before + # redirecting to the URL. + #or { popup_url => $p.'popup_contents.html' } + # which loads that URL into the popup after completion + ) %> +
+ - + +% if (!$noinit) { +<& /elements/init_overlib.html &> +% $noinit = 1; +% } + + +<%once> +my $noinit = 0; + +<%init> + +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'} ); + $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'}; + +} else { + $url_or_message_link = "url=$url_or_message"; +} + +#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; + +