# -*- Tcl -*- ######################################################################## # Inclass-Exam workflow, designed similar to online-exam # ======================================================== # # Defining exams: This workflow lets a teacher choose from a # predefined set of exam questions, which are typically open text, # short text, single or multiple choice questions. The teacher # selects test questions via drag and drop. The teacher can perform a # test run of the created exam, and can get the results via a result # table. # # Publishing and closing exams: When a teacher is satisfied with the # exam, the exam can be published. In this step, all answers of the # testing phase are deleted. In the process of publishing, the link to # start the exam is offered to the user. When the exam is published, # the teacher can see the incoming answers in the report by refreshing # the page. When the exam is done, it is unpublished. The workflow # offers the teacher to see a summary of the results in form of a # table (an to download the results via csv), or the teacher can # produce a printer friendly version of the answers. # # An admin might with to add the following entries to the folder to ease # creation of exercises and exams # # {clear_menu -menu New} # # {entry -name New.Item.TextInteraction -form en:TestItemText.form} # {entry -name New.Item.ShortTextInteraction -form en:TestItemShortText.form} # {entry -name New.Item.MCInteraction -form en:TestItemMC.form} # {entry -name New.Item.SCInteraction -form en:TestItemSC.form} # {entry -name New.Item.ReorderInteraction -form en:TestItemReorder.form} # {entry -name New.Item.UploadInteraction -form en:TestItemUpload.form} # {entry -name New.App.Exam -label "Online Exam" -form en:online-exam.wf} # # The policy has to allow the following methods on FormPages: # # - "answer" (for students), # - "proctor" (for students), # - "edit" (for students), # - "poll" (for teachers), # - "print-answers" (for teachers), # - "print-answer-table" (for teachers), # - "delete" (for teachers), # - "qrcode" (for teachers) # # Gustaf Neumann, Feb 2012 ######################################################################## set :autoname 1 ;# to avoid editable name field set :policy ::xowf::test_item::test-item-policy-publish set :debug 0 set :live_updates 0 Action select -next_state created -label #xowf.online-exam-select# \ -title #xowf.online-exam-title-select# Action publish -next_state published -label #xowf.online-exam-publish# \ -title #xowf.online-exam-title-publish# Action unpublish -next_state done -label #xowf.online-exam-unpublish# Action republish -next_state published -label #xowf.online-exam-republish# \ -title #xowf.online-exam-title-republish# Action restart -next_state initial -label #xowf.restart# \ -title #xowf.online-exam-title-restart# State parameter { {extra_css {/resources/xowf/test-item.css}} } State initial -actions {select} -form en:select_question.form -view_method edit State created -actions {publish restart} -form_loader load_form -view_method edit \ -form "#xowf.inclass-exam-draft_exam#" State published -actions {unpublish} -form_loader load_form -view_method edit \ -form "#xowf.inclass-exam-open#" State done -actions {republish restart} -form_loader load_form -view_method edit \ -form "#xowf.inclass-exam-closed#" ######################################################################## # Activate action select: After the teacher has selected the # exercises, the answer workflow is created. # select proc activate {obj} { xowf::test_item::answer_manager create_workflow \ -answer_workflow /packages/xowf/lib/inclass-exam-answer.wf \ $obj } ######################################################################## # Activate action publish: delete all responses for the workflow and # publish user participation link. # publish proc activate {obj} { xowf::test_item::answer_manager delete_all_answer_data $obj :publish_link $obj } ######################################################################## # Activate action republish: publish user participation link. # republish proc activate {obj} { :publish_link $obj } ######################################################################## # When the user un-publishes an exam, just the user participation # link should be removed for the users # unpublish proc activate {obj} { :unpublish_link $obj } ######################################################################## # publish_link: make the user participation link available for the # target group # Action instproc publish_link {obj} { set aLink [$obj pretty_link -query m=answer] util_user_message -html \ -message "[$obj name] is available as [ns_quotehtml $aLink]" # TODO: make it happen in the LMS } ######################################################################## # unpublish_link: remove the user participation link for the target # group # Action instproc unpublish_link {obj} { util_user_message -html -message "[$obj name] is closed" # TODO: make it happen in the LMS } ######################################################################## # form loader: create dynamically a form containing the disabled # questions as a preview and the survey results (the results can be # refreshed). # :proc load_form {ctx title} { set obj [$ctx object] set state [$obj property _state] set combined_form_info [::xowf::test_item::question_manager combined_question_form -with_numbers $obj] set fullQuestionForm [dict get $combined_form_info form] set full_fc [dict get $combined_form_info disabled_form_constraints] #:log fullQuestionForm=$fullQuestionForm set text "