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.61 -r1.1.2.62 --- openacs-4/packages/xowf/lib/inclass-exam.wf 31 Mar 2021 15:21:14 -0000 1.1.2.61 +++ openacs-4/packages/xowf/lib/inclass-exam.wf 1 Apr 2021 17:24:57 -0000 1.1.2.62 @@ -267,25 +267,30 @@ # } + set answers [xowf::test_item::answer_manager get_answers $wf] + # - # If there are answers, include the full menu. + # Per default, the entries are disabled. when there are answers, + # these will be enabled. # - set answers [xowf::test_item::answer_manager get_answers $wf] - if {[llength $answers] > 0} { + set link_disabled [expr {[llength $answers] == 0 ? "link-disabled" : ""}] + set md [subst { + listing {obj $wf m list label #xowf.online-exam-exam_instances# glyph list} + participants {obj $obj m print-participants label #xowf.Participants# glyph user} + protocol {obj $obj m print-answers label #xowf.online-exam-protocol# glyph list-alt} + results {obj $obj m print-answer-table label #xowf.online-exam-results-table# glyph th-list} + }] - set lLink "$wf_pretty_link?m=list" - set pLink1 [$obj pretty_link -query m=print-answers] - set pLink2 [$obj pretty_link -query m=print-answer-table] - set pLink3 [$obj pretty_link -query m=print-participants] + if {![acs_user::site_wide_admin_p -user_id [::xo::cc user_id]]} { + dict unset md listing + } + dict unset md results - set menu "\[" - if {[acs_user::site_wide_admin_p -user_id [::xo::cc user_id]]} { - append menu "#xowf.online-exam-exam_instances#, " - } - append menu \ - "#xowf.Participants#, " \ - "#xowf.online-exam-protocol#, " \ - "#xowf.online-exam-results-table#\]" + set menu "" + dict for {name d} $md { + set href [[dict get $d obj] pretty_link -query m=[dict get $d m]] + append menu "" \ + " [dict get $d label]\n" } } @@ -328,7 +333,8 @@ } else { set answerStatus "" set marked "" - if {$state in {published done submission_review} } { + + if {$state in {published done submission_review} || [llength $answers] > 0 } { if {$state eq "done"} { [$ctx object] setCSSDefaults set marked [xowf::test_item::answer_manager marked_results -obj $obj -wf $wf $combined_form_info] @@ -340,6 +346,7 @@ -polling=[expr {${:live_updates} && $state ni {initial created done}}] \ -manager_obj $obj \ -target_state done \ + -extra_text $menu \ -wf $wf] } @@ -359,15 +366,15 @@ append text [subst {
-
$answerStatus
+
$answerStatus
+
$qrCode
$fullQuestionForm
-
$qrCode
$countdownHTML
}] } - set footer "$menu $extraAction" + set footer " $extraAction" #-form [subst {
$text
$fullQuestionForm
$report
text/html}] set f [::xowiki::Form new \ 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.119 -r1.7.2.120 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 31 Mar 2021 15:21:15 -0000 1.7.2.119 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 1 Apr 2021 17:24:57 -0000 1.7.2.120 @@ -2514,11 +2514,11 @@ if {$polling} { # - # auto refresh: when in $parent_obj 'state' or 'position' changes, - # do automatically a reload of the current page. + # Auto refresh of number of participants and submissions when + # polling is on. # set url [$manager_obj pretty_link -query m=poll] - template::add_body_script -script [subst { + template::add_body_script -script [subst -nocommands { (function poll() { setTimeout(function() { var xhttp = new XMLHttpRequest(); @@ -2529,6 +2529,14 @@ var el = document.querySelector('#answer-status'); el.innerHTML = data; poll(); + //activate links if a users started the exam + var answers = data.split('/'); + if (answers.length == 2 && answers[1] > 0) { + var disabledLinkItems = document.querySelectorAll(".list-group-item.link-disabled"); + disabledLinkItems.forEach(function(linkItem) { + linkItem.classList.remove("link-disabled"); + }); + } } }; xhttp.send(); Index: openacs-4/packages/xowf/www/resources/test-item.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/www/resources/Attic/test-item.css,v diff -u -N -r1.1.2.31 -r1.1.2.32 --- openacs-4/packages/xowf/www/resources/test-item.css 4 Feb 2021 13:22:16 -0000 1.1.2.31 +++ openacs-4/packages/xowf/www/resources/test-item.css 1 Apr 2021 17:24:57 -0000 1.1.2.32 @@ -34,6 +34,13 @@ text-align: right; } +div.panel a.link-disabled { + pointer-events: none; + text-decoration: none; + cursor: default; + opacity: 0.6; +} + @media print{ div { font-size: 11px;