xowf::test_item::Answer_manager method waiting_room_message (public)

 <instance of xowf::test_item::Answer_manager[i]> waiting_room_message \
    obj

Defined in packages/xowf/tcl/test-item-procs.tcl

Renders the waiting room message, including the JavaScript reacting to actions from the backend.

Parameters:
obj

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) template::add_body_script template::add_body_script (public) xowiki::bootstrap::card xowiki::bootstrap::card (public) xowf::test_item::Answer_manager instproc waiting_room_message xowf::test_item::Answer_manager instproc waiting_room_message xowf::test_item::Answer_manager instproc waiting_room_message->_ xowf::test_item::Answer_manager instproc waiting_room_message->template::add_body_script xowf::test_item::Answer_manager instproc waiting_room_message->xowiki::bootstrap::card

Testcases:
No testcase defined.
Source code:
set message [::xowiki::bootstrap::card  -title #xowf.Waiting_Room#  -body [subst {
                   <p>[_ xowf.waiting_for_exam [list title "[$obj title]"]]
                   <p><adp:icon name='clock'>  <span id='waiting-msg'></span></p>
                   #xowf.waiting_redirect#
                 }]]

set url [$obj pretty_link -query m=poll-open]
template::add_body_script -script [subst -nocommands {
  (function poll() {
    setTimeout(function() {
      var xhttp = new XMLHttpRequest();
      xhttp.open("GET", '$url', true);
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
          var data = JSON.parse(xhttp.response);
          console.log(data);
          console.log(data["action"]);
          console.log(data["msg"]);
          if (data["action"] == "msg") {
            var el = document.querySelector('#waiting-msg');
            el.innerHTML = data["msg"];
            poll();
          } else if (data["action"] == "redirect") {
            window.location.href =  data["url"];
          } else {
            console.log("something else");
          }
        }
      };
      xhttp.send();
    }, 1000);
  })();
}]
return $message
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: