- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::formfield::short_text_interaction
::xowiki::formfield::short_text_interactioncreate ... \
[ -nr (default "25") ]
Class Relations
::xotcl::Class create ::xowiki::formfield::short_text_interaction \ -superclass ::xowiki::formfield::TestItemFieldMethods (to be applied on instances)
convert_to_internal (scripted)
next set intro_text [:get_named_sub_component_value text] append intro_text [:text_attachments] set answerFields [:get_named_sub_component_value -from_repeat answer] if {[acs_user::site_wide_admin_p]} { set substvalues [:get_named_sub_component_value substvalues] } else { set substvalues "" } set options {} set render_hints {} set answer {} set solution {} set count 0 foreach {fieldName value} $answerFields { # ns_log notice ...fieldName=$fieldName->$value set af answer[incr count] lappend options [list [dict get $value $fieldName.text] $af] lappend answer [:comp_correct_when_from_value [dict get $value $fieldName.correct_when]] lappend solution [dict get $value $fieldName.solution] lappend render_hints [list words [dict get $value $fieldName.options] lines [dict get $value $fieldName.lines]] } set fc_dict { _name answer _type text_fields disabled_as_div 1 label ""} dict set fc_dict shuffle_kind [${:parent_field} get_named_sub_component_value shuffle] dict set fc_dict show_max [${:parent_field} get_named_sub_component_value show_max] dict set fc_dict options $options dict set fc_dict answer $answer dict set fc_dict descriptions $solution dict set fc_dict render_hints $render_hints dict set fc_dict substvalues $substvalues set form [:form_markup -interaction short_text -intro_text $intro_text -body @answer@] set fc {} lappend fc [:dict_to_spec $fc_dict] @categories:off @cr_fields:hidden #ns_log notice "short_text_interaction $form\n$fc" ${:object} set_property -new 1 form $form ${:object} set_property -new 1 form_constraints $fc set anon_instances true ;# TODO make me configurable ${:object} set_property -new 1 anon_instances $anon_instances ${:object} set_property -new 1 auto_correct ${:auto_correct} ${:object} set_property -new 1 has_solution false ${:object} set_property -new 1 substvalues $substvaluesinitialize (scripted)
if {${:__state} ne "after_specs"} return # # Create component structure. # set widget [test_item set richtextWidget] ns_log notice "[self] [:info class] auto_correct=${:auto_correct}" if {[acs_user::site_wide_admin_p]} { set substvalues "{substvalues {textarea,label=Substitution Values}}" } else { set substvalues "" } #{substvalues {textarea,label=Substitution Values}} :create_components [subst { {text {$widget,height=100px,label=#xowf.exercise-text#,plugins=OacsFs}} {attachments {[:attachments_widget ${:nr_attachments}]}} {answer {short_text_field,repeat=1..${:nr},label=}} $substvalues }] set :__initialized 1nr (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables