Index: openacs-4/packages/xowf/lib/inclass-exam.wf =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/Attic/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 #