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.15 -r1.16 --- openacs-4/packages/assessment/lib/section-items.adp 15 Mar 2005 22:46:15 -0000 1.15 +++ openacs-4/packages/assessment/lib/section-items.adp 13 Apr 2005 18:51:54 -0000 1.16 @@ -36,7 +36,7 @@ #assessment.Search_Item# - + #assessment.add_trigger# (@items.checks_related@) Index: openacs-4/packages/assessment/lib/section-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/lib/section-items.tcl 13 Apr 2005 10:48:29 -0000 1.8 +++ openacs-4/packages/assessment/lib/section-items.tcl 13 Apr 2005 18:51:54 -0000 1.9 @@ -2,19 +2,23 @@ {section_id:text(hidden) {value $section_id}} } -db_multirow -extend { checks_related presentation_type html mc_type choice_orientation } items section_items {} { +db_multirow -extend { checks_related presentation_type html item_type choice_orientation } items section_items {} { set presentation_type [as::item_form::add_item_to_form -name admin_section -section_id $section_id -item_id $as_item_id -random_p f] if {$presentation_type == "fitb"} { regsub -all -line -nocase -- { - + select html_display_options, choice_orientation, choice_label_orientation, 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.11 -r1.12 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.11 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.12 @@ -144,6 +144,17 @@ @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 + Get the cached Display Data of RadioButton Type +} { + return [util_memoize [list as::item_display_rb::data_not_cached -type_id $type_id]] +} + +ad_proc -private as::item_display_rb::data_not_cached { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + Get the Display Data of RadioButton Type } { db_1row display_item_data {} -column_array type 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.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 13 Apr 2005 18:51:54 -0000 1.4 @@ -23,7 +23,7 @@ - + select html_display_options, choice_orientation, choice_label_orientation, 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.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 9 Apr 2005 22:39:27 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 13 Apr 2005 18:51:54 -0000 1.8 @@ -125,6 +125,17 @@ @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 + Get the cached Display Data of ShortAnswer Type +} { + return [util_memoize [list as::item_display_sa::data_not_cached -type_id $type_id]] +} + +ad_proc -private as::item_display_sa::data_not_cached { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + Get the Display Data of ShortAnswer Type } { db_1row display_item_data {} -column_array type 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.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 13 Apr 2005 18:51:54 -0000 1.4 @@ -22,7 +22,7 @@ - + select html_display_options, abs_size, box_orientation 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.9 -r1.10 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.9 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.10 @@ -149,6 +149,17 @@ @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 + Get the cached Display Data of SelectBox Type +} { + return [util_memoize [list as::item_display_sb::data_not_cached -type_id $type_id]] +} + +ad_proc -private as::item_display_sb::data_not_cached { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + Get the Display Data of SelectBox Type } { db_1row display_item_data {} -column_array type 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.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 13 Apr 2005 18:51:54 -0000 1.4 @@ -23,7 +23,7 @@ - + select html_display_options, multiple_p, choice_label_orientation, 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.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 9 Apr 2005 22:39:27 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 13 Apr 2005 18:51:54 -0000 1.8 @@ -133,6 +133,17 @@ @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 + Get the cached Display Data of TextArea Type +} { + return [util_memoize [list as::item_display_ta::data_not_cached -type_id $type_id]] +} + +ad_proc -private as::item_display_ta::data_not_cached { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + Get the Display Data of TextArea Type } { db_1row display_item_data {} -column_array type 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.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 13 Apr 2005 18:51:54 -0000 1.4 @@ -22,7 +22,7 @@ - + select html_display_options, abs_size, item_answer_alignment 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.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.8 @@ -128,6 +128,17 @@ @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 + Get the cached Display Data of TextBox Type +} { + return [util_memoize [list as::item_display_tb::data_not_cached -type_id $type_id]] +} + +ad_proc -private as::item_display_tb::data_not_cached { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + Get the Display Data of TextBox Type } { db_1row display_item_data {} -column_array type 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.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 13 Apr 2005 18:51:54 -0000 1.4 @@ -22,7 +22,7 @@ - + select html_display_options, abs_size, item_answer_alignment 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.14 -r1.15 --- openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 9 Apr 2005 22:39:27 -0000 1.14 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 13 Apr 2005 18:51:54 -0000 1.15 @@ -23,19 +23,17 @@ } { randomInit [randomRange 20000] set element_name "response_to_item.$item_id" - array set item [util_memoize [list as::item_form::item_data -item_id $item_id]] - set item_type [string range $item(item_type) end-1 end] - set display_type [string range $item(display_type) end-1 end] + array set item [as::item::item_data -as_item_id $item_id] if {$random_p == "f"} { - set item_data [util_memoize [list as::item_type_$item_type\::render -type_id $item(item_type_id) -session_id "" -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback]] + set item_data [util_memoize [list as::item_type_$item(item_type)\::render -type_id $item(item_type_id) -session_id "" -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback]] } else { - set item_data [as::item_type_$item_type\::render -type_id $item(item_type_id) -session_id $session_id -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback] + set item_data [as::item_type_$item(item_type)\::render -type_id $item(item_type_id) -session_id $session_id -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback] } util_unlist $item_data default_value data - as::item_display_$display_type\::render \ + as::item_display_$item(display_type)\::render \ -form $name \ -element $element_name \ -type_id $item(display_type_id) \ @@ -47,17 +45,5 @@ -default_value $default_value \ -data $data - return $display_type + return $item(display_type) } - -ad_proc -private as::item_form::item_data { - -item_id:required -} { - @author Timo Hentschel (timo@timohentschel.de) - @creation-date 2005-04-08 - - Gets the item type and display -} { - db_1row item_properties {} -column_array item - return [array get item] -} 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.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-form-procs.xql 9 Apr 2005 22:39:27 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.xql 13 Apr 2005 18:51:54 -0000 1.8 @@ -1,23 +1,4 @@ - - - select cr.title, i.subtext, i.data_type, - max(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 - group by cr.title, i.subtext, i.data_type, oi.object_type,od.object_id, od.object_type - - - Index: openacs-4/packages/assessment/tcl/as-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/assessment/tcl/as-item-procs.tcl 13 Apr 2005 10:48:29 -0000 1.11 +++ openacs-4/packages/assessment/tcl/as-item-procs.tcl 13 Apr 2005 18:51:54 -0000 1.12 @@ -204,42 +204,29 @@ db_dml copy_types {} } -ad_proc -private as::item::mc_type { +ad_proc -public as::item::item_data { -as_item_id:required } { - Return the type to determine if this is a multiple choice question - - Allow caching of the choice_orientation as it is unlikely to change. -} { - return [util_memoize [list as::item::mc_type_not_cached -as_item_id $as_item_id]] -} + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-13 -ad_proc -private as::item::mc_type_not_cached { - -as_item_id:required + Return cached item data } { - Return the type to determine if this is a multiple choice question - -} { - return [db_string item_type_id {} -default "nmc"] + return [util_memoize [list as::item::item_data_not_cached -as_item_id $as_item_id]] } -ad_proc -private as::item::get_choice_orientation { +ad_proc -private as::item::item_data_not_cached { -as_item_id:required - -presentation_type:required } { - Return the orientation for choices. - - Allow caching of the choice_orientation as it is unlikely to change. -} { - return [util_memoize [list as::item::get_choice_orientation_not_cached -as_item_id $as_item_id -presentation_type $presentation_type]] -} + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 -ad_proc -private as::item::get_choice_orientation_not_cached { - -as_item_id:required - -presentation_type:required + Gets the item type and display } { - Return the orientation for choices - -} { - return [db_string get_choice_orientation ""] -} \ No newline at end of file + db_1row item_properties {} -column_array item + + set item(item_type) [string range $item(item_type) end-1 end] + set item(display_type) [string range $item(display_type) end-1 end] + + return [array get item] +} Index: openacs-4/packages/assessment/tcl/as-item-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-procs.xql 13 Apr 2005 10:48:29 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-procs.xql 13 Apr 2005 18:51:54 -0000 1.5 @@ -72,32 +72,23 @@ - - - - select max(t.as_item_type_id) as as_item_type_id - from as_item_type_mc t, cr_revisions c, as_item_rels r - where t.as_item_type_id = r.target_rev_id - and r.item_rev_id = :as_item_id - and r.rel_type = 'as_item_type_rel' - and c.revision_id = t.as_item_type_id - group by c.title, t.increasing_p, t.allow_negative_p, - t.num_correct_answers, t.num_answers - - - - - + - - select d.choice_orientation - from as_item_rels r, as_item_display_$presentation_type d - where r.item_rev_id = :as_item_id - and r.rel_type = 'as_item_display_rel' - and r.target_rev_id = d.as_item_display_id - + select cr.title, i.subtext, i.data_type, + max(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 = :as_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 + group by cr.title, i.subtext, i.data_type, oi.object_type,od.object_id, od.object_type - Index: openacs-4/packages/assessment/www/assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment.tcl,v diff -u -N -r1.43 -r1.44 --- openacs-4/packages/assessment/www/assessment.tcl 13 Apr 2005 09:58:47 -0000 1.43 +++ openacs-4/packages/assessment/www/assessment.tcl 13 Apr 2005 18:51:54 -0000 1.44 @@ -340,8 +340,8 @@ set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] if {$presentation_type == "rb" || $presentation_type == "cb"} { - array set item [util_memoize [list as::item_form::item_data -item_id $as_item_id]] - array set type [util_memoize [list as::item_display_$presentation_type\::data -type_id $item(display_type_id)]] + array set item [as::item_form::item_data -as_item_id $as_item_id] + array set type [as::item_display_$presentation_type\::data -type_id $item(display_type_id)] set choice_orientation $type(choice_orientation) array unset item array unset type