Index: openacs-4/contrib/packages/survey/tcl/survey-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/tcl/Attic/survey-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 12 Mar 2004 06:35:45 -0000 1.4 +++ openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 2 Sep 2004 15:17:47 -0000 1.4.2.1 @@ -112,6 +112,8 @@ if {[file exists $template_filename]} { set section_template [template::util::read_file $template_filename] uplevel [list set section_template($section_info(name)) $section_template] + ns_log notice "CM list set section_template($section_info(name)) $section_template" + # uplevel [set section_template($section_info(name)) $section_template] } # If this is a block section, generate a block question, else add questions one by one @@ -308,7 +310,7 @@ template::element::create $form $element_name \ -widget file \ -label "$question_text" \ - -required_p $required_p \ + -optional $required_p \ -value $user_value } "textbox" { @@ -319,7 +321,7 @@ -label "$question_text" \ -value $user_value \ -html $html \ - -required_p $required_p + -optional $required_p } "textarea" { set html [ad_decode $presentation_options "large" {rows 20 cols 65} "medium" {rows 15 cols 55} {rows 8 cols 35}] @@ -329,7 +331,7 @@ -label "$question_text" \ -value $user_value \ -html $html \ - -required_p $required_p + -optional $required_p } "date" { #set options {format "DD Month YYYY"} @@ -338,7 +340,7 @@ -widget date \ -label "$question_text" \ -value $user_value \ - -required_p $required_p + -optional $required_p } "select" { if { $abstract_data_type == "boolean" } { @@ -366,7 +368,7 @@ -label "$question_text" \ -value $user_value \ -options $options \ - -required_p $required_p + -optional $required_p } "radio" { set widget "text(radio)" @@ -396,7 +398,7 @@ -label "$question_text" \ -value $user_value \ -options $options \ - -required_p $required_p + -optional $required_p } "checkbox" { @@ -412,7 +414,7 @@ -label "$question_text" \ -values $user_value \ -options $options \ - -required_p $required_p + -optional $required_p } } } @@ -981,5 +983,40 @@ ns_conn close } - - +ad_proc -public survey_get_section_page_numbers { + {-survey_id} + {-array} +} { + gets corresponding page numbers for sections + + @author Deds Castillo (deds@i-manila.com.ph) + @creation-date 2004-05-24 +} { + upvar $array survey_section_page_numbers + set page_list [list] + set new_page_p 0 + set current_page 1 + db_foreach get_section_pages { + select section_id, + page_break_p + from survey_sections + where survey_id = :survey_id + order by sort_key + } { + if {$new_page_p} { + incr current_page + set new_page_p 0 + } + if {[string equal $page_break_p t]} { + set new_page_p 1 + } + lappend page_list [list $section_id $current_page] + set survey_section_page_numbers($section_id) $current_page + } + + # get total and assign it to element 0 + lappend page_list [list total $current_page] + set survey_section_page_numbers(total) $current_page + + return $page_list +}