Index: openacs-4/packages/xowf/xowf.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v diff -u -N -r1.12.2.17 -r1.12.2.18 --- openacs-4/packages/xowf/xowf.info 14 Jul 2020 19:38:53 -0000 1.12.2.17 +++ openacs-4/packages/xowf/xowf.info 4 Aug 2020 16:16:17 -0000 1.12.2.18 @@ -10,15 +10,15 @@ t xowf - + Gustaf Neumann XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms 2017-08-06 WU Vienna 2 - - + + Index: openacs-4/packages/xowf/lib/inclass-exam-answer.wf =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/Attic/inclass-exam-answer.wf,v diff -u -N -r1.1.2.19 -r1.1.2.20 --- openacs-4/packages/xowf/lib/inclass-exam-answer.wf 14 Jun 2020 20:26:29 -0000 1.1.2.19 +++ openacs-4/packages/xowf/lib/inclass-exam-answer.wf 4 Aug 2020 16:16:17 -0000 1.1.2.20 @@ -295,7 +295,15 @@ ? [$parent_obj last_modified] : [$obj creation_date]}] \ ] - ::xo::cc set_parameter top_includelet [list countdown-timer -target_time $target_time] + set url_poll [$obj pretty_link -query m=message-poll] + set url_dismiss [$obj pretty_link -query m=message-dismiss] + ::xo::cc set_parameter top_includelet \ + [list exam-top-includelet \ + -target_time $target_time \ + -url_poll $url_poll \ + -url_dismiss $url_dismiss \ + -poll_interval 5000 \ + ] } } @@ -451,8 +459,39 @@ } } + ######################################################################## + # AJAX call "message-poll" + # + :proc www-message-poll {} { + # + # Query messages for this exam and user + # + set response [::xowiki::includelet::personal-notification-messages get_messages_response \ + -notification_id ${:parent_id} \ + -user_id [xo::cc user_id]] + ns_return 200 text/json $response + ns_log notice "AJAX-message-poll -> $response" + ad_script_abort + } + + # + # AJAX call "message-dismiss" + # + :proc www-message-dismiss {} { + # + # Handle message dismiss + # + ns_log notice "AJAX-message-dismiss (${:parent_id} [xo::cc user_id] [ns_queryget ts])" + ::xowiki::includelet::personal-notification-messages message_dismiss \ + -notification_id ${:parent_id} \ + -user_id [xo::cc user_id] \ + -ts [ns_queryget ts] + ns_return 200 text/plain OK + ad_script_abort + } } + # # Local variables: # mode: tcl 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 -N -r1.1.2.39 -r1.1.2.40 --- openacs-4/packages/xowf/lib/inclass-exam.wf 29 Jul 2020 11:53:26 -0000 1.1.2.39 +++ openacs-4/packages/xowf/lib/inclass-exam.wf 4 Aug 2020 16:16:17 -0000 1.1.2.40 @@ -311,45 +311,50 @@ } } - set answerStatus "" - set marked "" - if {$state in {published done submission_review}} { - if {$state eq "done"} { - [$ctx object] setCSSDefaults - set marked [xowf::test_item::answer_manager marked_results -obj $obj -wf $wf $combined_form_info] - set marked "" ;# not needed right now + set www_method [xo::cc query_parameter m] + if {$www_method ni {edit view}} { + set marked "" + } else { + set answerStatus "" + set marked "" + if {$state in {published done submission_review} } { + if {$state eq "done"} { + [$ctx object] setCSSDefaults + set marked [xowf::test_item::answer_manager marked_results -obj $obj -wf $wf $combined_form_info] + set marked "" ;# not needed right now + } + set answerStatus [xowf::test_item::answer_manager answers_panel \ + -heading "#xowf.online-exam-submitted_exams_heading#" \ + -submission_msg "#xowf.online-exam-submitted_exams_msg#" \ + -polling=[expr {${:live_updates} && $state ni {initial created done}}] \ + -manager_obj $obj \ + -target_state done \ + -wf $wf] } - set answerStatus [xowf::test_item::answer_manager answers_panel \ - -heading "#xowf.online-exam-submitted_exams_heading#" \ - -submission_msg "#xowf.online-exam-submitted_exams_msg#" \ - -polling=[expr {${:live_updates} && $state ni {initial created done}}] \ - -manager_obj $obj \ - -target_state done \ - -wf $wf] - } - set qrCode "" - set countdownHTML "" - if {$state eq "published"} { - set src [$obj pretty_link -query m=qrcode] - set qrCode [subst {
}] - set target_time [xowf::test_item::question_manager exam_target_time \ - -manager $obj -base_time [$obj last_modified]] - set countdownHTML [xowf::test_item::answer_manager countdown_timer \ - -target_time $target_time -id "countdown"] - } + set qrCode "" + set countdownHTML "" + if {$state eq "published"} { + set src [$obj pretty_link -query m=qrcode] + set qrCode [subst {
}] + set target_time [xowf::test_item::question_manager exam_target_time \ + -manager $obj -base_time [$obj last_modified]] + set countdownHTML [xowf::test_item::answer_manager countdown_timer \ + -target_time $target_time -id "countdown"] + } - # Remove wrapping forms - regsub -all {]*>} $fullQuestionForm {} fullQuestionForm + # Remove wrapping forms + regsub -all {]*>} $fullQuestionForm {} fullQuestionForm - append text [subst { -
-
$answerStatus
-
$fullQuestionForm
-
$qrCode
-
$countdownHTML
-
- }] + append text [subst { +
+
$answerStatus
+
$fullQuestionForm
+
$qrCode
+
$countdownHTML
+
+ }] + } set footer "$menu $extraAction" @@ -445,7 +450,6 @@ set HTML "" set wf [xowf::test_item::answer_manager get_answer_wf [self]] if {$wf ne ""} { - set items [xowf::test_item::answer_manager get_wf_instances $wf] set items2 [$items deep_copy] foreach i [$items2 children] { @@ -789,7 +793,6 @@ } } - :proc www-qrcode {} { # # Produce a QR code with an answer link @@ -868,6 +871,22 @@ #ns_log notice "MASTER POLL [self] ${:name}, returned [llength $answered]/[llength $answers]" ad_script_abort } + + ######################################################################## + # AJAX call "send-participant-message" + # + :proc www-send-participant-message {} { + # + # Send a message to a participant + # + ::xowiki::includelet::personal-notification-messages message_add \ + -notification_id ${:item_id} \ + -to_user_id [xo::cc user_id] \ + -payload [list msg [ns_queryget msg] from [xo::cc user_id] urgency [ns_queryget urgency]] + + ns_return 200 text/plain ok + ad_script_abort + } } # 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 -N -r1.7.2.70 -r1.7.2.71 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 1 Jul 2020 19:31:58 -0000 1.7.2.70 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 4 Aug 2020 16:16:17 -0000 1.7.2.71 @@ -68,7 +68,7 @@ Wrapper for complex test items, containing specification for minutes, grading scheme, feedback levels, handling different types of questions ("interactions" in the terminology of QTI). When such - a question is saved, a HTML form is generated, which is used as a + a question is saved, an HTML form is generated, which is used as a question. @param feedback_level "full", "single", or "none" @@ -1999,7 +1999,7 @@ -spec text,label=#xowf.participant#] \ [$wf create_raw_form_field \ -name _online-exam-fullName \ - -spec text,label=#acs-subsite.Name#] \ + -spec url,label=#acs-subsite.Name#] \ [$wf create_raw_form_field \ -name _state \ -spec text,label=#xowf.Status#] \ @@ -2030,6 +2030,7 @@ # Extend properties of every answer with corresponding ".score" # values. # + set dialogs "" foreach p [$items children] { #foreach ff_obj $answer_form_field_objs { @@ -2041,14 +2042,22 @@ set duration [:get_duration [$p get_revision_sets]] $p set_property -new 1 _online-exam-seconds \ [expr {[dict get $duration toClock] - [dict get $duration fromClock]}] + + set dialog_info [::xowiki::includelet::personal-notification-messages \ + modal_message_dialog -to_user_id [$p creation_user]] + append dialogs [dict get $dialog_info dialog] \n + $p set online-exam-fullName "[dict get $dialog_info link] [$p set online-exam-fullName]" } + ::xowiki::includelet::personal-notification-messages \ + modal_message_dialog_register_submit \ + -url [$wf pretty_link -query m=send-participant-message] + if {$state eq "done"} { set uc {tcl {[$p state] ne "done"}} } else { set uc {tcl {false}} } - # # Render table widget with extended properties. # @@ -2065,7 +2074,7 @@ -return_url_att local_return_url \ ] $table_widget destroy - return $HTML + return $dialogs$HTML } @@ -2879,6 +2888,7 @@ proctor-answer {{item_id read}} proctor {{item_id read}} poll admin + send-participant-message admin edit admin print-answers admin print-answer-table admin @@ -2890,8 +2900,10 @@ } test-item-policy-answer contains { Class create FormPage -array set require_permission { - poll {{item_id read}} - edit {{item_id read}} + poll {{item_id read}} + edit {{item_id read}} + message-poll {{item_id read}} + message-dismiss {{item_id read}} } } Index: openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl,v diff -u -N -r1.4.2.2 -r1.4.2.3 --- openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl 23 Mar 2020 16:54:47 -0000 1.4.2.2 +++ openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl 4 Aug 2020 16:16:17 -0000 1.4.2.3 @@ -5,9 +5,9 @@ @creation-date 2008-03-05 } -::xo::db::require package xowiki +::xo::library require -package xotcl-core 06-package-procs +::xo::library require -package xowiki includelet-procs - namespace eval ::xowiki::includelet { # # Define additional elements for includelets @@ -157,8 +157,55 @@ return [xowf::test_item::answer_manager countdown_timer \ -target_time $target_time -id [::xowiki::Includelet html_id [self]]] } +} +namespace eval ::xowiki::includelet { + # + # exam-top-includelet + # + Class exam-top-includelet -superclass ::xowiki::Includelet \ + -parameter { + {__decoration plain} + {parameter_declaration { + {-target_time ""} + {-url_poll ""} + {-url_dismiss ""} + {-poll_interval 5000} + }} + } -ad_doc { + + This is the top includelet for the in-class exam, containing a + countdown timer and the personal notifications includelet + + @param target_time + @param url_poll + @param url_dismiss + @param poll_interval + } + + exam-top-includelet instproc render {} { + :get_parameters + + if {$url_poll ne ""} { + set pn [${:__including_page} include \ + [list personal-notification-messages \ + -url_poll $url_poll \ + -url_dismiss $url_dismiss \ + -poll_interval $poll_interval \ + ]] + } else { + set pn "" + } + return [subst { + [${:__including_page} include [list countdown-timer -target_time $target_time]] + $pn + }] + } + } + + +::xo::library source_dependent # # Local variables: # mode: tcl