Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 29 Jun 2018 17:27:18 -0000 1.13 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 3 Sep 2024 15:37:35 -0000 1.14 @@ -20,12 +20,16 @@ as::assessment::data -assessment_id $assessment_id if {![info exists assessment_data(assessment_id)]} { - ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_return_complaint 1 [_ assessment.Requested_assess_does] ad_script_abort } set page_title [_ assessment.edit_item_display_sb] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set context [list \ + [list index [_ assessment.admin]] \ + [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] \ + [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] \ + $page_title] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] @@ -56,56 +60,56 @@ } -edit_request { db_1row last_used_display_type {} if {$as_item_display_id ne ""} { - db_1row display_type_data {} + db_1row display_type_data {} } else { - # default data if display newly mapped - set html_display_options "" - set multiple_p f - set choice_label_orientation "top" - set sort_order_type "order_of_entry" - set item_answer_alignment "besideright" - set as_item_display_id 0 - set prepend_empty_p t + # default data if display newly mapped + set html_display_options "" + set multiple_p f + set choice_label_orientation "top" + set sort_order_type "order_of_entry" + set item_answer_alignment "besideright" + set as_item_display_id 0 + set prepend_empty_p t } } -validate { {html_display_options {[as::assessment::check_html_options -options $html_display_options]} "[_ assessment.error_html_options]"} } -edit_data { db_transaction { - set new_item_id [as::item::new_revision -as_item_id $as_item_id] + set new_item_id [as::item::new_revision -as_item_id $as_item_id] - if {$as_item_display_id} { - # edit existing display type - set new_item_display_id [as::item_display_sb::edit \ - -as_item_display_id $as_item_display_id \ - -html_display_options $html_display_options \ - -multiple_p $multiple_p \ - -choice_label_orientation $choice_label_orientation \ - -sort_order_type $sort_order_type \ - -item_answer_alignment $item_answer_alignment \ - -prepend_empty_p t] - } else { - # create new display type - set new_item_display_id [as::item_display_sb::new \ - -html_display_options $html_display_options \ - -multiple_p $multiple_p \ - -choice_label_orientation $choice_label_orientation \ - -sort_order_type $sort_order_type \ - -item_answer_alignment $item_answer_alignment \ - -prepend_empty_p t] - } + if {$as_item_display_id} { + # edit existing display type + set new_item_display_id [as::item_display_sb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_display_options \ + -multiple_p $multiple_p \ + -choice_label_orientation $choice_label_orientation \ + -sort_order_type $sort_order_type \ + -item_answer_alignment $item_answer_alignment \ + -prepend_empty_p t] + } else { + # create new display type + set new_item_display_id [as::item_display_sb::new \ + -html_display_options $html_display_options \ + -multiple_p $multiple_p \ + -choice_label_orientation $choice_label_orientation \ + -sort_order_type $sort_order_type \ + -item_answer_alignment $item_answer_alignment \ + -prepend_empty_p t] + } - set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] - set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] - set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] - set as_item_id [as::item::latest -as_item_id $as_item_id -section_id $new_section_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_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + set as_item_id [as::item::latest -as_item_id $as_item_id -section_id $new_section_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 - as::section::update_section_in_assessment\ + 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_dml update_item_in_section {} - db_dml update_display_of_item {} + db_dml update_item_in_section {} + db_dml update_display_of_item {} } set as_item_id $new_item_id set section_id $new_section_id