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 -r1.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 11 Dec 2004 11:23:00 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 22 Dec 2004 20:52:17 -0000 1.8 @@ -132,6 +132,11 @@ ad_proc -public as::item_type_mc::render { -type_id:required + -section_id:required + -as_item_id:required + -default_provided:boolean + {-default_value ""} + {-session_id ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-10 @@ -157,7 +162,19 @@ lappend wrong_choices [list $title $choice_id] } } - + + if {$default_provided_p} { + set defaults $default_value + } + + if {![empty_string_p $session_id]} { + set choice_list [db_list get_sorted_choices {}] + + if {[llength $choice_list] > 0} { + return [list $defaults $choice_list] + } + } + if {![empty_string_p $num_answers] && $num_answers < $total} { # display fewer choices, select random set correct_choices [util::randomize_list $correct_choices] @@ -176,10 +193,20 @@ set display_choices [util::randomize_list $display_choices] } + # save choice order + if {![empty_string_p $session_id]} { + set count 0 + foreach one_choice $display_choices { + util_unlist $one_choice title choice_id + incr count + db_dml save_order {} + } + } + return [list $defaults $display_choices] } -ad_proc -public as::item_type_sa::process { +ad_proc -public as::item_type_mc::process { -type_id:required -session_id:required -as_item_id:required @@ -250,6 +277,7 @@ } } - set points [expr round($max_points * percent / 100)] + set points [expr round($max_points * $percent / 100)] + as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -choice_answer $response -points $points }