source: main/waeup.kofa/branches/uli-fix-zc-async/src/waeup/kofa/async.pt

Last change on this file was 9217, checked in by uli, 12 years ago

Merge changes from uli-async-update back into trunk.

File size: 1.6 KB
Line 
1<html>
2  <head>
3    <title>Async testing</title>
4    <script type="text/javascript">
5$(document).ready(function() {
6  var myLoadingDiv = $("#progressbar");
7  var mySpinner = $("#loadspinner");
8  myLoadingDiv.progressbar({disabled:true});
9  function update() {
10  $.getJSON("status?",  {jobid: "4",}, function(data) {
11    if (data == null) {
12      myLoadingDiv.progressbar("disable");
13      myLoadingDiv.progressbar("value", 0);
14      mySpinner.html('No Data');
15      $("#msg").html("Syncing...");
16      clearInterval(intervalID);
17      //alert('No Data'):
18      }
19    else {
20      myLoadingDiv.progressbar("enable");
21      myLoadingDiv.progressbar("value", data.percent);
22      $("#msg").html(data.msg + ' (' + data.status + ') ');
23      //alert(data.msg);
24      if (data.percent == 100) {
25        mySpinner.html('Job finished.')
26        clearInterval(intervalID);
27        }
28      }
29  });}
30  intervalID = setInterval(update, 500);
31  //update();
32});
33    </script>
34  </head>
35  <body>
36    <h1>Async stuff</h1>
37    <div>Dispatcher: <span tal:content="view/dispatcher"></span></div>
38    <div>Queue: <span tal:content="view/queue"></span></div>
39    <div>Jobs: <span tal:content="structure view/job_status"></span></div>
40    <form method="POST">
41      <input type="submit" name="reload" value="reload" />
42      <input type="submit" name="start" value="start up" />
43    </form>
44    <div id="progressbar"
45         class="ui-progressbar ui-widget ui-widget-content ui-corner-all">
46    </div>
47    <div id="msg">Hi there</div>
48    <div id="loadspinner">
49      <img src="" alt="Please wait..."
50           tal:attributes="src view/spinner_url" />
51    </div>
52  </body>
53</html>
Note: See TracBrowser for help on using the repository browser.