2 % my $jobnum = $cgi->param('jobnum');
3 % my $url = $cgi->param('url');
4 % my $message = $cgi->param('message');
5 % my $popup_url = $cgi->param('popup_url');
6 % my $formname = scalar($cgi->param('formname'));
13 <BODY BGCOLOR="#ccccff" onLoad="refreshStatus()">
15 <% include('/elements/xmlhttp.html',
16 'url' => $p.'elements/jsrsServer.html',
17 'subs' => [ 'job_status' ],
20 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/control.js"></SCRIPT>
21 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/imagelist.js"></SCRIPT>
22 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/progress.js"></SCRIPT>
23 <SCRIPT TYPE="text/javascript">
24 function refreshStatus () {
25 //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
27 job_status( '<% $jobnum %>', updateStatus );
29 function updateStatus( status_statustext ) {
31 //var Array = status_statustext.split("\n");
32 var statusArray = eval('(' + status_statustext + ')');
33 var status = statusArray[0];
34 var statustext = statusArray[1];
35 var actiontext = statusArray[2];
37 //if ( status == 'progress' ) {
38 //IE workaround, no i have no idea why
39 if ( status.indexOf('progress') > -1 ) {
40 document.getElementById("progress_message").innerHTML = actiontext + '...';
41 document.getElementById("progress_percent").innerHTML = statustext + '%';
44 //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
45 job_status( '<% $jobnum %>', updateStatus );
46 } else if ( status.indexOf('complete') > -1 ) {
50 % ? "window.top.location.href = \\'$url\\';"
53 document.getElementById("progress_message").innerHTML = "<% $message %>";
54 document.getElementById("progress_bar").innerHTML = '';
55 document.getElementById("progress_percent").innerHTML =
56 '<INPUT TYPE="button" VALUE="OK" onClick="<% $onClick %>">';
57 document.getElementById("progress_jobnum").innerHTML = '';
60 if ( parent.document.<%$formname%>.submit.disabled == true ) {
61 parent.document.<%$formname%>.submit.disabled=false;
67 window.top.location.href = '<% $url %>';
68 % } elsif ( $popup_url ) {
69 document.location.replace('<% $popup_url %>');
73 alert('job done but no url or message specified');
75 } else if ( status.indexOf('done') > -1 ) {
77 document.getElementById("progress_message").innerHTML = "Loading report";
78 document.getElementById("progress_bar").innerHTML = '';
79 document.getElementById("progress_percent").innerHTML = '';
80 document.getElementById("progress_jobnum").innerHTML = '';
81 window.top.location.href = statustext.substr(8, statustext.length-18);
83 } else if ( status.indexOf('error') > -1 ) {
84 document.getElementById("progress_message").innerHTML = '<FONT SIZE="+1" COLOR="#FF0000">Error: ' + statustext + '</FONT>';
85 document.getElementById("progress_bar").innerHTML = '';
86 document.getElementById("progress_percent").innerHTML = '<INPUT TYPE="button" VALUE="OK" onClick="parent.nd(1);">';
87 document.getElementById("progress_jobnum").innerHTML = '';
88 if ( parent.document.<%$formname%>.submit.disabled == true ) {
89 parent.document.<%$formname%>.submit.disabled=false;
92 alert('XXX unknown status returned from server: ' + status);
100 <TD ALIGN="center" ID="progress_message">
101 Server processing job...
104 <TD ALIGN="center" ID="progress_bar">
105 <SCRIPT TYPE="text/javascript">
107 SEGS = new QImageList(4, 23, "<%$fsurl%>images/progressbar-empty.png", "<%$fsurl%>images/progressbar-full.png");
109 bar1 = new QProgress(null, "bar1", SEGS, 100);
116 <DIV ID="progress_percent">%</DIV>
119 <TD ALIGN="center" ID="progress_jobnum">
120 (progress of job #<% $jobnum %>)