diff options
author | ivan <ivan> | 2005-02-20 08:44:40 +0000 |
---|---|---|
committer | ivan <ivan> | 2005-02-20 08:44:40 +0000 |
commit | d6047391feb3236374e16fd73240d9821d77fe06 (patch) | |
tree | 26cd3c1df50a28ed50ce77669a31d672748866a6 /httemplate/elements/progress-popup.html | |
parent | 9e1ec0694dff61d375af8c0ef0e3895a7f1e07fd (diff) |
use a javascript layer instead of a browser popup (popup blockers), really generalize the progressbar code to make it easy to use as a component
Diffstat (limited to 'httemplate/elements/progress-popup.html')
-rw-r--r-- | httemplate/elements/progress-popup.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/httemplate/elements/progress-popup.html b/httemplate/elements/progress-popup.html new file mode 100644 index 000000000..0881a9643 --- /dev/null +++ b/httemplate/elements/progress-popup.html @@ -0,0 +1,74 @@ +<% + my( $jobnum ) = $cgi->param('jobnum'); + my( $url ) = $cgi->param('url'); +%> +<HTML> + <HEAD> + <TITLE></TITLE> + </HEAD> + <BODY BGCOLOR="#ccccff" onLoad="refreshStatus()"> + +<SCRIPT TYPE="text/javascript" SRC="../elements/jsrsClient.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" src="../elements/qlib/control.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" src="../elements/qlib/imagelist.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" src="../elements/qlib/progress.js"></SCRIPT> +<SCRIPT TYPE="text/javascript"> +function refreshStatus () { + jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' ); +} +function updateStatus( status_statustext ) { + var Array = status_statustext.split("\n"); + var status = Array[0]; + var statustext = Array[1]; + //if ( status == 'progress' ) { + //IE workaround, no i have no idea why + if ( status.indexOf('progress') > -1 ) { + document.getElementById("progress_percent").innerHTML = statustext + '%'; + bar1.set(statustext); + bar1.update; + jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' ); + } else if ( status.indexOf('complete') > -1 ) { + window.top.location.href = '<%= $url %>'; + } else if ( status.indexOf('error') > -1 ) { + document.getElementById("progress_message").innerHTML = '<FONT SIZE="+1" COLOR="#FF0000">Error: ' + statustext + '</FONT>'; + document.getElementById("progress_bar").innerHTML = ''; + document.getElementById("progress_percent").innerHTML = '<INPUT TYPE="button" VALUE="OK" onClick="parent.nd(1);">'; + document.getElementById("progress_jobnum").innerHTML = ''; + parent.document.OneTrueForm.submit.disabled=false; + } else { + alert('XXX unknown status returned from server: ' + status); + } + +} +</SCRIPT> + + <TABLE> + <TR> + <TD ALIGN="center" ID="progress_message"> + Server processing job... + </TD> + </TR><TR> + <TD ALIGN="center" ID="progress_bar"> + <SCRIPT TYPE="text/javascript"> + // Create imagelist + SEGS = new QImageList(4, 23, "../images/progressbar-empty.png", "../images/progressbar-full.png"); + // Create bars + bar1 = new QProgress(null, "bar1", SEGS, 100); + // bar1.set(0); + // bar1.update; + </SCRIPT> + </TD> + </TR><TR> + <TD ALIGN="center"> + <DIV ID="progress_percent">%</DIV> + </TD> + </TR><TR> + <TD ALIGN="center" ID="progress_jobnum"> + (progress of job #<%= $jobnum %>) + </TD> + </TR> + </TABLE> + + </BODY> +</HTML> + |