Index: openacs-4/contrib/packages/survey/catalog/survey.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/catalog/Attic/survey.en_US.ISO-8859-1.xml,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/survey/catalog/survey.en_US.ISO-8859-1.xml 17 Mar 2005 13:37:40 -0000 1.10 +++ openacs-4/contrib/packages/survey/catalog/survey.en_US.ISO-8859-1.xml 18 Mar 2005 02:28:02 -0000 1.11 @@ -163,18 +163,16 @@ DELETE: %survey_info.name% DELETE: Survey Response Deleting this survey will delete all %questions_count% questions and all %responses_count% responses associated with this survey! - Deleting this survey will delete all %questions_count% questions and all $responses_count responses associated with this survey! + Deleting this survey will delete all %questions_count% questions and all %responses_count% responses associated with this survey! denotes a required question Description must be less than 4000 characters Edit and submit to change the name for this survey: Erase custom template - $errmsg: Please make sure your dates are valid. + %errmsg%: Please make sure your dates are valid. Essay Answer (Text Area) Everyone eligible to take this survey Everyone who has already taken this survey - Everyone who has already taken this survey" "all"}}} - {value "all"} - {label "<#_ Send mail to + Everyone who has already taken this survey Everyone who has not yet taken this survey First section cannot be branch For Multiple Choice<br />Enter a List of Valid Responses<br /> (enter one choice per line) @@ -185,11 +183,11 @@ Import responses from a .csv file Import successful" <#_ There were no problems with the import. %line% records have been created. <a href=one?survey_id=%survey_id%>Return to the survey</a> Line %line%: Answer to question %question(%question_id.question_text%)% cannot be empty - Line %line%: Choice \"$choice\" does not exist in question %question(%question_id.question_text%)% - Line %line%: Invalid boolean value \"$response_value\" for question %question(%question_id.question_text%)%< - Line %line%: Invalid Date \"$response_value\" for question %question(%question_id.question_text%)% - Line %line%: Invalid Number \"$response_value\" for question %question(%question_id.question_text%)% - Line %line%: User with $identifier \"[lindex $data $idfield]\" does not exist + Line %line%: Choice \"%choice%\" does not exist in question %question(%question_id.question_text%)% + Line %line%: Invalid boolean value \"%response_value%\" for question %question(%question_id.question_text%)%< + Line %line%: Invalid Date \"%response_value%\" for question %question(%question_id.question_text%)% + Line %line%: Invalid Number \"%response_value%\" for question %question(%question_id.question_text%)% + Line %line%: User with %identifier% does not exist Main Survey Administration Manage predefined questions Modify a Question's Text @@ -211,23 +209,7 @@ One Respondent: %first_names% %last_name% One Survey: %survey_info.name% People who answered %response_text% - Plain Text" "plain"}}}} -} -edit_request { - get_survey_info -survey_id $survey_id - set survey_name $survey_info(name) - set description $survey_info(description) - set description_html_p $survey_info(description_html_p) - set desc_html "" - if {$description_html_p=="t"} { - set desc_html "html" - } else { - set desc_html "plain" - } - ad_set_form_values desc_html description - -} -validate { - {description {[string length $description] <= 4000} - <#_ Description must be less than 4000 characters + Plain Text Please enter a column name Please enter a description for the survey Please enter a key name @@ -296,13 +278,13 @@ The above description is The response to %question_text% must be an integer. Your answer was %response_value%. The response to %question_text% must be a number. Your answer was %response_value%. - The response to \"$question_text\" must be a number. Your answer was \"$response_value\ - The response to \"$question_text\" must be an integer. Your answer was \"$response_value\". + The response to \"%question_text%\" must be a number. Your answer was \"%response_value%\ + The response to \"%question_text%\" must be an integer. Your answer was \"%response_value%\". There has been 1 response. There have been %n_responses% responses. There have been %n_responses% responses. There %isare% %n_responses% %resp% to this question. Editing a question with responses is not recommnded. No record of the original question will remain. Proceed with caution. - There $isare $n_responses $resp to this question. Editing a question with responses is not recommended. No record of the original question will remain. Proceed with caution. + There %isare% %n_responses% %resp% to this question. Editing a question with responses is not recommended. No record of the original question will remain. Proceed with caution. There was an error while trying to delete the question: There was an error while trying to delete the question There were some errors @@ -320,12 +302,12 @@ and free text answer questions in the same survey. This survey contains measurement sections, which cannot be compressed This survey is not editable - This will remove $response_count responses + This will remove %response_count% responses This will remove %response_count% responses to the survey index page. to the survey index page. - Unable to delete section. This was the Error: <pre>$errmsg</pre> + Unable to delete section. This was the Error: <pre>%errmsg%</pre> Unable to delete section. It does contain questions, which must be deleted first Users may edit their responses Users may not edit their responses @@ -337,7 +319,7 @@ You did not enter a question. You did not enter a set of valid responses You didn't respond to all required sections. You skipped: - You didn't respond to all required sections. You skipped:<ul>$missing</ul> + You didn't respond to all required sections. You skipped:<ul>%missing%</ul> You have already completed this survey Your file is zero-length. Either you attempted to upload a zero length file, a file which does not exist, or something went wrong during the transfer. Your response Index: openacs-4/contrib/packages/survey/tcl/survey-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/tcl/Attic/survey-form-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/survey/tcl/survey-form-procs.tcl 13 Jan 2005 13:54:39 -0000 1.2 +++ openacs-4/contrib/packages/survey/tcl/survey-form-procs.tcl 18 Mar 2005 02:28:02 -0000 1.3 @@ -45,19 +45,14 @@ [list "section_info$section_id:text(inform)" {label ""} {value $section_info(description)} {section $section_info(name)}] ] - db_foreach get_questions { - select question_id - from survey_questions - where section_id=:section_id - order by sort_order - } { + db_foreach get_questions {} { survey::form::create_ad_form_element \ -form $form \ -question_id $question_id \ -response_id $response_id \ -mode $mode \ -edit_p $edit_p - } + } } @@ -92,40 +87,16 @@ set element_name "response_to_question.$question_id" - db_1row get_question_properties { - select section_id, - sort_order, - question_text, - abstract_data_type, - required_p, - active_p, - presentation_type, - presentation_options, - presentation_alignment, - creation_user, - creation_date, - predefined_question_id - from survey_questions, - acs_objects - where object_id = question_id - and question_id = :question_id - } + db_1row get_question_properties {} set user_value "" + set selected_choices [list] if { $predefined_question_id != [db_null] } { # question is a predefined question. If it has already been answered, get the last response value from the db # if it is a predefined question with action_type="db" get the value from the db instead. - db_1row predefined_question_data { - select action_type, - abstract_data_type, - table_name, - column_name, - key_name - from survey_predefined_questions - where predefined_question_id = :predefined_question_id - } + db_1row predefined_question_data {} if {[string equal $action_type "db"]} { # select preselected value from the db @@ -154,48 +125,13 @@ } else { # select preselected value from latest response set user_id [ad_conn user_id] - if {[db_0or1row locate_predef_preselect { - select question_id as preselect_question_id, - object_id as response_id - from survey_question_responses, - acs_objects - where question_id in ( - select question_id - from survey_questions - where predefined_question_id = :predefined_question_id - ) - and object_type = 'survey_response' - and response_id = object_id - and creation_date = (select min(creation_date) - from survey_question_responses, - acs_objects - where question_id in ( - select question_id - from survey_questions - where predefined_question_id = :predefined_question_id - ) - and object_type = 'survey_response' - and response_id=object_id - ) - }]} { + if {[db_0or1row locate_predef_preselect {}]} { set count 0 - db_foreach prev_response_query_predef { - select choice_id, - boolean_answer, - clob_answer, - number_answer, - varchar_answer, - to_char(date_answer,'YYYY MM DD HH24 MI SS') as date_answer, - attachment_answer - from survey_question_responses - where question_id = :preselect_question_id - and response_id = :response_id - } { + db_foreach prev_response_query_predef {} { incr count - - if {[string equal $presentation_type "checkbox"]} { - set selected_choices($choice_id) "t" - } + if {![empty_string_p $choice_id]} { + lappend selected_choices $choice_id + } } if_no_rows { set choice_id 0 set boolean_answer "" @@ -221,22 +157,10 @@ set user_id [ad_conn user_id] set count 0 - db_foreach prev_response_query { - select choice_id, - boolean_answer, - clob_answer, - number_answer, - varchar_answer, - to_char(date_answer,'YYYY MM DD HH24 MI SS') as date_answer, - attachment_answer - from survey_question_responses - where question_id = :question_id - and response_id = :response_id - } { + db_foreach prev_response_query {} { incr count - - if {[string equal $presentation_type "checkbox"]} { - set selected_choices($choice_id) "t" + if {![empty_string_p $choice_id]} { + lappend selected_choices $choice_id } } if_no_rows { set choice_id 0 @@ -253,7 +177,7 @@ if {$edit_previous_response_p} { switch -- $abstract_data_type { "choice" { - set user_value $choice_id + set user_value [join $selected_choices " "] } "shorttext" { set user_value $varchar_answer @@ -308,6 +232,7 @@ "date" { set element_type "date(date)" } + "select_text" - "select" { if { [string equal $abstract_data_type "boolean"] } { if {![empty_string_p $presentation_options]} { @@ -324,25 +249,20 @@ # at some point, we may want to add a UI option for the admin # to sepcify multiple or not for select set optionlist [list] - db_foreach question_choices { - select choice_id, - label - from survey_question_choices - where question_id = :question_id - order by sort_order - } { + db_foreach question_choices {} { lappend optionlist [list $label $choice_id] } set options $optionlist - set pretty_user_value [db_string get_pretty_value { - select label - from survey_question_choices - where choice_id = :user_value - } -default ""] + set pretty_user_value [db_string get_pretty_value {} -default ""] } - set element_type "text(select)" + if { $presentation_type == "select_text" } { + set element_type "text(select_text)" + } else { + set element_type "text(select)" + } set element_param_list {{options $options}} } + "radio_text" - "radio" { if { [string equal $abstract_data_type "boolean"] } { if {![empty_string_p $presentation_options]} { @@ -358,40 +278,34 @@ set pretty_user_value [string map {t $choice_t f $choice_f} $user_value] } else { set optionlist [list] - db_foreach question_choices_2 { - select choice_id, - label - from survey_question_choices - where question_id = :question_id - order by sort_order - } { + db_foreach question_choices {} { # replace {xxx.gif} by image inclusion regsub -all "\{(\[^\{\}\]*)\}" $label {} label lappend optionlist [list $label $choice_id] } set options $optionlist - set pretty_user_value [db_string get_pretty_value { - select label - from survey_question_choices - where choice_id = :user_value - } -default ""] + set pretty_user_value [db_string get_pretty_value {} -default ""] } - set element_type "text(radio)" + if {$presentation_type == "radio_text"} { + set element_type "text(radio_text)" + } else { + set element_type "text(radio)" + } set element_param_list {{options $options}} } + "checkbox_text" - "checkbox" { set choices [list] set optionlist [list] - db_foreach question_choices_3 { - select * - from survey_question_choices - where question_id = :question_id - order by sort_order - } { + db_foreach question_choices_all {} { lappend optionlist [list $label $choice_id] } set options $optionlist - set element_type "text(checkbox)" + if { $presentation_type == "checkbox_text" } { + set element_type "text(checkbox_text)" + } else { + set element_type "text(checkbox)" + } set element_param_list {{options $options}} } } @@ -402,19 +316,29 @@ # we allow multiple values here only if not on display # mode if {[string equal $mode display]} { - set pretty_user_value_list [db_list get_choice_label " - select label - from survey_question_choices - where choice_id in ($user_value) - "] + set pretty_user_value_list [db_list get_choice_label {}] set pretty_user_value [join $pretty_user_value_list ", "] regsub -all -- {\$} $pretty_user_value {\\$} pretty_user_value lappend element_param_list [list value $pretty_user_value] } else { lappend element_param_list [list values $user_value] } - } else { + } elseif { $presentation_type == "checkbox_text" } { + # SB: checkbox_text widget expects "value" to be in the format {{choice ids} text} + set text_value [survey::form::get_response_text -response_id $response_id -question_id $question_id \ + -abstract_data_type "choice"] if {[string equal $mode display]} { + set pretty_user_value_list [db_list get_choice_label {}] + set pretty_user_value [join $pretty_user_value_list ", "] + regsub -all -- {\$} $pretty_user_value {\\$} pretty_user_value + lappend element_param_list [list value $pretty_user_value] + } else { + lappend element_param_list [list value "\{$user_value\} \"$text_value\""] + } + } elseif { $presentation_type == "select_text" || $presentation_type == "radio_text" } { + set text_value [survey::form::get_response_text -response_id $response_id -question_id $question_id \ + -abstract_data_type $abstract_data_type] + if {[string equal $mode display]} { if { ![string equal $abstract_data_type "boolean"] } { # boolean is a special case so we do not replace # their dollar signs @@ -424,6 +348,19 @@ regsub -all -- {\n} $pretty_user_value {
} pretty_user_value lappend element_param_list [list value $pretty_user_value] } else { + lappend element_param_list [list value "$user_value \"$text_value\""] + } + } else { + if {[string equal $mode display]} { + if { ![string equal $abstract_data_type "boolean"] } { + # boolean is a special case so we do not replace + # their dollar signs + regsub -all -- {\$} $pretty_user_value {\\$} pretty_user_value + } + # this takes care of textareas + regsub -all -- {\n} $pretty_user_value {
} pretty_user_value + lappend element_param_list [list value $pretty_user_value] + } else { lappend element_param_list [list value $user_value] } } @@ -454,3 +391,28 @@ } +ad_proc -public survey::form::get_response_text { + {-response_id:required} + {-question_id:required} + {-abstract_data_type:required} +} { + Utility procedure for checkbox_text, radio_text and select_text widgets. + Returns the value of the text part of the widget. + Used for retrieving the response for editing purposes. + + @author simon@simonbuckle.com +} { + set txt "" + + # only return the text if the widget is one of the allowed types + switch -- $abstract_data_type { + "choice" { + set txt [db_string choice_text_value {} -default ""] + } + "boolean" { + set txt [db_string boolean_text_value {} -default ""] + } + } + + return $txt +} \ No newline at end of file Index: openacs-4/contrib/packages/survey/tcl/survey-form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/tcl/Attic/survey-form-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/survey/tcl/survey-form-procs.xql 18 Mar 2005 02:28:02 -0000 1.1 @@ -0,0 +1,156 @@ + + + + + + select question_id + from survey_questions + where section_id=:section_id + order by sort_order + + + + + + select section_id, + sort_order, + question_text, + abstract_data_type, + required_p, + active_p, + presentation_type, + presentation_options, + presentation_alignment, + creation_user, + creation_date, + predefined_question_id + from survey_questions, + acs_objects + where object_id = question_id + and question_id = :question_id + + + + + + select action_type, + abstract_data_type, + table_name, + column_name, + key_name + from survey_predefined_questions + where predefined_question_id = :predefined_question_id + + + + + +select question_id as preselect_question_id, + object_id as response_id +from survey_question_responses, + acs_objects +where question_id in (select question_id + from survey_questions + where predefined_question_id = :predefined_question_id + ) +and object_type = 'survey_response' +and response_id = object_id +and creation_date = (select min(creation_date) + from survey_question_responses, + acs_objects + where question_id in (select question_id + from survey_questions + where predefined_question_id = :predefined_question_id + ) + and object_type = 'survey_response' + and response_id=object_id + ) + + + + + + select choice_id, + boolean_answer, + clob_answer, + number_answer, + varchar_answer, + to_char(date_answer,'YYYY MM DD HH24 MI SS') as date_answer, + attachment_answer + from survey_question_responses + where question_id = :preselect_question_id + and response_id = :response_id + + + + + + select choice_id, + boolean_answer, + clob_answer, + number_answer, + varchar_answer, + to_char(date_answer,'YYYY MM DD HH24 MI SS') as date_answer, + attachment_answer + from survey_question_responses + where question_id = :question_id + and response_id = :response_id + + + + + + select choice_id, + label + from survey_question_choices + where question_id = :question_id + order by sort_order + + + + + + select label + from survey_question_choices + where choice_id = :user_value + + + + + + select varchar_answer + from survey_question_responses + where response_id = :response_id + and question_id = :question_id + and choice_id is null + + + + + + select varchar_answer + from survey_question_responses + where response_id = :response_id + and question_id = :question_id + and boolean_answer is null + + + + + + select label + from survey_question_choices + where choice_id in ($user_value) + + + + + + select * + from survey_question_choices + where question_id = :question_id + order by sort_order + + + + \ No newline at end of file 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.6 -r1.7 --- openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 31 Jan 2005 19:24:13 -0000 1.6 +++ openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 18 Mar 2005 02:28:02 -0000 1.7 @@ -469,14 +469,24 @@ append return_string "[survey_decode_boolean_answer -response $boolean_answer -question_id $question_id]" } - + + # SB: again, we need to extract the text separately for checkbox_text, radio_text and select_text widgets + switch -- $presentation_type { + "checkbox_text" - + "radio_text" - + "select_text" { + append return_string " [survey::form::get_response_text -response_id $response_id -question_id $question_id \ + -abstract_data_type $abstract_data_type]" + } + } + if $html_p { append return_string "

" } 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 @@ Answers to @survey_name@ @context;noquote@ - @description@ + @description;noquote@

@@ -19,7 +19,7 @@ Your response on @responses.pretty_submission_date@ [#survey.edit_this_response#] + href="respond?survey_id=@survey_id@&response_id=@responses.response_id@&edit_p=t">#survey.edit_this_response#] 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 \