- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::formfield::TestItemField
::xowiki::formfield::TestItemField create ... \Abstract class for defining common attributes for all Test Item fields.
[ -auto_correct:boolean (default "false") ] \
[ -feedback_level (default "full") ] \
[ -nr_attachments (default "15") ] \
[ -with_correction_notes:boolean (default "true") ]
Defined in /var/www/openacs.org/packages/xowf/tcl/test-item-procs.tcl
- Documented Parameters:
- feedback_level
- "full", "single", or "none"
- auto_correct
- boolean to let user add auto correction fields
Class Relations
- class: ::xotcl::Class
- superclass: ::xowiki::formfield::FormGeneratorField
- subclass: ::xowiki::formfield::pool_question_placeholder, ::xowiki::formfield::short_text_field, ::xowiki::formfield::reorder_interaction, ::xowiki::formfield::short_text_interaction, ::xowiki::formfield::test_section, ::xowiki::formfield::test_item, ::xowiki::formfield::mc_interaction2, ::xowiki::formfield::text_interaction, ::xowiki::formfield::pool_question, ::xowiki::formfield::mc_interaction, ::xowiki::formfield::mc_choice, ::xowiki::formfield::upload_interaction, ::xowiki::formfield::mc_field
::xotcl::Class create ::xowiki::formfield::TestItemField \ -superclass ::xowiki::formfield::FormGeneratorFieldMethods (to be applied on instances)
QM (forward)
attachments_widget (scripted)
dict set attachments_dict repeat 0..${:nr_attachments} dict set attachments_dict repeat_add_label #xowiki.form-repeatable-add-file# dict set attachments_dict label #general-comments.Attachments# # {attachments {file,0..${:nr_attachments},label=#general-comments.Attachments#}} # {attachments {bootstrap_file_input,multiple=true,label=#general-comments.Attachments#}} # {attachments {file,multiple=true,label=#general-comments.Attachments#}} return [:dict_to_fc -type file $attachments_dict]auto_correct (setter)
comp_correct_when_from_value (scripted)
set correct_whens {} foreach {compound_key compound_entries} $value { if {![string match "*.0" $compound_key]} { # ns_log notice "key $compound_key, value $compound_entries" set d {} foreach {entry_key entry_value} $compound_entries { set tail [lindex [split $entry_key .] end] # ns_log notice "... entry_key $tail, entry_value $entry_value" dict set d $tail $entry_value } set text [string trim [dict get $d text]] if {$text ne ""} { set correct_when "[dict get $d operator] " append correct_when [expr {[dict get $d nocase] ? "-nocase " : ""}] append correct_when $text lappend correct_whens $correct_when } else { set correct_when "" } } } if {[llength $correct_whens] < 2} { set correct_when [lindex $correct_whens 0] } else { set correct_when "AND $correct_whens" } ns_log notice FINAL-correct_when([self])='$correct_when' return $correct_whencorrect_when_spec (scripted)
if {${:auto_correct}} { return [list [list correct_when [:correct_when_widget -nr $nr]]] } return ""correct_when_widget (scripted)
dict set dict repeat 1..10 dict set dict repeat_add_label #xowiki.form-repeatable-add-condition# dict set dict help_text #xowiki.formfield-comp_correct_when-help_text# dict set dict label #xowf.correct_when# return [:dict_to_fc -type comp_correct_when $dict]feedback_level (setter)
form_markup (scripted)
set twocol [:twocol_layout] return [string cat "<form>\n" "<div class='${interaction}_interaction row row-$twocol'>\n" "<div class='question_text first-column $twocol'>$intro_text</div>\n" "<div class='second-column $twocol'>$body</div>\n" "</div>\n" "</form>\n"]nr_attachments (setter)
text_attachments (scripted)
set html "" if {[:exists_named_sub_component attachments]} { set attachments_ff [:get_named_sub_component attachments] set attachments_count [$attachments_ff count_values [$attachments_ff value]] set attachments_label [expr {$attachments_count > 1 ? "#general-comments.Attachments# ($attachments_count)" : "#attachments.Attachment#"}] for {set i 1} {$i <= $attachments_count} {incr i} { set label [lindex [dict get [:get_named_sub_component_value -from_repeat attachments $i] name] 0] set encoded_label [ns_urlencode $label] append attachments_links {<div class='attachment'>} [subst -nocommands {[[file:question.interaction.attachments.$i|$label|-query filename=$encoded_label]]}] </div> } if {$attachments_count > 0} { append html "<div class='question_attachments'>$attachments_label $attachments_links</div><br>" } } #ns_log notice text_attachments=>$attachments_html return $htmltwocol_layout (scripted)
return [expr {[${:parent_field} get_named_sub_component_value -default 0 twocol] ? "col-sm-6" : "col-xs-12"}]with_correction_notes (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables