Index: openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 10 Dec 2004 11:42:19 -0000 1.12 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 10 Dec 2004 20:21:50 -0000 1.13 @@ -72,9 +72,8 @@ Boolean File Date - Exponential + Float Integer - Numerical Text Time Short Text Index: openacs-4/packages/assessment/lib/section-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/lib/section-items.adp 10 Dec 2004 11:42:22 -0000 1.6 +++ openacs-4/packages/assessment/lib/section-items.adp 10 Dec 2004 20:21:50 -0000 1.7 @@ -57,7 +57,7 @@
@items.title;noquote@
- + @formgroup.widget;noquote@ @formgroup.label;noquote@
@@ -68,6 +68,12 @@ + +
+ [i] + @items.subtext@ +
+
Index: openacs-4/packages/assessment/lib/section-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/lib/section-items.xql 10 Dec 2004 11:42:22 -0000 1.2 +++ openacs-4/packages/assessment/lib/section-items.xql 10 Dec 2004 20:21:50 -0000 1.3 @@ -4,7 +4,7 @@ - select i.as_item_id, cr.title, ci.name, ism.required_p, + select i.as_item_id, i.subtext, cr.title, ci.name, ism.required_p, ism.section_id, ism.sort_order, ism.max_time_to_complete, ism.points from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism Index: openacs-4/packages/assessment/lib/section-show.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-show.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/lib/section-show.adp 10 Dec 2004 11:42:22 -0000 1.2 +++ openacs-4/packages/assessment/lib/section-show.adp 10 Dec 2004 20:21:50 -0000 1.3 @@ -28,7 +28,7 @@
@items.title;noquote@
- + @formgroup.widget;noquote@ @formgroup.label;noquote@
@@ -39,6 +39,12 @@ + +
+ [i] + @items.subtext@ +
+
Index: openacs-4/packages/assessment/lib/section-show.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-show.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/lib/section-show.xql 10 Dec 2004 11:42:22 -0000 1.2 +++ openacs-4/packages/assessment/lib/section-show.xql 10 Dec 2004 20:21:50 -0000 1.3 @@ -4,7 +4,7 @@ - select i.as_item_id, cr.title, ci.name, ism.required_p, + select i.as_item_id, i.subtext, cr.title, ci.name, ism.required_p, ism.section_id, ism.sort_order, ism.max_time_to_complete, ism.points from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -91,3 +91,42 @@ return $new_item_display_id } + +ad_proc -public as::item_display_cb::render { + -form:required + -element:required + -type_id:required + {-datatype ""} + {-title ""} + {-subtext ""} + {-required_p ""} + {-default_value ""} + {-data ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Item Display CheckBox Type +} { + db_1row display_item_data {} + if {[empty_string_p $required_p]} { + set required_p f + } + + # numerical alphabetical randomized order_of_entry + switch -exact $sort_order_type { + numerical { + set data [lsort -real -index 1 $data] + } + alphabetical { + set data [lsort -dictionary -index 1 $data] + } + randomized { + set data [util::randomize_list $data] + } + } + + set options {-datatype text -widget checkbox -label $title -help_text $subtext -values $default_value -required_p $required_p -html $html_display_options -options $data} + + eval template::element::create $form $element $options +} Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -23,4 +23,15 @@ + + + + select html_display_options, choice_orientation, choice_label_orientation, + sort_order_type, item_answer_alignment + from as_item_display_cb + where as_item_display_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -91,3 +91,42 @@ return $new_item_display_id } + +ad_proc -public as::item_display_rb::render { + -form:required + -element:required + -type_id:required + {-datatype ""} + {-title ""} + {-subtext ""} + {-required_p ""} + {-default_value ""} + {-data ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Item Display RadioButton Type +} { + db_1row display_item_data {} + if {[empty_string_p $required_p]} { + set required_p f + } + + # numerical alphabetical randomized order_of_entry + switch -exact $sort_order_type { + numerical { + set data [lsort -real -index 1 $data] + } + alphabetical { + set data [lsort -dictionary -index 1 $data] + } + randomized { + set data [util::randomize_list $data] + } + } + + set options {-datatype text -widget radio -label $title -help_text $subtext -value $default_value -required_p $required_p -html $html_display_options -options $data} + + eval template::element::create $form $element $options +} Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -23,4 +23,15 @@
+ + + + select html_display_options, choice_orientation, choice_label_orientation, + sort_order_type, item_answer_alignment + from as_item_display_rb + where as_item_display_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -80,3 +80,35 @@ return $new_item_display_id } + +ad_proc -public as::item_display_sa::render { + -form:required + -element:required + -type_id:required + {-datatype ""} + {-title ""} + {-subtext ""} + {-required_p ""} + {-default_value ""} + {-data ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Item Display ShortAnswer Type +} { + db_1row display_item_data {} + if {![empty_string_p $abs_size]} { + set maxlength_option {-maxlength $abs_size} + } + if {[empty_string_p $required_p]} { + set required_p f + } + if {[empty_string_p $datatype]} { + set datatype text + } + + set options {-datatype $datatype -widget text -label $title -help_text $subtext -value $default_value -required_p $required_p -html $html_display_options} + + eval template::element::create $form $element $options $maxlength_option +} Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -22,4 +22,14 @@ + + + + select html_display_options, abs_size, box_orientation + from as_item_display_sa + where as_item_display_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.2 @@ -87,6 +87,50 @@ -sort_order_type $sort_order_type \ -item_answer_alignment $item_answer_alignment] } - + return $new_item_display_id } + +ad_proc -public as::item_display_sb::render { + -form:required + -element:required + -type_id:required + {-datatype ""} + {-title ""} + {-subtext ""} + {-required_p ""} + {-default_value ""} + {-data ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Item Display SelectBox Type +} { + db_1row display_item_data {} + if {[empty_string_p $required_p]} { + set required_p f + } + set widget select + if {$multiple_p == "t"} { + set widget multiselect + } + + # multiple_p + # numerical alphabetical randomized order_of_entry + switch -exact $sort_order_type { + numerical { + set data [lsort -real -index 1 $data] + } + alphabetical { + set data [lsort -dictionary -index 1 $data] + } + randomized { + set data [util::randomize_list $data] + } + } + + set options {-datatype text -widget $widget -label $title -help_text $subtext -values $default_value -required_p $required_p -html $html_display_options -options $data} + + eval template::element::create $form $element $options +} Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -23,4 +23,15 @@ + + + + select html_display_options, multiple_p, choice_label_orientation, + sort_order_type, item_answer_alignment + from as_item_display_sb + where as_item_display_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -85,3 +85,36 @@ return $new_item_display_id } + +ad_proc -public as::item_display_ta::render { + -form:required + -element:required + -type_id:required + {-datatype ""} + {-title ""} + {-subtext ""} + {-required_p ""} + {-default_value ""} + {-data ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Item Display TextArea Type +} { + db_1row display_item_data {} + set maxlength_option "" + if {![empty_string_p $abs_size]} { + set maxlength_option {-maxlength $abs_size} + } + if {[empty_string_p $required_p]} { + set required_p f + } + if {[empty_string_p $datatype]} { + set datatype text + } + + set options {-datatype $datatype -widget textarea -label $title -help_text $subtext -value $default_value -required_p $required_p -nospell -html $html_display_options} + + eval template::element::create $form $element $options $maxlength_option +} Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -22,4 +22,14 @@ + + + + select html_display_options, abs_size, item_answer_alignment + from as_item_display_ta + where as_item_display_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -80,3 +80,36 @@ return $new_item_display_id } + +ad_proc -public as::item_display_tb::render { + -form:required + -element:required + -type_id:required + {-datatype ""} + {-title ""} + {-subtext ""} + {-required_p ""} + {-default_value ""} + {-data ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Item Display TextBox Type +} { + db_1row display_item_data {} + set maxlength_option "" + if {![empty_string_p $abs_size]} { + set maxlength_option {-maxlength $abs_size} + } + if {[empty_string_p $required_p]} { + set required_p f + } + if {[empty_string_p $datatype]} { + set datatype text + } + + set options {-datatype $datatype -widget text -label $title -help_text $subtext -value $default_value -required_p $required_p -html $html_display_options} + + eval template::element::create $form $element $options $maxlength_option +} Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -22,4 +22,14 @@ + + + + select html_display_options, abs_size, item_answer_alignment + from as_item_display_tb + where as_item_display_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 8 Dec 2004 15:30:34 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 10 Dec 2004 20:21:50 -0000 1.9 @@ -10,93 +10,29 @@ form item_id } { + @author Timo Hentschel (timo@timohentschel.de) + @modified-date 2004-12-10 + Add items to a form. The form values are stored in response_to_item.item_id } { + randomInit [randomRange 20000] set element_name "response_to_item.$item_id" - db_1row item_properties "" - set user_value "" + db_1row item_properties {} + set item_type [string range $item_type end-1 end] + set display_type [string range $display_type end-1 end] - set item_display_id [as::item_rels::get_target -item_rev_id $item_id -type as_item_display_rel] - db_0or1row as_item_display_rbx "SELECT as_item_display_id AS rb__display_id FROM as_item_display_rb WHERE as_item_display_id=:item_display_id" - db_0or1row as_item_display_tbx "SELECT as_item_display_id AS tb__display_id FROM as_item_display_tbx WHERE as_item_display_id=:item_display_id" - db_0or1row as_item_display_tax "SELECT as_item_display_id AS ta__display_id FROM as_item_display_tax WHERE as_item_display_id=:item_display_id" - set presentation_type "checkbox" ;# DEFAULT - #get the presentation type - if {[info exists rb__display_id]} {set presentation_type "radio"} - if {[info exists tb__display_id]} {set presentation_type "fitb"} - if {[info exists ta__display_id]} {set presentation_type "textarea"} + util_unlist [as::item_type_$item_type\::render -type_id $item_type_id] default_value data - #Add the items depending on the presentation type (as_item_display_types) - switch -- $presentation_type { - "textbox" { - template::element::create $form $element_name \ - -datatype text \ - -widget text \ - -label $title \ - -value $user_value \ - -size 40 \ - -required_p $required_p - } + as::item_display_$display_type\::render \ + -form $form \ + -element $element_name \ + -type_id $display_type_id \ + -datatype $data_type \ + -title $title \ + -subtext $subtext \ + -required_p $required_p \ + -default_value $default_value \ + -data $data - "textarea" { - db_0or1row html_rows_cols "SELECT html_display_options FROM as_item_display_ta WHERE as_item_display_id=:item_display_id" - template::element::create $form $element_name \ - -datatype text \ - -widget textarea \ - -label $title \ - -value $user_value \ - -html $html_display_options \ - -nospell \ - -required_p $required_p - } - - "radio" { - set widget "text(radio)" - set mc_id [as::item_rels::get_target -item_rev_id $item_id -type as_item_type_rel] - set optionlist [list] - db_foreach item_choices_2 "" { - #for multiple choice item with multimedia - if {[empty_string_p $content_value]} { - lappend optionlist [list $title $choice_id] - } elseif {[db_string mime_type {SELECT mime_type LIKE 'image%' FROM cr_revisions WHERE revision_id = :content_value}]} { - lappend optionlist [list "$title" $choice_id] - } else { - lappend optionlist [list "$title" $choice_id] - } - } - set options $optionlist - template::element::create $form $element_name \ - -datatype text \ - -widget radio \ - -label $title \ - -value $user_value \ - -options $options \ - -required_p $required_p - } - - "checkbox" { - set mc_id [as::item_rels::get_target -item_rev_id $item_id -type as_item_type_rel] - set choices [list] - set optionlist [list] - db_foreach item_choices_2 "" { - #for multiple choice item with multimedia - if {[empty_string_p $content_value]} { - lappend optionlist [list $title $choice_id] - } elseif {[db_string mime_type {SELECT mime_type LIKE 'image%' FROM cr_revisions WHERE revision_id = :content_value}]} { - lappend optionlist [list "$title" $choice_id] - } else { - lappend optionlist [list "$title" $choice_id] - } - } - set options $optionlist - template::element::create $form $element_name \ - -datatype text \ - -widget checkbox \ - -label $title \ - -values $user_value \ - -options $options \ - -required_p $required_p - } - } - return $presentation_type + return $display_type } Index: openacs-4/packages/assessment/tcl/as-item-form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-form-procs.xql 10 Dec 2004 11:42:23 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.xql 10 Dec 2004 20:21:50 -0000 1.4 @@ -1,32 +1,21 @@ - - - select i.choice_id, cr.title, i.content_value - from as_item_choices i, cr_revisions cr - where i.mc_id = :mc_id - and cr.revision_id = i.choice_id - order by i.sort_order - - - - - - select i.choice_id, cr.title - from as_item_choices i, cr_revisions cr - where i.mc_id = :mc_id - and cr.revision_id = i.choice_id - order by i.sort_order - - - - select cr.title, i.required_p - from as_items i, cr_revisions cr + select cr.title, i.subtext, i.data_type, i.required_p, + oi.object_id as item_type_id, oi.object_type as item_type, + od.object_id as display_type_id, od.object_type as display_type + from as_items i, cr_revisions cr, as_item_rels it, + as_item_rels dt, acs_objects oi, acs_objects od where i.as_item_id = :item_id and cr.revision_id = i.as_item_id + and it.item_rev_id = i.as_item_id + and dt.item_rev_id = i.as_item_id + and it.rel_type = 'as_item_type_rel' + and dt.rel_type = 'as_item_display_rel' + and oi.object_id = it.target_rev_id + and od.object_id = dt.target_rev_id Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 10 Dec 2004 11:42:23 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 10 Dec 2004 20:21:50 -0000 1.6 @@ -129,3 +129,60 @@ return $new_item_type_id } + +ad_proc -public as::item_type_mc::render { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render a Multiple Choice Type +} { + db_1row item_type_data {} + + set defaults "" + set display_choices [list] + set correct_choices [list] + set wrong_choices [list] + set choices [db_list_of_lists get_choices {}] + set choices [db_list_of_lists foobar { + select c.choice_id, r.title, c.correct_answer_p, c.selected_p + from as_item_choices c, cr_revisions r + where c.mc_id = :type_id + and r.revision_id = c.choice_id + order by c.sort_order + }] + + foreach one_choice $choices { + util_unlist $one_choice choice_id title correct_answer_p selected_p + lappend display_choices [list $title $choice_id] + if {$selected_p == "t"} { + lappend defaults $choice_id + } + if {$correct_answer_p == "t"} { + lappend correct_choices [list $title $choice_id] + } else { + lappend wrong_choices [list $title $choice_id] + } + } + + if {![empty_string_p $num_answers] && $num_answers < [llength $choices]} { + # display fewer choices, select random + set correct_choices [util::randomize_list $correct_choices] + set wrong_choices [util::randomize_list $wrong_choices] + + if {![empty_string_p $num_correct_answers] && $num_correct_answers > 0 && $num_correct_answers < [llength $correct_choices]} { + # display fewer correct answers than there are + set display_choices [lrange $correct_choices 1 $num_correct_answers] + } else { + # display all correct answers + set display_choices $correct_choices + } + + # now fill up with wrong answers + set display_choices [concat $display_choices [lrange $wrong_choices 0 [expr $num_answers - [llength $display_choices] -1]]] + set display_choices [util::randomize_list $display_choices] + } + + return [list $defaults $display_choices] +} Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql 10 Dec 2004 11:42:23 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql 10 Dec 2004 20:21:50 -0000 1.3 @@ -55,4 +55,26 @@ + + + + select num_correct_answers, num_answers + from as_item_type_mc + where as_item_type_id = :type_id + + + + + + + + select c.choice_id, r.title, c.correct_answer_p, c.selected_p + from as_item_choices c, cr_revisions r + where c.mc_id = :type_id + and r.revision_id = c.choice_id + order by c.sort_order + + + + Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -80,3 +80,16 @@ return $new_item_type_id } + +ad_proc -public as::item_type_oq::render { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render an Open Question Type +} { + db_1row item_type_data {} + + return [list $default_value ""] +} Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 @@ -22,4 +22,14 @@ + + + + select default_value + from as_item_type_oq + where as_item_type_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5 @@ -80,3 +80,14 @@ return $new_item_type_id } + +ad_proc -public as::item_type_sa::render { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-10 + + Render a Short Answer Type +} { + return [list "" ""] +} Index: openacs-4/packages/assessment/tcl/as-section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 10 Dec 2004 11:42:23 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 10 Dec 2004 20:21:50 -0000 1.7 @@ -102,7 +102,6 @@ -attributes [list [list instructions $instructions] \ [list feedback_text $feedback_text] \ [list max_time_to_complete $max_time_to_complete] \ - [list required_p $required_p] \ [list display_type_id $display_type_id] \ [list points $points] ] ] Index: openacs-4/packages/assessment/www/assessment-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/assessment-oracle.xql 26 Nov 2004 20:46:50 -0000 1.1 +++ openacs-4/packages/assessment/www/assessment-oracle.xql 10 Dec 2004 20:23:00 -0000 1.2 @@ -4,7 +4,7 @@ - SELECT i.as_item_id, i.name, i.title, s.section_id as section_id, s.title as section_title, s.description as section_description + SELECT i.as_item_id, i.name, i.title, i.subtext, s.section_id as section_id, s.title as section_title, s.description as section_description FROM as_sectionsx s, as_assessmentsx a, as_item_section_map ism, as_itemsx i WHERE a.assessment_id = :assessment_id Index: openacs-4/packages/assessment/www/assessment-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-postgresql.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/assessment-postgresql.xql 26 Nov 2004 20:46:51 -0000 1.5 +++ openacs-4/packages/assessment/www/assessment-postgresql.xql 10 Dec 2004 20:21:50 -0000 1.6 @@ -4,7 +4,7 @@ - SELECT i.as_item_id, i.name, i.title, s.section_id as section_id, s.title as section_title, s.description as section_description + SELECT i.as_item_id, i.name, i.title, i.subtext, s.section_id as section_id, s.title as section_title, s.description as section_description FROM as_sectionsx s INNER JOIN as_assessment_section_map asm USING (section_id) INNER JOIN as_assessmentsx a USING (assessment_id) INNER JOIN as_item_section_map ism ON s.section_id = ism.section_id Index: openacs-4/packages/assessment/www/assessment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment.adp,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/assessment/www/assessment.adp 4 Nov 2004 17:20:44 -0000 1.10 +++ openacs-4/packages/assessment/www/assessment.adp 10 Dec 2004 20:21:50 -0000 1.11 @@ -25,22 +25,28 @@ - #assessment.Question# @items.rownum@:@items.title@ + #assessment.Question# @items.rownum@:@items.title;noquote@
- + @formgroup.widget;noquote@ @formgroup.label;noquote@
- + @items.html;noquote@ + +
+ [i] + @items.subtext@ +
+

Index: openacs-4/packages/assessment/www/admin/catalog-item-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-item-add.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/admin/catalog-item-add.adp 10 Dec 2004 11:42:23 -0000 1.2 +++ openacs-4/packages/assessment/www/admin/catalog-item-add.adp 10 Dec 2004 20:21:50 -0000 1.3 @@ -34,7 +34,7 @@
@items.title;noquote@
- + @formgroup.widget;noquote@ @formgroup.label;noquote@
@@ -45,6 +45,12 @@ + +
+ [i] + @items.subtext@ +
+
Index: openacs-4/packages/assessment/www/admin/catalog-item-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-item-add.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/admin/catalog-item-add.xql 10 Dec 2004 11:42:23 -0000 1.2 +++ openacs-4/packages/assessment/www/admin/catalog-item-add.xql 10 Dec 2004 20:21:50 -0000 1.3 @@ -14,7 +14,7 @@ - select i.as_item_id, cr.title, ci.name, i.required_p, + select i.as_item_id, i.subtext, cr.title, ci.name, i.required_p, i.max_time_to_complete, i.points from as_items i, cr_revisions cr, cr_items ci where ci.item_id = cr.item_id Index: openacs-4/packages/assessment/www/admin/catalog-section-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-section-add.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/admin/catalog-section-add.adp 10 Dec 2004 11:42:23 -0000 1.2 +++ openacs-4/packages/assessment/www/admin/catalog-section-add.adp 10 Dec 2004 20:21:50 -0000 1.3 @@ -33,4 +33,4 @@ - + Index: openacs-4/packages/assessment/www/admin/item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/admin/item-add.tcl 10 Dec 2004 11:42:23 -0000 1.3 +++ openacs-4/packages/assessment/www/admin/item-add.tcl 10 Dec 2004 20:21:50 -0000 1.4 @@ -29,7 +29,7 @@ set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] set data_types [list] -foreach data_type [list varchar text integer numeric exponential date timestamp boolean content_type] { +foreach data_type [list varchar text integer float date timestamp boolean content_type] { lappend data_types [list "[_ assessment.data_type_$data_type]" $data_type] }