Class ::xowiki::formfield::test_section
::xowiki::formfield::test_section
create ... \
[ -form (default "en:edit-interaction.wf") ] \
[ -multiple (default "true") ]
Class Relations
- class: ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- superclass: ::xowiki::formfield::TestItemField
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xotcl::Class create ::xowiki::formfield::test_section \
-superclass ::xowiki::formfield::TestItemField
Methods (to be applied on instances)
convert_to_internal (scripted)
set intro_text [:get_named_sub_component_value text]
set selection [:get_named_sub_component_value selection]
set package_id [${:object} package_id]
set formObjs [::$package_id instantiate_forms -forms [join [split $selection \n] |] -default_lang en]
set number 0
set numbers [lmap formObj $formObjs {incr number}]
set option_dict {with_minutes t with_points f with_title f}
foreach field {show_minutes show_points show_title} {
set value [${:parent_field} get_named_sub_component_value -default "" $field]
if {$value ne ""} {
dict set option_dict $field $value
}
}
set title_options [lmap kind {minutes points title} {
if {![dict get $option_dict show_$kind]} {
continue
}
set result "-with_$kind"
}]
set question_infos [:QM question_info -question_number_label "#xowf.subquestion#" {*}$title_options -numbers $numbers -no_position -obj ${:object} $formObjs]
set aggregatedForm [:QM aggregated_form -with_grading_box hidden $question_infos]
set aggregatedFC [dict get $question_infos form_constraints]
set names [regexp -inline -all {@([^@]+_)@} $aggregatedForm]
foreach {. name} $names {
regsub -all "@$name@" $aggregatedForm "@answer_$name@" aggregatedForm
regsub -all ${name}: $aggregatedFC "answer_${name}:" aggregatedFC
}
ns_log notice "AGGREGATED FORM $aggregatedForm\nFC\n$aggregatedFC\n"
set total_minutes [:QM total_minutes $question_infos]
set total_points [:QM total_points $question_infos]
[${:parent_field} get_named_sub_component minutes] value $total_minutes
[${:parent_field} get_named_sub_component points] value $total_points
set form [:form_markup -interaction composite -intro_text $intro_text -body $aggregatedForm]
${:object} set_property -new 1 form $form
${:object} set_property -new 1 form_constraints $aggregatedFC
set anon_instances true ;
${:object} set_property -new 1 anon_instances $anon_instancesform (setter)
initialize (scripted)
if {${:__state} ne "after_specs"} {
return
}
next
set widget [test_item set richtextWidget]
:create_components [subst {
{text {$widget,height=150px,label=#xowf.exercise-text#,plugins=OacsFs}}
{selection {form_page,form=en:edit-interaction.wf,unless=item_type=Composite|PoolQuestion,multiple=true,label=#xowf.question_selection#}}
}]
set :__initialized 1multiple (setter)
pretty_value (scripted)
return [${:object} property form ""]