Index: openacs-4/packages/survey/www/admin/question-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/question-add-3.tcl,v diff -u -r1.9.4.1 -r1.9.4.2 --- openacs-4/packages/survey/www/admin/question-add-3.tcl 17 Dec 2019 16:28:44 -0000 1.9.4.1 +++ openacs-4/packages/survey/www/admin/question-add-3.tcl 9 Feb 2020 16:10:31 -0000 1.9.4.2 @@ -28,8 +28,8 @@ presentation_alignment type:notnull {valid_responses ""} - {textbox_size ""} - {textarea_size: "medium"} + {textbox_size ""} + {textarea_size: "medium"} {required_p:boolean t} {active_p:boolean t} {responses:multiple ""} @@ -83,66 +83,66 @@ # Generate presentation_options. set presentation_options "" if { $presentation_type eq "textbox" } { - if { ([info exists textbox_size] && $textbox_size ne "") } { - # Will be "small", "medium", or "large". - set presentation_options $textbox_size - } + if { ([info exists textbox_size] && $textbox_size ne "") } { + # Will be "small", "medium", or "large". + set presentation_options $textbox_size + } } elseif { $presentation_type eq "textarea" } { - if { ([info exists textarea_size] && $textarea_size ne "") } { - # Will be "small", "medium", or "large". - set presentation_options $textarea_size - } + if { ([info exists textarea_size] && $textarea_size ne "") } { + # Will be "small", "medium", or "large". + set presentation_options $textarea_size + } } elseif { $abstract_data_type eq "yn" } { - set abstract_data_type "boolean" - set presentation_options "[_ survey.YesNo]" + set abstract_data_type "boolean" + set presentation_options "[_ survey.YesNo]" } elseif { $abstract_data_type eq "boolean" } { - set presentation_options "[_ survey.TrueFalse]" + set presentation_options "[_ survey.TrueFalse]" } db_transaction { - if { ([info exists after] && $after ne "") } { - # We're inserting between existing questions; move everybody down. - set sort_order [expr { $after + 1 }] - db_dml renumber_sort_orders {} - } else { - set sort_order [db_string max_question {}] - if { $sort_order eq ""} { - set sort_order 1 - } - } + if { ([info exists after] && $after ne "") } { + # We're inserting between existing questions; move everybody down. + set sort_order [expr { $after + 1 }] + db_dml renumber_sort_orders {} + } else { + set sort_order [db_string max_question {}] + if { $sort_order eq ""} { + set sort_order 1 + } + } - db_exec_plsql create_question {} + db_exec_plsql create_question {} - db_dml add_question_text {} + db_dml add_question_text {} # For questions where the user is selecting a canned response, insert # the canned responses into survey_question_choices by parsing the valid_responses # field. if { $presentation_type eq "checkbox" || $presentation_type eq "radio" || $presentation_type eq "select" } { if { $abstract_data_type eq "choice" } { - set responses [split $valid_responses "\n"] - set count 0 - foreach response $responses { - set trimmed_response [string trim $response] - if { $trimmed_response eq "" } { - # skip empty lines - continue - } - ### added this next line to - set choice_id [db_string get_choice_id "select survey_choice_id_sequence.nextval as choice_id from dual"] - db_dml insert_survey_question_choice "insert into survey_question_choices (choice_id, question_id, label, sort_order) + set responses [split $valid_responses "\n"] + set count 0 + foreach response $responses { + set trimmed_response [string trim $response] + if { $trimmed_response eq "" } { + # skip empty lines + continue + } + ### added this next line to + set choice_id [db_string get_choice_id "select survey_choice_id_sequence.nextval as choice_id from dual"] + db_dml insert_survey_question_choice "insert into survey_question_choices (choice_id, question_id, label, sort_order) values (survey_choice_id_sequence.nextval, :question_id, :trimmed_response, :count)" - incr count - } - } + incr count + } + } } } on_error { db_release_unused_handles ad_return_error "[_ survey.Database_Error]" "
$errmsg
" ad_script_abort - + } @@ -155,3 +155,9 @@ + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: