Index: openacs-4/packages/xowf/lib/online-exam.wf =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/online-exam.wf,v diff -u -r1.6.2.16 -r1.6.2.17 --- openacs-4/packages/xowf/lib/online-exam.wf 2 Feb 2020 16:45:43 -0000 1.6.2.16 +++ openacs-4/packages/xowf/lib/online-exam.wf 3 Feb 2020 22:59:50 -0000 1.6.2.17 @@ -36,6 +36,7 @@ # - "edit" (for students), # - "poll" (for teachers), # - "print-answers" (for teachers), +# - "print-answer-table" (for teachers), # - "delete" (for teachers), # # Gustaf Neumann, Feb 2012 @@ -151,11 +152,17 @@ }] set lLink "$wf_pretty_link?m=list" set aLink [$obj pretty_link -query m=answer] - set pLink [$obj pretty_link -query m=print-answers] + set pLink1 [$obj pretty_link -query m=print-answers] + set pLink2 [$obj pretty_link -query m=print-answer-table] #util_user_message -html -message "$survey is available as $pLink" # [#xowf.refresh#, - set menu "\[#xowf.online-exam-exam_instances#,\ - #xowf.online-exam-protocol#\]" + 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.online-exam-protocol#, " \ + "#xowf.online-exam-results-table#\]" } set extraAction "" @@ -171,6 +178,7 @@ "$aLink" } } + if {$state in {published done}} { if {$state eq "done"} { [$ctx object] setCSSDefaults @@ -222,7 +230,7 @@ # Unset the actual query return_url, since we want to use it via # property. In some cases, we have to set it explicitly from the # property, e.g. in www-delete. - # + # ::xo::cc unset_query_parameter return_url ######################################################################## @@ -237,6 +245,40 @@ } ######################################################################## + # web-callable method "print-answer-table" + # + # Print the answers in a somewhat printer friendly way. + # + :proc www-print-answer-table {} { + set HTML "" + set ctx [::xowf::Context require [self]] + 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] { + $i set online-exam-userName [acs_user::get_element -user_id [$i creation_user] -element username] + $i set online-exam-fullName [::xo::get_user_name [$i creation_user]] + } + set HTML [::xowf::test_item::answer_manager result_table \ + -package_id ${:package_id} \ + -items $items2 \ + [self]] + $items2 destroy + } + if {$HTML eq ""} { + set HTML "#xowiki.no_data#" + } else { + set HTML "