"
} else {
append return_string "\n\n"
}
-
+
set question_id_previous $question_id
}
Index: openacs-4/contrib/packages/survey/www/one-respondent.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/Attic/one-respondent.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/survey/www/one-respondent.adp 16 Mar 2005 12:26:31 -0000 1.3
+++ openacs-4/contrib/packages/survey/www/one-respondent.adp 18 Mar 2005 02:28:02 -0000 1.4
@@ -2,7 +2,7 @@
Your response
on @responses.pretty_submission_date@
Index: openacs-4/contrib/packages/survey/www/process-response.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/Attic/process-response.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/contrib/packages/survey/www/process-response.tcl 16 Mar 2005 12:26:31 -0000 1.10
+++ openacs-4/contrib/packages/survey/www/process-response.tcl 18 Mar 2005 02:28:02 -0000 1.11
@@ -174,10 +174,10 @@
if {[db_string get_response_count {}] == 0} {
db_exec_plsql create_response {}
- }
+ }
set question_info_list [db_list_of_lists survey_question_info_list {}]
-
+
# in case of editing a response, clear old responses
db_dml clear_section_response ""
@@ -188,11 +188,11 @@
set presentation_type [lindex $question 3]
set required_p [lindex $question 4]
set predefined_question_id [lindex $question 5]
-
+
if {[info exists response_to_question($question_id)]} {
if {$abstract_data_type=="date" && \
- [exists_and_not_null invalid_date_p($question_id)]} {
- set response_value [db_null]
+ [exists_and_not_null invalid_date_p($question_id)]} {
+ set response_value [db_null]
} else {
set response_value [string trim $response_to_question($question_id)]
}
@@ -203,26 +203,26 @@
# If this is a predefined question, handle it accordingly
if {$predefined_question_id != [db_null]} {
db_1row predefined ""
-
+
# Predefined DB questions are inserted both in the DB and in the response.
if {$action_type=="db"} {
# Make sure we deal with dates correctly
# If we have an invalid date, insert a NULL value
if {[exists_and_not_null invalid_date_p($question_id)]} {
set response_value [db_null]
}
-
+
# insert value into db
db_dml ignore "update $table_name set $column_name=:response_value where $key_name=:user_id"
if {![db_resultrows]} {
db_dml insert "insert into $table_name ($key_name,$column_name) values (:user_id,_response_value)"
}
}
}
-
+
switch -- $abstract_data_type {
"choice" {
- if { $presentation_type == "checkbox" } {
+ if { $presentation_type == "checkbox" || $presentation_type == "checkbox_text" } {
# Deal with multiple responses.
set checked_responses $response_to_question($question_id)
foreach response_value $checked_responses {
@@ -237,7 +237,7 @@
if { [empty_string_p $response_value] || [empty_string_p [lindex $response_value 0]] } {
set response_value [db_null]
}
-
+
db_dml survey_question_response_choice_insert "insert into survey_question_responses (response_id, question_id, choice_id)
values (:response_id, :question_id, :response_value)"
}
@@ -267,63 +267,69 @@
}
db_dml survey_question_response_text_insert {} -clobs [list $response_value]
- }
- "date" {
- if { [empty_string_p $response_value] } {
- set response_value [db_null]
- }
- # Make sure we deal with dates correctly
- # If we have an invalid date, insert a NULL value
- if {[exists_and_not_null invalid_date_p($question_id)]} {
- set response_value [db_null]
}
- db_dml survey_question_response_date_insert {}
- }
- "blob" {
-
- if { ![empty_string_p $response_value] } {
- # this stuff only makes sense to do if we know the file exists
- # cannot use [template::data::transform::file because of the . in the var name
- set filename [ns_queryget response_to_question.$question_id]
- set tmp_filename [ns_queryget response_to_question.$question_id.tmpfile]
- set mime_type [ns_queryget response_to_question.$question_id.content-type]
- set file_extension [string tolower [file extension $response_value]]
- # remove the first . from the file extension
- regsub {\.} $file_extension "" file_extension
-
- set n_bytes [file size $tmp_filename]
-
- if { $n_bytes == 0 } {
- error "[_ survey.lt_This_should_have_been]"
- } else {
- set unique_name "${filename}_${response_id}"
- if {[ad_conn user_id]=="0"} {
- # anonymous answer
- set creation_user [db_null]
+ "date" {
+ if { [empty_string_p $response_value] } {
+ set response_value [db_null]
+ }
+ # Make sure we deal with dates correctly
+ # If we have an invalid date, insert a NULL value
+ if {[exists_and_not_null invalid_date_p($question_id)]} {
+ set response_value [db_null]
+ }
+ db_dml survey_question_response_date_insert {}
+ }
+ "blob" {
+
+ if { ![empty_string_p $response_value] } {
+ # this stuff only makes sense to do if we know the file exists
+ # cannot use [template::data::transform::file because of the . in the var name
+ set filename [ns_queryget response_to_question.$question_id]
+ set tmp_filename [ns_queryget response_to_question.$question_id.tmpfile]
+ set mime_type [ns_queryget response_to_question.$question_id.content-type]
+ set file_extension [string tolower [file extension $response_value]]
+ # remove the first . from the file extension
+ regsub {\.} $file_extension "" file_extension
+
+ set n_bytes [file size $tmp_filename]
+
+ if { $n_bytes == 0 } {
+ error "[_ survey.lt_This_should_have_been]"
} else {
- set creation_user [ad_conn user_id]
+ set unique_name "${filename}_${response_id}"
+ if {[ad_conn user_id]=="0"} {
+ # anonymous answer
+ set creation_user [db_null]
+ } else {
+ set creation_user [ad_conn user_id]
+ }
+ if {[info exist upload_file_exist($question_id)]} {
+ set old_revision_id $upload_file_exist($question_id)
+ set old_item [db_string get_item_id ""]
+ set revision_id [cr_import_content -item_id $old_item -creation_user $creation_user -title $filename "" $tmp_filename $n_bytes $mime_type $unique_name ]
+ db_dml survey_question_response_file_attachment_update ""
+ db_dml update_item_description ""
+ } else {
+ set revision_id [cr_import_content -creation_user $creation_user -title $filename "" $tmp_filename $n_bytes $mime_type $unique_name ]
+ db_dml survey_question_response_file_attachment_insert ""
+ }
+ # we use cr_import_content now --DaveB
+ # this abstracts out for use the blob handling for oracle or postgresql
+ # we are linking the file item_id to the survey_question_response attachment_answer field now
+
}
- if {[info exist upload_file_exist($question_id)]} {
- set old_revision_id $upload_file_exist($question_id)
- set old_item [db_string get_item_id ""]
- set revision_id [cr_import_content -item_id $old_item -creation_user $creation_user -title $filename "" $tmp_filename $n_bytes $mime_type $unique_name ]
- db_dml survey_question_response_file_attachment_update ""
- db_dml update_item_description ""
- } else {
- set revision_id [cr_import_content -creation_user $creation_user -title $filename "" $tmp_filename $n_bytes $mime_type $unique_name ]
- db_dml survey_question_response_file_attachment_insert ""
- }
- # we use cr_import_content now --DaveB
- # this abstracts out for use the blob handling for oracle or postgresql
- # we are linking the file item_id to the survey_question_response attachment_answer field now
+ }
+ }
+ }
- }
- }
- }
+ # SB: each of these widgets has an additional element, the text field, that has to be dealt with
+ if { $presentation_type == "checkbox_text" || $presentation_type == "radio_text" || $presentation_type == "select_text" } {
+ set response_value [ns_set get [ns_getform] "response_to_question.${question_id}.text"]
+ db_dml survey_question_choice_shorttext_insert {}
+ }
}
}
}
-}
# Look for next section
set section_ids [survey_next_sections -edit_p $edit_p $survey_id $section_id $response_id]
Index: openacs-4/contrib/packages/survey/www/admin/one.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/one.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/survey/www/admin/one.tcl 16 Mar 2005 12:26:31 -0000 1.4
+++ openacs-4/contrib/packages/survey/www/admin/one.tcl 18 Mar 2005 02:28:02 -0000 1.5
@@ -109,7 +109,7 @@
}
}
if {![empty_string_p $question_id]} {
- survey_question_add_to_form admin_survey $question_id
+ survey::form::create_ad_form_element -form admin_survey -question_id $question_id
}
}
Index: openacs-4/contrib/packages/survey/www/admin/question-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-add-2.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/survey/www/admin/question-add-2.tcl 16 Mar 2005 12:26:31 -0000 1.4
+++ openacs-4/contrib/packages/survey/www/admin/question-add-2.tcl 18 Mar 2005 02:28:02 -0000 1.5
@@ -57,8 +57,7 @@
{required_p:text(hidden) {value $required_p}}
{active_p:text(hidden) {value $active_p}}
{type:text(hidden) {value $type}}
- {pretty_id:text {label "Variable name"}
- {help_text "This will be the name of the variable when creating reports. No spaces or special characers."}
+ {pretty_id:text(hidden)
{value $question_id}
}
}
@@ -143,6 +142,8 @@
set response_fields ""
switch -- $presentation_type {
+ "radio_text" -
+ "select_text" -
"radio" -
"select" {
@@ -156,14 +157,13 @@
}
}
+ "checkbox_text" -
"checkbox" {
ad_form -extend -name create-question-2 -form {
{valid_responses:text(textarea) {label "[_ survey.lt_Valid_Resposnes_enter_1]"} {html {rows 10 cols 50}}}
{abstract_data_type:text(hidden) {value "choice"}}
}
}
-
-
"date" {
Index: openacs-4/contrib/packages/survey/www/admin/question-modify.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-modify.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/survey/www/admin/question-modify.tcl 16 Mar 2005 12:26:31 -0000 1.5
+++ openacs-4/contrib/packages/survey/www/admin/question-modify.tcl 18 Mar 2005 02:28:02 -0000 1.6
@@ -48,8 +48,8 @@
{question_number:text(inform) {label "[_ survey.Modify_Question__]"}}
{survey_name:text(inform) {label "[_ survey.From_1]"} {value $survey_name}}
{question_text:text(textarea) {label "[_ survey.Question]"} {html {rows 5 cols 70}}}
- {pretty_id:text {label "Variable name"}
- {help_text "This will be the name of the variable when creating reports. No spaces or special characers."}
+ {pretty_id:text(hidden)
+ (value $question_id)
}
}
Index: openacs-4/contrib/packages/survey/www/admin/send-mail.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/send-mail.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/survey/www/admin/send-mail.tcl 16 Mar 2005 12:26:32 -0000 1.4
+++ openacs-4/contrib/packages/survey/www/admin/send-mail.tcl 18 Mar 2005 02:28:02 -0000 1.5
@@ -9,9 +9,9 @@
@date July 29, 2002
@cvs-id $Id:
} {
- survey_id:integer,notnull
- {package_id:integer 0}
- {to "responded"}
+ survey_id:integer,notnull
+ {package_id:integer 0}
+ {to "responded"}
}
set package_id [ad_conn package_id]
@@ -46,18 +46,21 @@
ad_form -name send-mail -form {
{to:text(radio) {options {
{"[_ survey.lt_Everyone_eligible_to_]" "all"}
- {"[_ survey.lt_Everyone_who_has_not_]" "not_responded"}}}
+ {"[_ survey.lt_Everyone_who_has_not_]" "not_responded"}
+ }}
{label "[_ survey.Send_mail_to]"}
{value $to}
}
}
}
} else {
ad_form -name send-mail -form {
- {to:text(radio) {options {
- {"[_ survey.lt_Everyone_who_has_alre_1]" "responded"}}}
+ {to:text(radio)
+ {options {
+ {"[_ survey.lt_Everyone_who_has_alre_1]" "responded"}
+ }}
{label "[_ survey.Send_mail_to]"}
- {value ""}
+ {value "responded"}
}
}
}
@@ -78,16 +81,16 @@
}
responded {
- set query [db_map dotlrn_responded]
+ set query [db_map dotlrn_responded]
}
not_responded {
set query [db_map dotlrn_not_responded]
}
}
-} else {
- set query [db_map responded]
-}
+ } else {
+ set query [db_map responded]
+ }
bulk_mail::new \
-package_id $package_id \