Index: openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl 12 Jun 2006 18:59:20 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl 8 Nov 2006 19:17:16 -0000 1.4 @@ -80,7 +80,7 @@ set default "" } - return [list $default ""] + return $default } ad_proc -public as::item_type_fu::process { @@ -136,3 +136,60 @@ return } } + + +ad_proc -private as::item_type_fu::add_to_assessment { + -choices + -correct_choices + -assessment_id + -section_id + -as_item_id + -title + -after + {-increasing_p "f"} + {-allow_negative_p "f"} +} { + Add the file upload item to an assessment. The creates the + as_item_type_fu object and associates the as_item_id + with an assessment, or updates the assessment with the latest version + + @param assessment_id Assessment to attach question to + @param section_id Section the question is in + @oaram as_item_id Item object this multiple choice belongs to + @param title Title of question/choice set for question library + @param after Add this question after the queston number in the section + + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2006-10-25 +} { + if {![as::item::get_item_type_info -as_item_id $as_item_id] \ + || $item_type_info(object_type) != "as_item_type_fu"} { + set as_item_type_id [as::item_type_fu::new -title $title ] + + if {![info exists object_type]} { + # first item type mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_id -type as_item_type_rel + } else { + # old item type existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + db_dml update_item_type {} + } + } else { + # old fu item type existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_type_id [as::item_type_fu::edit \ + -as_item_type_id $as_item_type_id \ + -title $title \ + -increasing_p $increasing_p \ + -allow_negative_p $allow_negative_p] + + as::item::update_item_type \ + -item_type_id $as_item_type_id \ + -as_item_id $as_item_id + } + as::item_display_f::set_item_display_type \ + -assessment_id $assessment_id \ + -section_id $section_id \ + -as_item_id $as_item_id \ + -after $after +} \ No newline at end of file