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.27.2.2 -r1.27.2.3 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 5 Mar 2019 14:36:10 -0000 1.27.2.2 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 13 Sep 2022 13:00:45 -0000 1.27.2.3 @@ -16,10 +16,10 @@ {-choices ""} {-allow_other_p "f"} } { + New Multiple Choice item to the data database + @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 - - New Multiple Choice item to the data database } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] @@ -50,10 +50,10 @@ {-num_answers ""} {-allow_other_p "f"} } { + Edit Multiple Choice item to the data database + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Edit Multiple Choice item to the data database } { # Update as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) db_transaction { @@ -76,10 +76,10 @@ -as_item_type_id:required {-with_choices_p "t"} } { + Create new revision of Multiple Choice item in the data database + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Create new revision of Multiple Choice item in the data database } { # Update as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) db_transaction { @@ -110,10 +110,10 @@ {-copy_correct_answer_p "t"} -new_title } { + Copy a Multiple Choice Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Copy a Multiple Choice Type } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] @@ -151,10 +151,10 @@ {-session_id ""} {-show_feedback ""} } { + Render a Multiple Choice Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-10 - - Render a Multiple Choice Type } { set allow_other_p [as::item_type_mc::allow_other_p -item_type_id $type_id] @@ -331,10 +331,10 @@ {-allow_overwrite_p t} {-package_id ""} } { + Process a Response to a Multiple Choice Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-11 - - Process a Response to a Multiple Choice Type } { array set type [util_memoize [list as::item_type_mc::data -type_id $type_id]] array set choices $type(choices) @@ -376,20 +376,39 @@ set widget [as::item_type_mc::form_widget -type_id $type_id] set response_value [template::util::${widget}_text::get_property ${widget}_value $response] set response_text [template::util::${widget}_text::get_property text_value $response] - set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -choice_answer $response_value -points $points -allow_overwrite_p $allow_overwrite_p -package_id $package_id -clob_answer $response_text] + set item_data_id [as::item_data::new \ + -session_id $session_id \ + -subject_id $subject_id \ + -staff_id $staff_id \ + -as_item_id $as_item_id \ + -section_id $section_id \ + -choice_answer $response_value \ + -points $points \ + -allow_overwrite_p $allow_overwrite_p \ + -package_id $package_id \ + -clob_answer $response_text] } else { - set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -choice_answer $response -points $points -allow_overwrite_p $allow_overwrite_p -package_id $package_id] + set item_data_id [as::item_data::new \ + -session_id $session_id \ + -subject_id $subject_id \ + -staff_id $staff_id \ + -as_item_id $as_item_id \ + -section_id $section_id \ + -choice_answer $response \ + -points $points \ + -allow_overwrite_p $allow_overwrite_p \ + -package_id $package_id] } as::session_results::new -target_id $item_data_id -points $points -package_id $package_id } ad_proc -public as::item_type_mc::data { -type_id:required } { + Return the Data of a Multiple Choice Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 - - Return the Data of a Multiple Choice Type } { db_1row item_type_data {} -column_array type @@ -414,10 +433,10 @@ {-data_type ""} -sessions:required } { + Return the results of a given item in a given list of sessions as an array + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-26 - - Return the results of a given item in a given list of sessions as an array } { db_foreach get_results {} { @@ -492,11 +511,14 @@ {-allow_other_p "f"} } { Add the multiple choice item to an assessment. The creates the - as_item_type_mc object and all the choices and associates the as_item_id - with an assessment, or updates the assessment with the latest version + as_item_type_mc object and all the choices and associates the + as_item_id with an assessment, or updates the assessment with the + latest version @param choices List in array get format of choice number/choice - @param correct_choices List in array get format of choice number/t. Elements appear in this list if choice number is one of the correct choices + @param correct_choices List in array get format of choice + number/t. Elements appear in this list if + choice number is one of the correct choices @param assessment_id Assessment to attach question to @param section_id Section the question is in @param as_item_id Item object this multiple choice belongs to @@ -655,38 +677,38 @@ Switch order of two choices } { -if { $direction=="up" } { - set next_sort_order [expr { $sort_order - 1 }] -} else { - set next_sort_order [expr { $sort_order + 1 }] -} + if { $direction=="up" } { + set next_sort_order [expr { $sort_order - 1 }] + } else { + set next_sort_order [expr { $sort_order + 1 }] + } -db_transaction { - set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] - set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] - set new_item_id [as::item::new_revision -as_item_id $as_item_id] - as::assessment::check::copy_item_checks -assessment_id $assessment_id -section_id $new_section_id -as_item_id $as_item_id -new_item_id $new_item_id - set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id] + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + set new_item_id [as::item::new_revision -as_item_id $as_item_id] + as::assessment::check::copy_item_checks -assessment_id $assessment_id -section_id $new_section_id -as_item_id $as_item_id -new_item_id $new_item_id + set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id] - as::section::update_section_in_assessment \ - -old_section_id $section_id \ - -new_section_id $new_section_id \ - -new_assessment_rev_id $new_assessment_rev_id + as::section::update_section_in_assessment \ + -old_section_id $section_id \ + -new_section_id $new_section_id \ + -new_assessment_rev_id $new_assessment_rev_id - as::item::update_item_in_section \ - -new_section_id $new_section_id \ - -old_item_id $as_item_id \ - -new_item_id $new_item_id + as::item::update_item_in_section \ + -new_section_id $new_section_id \ + -old_item_id $as_item_id \ + -new_item_id $new_item_id - as::item::update_item_type_in_item \ - -new_item_id $new_item_id \ - -old_item_type_id $mc_id \ - -new_item_type_id $new_mc_id + as::item::update_item_type_in_item \ + -new_item_id $new_item_id \ + -old_item_type_id $mc_id \ + -new_item_type_id $new_mc_id - db_dml swap_choices {} + db_dml swap_choices {} + } + return [list as_item_id $new_item_id section_id $new_section_id assessment_rev_id $new_assessment_rev_id] } -return [list as_item_id $new_item_id section_id $new_section_id assessment_rev_id $new_assessment_rev_id] -} ad_proc -private as::item_type_mc::choice_delete { -assessment_id @@ -696,40 +718,40 @@ } { Delete a choice } { -db_transaction { - set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] - set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] - set new_item_id [as::item::new_revision -as_item_id $as_item_id] - # HAM : querried the mc_id for the given choice id - set mc_id [db_string get_mc_id {select mc_id from as_item_choices where choice_id=:choice_id}] - # *********** - set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id -with_choices_p f] - as::section::update_section_in_assessment \ - -old_section_id $section_id \ - -new_section_id $new_section_id \ - -new_assessment_rev_id $new_assessment_rev_id + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + set new_item_id [as::item::new_revision -as_item_id $as_item_id] + # HAM : querried the mc_id for the given choice id + set mc_id [db_string get_mc_id {select mc_id from as_item_choices where choice_id=:choice_id}] + # *********** + set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id -with_choices_p f] + as::section::update_section_in_assessment \ + -old_section_id $section_id \ + -new_section_id $new_section_id \ + -new_assessment_rev_id $new_assessment_rev_id - as::item::update_item_in_section \ - -new_section_id $new_section_id \ - -old_item_id $as_item_id \ - -new_item_id $new_item_id + as::item::update_item_in_section \ + -new_section_id $new_section_id \ + -old_item_id $as_item_id \ + -new_item_id $new_item_id - as::item::update_item_type_in_item \ - -new_item_id $new_item_id \ - -old_item_type_id $mc_id \ - -new_item_type_id $new_mc_id + as::item::update_item_type_in_item \ + -new_item_id $new_item_id \ + -old_item_type_id $mc_id \ + -new_item_type_id $new_mc_id - db_1row get_sort_order_to_be_removed {} - set choices [db_list get_choices {}] - foreach old_choice_id $choices { - if {$old_choice_id != $choice_id} { - set new_choice_id [as::item_choice::new_revision -choice_id $old_choice_id -mc_id $new_mc_id] + db_1row get_sort_order_to_be_removed {} + set choices [db_list get_choices {}] + foreach old_choice_id $choices { + if {$old_choice_id != $choice_id} { + set new_choice_id [as::item_choice::new_revision -choice_id $old_choice_id -mc_id $new_mc_id] + } } + db_dml move_up_choices {} } - db_dml move_up_choices {} + return [list as_item_id $new_item_id section_id $new_section_id assessment_rev_id $new_assessment_rev_id] } -return [list as_item_id $new_item_id section_id $new_section_id assessment_rev_id $new_assessment_rev_id] -} ad_proc -private as::item_type_mc::allow_other_p { 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 -r1.22.2.1 -r1.22.2.2 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 13 Sep 2022 13:03:05 -0000 1.22.2.1 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 13 Sep 2022 13:05:01 -0000 1.22.2.2 @@ -13,10 +13,10 @@ {-reference_answer ""} {-keywords ""} } { + New Open Question item to the data database + @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-09-29 - - New Open Question item to the data database } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] @@ -45,10 +45,10 @@ {-reference_answer ""} {-keywords ""} } { + Edit Open Question item to the data database + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Edit Open Question item to the data database } { # Update as_item_type_oq in the CR (and as_item_type_oq table) getting the revision_id (as_item_type_id) db_transaction { @@ -69,10 +69,10 @@ ad_proc -public as::item_type_oq::copy { -type_id:required } { + Copy an Open Question Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Copy an Open Question Type } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] @@ -99,10 +99,10 @@ {-session_id ""} {-show_feedback ""} } { + Render an Open Question Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-10 - - Render an Open Question Type } { if {$default_value ne ""} { array set values $default_value @@ -127,14 +127,13 @@ {-allow_overwrite_p t} {-package_id ""} } { + Process a Response to an Open Question Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-11 - - Process a Response to an Open Question Type } { array set type [util_memoize [list as::item_type_oq::data -type_id $type_id]] - if {[llength $type(keywords)] > 0} { set points 0 foreach keyword $type(keywords) { @@ -147,17 +146,26 @@ set points "" } - set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -clob_answer $response -points $points -allow_overwrite_p $allow_overwrite_p -package_id $package_id] + set item_data_id [as::item_data::new \ + -session_id $session_id \ + -subject_id $subject_id \ + -staff_id $staff_id \ + -as_item_id $as_item_id \ + -section_id $section_id \ + -clob_answer $response \ + -points $points \ + -allow_overwrite_p $allow_overwrite_p \ + -package_id $package_id] as::session_results::new -target_id $item_data_id -points $points } ad_proc -public as::item_type_oq::data { -type_id:required } { + Return the Data of an Open Question Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-04-08 - - Return the Data of an Open Question Type } { db_1row item_type_data {} -column_array type return [array get type] @@ -169,10 +177,10 @@ -data_type:required -sessions:required } { + Return the results of a given item in a given list of sessions as an array + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-26 - - Return the results of a given item in a given list of sessions as an array } { db_foreach get_results {} { set results($session_id) $clob_answer @@ -197,9 +205,9 @@ {-default_value ""} } { Add the open question (long answer/essay) item to an assessment. - This creates the as_item_type_oq object and - associates the as_item_id - with an assessment, or updates the assessment with the latest version + This creates the as_item_type_oq 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 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 -r1.20 -r1.20.2.1 --- openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 15 Jun 2018 23:11:09 -0000 1.20 +++ openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 13 Sep 2022 13:07:32 -0000 1.20.2.1 @@ -12,10 +12,10 @@ {-allow_negative_p ""} {-package_id ""} } { + New Short Answer Answers item to the data database + @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-09-29 - - New Short Answer Answers item to the data database } { if { $package_id eq "" } { set package_id [ad_conn package_id] @@ -42,10 +42,10 @@ {-increasing_p ""} {-allow_negative_p ""} } { + Edit Short Answer Answers item to the data database + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Edit Short Answer Answers item to the data database } { # Update as_item_type_sa in the CR (and as_item_type_sa table) getting the revision_id (as_item_type_id) db_transaction { @@ -64,10 +64,10 @@ ad_proc -public as::item_type_sa::copy { -type_id:required } { + Copy a Short Answer Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 - - Copy a Short Answer Type } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] @@ -92,10 +92,10 @@ {-session_id ""} {-show_feedback ""} } { + Render a Short Answer Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-10 - - Render a Short Answer Type } { if {$default_value ne ""} { array set values $default_value @@ -119,12 +119,21 @@ {-allow_overwrite_p t} {-package_id ""} } { + Process a Response to a Short Answer Type + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-11 - - Process a Response to a Short Answer Type } { - as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -text_answer [lindex $response 0] -points "" -allow_overwrite_p $allow_overwrite_p -package_id $package_id + as::item_data::new \ + -session_id $session_id \ + -subject_id $subject_id \ + -staff_id $staff_id \ + -as_item_id $as_item_id \ + -section_id $section_id \ + -text_answer [lindex $response 0] \ + -points "" \ + -allow_overwrite_p $allow_overwrite_p \ + -package_id $package_id } ad_proc -public as::item_type_sa::results { @@ -133,10 +142,10 @@ -data_type:required -sessions:required } { + Return the results of a given item in a given list of sessions as an array + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-26 - - 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 @@ -161,8 +170,8 @@ {-allow_negative_p "f"} } { 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 + as_item_type_sa 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 Index: openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl 13 Sep 2022 13:08:26 -0000 1.6.2.1 +++ openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl 13 Sep 2022 13:10:06 -0000 1.6.2.2 @@ -15,17 +15,20 @@ {-title ""} {-tree_id:required} } { + New SW Category item to the database + @author Dave Bauer (dave@solutiongrove.com) @creation-date 2005-05-15 - - New SW Category item to the database } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_item_type_swcat in the CR (and as_item_type_swcat table) getting the revision_id (as_item_type_id) db_transaction { - set item_item_type_swcat_id [content::item::new -parent_id $folder_id -content_type {as_item_type_swcat} -name [as::item::generate_unique_name]] + set item_item_type_swcat_id [content::item::new \ + -parent_id $folder_id \ + -content_type {as_item_type_swcat} \ + -name [as::item::generate_unique_name]] set as_item_type_swcat_id [content::revision::new \ -item_id $item_item_type_swcat_id \ -content_type {as_item_type_swcat} \ @@ -40,10 +43,10 @@ -as_item_type_id:required -tree_id:required } { + Edit SW Category Answers item to the database + @author Dave Bauer (dave@solutiongrove.com) @creation-date 2005-05-15 - - Edit SW Category Answers item to the database } { # Update as_item_type_swcat in the CR (and as_item_type_swcat table) getting the revision_id (as_item_type_id) db_transaction { @@ -61,10 +64,10 @@ ad_proc -public as::item_type_swcat::copy { -type_id:required } { + Copy a Short Answer Type + @author Dave Bauer (dave@solutiongrove.com) @creation-date 2005-05-15 - - Copy a Short Answer Type } { set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] @@ -87,10 +90,10 @@ {-session_id ""} {-show_feedback ""} } { + Render a SW Category Type + @author Dave Bauer (dave@solutiongrove.com) @creation-date 2005-05-15 - - Render a SW Category Type } { if {$default_value ne ""} { array set values $default_value @@ -120,12 +123,21 @@ {-allow_overwrite_p t} {-package_id ""} } { + Process a Response to a SW Category Answer + @author Dave Bauer (dave@solutiongrove.com) @creation-date 2005-05-15 - - Process a Response to a SW Category Answer } { - as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -text_answer [lindex $response 0] -points "" -allow_overwrite_p $allow_overwrite_p -package_id $package_id + as::item_data::new \ + -session_id $session_id \ + -subject_id $subject_id \ + -staff_id $staff_id \ + -as_item_id $as_item_id \ + -section_id $section_id \ + -text_answer [lindex $response 0] \ + -points "" \ + -allow_overwrite_p $allow_overwrite_p \ + -package_id $package_id } ad_proc -public as::item_type_swcat::results { @@ -134,10 +146,10 @@ -data_type:required -sessions:required } { + Return the results of a given item in a given list of sessions as an array + @author Dave Bauer (dave@solutiongrove.com) @creation-date 2005-05-15 - - 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