Index: openacs-4/packages/survey/tcl/survey-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/tcl/survey-procs.tcl,v
diff -u -r1.9.2.1 -r1.9.2.2
--- openacs-4/packages/survey/tcl/survey-procs.tcl 8 Sep 2014 08:41:08 -0000 1.9.2.1
+++ openacs-4/packages/survey/tcl/survey-procs.tcl 10 Sep 2014 10:31:10 -0000 1.9.2.2
@@ -59,8 +59,10 @@
ad_proc -public survey_question_display {
question_id
{response_id ""}
-} {Returns a string of HTML to display for a question, suitable for embedding in a form. The form variable is of the form \"response_to_question.\$question_id} {
-
+} {
+ Returns a string of HTML to display for a question, suitable for embedding in a form.
+ The form variable is of the form \"response_to_question.\$question_id
+} {
if {$response_id ne ""} {
set edit_previous_response_p "t"
} else {
@@ -107,12 +109,14 @@
}
switch -- $presentation_type {
+
"upload_file" {
if {$edit_previous_response_p == "t"} {
set user_value $attachment_answer
}
append html " "
}
+
"textbox" {
if {$edit_previous_response_p == "t"} {
if {$abstract_data_type eq "number" || $abstract_data_type eq "integer"} {
@@ -122,24 +126,26 @@
}
}
- append html " "
+ append html [subst { }]
}
+
"textarea" {
if {$edit_previous_response_p == "t"} {
-
set user_value $clob_answer
}
set presentation_options [ad_decode $presentation_options "large" "rows=20 cols=65" "medium" "rows=15 cols=55" "rows=8 cols=35"]
append html ""
- }
+ }
+
"date" {
if {$edit_previous_response_p == "t"} {
set user_value $date_answer
}
-
- append html "[ad_dateentrywidget $element_name $user_value]"
+ append html [ad_dateentrywidget $element_name $user_value]
}
+
"select" {
if { $abstract_data_type eq "boolean" } {
if {$edit_previous_response_p == "t"} {
@@ -167,7 +173,7 @@
}
# at some point, we may want to add a UI option for the admin
-# to sepcify multiple or not for select
+# to specify multiple or not for select
append html "
Select One \n"
db_foreach question_choices "" {
@@ -239,7 +245,10 @@
return $html
}
-ad_proc -public util_show_plain_text { text_to_display } "allows plain text (e.g. text entered through forms) to look good on screen without using tags; preserves newlines, angle brackets, etc." {
+ad_proc -public util_show_plain_text { text_to_display } {
+ allows plain text (e.g. text entered through forms) to look good on screen
+ without using tags; preserves newlines, angle brackets, etc.
+} {
regsub -all "\\&" $text_to_display "\\&" good_text
regsub -all "\>" $good_text "\\>" good_text
regsub -all "\<" $good_text "\\<" good_text
@@ -249,8 +258,11 @@
return $good_text
}
-ad_proc -public survey_answer_summary_display {response_id {html_p 1}} "Returns a string with the questions and answers. If html_p =t, the format will be html. Otherwise, it will be text. If a list of category_ids is provided, the questions will be limited to that set of categories." {
-
+ad_proc -public survey_answer_summary_display {response_id {html_p 1}} {
+ Returns a string with the questions and answers. If html_p =t, the format will be html.
+ Otherwise, it will be text. If a list of category_ids is provided,
+ the questions will be limited to that set of categories.
+} {
set return_string ""
set question_id_previous ""
@@ -295,12 +307,14 @@
set question_id_previous $question_id
}
- return "$return_string"
+ return $return_string
}
-ad_proc -public survey_get_score {section_id user_id} "Returns the score of the user's most recent response to a survey" {
+ad_proc -public survey_get_score {section_id user_id} {
+ Returns the score of the user's most recent response to a survey
+} {
set response_id [ survey_get_response_id $section_id $user_id ]
Index: openacs-4/packages/survey/www/process-response.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/process-response.tcl,v
diff -u -r1.15.2.1 -r1.15.2.2
--- openacs-4/packages/survey/www/process-response.tcl 7 Aug 2014 07:11:46 -0000 1.15.2.1
+++ openacs-4/packages/survey/www/process-response.tcl 10 Sep 2014 10:31:10 -0000 1.15.2.2
@@ -29,7 +29,7 @@
}
}
- check_questions -requires { section_id:integer } {
+ check_questions -requires { section_id } {
set question_info_list [db_list_of_lists survey_question_info_list {
select question_id, question_text, abstract_data_type, presentation_type, required_p
@@ -69,10 +69,20 @@
}
if { $abstract_data_type eq "date" } {
- if [catch { set response_to_question($question_id) [validate_ad_dateentrywidget "" response_to_question.$question_id [ns_getform]]} errmsg] {
- ad_complain "$errmsg: [_ survey.lt_Please_make_sure_your]"
+ foreach {name value} [ns_set array [ns_getform]] {
+ if {[regexp "^response_to_question\[.\]$question_id\[.\](.*)\$" $name _ part]} {
+ set date_value($part) $value
+ }
}
- }
+ set ok [ad_page_contract_filter_proc_date "date" date_value]
+ if {$ok} {
+ set response_to_question($question_id) [ns_buildsqldate $date_value(month) \
+ $date_value(day) \
+ $date_value(year)]
+ } else {
+ ad_complain "Please make sure your dates are valid."
+ }
+ }
if { ([info exists response_to_question($question_id)] && $response_to_question($question_id) ne "") } {
Index: openacs-4/packages/survey/www/admin/modify-responses.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/modify-responses.tcl,v
diff -u -r1.3.2.1 -r1.3.2.2
--- openacs-4/packages/survey/www/admin/modify-responses.tcl 7 Aug 2014 07:11:47 -0000 1.3.2.1
+++ openacs-4/packages/survey/www/admin/modify-responses.tcl 10 Sep 2014 10:31:10 -0000 1.3.2.2
@@ -63,26 +63,24 @@
append table_html "\n"
-db_release_unused_handles
+set title [_ survey.Modify_Responses]
+set context [list "one?[export_vars -url {survey_id}]" $survey_info(name)] [_ survey.lt_Modify_Question_Respo]
-doc_return 200 text/html "[ad_header "[_ survey.Modify_Responses]"]
-$survey_name
+set body [subst {
+ $survey_name
-[ad_context_bar [list "one?[export_vars -url {survey_id}]" $survey_info(name)] "[_ survey.lt_Modify_Question_Respo]"]
+
+ [_ survey.Question]: $question_text
+
+
+}]
-[_ survey.Question]: $question_text
-
-
-
-[ad_footer]
-"
+ad_return_template generic
Index: openacs-4/packages/survey/www/admin/process-response.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/process-response.tcl,v
diff -u -r1.5.2.1 -r1.5.2.2
--- openacs-4/packages/survey/www/admin/process-response.tcl 7 Aug 2014 07:11:47 -0000 1.5.2.1
+++ openacs-4/packages/survey/www/admin/process-response.tcl 10 Sep 2014 10:31:10 -0000 1.5.2.2
@@ -30,7 +30,7 @@
}
}
- check_questions -requires { section_id:integer } {
+ check_questions -requires { section_id } {
set question_info_list [db_list_of_lists survey_question_info_list {
select question_id, question_text, abstract_data_type, presentation_type, required_p
@@ -43,7 +43,7 @@
## Validate input.
set questions_with_missing_responses [list]
-
+
foreach question $question_info_list {
set question_id [lindex $question 0]
set question_text [lindex $question 1]
@@ -68,11 +68,21 @@
}
}
}
-
+
if { $abstract_data_type eq "date" } {
- if [catch { set response_to_question($question_id) [validate_ad_dateentrywidget "" response_to_question.$question_id [ns_getform]]} errmsg] {
- ad_complain "$errmsg: Please make sure your dates are valid."
+ foreach {name value} [ns_set array [ns_getform]] {
+ if {[regexp "^response_to_question\[.\]$question_id\[.\](.*)\$" $name _ part]} {
+ set date_value($part) $value
+ }
}
+ set ok [ad_page_contract_filter_proc_date "date" date_value]
+ if {$ok} {
+ set response_to_question($question_id) [ns_buildsqldate $date_value(month) \
+ $date_value(day) \
+ $date_value(year)]
+ } else {
+ ad_complain "Please make sure your dates are valid."
+ }
}
if { ([info exists response_to_question($question_id)] && $response_to_question($question_id) ne "") } {
Index: openacs-4/packages/survey/www/admin/survey-create-choice.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/survey-create-choice.tcl,v
diff -u -r1.3 -r1.3.2.1
--- openacs-4/packages/survey/www/admin/survey-create-choice.tcl 6 Nov 2013 07:33:55 -0000 1.3
+++ openacs-4/packages/survey/www/admin/survey-create-choice.tcl 10 Sep 2014 10:31:10 -0000 1.3.2.1
@@ -16,22 +16,18 @@
set package_id [ad_conn package_id]
permission::require_permission -object_id $package_id -privilege survey_create_survey
-set whole_page "[ad_header "[_ survey.Choose_Survey_Type]"]
+set title [_ survey.Choose_a_Survey_Type]
+set context [list [_ survey.Choose_Type]]
-[_ survey.Choose_a_Survey_Type]
+set body [subst {
+
+
+ [_ survey.Scored_Survey]
+ [_ survey.lt_This_is_a_multiple_ch]
+ [_ survey.General_Survey]
+ [_ survey.lt_This_survey_allows_yo]
+
+}]
-[ad_context_bar "[_ survey.Choose_Type]"]
+ad_return_template generic
-
-
-
-[_ survey.Scored_Survey]
-[_ survey.lt_This_is_a_multiple_ch]
-[_ survey.General_Survey]
-[_ survey.lt_This_survey_allows_yo]
-
-
-[ad_footer]
-"
-
-doc_return 200 text/html $whole_page