xowf::test_item::Answer_manager method waiting_room_message (public)
<instance of xowf::test_item::Answer_manager> 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 (required, object)
- 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 $messageXQL Not present: Generic, PostgreSQL, Oracle