Index: openacs-4/contrib/packages/survey/www/admin/section-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/section-edit-2.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/contrib/packages/survey/www/admin/section-edit-2.tcl 19 Sep 2003 16:48:04 -0000 1.1 +++ openacs-4/contrib/packages/survey/www/admin/section-edit-2.tcl 13 Jan 2004 20:19:31 -0000 1.1.2.1 @@ -6,7 +6,8 @@ @author cmceniry@arsdigita.com @author nstrug@arsdigita.com - @date Jun 16, 2000 + @author openacs@sussdorff.de + @date Jan 13, 2004 @cvs-id $Id$ } { @@ -18,6 +19,7 @@ branch_p:boolean,notnull {block_section_p:boolean "f"} page_break_p:boolean,notnull + {answer_descriptions:trim ""} } -validate { first_section_not_branch -requires {branch_p:notnull} { if {$branch_p=="t" && $after==0} { @@ -55,24 +57,38 @@ ad_script_abort } # Make this a block section + # Create a row in survey_block_sections for each set of choices # - create a row in survey_block_questions for each of the choices of the questions # - mark section as block-section db_foreach example_questions "" { set block_id [db_nextval survey_block_section_id_seq] set choice_id [db_nextval survey_block_choice_id_seq] + db_dml make_block_section "" db_dml make_block_choices "" } - db_dml make_block_section "" + db_dml mark_block_section "" } else { if {$old_block_section_p=="t" && $block_section_p=="f"} { # undo block section - db_dml make_noblock_section "" + db_dml mark_noblock_section "" db_dml remove_block_questions "" + db_dml remove_block_sections "" } } + # Answer descriptions for block sections + if {$block_section_p=="t"} { + set answer_descriptions [split $answer_descriptions "\n"] + set count 0 + foreach block_section_id [db_list block_sections ""] { + set answer_description [lindex $answer_descriptions $count] + incr count + db_dml add_answer_description "" + } + } + # after is the section which is to be newly above the section # refers_to is the section our condition refers to # if after is before refers_to we're before our condition and that case should be avoided