Index: openacs-4/packages/survey/tcl/survey-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/tcl/survey-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/tcl/survey-procs-postgresql.xql 15 Sep 2002 23:56:54 -0000 1.1 +++ openacs-4/packages/survey/tcl/survey-procs-postgresql.xql 25 Sep 2002 00:43:40 -0000 1.2 @@ -30,4 +30,19 @@ + + + select r.initial_response_id, r.responding_user_id, r.response_id, + u.first_names || ' ' || u.last_name as user_name, + edit_p, + o.creation_date as response_date + from (select survey_response__initial_user_id(response_id) as responding_user_id, + survey_response__initial_response_id(response_id) as initial_response_id, + response_id, (case when initial_response_id is NULL then 'f' else 't' end) as edit_p + from survey_responses) r, acs_objects o, + cc_users u where r.response_id=:response_id + and r.responding_user_id = u.user_id + and r.response_id = o.object_id + + \ No newline at end of file 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.1 -r1.2 --- openacs-4/packages/survey/tcl/survey-procs.tcl 15 Sep 2002 23:56:54 -0000 1.1 +++ openacs-4/packages/survey/tcl/survey-procs.tcl 25 Sep 2002 00:43:40 -0000 1.2 @@ -35,6 +35,11 @@ db_1row get_info_by_survey_id "" -column_array survey_info + if {![info exists survey_info(survey_id)]} { + # survey doesn't exist, caller has to handle this in their + # own way + return + } # If it's a single-section survey, look up the section_id if {[empty_string_p $section_id] && $survey_info(single_section_p) == "t"} { db_1row lookup_single_section_id "" @@ -405,19 +410,7 @@ set community_name [dotlrn_community::get_community_name $community_id] set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]" } - db_1row get_response_info { - select r.initial_response_id, r.responding_user_id, r.response_id, - u.first_names || ' ' || u.last_name as user_name, - edit_p, - o.creation_date as response_date - from (select survey_response.initial_user_id(response_id) as responding_user_id, - survey_response.initial_response_id(response_id) as initial_response_id, - response_id, (case when initial_response_id is NULL then 'f' else 't' end) as edit_p - from survey_responses) r, acs_objects o, - cc_users u where r.response_id=:response_id - and r.responding_user_id = u.user_id - and r.response_id = o.object_id - } + db_1row get_response_info {} set notif_text "" if {$dotlrn_installed_p} { Index: openacs-4/packages/survey/www/process-response-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/process-response-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/www/process-response-oracle.xql 16 Sep 2002 00:00:23 -0000 1.1 +++ openacs-4/packages/survey/www/process-response-oracle.xql 25 Sep 2002 00:43:42 -0000 1.2 @@ -46,19 +46,4 @@ - - - - - begin - :1 := acs_rel.new ( - rel_type => 'user_blob_response_rel', - object_id_one => :user_id, - object_id_two => :item_id); - end; - - - - - Index: openacs-4/packages/survey/www/process-response.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/process-response.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/www/process-response.xql 16 Sep 2002 00:00:23 -0000 1.1 +++ openacs-4/packages/survey/www/process-response.xql 25 Sep 2002 00:43:42 -0000 1.2 @@ -98,27 +98,7 @@ - - - select variable_name, sum(score) as sum_of_scores - from survey_choice_scores, survey_question_responses, survey_variables - where survey_choice_scores.choice_id = survey_question_responses.choice_id - and survey_choice_scores.variable_id = survey_variables.variable_id - and survey_question_responses.response_id = :response_id - group by variable_name - - - - - - select logic from survey_logic, survey_logic_surveys_map - where survey_logic.logic_id = survey_logic_surveys_map.logic_id - and section_id = :section_id - - - - insert into survey_question_responses Index: openacs-4/packages/survey/www/admin/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/one.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/survey/www/admin/one.tcl 16 Sep 2002 10:28:14 -0000 1.3 +++ openacs-4/packages/survey/www/admin/one.tcl 25 Sep 2002 00:43:42 -0000 1.4 @@ -21,7 +21,10 @@ # Get the survey information. get_survey_info -survey_id $survey_id - +if {![info exists survey_info(survey_id)]} { + ad_return_complaint 1 "Requested survey does not exist" + ad_script_abort +} # get users and # who responded etc... if {[apm_package_installed_p dotlrn]} { set community_id [dotlrn_community::get_community_id_from_url] Index: openacs-4/packages/survey/www/admin/question-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/question-add-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/www/admin/question-add-2.tcl 16 Sep 2002 00:00:24 -0000 1.1 +++ openacs-4/packages/survey/www/admin/question-add-2.tcl 25 Sep 2002 00:43:42 -0000 1.2 @@ -34,6 +34,12 @@ set question_id [db_nextval acs_object_id_seq] get_survey_info -section_id $section_id + +if {![info exists survey_info(survey_id)]} { + ad_return_complaint 1 "Requested survey does not exist" + ad_script_abort +} + set survey_id $survey_info(survey_id) set type $survey_info(type) Index: openacs-4/packages/survey/www/admin/question-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/question-add-3.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/survey/www/admin/question-add-3.tcl 24 Sep 2002 02:22:25 -0000 1.3 +++ openacs-4/packages/survey/www/admin/question-add-3.tcl 25 Sep 2002 00:43:42 -0000 1.4 @@ -42,6 +42,12 @@ set user_id [ad_get_user_id] ad_require_permission $package_id survey_create_question get_survey_info -section_id $section_id + +if {![info exists survey_info(survey_id)]} { + ad_return_complaint 1 "Requested survey does not exist" + ad_script_abort +} + set survey_id $survey_info(survey_id) set exception_count 0 set exception_text "" Index: openacs-4/packages/survey/www/admin/survey-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/survey-create.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/survey/www/admin/survey-create.tcl 18 Sep 2002 12:15:21 -0000 1.3 +++ openacs-4/packages/survey/www/admin/survey-create.tcl 25 Sep 2002 00:43:42 -0000 1.4 @@ -45,6 +45,8 @@ } {description {[string length $description] <= 4000} "Survey Name must be 4000 characters or less" } + {survey_id {[db_string count_surveys "select count(survey_id) from surveys where survey_id=:survey_id"] < 1} "oops" + } } -new_data {