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'));
7 % my $error_url = $cgi->param('error_url');
14 <BODY BGCOLOR="#ccccff" onLoad="refreshStatus()">
16 <% include('/elements/xmlhttp.html',
17 'url' => $p.'misc/jsrsServer.html',
18 'subs' => [ 'job_status' ],
21 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/control.js"></SCRIPT>
22 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/imagelist.js"></SCRIPT>
23 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/progress.js"></SCRIPT>
24 <SCRIPT TYPE="text/javascript">
25 function refreshStatus () {
26 //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
28 job_status( '<% $jobnum %>', updateStatus );
30 function updateStatus( status_statustext ) {
32 //var Array = status_statustext.split("\n");
33 var statusArray = eval('(' + status_statustext + ')');
34 var status = statusArray[0];
35 var statustext = statusArray[1];
36 var actiontext = statusArray[2];
38 //if ( status == 'progress' ) {
39 //IE workaround, no i have no idea why
40 if ( status.indexOf('progress') > -1 ) {
41 document.getElementById("progress_message").innerHTML = actiontext + '...';
42 document.getElementById("progress_percent").innerHTML = statustext + '%';
45 //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
46 job_status( '<% $jobnum %>', updateStatus );
47 } else if ( status.indexOf('complete') > -1 ) {
51 % ? "window.top.location.href = \\'$url\\';"
54 document.getElementById("progress_message").innerHTML = "<% $message %>";
55 document.getElementById("progress_bar").innerHTML = '';
56 document.getElementById("progress_percent").innerHTML =
57 '<INPUT TYPE="button" VALUE="OK" onClick="<% $onClick %>">';
58 document.getElementById("progress_jobnum").innerHTML = '';
61 if ( parent.document.<%$formname%>.submit.disabled == true ) {
62 parent.document.<%$formname%>.submit.disabled=false;
68 window.top.location.href = '<% $url %>';
69 % } elsif ( $popup_url ) {
70 document.location.replace('<% $popup_url %>');
74 alert('job done but no url or message specified');
76 } else if ( status.indexOf('done') > -1 ) {
78 document.getElementById("progress_message").innerHTML = "Loading report";
79 document.getElementById("progress_bar").innerHTML = '';
80 document.getElementById("progress_percent").innerHTML = '';
81 document.getElementById("progress_jobnum").innerHTML = '';
82 window.top.location.href = statustext.substr(8, statustext.length-18);
84 } else if ( status.indexOf('error') > -1 ) {
86 % # default behavior: just close the popup
87 % my $onClick = 'parent.nd(1);';
88 % if ( $error_url ) { # then on clicking to confirm, redirect somewhere
89 % $onClick = "window.top.location.href = \\'$error_url\\';";
92 document.getElementById("progress_message").innerHTML = '<FONT SIZE="+1" COLOR="#FF0000">Error: ' + statustext + '</FONT>';
93 document.getElementById("progress_bar").innerHTML = '';
94 document.getElementById("progress_percent").innerHTML = '<INPUT TYPE="button" VALUE="OK" onClick="<% $onClick %>">';
95 document.getElementById("progress_jobnum").innerHTML = '';
96 if ( parent.document.<%$formname%>.submit.disabled == true ) {
97 parent.document.<%$formname%>.submit.disabled=false;
100 alert('XXX unknown status returned from server: ' + status);
108 <TD ALIGN="center" ID="progress_message">
109 Server processing job...
112 <TD ALIGN="center" ID="progress_bar">
113 <SCRIPT TYPE="text/javascript">
115 SEGS = new QImageList(4, 23, "<%$fsurl%>images/progressbar-empty.png", "<%$fsurl%>images/progressbar-full.png");
117 bar1 = new QProgress(null, "bar1", SEGS, 100);
124 <DIV ID="progress_percent">%</DIV>
127 <TD ALIGN="center" ID="progress_jobnum">
128 (progress of job #<% $jobnum %>)