%3 ::xowiki::formfield::TestItemField ::xowiki::formfield::TestItemField QM attachments_widget comp_correct_when_from_value correct_when_spec correct_when_widget form_markup text_attachments twocol_layout ::xowiki::formfield::FormGeneratorField ::xowiki::formfield::FormGeneratorField pretty_value render_input ::xowiki::formfield::TestItemField->::xowiki::formfield::FormGeneratorField ::xowiki::formfield::CompoundField ::xowiki::formfield::CompoundField ::xowiki::formfield::FormGeneratorField->::xowiki::formfield::CompoundField ::xowiki::formfield::reorder_interaction ::xowiki::formfield::reorder_interaction convert_to_internal initialize ::xowiki::formfield::reorder_interaction->::xowiki::formfield::TestItemField

Class ::xowiki::formfield::reorder_interaction

::xowiki::formfield::reorder_interaction[i] create ... \
           [ -nr (default "25") ]

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xowiki::formfield::TestItemField[i]
::xotcl::Class create ::xowiki::formfield::reorder_interaction \
     -superclass ::xowiki::formfield::TestItemField

Methods (to be applied on instances)

  • convert_to_internal (scripted)

    
    set intro_text   [:get_named_sub_component_value text]
    set answerFields [:get_named_sub_component_value -from_repeat answer]
    
    set options {}
    set answer {}
    set count 0
    
    foreach {fieldName value} $answerFields {
      #ns_log notice ...fieldName=$fieldName->$value
      lappend options [list $value $count]
      lappend answer $count
      incr count
    }
    
    set fc_dict {_name answer _type reorder_box}
    dict set fc_dict disabled_as_div 1
    dict set fc_dict label ""
    dict set fc_dict options $options
    dict set fc_dict answer $answer
    dict set fc_dict grading [${:parent_field} get_named_sub_component_value grading]
    
    set form [:form_markup -interaction reorder -intro_text $intro_text -body @answer@]
    set fc {}
    lappend fc  [:dict_to_spec $fc_dict]  @categories:off @cr_fields:hidden
    
    #ns_log notice "reorder_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
    #ns_log notice "${:name} FINAL FC $fc"
  • initialize (scripted)

    if {${:__state} ne "after_specs"} return
    #
    # Create component structure.
    #
    set widget [test_item set richtextWidget]
    
    :create_components [subst {
      {text  {$widget,height=100px,label=#xowf.exercise-text#,plugins=OacsFs}}
      {answer {text,repeat=1..${:nr},label=#xowf.reorder_question_elements#}}
    }]
    set :__initialized 1
  • nr (setter)