- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::formfield::pool_question
::xowiki::formfield::pool_question create ...
Class Relations
::xotcl::Class create ::xowiki::formfield::pool_question \ -superclass ::xowiki::formfield::TestItemFieldMethods (to be applied on the object)
all_item_types_selected (scripted)
# # Check, if all item types were selected # foreach item_type [pool_question set item_types] { if {$item_type ni $item_types} { return 0 } } return 1Methods (to be applied on instances)
convert_to_internal (scripted)
next set allowed_item_types [:get_named_sub_component_value item_types] set fc_dict {_name answer _type pool_question_placeholder} dict set fc_dict folder [:get_named_sub_component_value folder] dict set fc_dict pattern [:get_named_sub_component_value pattern] dict set fc_dict item_types $allowed_item_types set form "<form>@answer@</form>" lappend fc @categories:off @cr_fields:hidden [:dict_to_spec $fc_dict] ${:object} set_property -new 1 form $form ${:object} set_property -new 1 form_constraints $fc # # Turn on "auto_correct" when for every selected item_type, *all* # items are fully closed and therefore suited for # auto_correction. For example, for composite questions, this might # or might not be true (to handle this more aggressively, we would # have to iterate over all exercises of this question types and # check their detailed subcomponents). # set auto_correct 1 foreach class [::xowiki::formfield::TestItemField info subclass -closure] { if {[$class exists item_type]} { foreach item_type [$class set item_type] { if {$item_type in $allowed_item_types && ![$class set closed_question_type]} { set auto_correct 0 break } } } } #ns_log notice "... FINAL auto_correct $auto_correct (allowed $allowed_item_types)" ${:object} set_property -new 1 auto_correct $auto_correctinitialize (scripted)
if {${:__state} ne "after_specs"} { return } set item_types [pool_question set item_types] set item_type_options [lmap item_type $item_types { list #xowf.menu-New-Item-${item_type}Interaction# $item_type }] set current_folder_id [[${:object} parent_id] item_id] set parent_folder_id [::$current_folder_id parent_id] set fi [::xowiki::includelet::folders new -destroy_on_cleanup] set folder_objs [$fi collect_folders -package_id [${:object} package_id] -parent_id $parent_folder_id] set folder_options [list] lappend folder_options {*}[lmap folder_obj $folder_objs { if {[$folder_obj parent_id] ne $parent_folder_id} { continue } list [$folder_obj title] ../[$folder_obj name] }] set pool_dict {_name folder _type select} dict set pool_dict required true dict set pool_dict options $folder_options dict set pool_dict default ../[::$current_folder_id name] dict set pool_dict label #xowf.pool_question_folder# set item_dict {_name item_types _type checkbox} dict set item_dict options $item_type_options dict set item_dict default $item_types dict set item_dict label #xowf.pool_question_item_types# :create_components [subst { [list [:dict_to_spec -aspair $pool_dict]] [list [:dict_to_spec -aspair $item_dict]] {pattern {text,default=*,label=#xowf.pool_question_pattern#}} }] set :__initialized 1
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables