summaryrefslogtreecommitdiff
path: root/httemplate/elements/progress-popup.html
blob: d180c17d40900f92ae29df92872aa95f0cd4fce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<%
  my $jobnum = $cgi->param('jobnum');
  my $url = $cgi->param('url');
  my $formname = scalar($cgi->param('formname'));
%>
<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.<%=$formname%>.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>