Gustaf Neumann
XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms
2021-09-15
WU Vienna
BSD-Style
2
-
+
Index: openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml,v
diff -u -r1.2.2.84 -r1.2.2.85
--- openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 15 Dec 2022 19:28:20 -0000 1.2.2.84
+++ openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 28 Feb 2023 15:18:13 -0000 1.2.2.85
@@ -258,5 +258,8 @@
Dateiabgabefrage
Wert muss kleiner oder gleich sein als
Wert muss gr��er oder gleich sein als
+ Warteraum
+ Die Pr�fung "%title%" ist noch nicht freigegeben.
+ Sobald die Pr�fung freigegeben ist, werden sie automatisch weitergeleitet.
ohne Bearbeitungszeit
Index: openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml,v
diff -u -r1.2.2.90 -r1.2.2.91
--- openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 15 Dec 2022 19:28:20 -0000 1.2.2.90
+++ openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 28 Feb 2023 15:18:13 -0000 1.2.2.91
@@ -279,5 +279,8 @@
File Upload Question
Value must smaller or equal
Value must larger or equal
+ Waiting Room
+ Waiting for exam "%title%" to be opened.
+ When the exam is opened, you will be automatically redirected.
without specified minutes
Index: openacs-4/packages/xowf/lib/inclass-exam.wf
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/inclass-exam.wf,v
diff -u -r1.1.2.105 -r1.1.2.106
--- openacs-4/packages/xowf/lib/inclass-exam.wf 12 Jan 2023 13:43:32 -0000 1.1.2.105
+++ openacs-4/packages/xowf/lib/inclass-exam.wf 28 Feb 2023 15:18:13 -0000 1.1.2.106
@@ -47,6 +47,7 @@
# - "edit" (for students),
# - "exam-results" (for lecturers),
# - "poll" (for lecturers),
+# - "poll-open" (for students),
# - "print-answers" (for lecturers),
# - "print-participants" (for lecturers),
# - "proctor" (for students),
@@ -718,8 +719,13 @@
# Make sure that no-one tries to start the answer workflow in a
# state different to "published".
#
- if {[:property _state] ne "published"} {
- return [:www-view "Cannot start answer workflow in this state"]
+ if {${:state} ne "published"} {
+ switch ${:state} {
+ done { set message "
#xowf.inclass-exam-closed#" }
+ created { set message [:AM waiting_room_message [self]] }
+ default { set message "
#The Exam has not been published#" }
+ }
+ return [:www-view $message]
} elseif {![:AM allow_answering -examwf [self] -ip [ns_conn peeraddr]]} {
return [:www-view "
[_ xowf.IPrange_not_allowed [list ip [ns_conn peeraddr]]]"]
} else {
@@ -901,6 +907,17 @@
ad_script_abort
}
+ :proc www-poll-open {} {
+ if {${:state} eq "created"} {
+ set time [lc_time_fmt [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"] "%Q %T"]
+ ns_return 200 text/plain [subst {{"action": "msg", "msg": "$time"} }]
+ } else {
+ set URL [:pretty_link -query m=answer]
+ ns_return 200 text/plain [subst {{"action": "redirect", "url": "$URL"} }]
+ }
+ ad_script_abort
+ }
+
########################################################################
# AJAX call "send-participant-message", acts as responder
#
Index: openacs-4/packages/xowf/tcl/test-item-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test-item-procs.tcl,v
diff -u -r1.7.2.270 -r1.7.2.271
--- openacs-4/packages/xowf/tcl/test-item-procs.tcl 31 Jan 2023 10:09:05 -0000 1.7.2.270
+++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 28 Feb 2023 15:18:13 -0000 1.7.2.271
@@ -1749,10 +1749,54 @@
# - last_time_switched_to_state
# - state_periods
# - time_window_setup
+ # - waiting_room_message
#
#----------------------------------------------------------------------
# Class: Answer_manager
+ # Method: waiting_room_message
+ #----------------------------------------------------------------------
+ :public method waiting_room_message {obj:object} {
+ set message [::xowiki::bootstrap::card \
+ -title #xowf.Waiting_Room# \
+ -body [subst {
+
[_ xowf.waiting_for_exam [list title "[$obj title]"]]
+
+ #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
+ }
+
+ #----------------------------------------------------------------------
+ # Class: Answer_manager
# Method: create_workflow
#----------------------------------------------------------------------
:public method create_workflow {
@@ -7835,6 +7879,7 @@
view-my-exam {{item_id read}}
proctor-answer {{item_id read}}
proctor {{item_id read}}
+ poll-open {{item_id read}}
view admin
poll admin
send-participant-message admin