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.1 -r1.2 --- openacs-4/packages/xowf/lib/online-exam.wf 28 Aug 2014 08:24:56 -0000 1.1 +++ openacs-4/packages/xowf/lib/online-exam.wf 16 Jun 2015 20:44:07 -0000 1.2 @@ -88,8 +88,8 @@ set fullQuestionForm "" foreach q $questions { append fullQuestionForm \ - "

Frage [incr counter]

\n" \ - [$q property form] + "

Frage [incr counter]

\n" \ + [$q property form] } # disable fields, remove wrapping form @@ -115,12 +115,14 @@ set aLink "[$obj pretty_link]?m=answer" set pLink "[$obj pretty_link]?m=print-answers" #util_user_message -html -message "$survey is available as $pLink" - set menu "\[refresh, listing, print\]" + set menu "\[refresh,\ + listing,\ + print\]" } set extraAction "" switch [my property _state] { - "created" {set extraAction "
Do you want to try out the exam?"} + "created" {set extraAction "
Do you want to try out the exam?"} "published" {set extraAction "
Students can now answer via $aLink"} } append text "$menu $extraAction\n" @@ -132,12 +134,12 @@ append report "
$menu" set f [::xowiki::Form new \ - -set name en:quesiton \ - -form [subst {
$text
$fullQuestionForm
$report
text/html}] \ - -text {} \ - -anon_instances t \ - -form_constraints {@cr_fields:hidden} \ - ] + -set name en:quesiton \ + -form [subst {
$text
$fullQuestionForm
$report
text/html}] \ + -text {} \ + -anon_instances t \ + -form_constraints {@cr_fields:hidden} \ + ] } ######################################################################## @@ -147,9 +149,9 @@ set questionNames [join [my property question] |] set object [my object] set questionForms [::xowiki::Weblog instantiate_forms \ - -parent_id [$object parent_id] -package_id [$object package_id] \ - -default_lang [$object lang] \ - -forms $questionNames] + -parent_id [$object parent_id] -package_id [$object package_id] \ + -default_lang [$object lang] \ + -forms $questionNames] if {[llength $questionForms] < 1} {error "unknown form $questionNames"} #my msg "questionNames '$questionNames', questionForms 'questionForms'" return $questionForms @@ -186,8 +188,8 @@ $doc documentElement root if {$root ne ""} { foreach node [$root selectNodes "//textarea|//input"] { - set newName $prefix[incr counter] - lappend attributeNames $newName + set newName $prefix[incr counter] + lappend attributeNames $newName } } lappend wfQuestionNames ../[$q name] @@ -203,18 +205,18 @@ set attributeNames [join $attributeNames ,] set WF [::xowiki::Weblog instantiate_forms \ - -parent_id [$obj parent_id] -package_id [$obj package_id] \ - -default_lang [$obj lang] \ - -forms $wfMaster] + -parent_id [$obj parent_id] -package_id [$obj package_id] \ + -default_lang [$obj lang] \ + -forms $wfMaster] set f [$WF create_form_page_instance \ - -name $wfName \ - -nls_language [$obj nls_language] \ + -name $wfName \ + -nls_language [$obj nls_language] \ -publish_status ready \ - -parent_id [$obj item_id] \ - -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"]] + -parent_id [$obj item_id] \ + -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"]] $f save_new my log "create_answer_workflow $obj DONE [$f pretty_link]" } @@ -224,19 +226,19 @@ # my proc get_answer_wf {obj} { return [::xowiki::Weblog instantiate_forms \ - -parent_id [$obj item_id] -package_id [$obj package_id] \ - -default_lang [$obj lang] \ - -forms [$obj property wfName]] + -parent_id [$obj item_id] -package_id [$obj package_id] \ + -default_lang [$obj lang] \ + -forms [$obj property wfName]] } ######################################################################## # get_wf_instances: return the workflow instances # my proc get_wf_instances {{-initialize false} wf} { return [::xowiki::FormPage get_form_entries \ - -base_item_ids [$wf item_id] -form_fields "" \ - -always_queried_attributes "*" -initialize $initialize \ - -publish_status all -package_id [$wf package_id]] + -base_item_ids [$wf item_id] -form_fields "" \ + -always_queried_attributes "*" -initialize $initialize \ + -publish_status all -package_id [$wf package_id]] } ######################################################################## @@ -257,7 +259,7 @@ # Action instproc publish_link {obj} { set aLink "[$obj pretty_link]?m=answer" - util_user_message -html -message "[$obj name] is available as $aLink" + util_user_message -html -message "[$obj name] is available as [ns_quotehtml $aLink]" # TODO: make it happen } @@ -324,3 +326,9 @@ } } +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: