1 <& /elements/header-popup.html, {
2 'etc' => 'onLoad="refreshStatus()"',
6 <& /elements/xmlhttp.html,
7 'url' => $p.'misc/jsrsServer.html',
8 'subs' => [ 'job_status' ],
10 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/control.js"></SCRIPT>
11 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/imagelist.js"></SCRIPT>
12 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/progress.js"></SCRIPT>
13 <script src="<% $fsurl %>elements/js.cookie.js"></script>
14 <SCRIPT TYPE="text/javascript">
15 function refreshStatus () {
16 //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
18 job_status( '<% $jobnum %>', updateStatus );
20 function updateStatus( status_statustext ) {
22 //var Array = status_statustext.split("\n");
23 var statusArray = eval('(' + status_statustext + ')');
24 var status = statusArray[0];
25 var statustext = statusArray[1];
26 var actiontext = statusArray[2];
28 //if ( status == 'progress' ) {
29 //IE workaround, no i have no idea why
30 if ( status.indexOf('progress') > -1 ) {
31 document.getElementById("progress_message").innerHTML = actiontext + '...';
32 document.getElementById("progress_percent").innerHTML = statustext + '%';
35 //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
36 job_status( '<% $jobnum %>', updateStatus );
37 } else if ( status.indexOf('complete') > -1 ) {
38 % if ( $message && !$url ) {
40 document.getElementById("progress_message").innerHTML = "<% $message %>";
41 document.getElementById("progress_bar").innerHTML = '';
42 document.getElementById("progress_percent").innerHTML =
43 '<INPUT TYPE="button" VALUE="OK" onClick="parent.nd(1)">';
44 document.getElementById("progress_jobnum").innerHTML = '';
46 if ( parent.document.<%$formname%>.submit.disabled == true ) {
47 parent.document.<%$formname%>.submit.disabled=false;
51 Cookies.set('freeside_status', <% $message |js_string %>, {
55 window.top.location.href = '<% $url %>';
56 % } elsif ( $popup_url ) {
57 document.location.replace('<% $popup_url %>');
61 alert('job done but no url or message specified');
63 } else if ( status.indexOf('done') > -1 ) {
65 document.getElementById("progress_message").innerHTML = "Loading report";
66 document.getElementById("progress_bar").innerHTML = '';
67 document.getElementById("progress_percent").innerHTML = '';
68 document.getElementById("progress_jobnum").innerHTML = '';
69 window.top.location.href = statustext.substr(8, statustext.length-18);
71 } else if ( status.indexOf('error') > -1 ) {
73 % # default behavior: just close the popup
74 % my $onClick = 'parent.nd(1);';
75 % if ( $error_url ) { # then on clicking to confirm, redirect somewhere
76 % $onClick = "window.top.location.href = \\'$error_url\\';";
79 document.getElementById("progress_message").innerHTML = '<FONT SIZE="+1" COLOR="#FF0000">Error: ' + statustext + '</FONT>';
80 document.getElementById("progress_bar").innerHTML = '';
81 document.getElementById("progress_percent").innerHTML = '<INPUT TYPE="button" VALUE="OK" onClick="<% $onClick %>">';
82 document.getElementById("progress_jobnum").innerHTML = '';
83 if ( parent.document.<%$formname%>.submit.disabled == true ) {
84 parent.document.<%$formname%>.submit.disabled=false;
87 alert('XXX unknown status returned from server: ' + status);
95 <TD ALIGN="center" ID="progress_message">
96 Server processing job...
99 <TD ALIGN="center" ID="progress_bar">
100 <SCRIPT TYPE="text/javascript">
102 SEGS = new QImageList(4, 23, "<%$fsurl%>images/progressbar-empty.png", "<%$fsurl%>images/progressbar-full.png");
104 bar1 = new QProgress(null, "bar1", SEGS, 100);
111 <DIV ID="progress_percent">%</DIV>
114 <TD ALIGN="center" ID="progress_jobnum">
115 (progress of job #<% $jobnum %>)
120 <& /elements/footer-popup.html &>
123 my $jobnum = $cgi->param('jobnum');
124 my $url = $cgi->param('url');
125 my $message = $cgi->param('message');
126 my $popup_url = $cgi->param('popup_url');
127 my $formname = scalar($cgi->param('formname'));
128 my $error_url = $cgi->param('error_url');