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.19 -r1.20 --- openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 15 Jun 2018 22:47:45 -0000 1.19 +++ openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 15 Jun 2018 23:11:09 -0000 1.20 @@ -18,19 +18,19 @@ New Short Answer Answers item to the data database } { if { $package_id eq "" } { - set package_id [ad_conn package_id] + set package_id [ad_conn package_id] } set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_item_type_sa in the CR (and as_item_type_sa table) getting the revision_id (as_item_type_id) db_transaction { set item_item_type_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_type_sa} -name [as::item::generate_unique_name]] set as_item_type_sa_id [content::revision::new \ - -item_id $item_item_type_sa_id \ - -content_type {as_item_type_sa} \ - -title $title \ - -attributes [list [list increasing_p $increasing_p] \ - [list allow_negative_p $allow_negative_p] ] ] + -item_id $item_item_type_sa_id \ + -content_type {as_item_type_sa} \ + -title $title \ + -attributes [list [list increasing_p $increasing_p] \ + [list allow_negative_p $allow_negative_p] ] ] } return $as_item_type_sa_id @@ -40,7 +40,7 @@ -as_item_type_id:required {-title ""} {-increasing_p ""} - {-allow_negative_p ""} + {-allow_negative_p ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 @@ -49,13 +49,13 @@ } { # Update as_item_type_sa in the CR (and as_item_type_sa table) getting the revision_id (as_item_type_id) db_transaction { - set type_item_id [db_string type_item_id {}] + set type_item_id [db_string type_item_id {}] set new_item_type_id [content::revision::new \ - -item_id $type_item_id \ - -content_type {as_item_type_sa} \ - -title $title \ - -attributes [list [list increasing_p $increasing_p] \ - [list allow_negative_p $allow_negative_p] ] ] + -item_id $type_item_id \ + -content_type {as_item_type_sa} \ + -title $title \ + -attributes [list [list increasing_p $increasing_p] \ + [list allow_negative_p $allow_negative_p] ] ] } return $new_item_type_id @@ -74,11 +74,11 @@ # Insert as_item_type_sa in the CR (and as_item_type_sa table) getting the revision_id (as_item_type_id) db_transaction { - db_1row item_type_data {} + db_1row item_type_data {} - set new_item_type_id [new -title $title \ - -increasing_p $increasing_p \ - -allow_negative_p $allow_negative_p] + set new_item_type_id [new -title $title \ + -increasing_p $increasing_p \ + -allow_negative_p $allow_negative_p] } return $new_item_type_id @@ -98,10 +98,10 @@ Render a Short Answer Type } { if {$default_value ne ""} { - array set values $default_value - set default $values(text_answer) + array set values $default_value + set default $values(text_answer) } else { - set default "" + set default "" } return [list $default ""] @@ -139,13 +139,13 @@ Return the results of a given item in a given list of sessions as an array } { db_foreach get_results {} { - set results($session_id) $text_answer + set results($session_id) $text_answer } if {[array exists results]} { - return [array get results] + return [array get results] } else { - return + return } } @@ -160,7 +160,7 @@ {-increasing_p "f"} {-allow_negative_p "f"} } { - Add the short answer item to an assessment. The creates the + Add the short answer item to an assessment. The creates the as_item_type_sa object and associates the as_item_id with an assessment, or updates the assessment with the latest version @@ -173,34 +173,34 @@ @author Dave Bauer (dave@solutiongrove.com) @creation-date 2006-10-25 } { - if {![as::item::get_item_type_info -as_item_id $as_item_id] \ + if {![as::item::get_item_type_info -as_item_id $as_item_id] \ || $item_type_info(object_type) ne "as_item_type_sa"} { - set as_item_type_id [as::item_type_sa::new \ - -title $title \ - -increasing_p $increasing_p \ - -allow_negative_p $allow_negative_p] - - if {![info exists item_type_info(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 sa 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_sa::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 \ - -as_item_id $as_item_id \ - -item_type_id $as_item_type_id - } + set as_item_type_id [as::item_type_sa::new \ + -title $title \ + -increasing_p $increasing_p \ + -allow_negative_p $allow_negative_p] + + if {![info exists item_type_info(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 sa 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_sa::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 \ + -as_item_id $as_item_id \ + -item_type_id $as_item_type_id + } as::item_display_tb::set_item_display_type \ -as_item_id $as_item_id \ -assessment_id $assessment_id \