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 -N -r1.6.2.8 -r1.6.2.9 --- openacs-4/packages/xowf/lib/online-exam.wf 27 Oct 2019 18:04:20 -0000 1.6.2.8 +++ openacs-4/packages/xowf/lib/online-exam.wf 4 Nov 2019 10:24:39 -0000 1.6.2.9 @@ -9,7 +9,7 @@ # can test the exam by entering test answers. The results are provided # in form of a table. # -# When the teacher is satisfied for the exam, the exam can be +# When the 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 @@ -22,11 +22,6 @@ # You might with to add the following entries to the folder to ease # creation of exercises and exams # -# OLD HTML variant -# {entry -name New.App.Frage -label TextQuestion -form en:Frage.form} -# -# NEW question types -# # {entry -name New.App.TextInteraction -label "Text Interaction" -form en:TestItemText.form} # {entry -name New.App.TextEntryInteraction -label "Text Entry Interaction" -form en:TestItemTextEntry.form} # {entry -name New.App.MCInteraction -label "MC Interaction" -form en:TestItemMC.form} @@ -45,6 +40,9 @@ Action republish -next_state published -label #xowf.online-exam-republish# Action restart -next_state initial -label #xowf.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.online-exam-draft_exam#" @@ -88,7 +86,7 @@ ######################################################################## # create_answer_workflow: create a workflow based on the template # provided in this method for answering the question for the -# students. The name of the workflow is derived from the wokflow +# students. The name of the workflow is derived from the workflow # instance and recorded in the formfield "wfName". # :proc create_answer_workflow {obj} { @@ -110,19 +108,13 @@ set wfQuestionNames {} set wfQuestionTitles {} set attributeNames {} - foreach q $questionObjs { - set counter 0 - set prefix [lindex [split [$q name] :] end]-a - dom parse -simple -html [$q property form] doc - $doc documentElement root - if {$root ne ""} { - foreach node [$root selectNodes "//textarea|//input"] { - set newName $prefix[incr counter] - lappend attributeNames $newName - } - } - lappend wfQuestionNames ../[$q name] - lappend wfQuestionTitles [$q title] + foreach form_obj $questionObjs { + + lappend attributeNames [xowf::test_item::renaming_form_loader \ + form_name_based_attribute_stem [$form_obj name]] + + lappend wfQuestionNames ../[$form_obj name] + lappend wfQuestionTitles [$form_obj title] } set wfID [$obj item_id] @@ -148,7 +140,7 @@ -package_id [$obj package_id] \ -default_variables [list title $wfTitle] \ -instance_attributes [list workflow_definition $wfDef \ - form_constraints "@table:_name,_state,$attributeNames @cr_fields:hidden"]] + form_constraints "@table:_name,_state,$attributeNames,_last_modified @cr_fields:hidden"]] $f save_new #:log "create_answer_workflow $obj DONE [$f pretty_link]" } @@ -232,7 +224,9 @@ ######################################################################## # form loader: create dynamically a form containing the disabled -# questions and the survey results (the results can be refreshed) +# questions as a preview and the survey results (the results can be +# refreshed). This is a simplified version of get_question_form_object +# of online-exam-answer.wf. # :proc load_form {ctx title} { set obj [$ctx object] @@ -241,15 +235,29 @@ set questions [:get_questions $obj] set counter 0 set fullQuestionForm "" + set full_fc {} foreach q $questions { + set raw_form [$q property form] + set raw_fc [$q property form_constraints] + set newName answer$counter + + regsub {@answer@} $raw_form "@$newName@" formContent + set fc [lmap f $raw_fc { + if {[string match "answer:*" $f]} { + regsub answer $f $newName f + append f ,disabled=true + } + set f}] + append fullQuestionForm \ - "