Index: openacs-4/packages/xowf/lib/online-exam-answer.wf =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/online-exam-answer.wf,v diff -u -N -r1.2.2.8 -r1.2.2.9 --- openacs-4/packages/xowf/lib/online-exam-answer.wf 4 Nov 2019 10:24:39 -0000 1.2.2.8 +++ openacs-4/packages/xowf/lib/online-exam-answer.wf 6 Nov 2019 18:49:21 -0000 1.2.2.9 @@ -140,14 +140,18 @@ Action review \ -next_state done \ - -label #xowf.online-exam-review# + -label #xowf.online-exam-review# \ + -proc activate {obj} { + [[$obj wf_context ] wf_container] addSignature $obj + } Action save \ -label #xowf.online-exam-save# Action logout \ -label #xowf.online-exam-submit# \ -proc activate {obj} { + [[$obj wf_context ] wf_container] addSignature $obj set pid [$obj package_id] set try_out_mode [$obj property try_out_mode 0] set return_url [$obj property return_url .] @@ -217,14 +221,13 @@ ######################################################################## # -# Helper methods for the workflow context +# Helper methods for the workflow container # ######################################################################## # # Field-renaming form loader # - proc get_question_form_object {ctx form_name} { set obj [$ctx object] @@ -248,7 +251,6 @@ return $form_obj } - # # Set "title" with question and user information. # @@ -264,7 +266,7 @@ lappend title $titleString } lappend title \ - "[$obj title]" \ + [$obj title] \ "IP: [$obj property ip]" #ns_log notice "SETTING $obj title [join $title { · }] (Container)" $obj title [join $title " · "] @@ -331,14 +333,25 @@ -form_constraints [lsort -unique $fc]] } +:proc addSignature {obj} { + set answerAttributes [xowf::test_item::renaming_form_loader \ + answer_attributes [$obj instance_attributes]] + set sha256 [ns_md string -digest sha256 $answerAttributes] + $obj set_property -new true signature $sha256 + return $sha256 +} + + ######################################################################## # # Object specific operations # ######################################################################## :object-specific { - # ensure default value is updated for each instance individually + # + # Ensure default value is updated for each instance individually. + # Property ip -default [expr {[ns_conn isconnected] ? [ad_conn peeraddr] : "nowhere"}] set ctx [:wf_context] 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.9 -r1.6.2.10 --- openacs-4/packages/xowf/lib/online-exam.wf 4 Nov 2019 10:24:39 -0000 1.6.2.9 +++ openacs-4/packages/xowf/lib/online-exam.wf 6 Nov 2019 18:49:21 -0000 1.6.2.10 @@ -359,7 +359,9 @@ set wf [[$ctx wf_container] get_answer_wf [self]] if {$wf ne ""} { set items [[$ctx wf_container] get_wf_instances $wf] - + set withSignature [expr {[dict exists ${:instance_attributes} signature] + ? [dict get ${:instance_attributes} signature] + : 0 }] set examTitle ${:title} foreach i [$items children] { set uid [$i property _creation_user] @@ -380,10 +382,24 @@ # $i set __feedback_mode 2 set question_form [$i render_content] - + + if {$withSignature} { + set answerAttributes [xowf::test_item::renaming_form_loader \ + answer_attributes [$i instance_attributes]] + set sha256 [ns_md string -digest sha256 $answerAttributes] + set signatureString "
Aktuelle Signatur: $sha256
\n" + set submissionSignature [$i property signature ""] + if {$submissionSignature ne ""} { + append signatureString "
Abgabe Signatur: $submissionSignature
\n" + } + } else { + set signatureString "" + } + append HTML "\n
" \ "

$examTitle - IP [$i property ip]

" \ "

$userName · [::xo::get_user_name $uid] · $pretty_date

" \ + $signatureString \ $question_form \ "
\n" }