summaryrefslogtreecommitdiff
path: root/httemplate/elements/progress-init.html
diff options
context:
space:
mode:
authormark <mark>2010-06-08 22:25:01 +0000
committermark <mark>2010-06-08 22:25:01 +0000
commitb7dbecfb82aea90a4289089927d0b17436b2ed5a (patch)
tree8f22377f952d54aba7efcde11a2cd3f2e8a8cf40 /httemplate/elements/progress-init.html
parent3d0320979331ac4b68fc07fd4203d74c1b05aff4 (diff)
RT#947: batch download of invoice PDFs
Diffstat (limited to 'httemplate/elements/progress-init.html')
-rw-r--r--httemplate/elements/progress-init.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html
index 194fc74..20eb9bf 100644
--- a/httemplate/elements/progress-init.html
+++ b/httemplate/elements/progress-init.html
@@ -1,3 +1,47 @@
+<%doc>
+Example:
+In misc/something.html:
+
+ <FORM NAME="MyForm">
+ <INPUT TYPE="hidden" NAME="recordnum" VALUE="42">
+ <INPUT TYPE="hidden" NAME="what_to_do" VALUE="delete">
+ <% 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!' },
+ );
+ </FORM>
+ <SCRIPT TYPE="text/javascript>process();</SCRIPT>
+
+In misc/process_something.html:
+
+<%init>
+my $server = FS::UI::Web::JSRPC->new('FS::something::process_whatever', $cgi);
+</%init>
+<% $server->process %>
+
+In FS/something.pm:
+
+sub process_whatever { #class method
+ my $job = shift;
+ my $param = thaw(base64_decode(shift));
+ # param = { 'recordnum' => 42, 'what_to_do' => delete }
+ # make use of this as you like
+ do_phase1;
+ $job->update_statustext(20);
+ do_phase2;
+ $job->update_statustext(40);
+ do_phase3;
+ $job->update_statustext(60);
+ # etc.
+ return 'BLAH BLAH NOBODY WILL EVER SEE THIS RETURN VALUE';
+}
+
+I am not responsible for errors in the above documentation.
+
+</%doc>
<% include('/elements/xmlhttp.html',
'method' => 'POST',
'url' => $action,