Index: openacs-4/packages/simple-survey/sql/oracle/simple-survey-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simple-survey/sql/oracle/simple-survey-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simple-survey/sql/oracle/simple-survey-create.sql 15 Mar 2002 05:26:42 -0000 1.3 +++ openacs-4/packages/simple-survey/sql/oracle/simple-survey-create.sql 16 Apr 2002 14:37:29 -0000 1.4 @@ -173,7 +173,6 @@ check(presentation_alignment in ('below','beside')) ); - -- for when a question has a fixed set of responses create sequence survsimp_choice_id_sequence start with 1; @@ -212,7 +211,6 @@ check(notify_on_comment_p in ('t','f')) ); - -- mbryzek: 3/27/2000 -- Sometimes you release a survey, and then later decide that -- you only want to include one response per user. The following @@ -257,16 +255,13 @@ attachment_file_extension varchar(50) -- e.g., "jpg" ); - -- We create a view that selects out only the last response from each -- user to give us at most 1 response from all users. create or replace view survsimp_question_responses_un as select qr.* from survsimp_question_responses qr, survsimp_responses_unique r where qr.response_id=r.response_id; - - -- sequence for variable names create sequence survsimp_variable_id_sequence start with 1; @@ -303,7 +298,6 @@ survey_id not null references survsimp_surveys ); - create index survsimp_response_index on survsimp_question_responses (response_id, question_id); -- We create a view that selects out only the last response from each @@ -313,247 +307,4 @@ -- from survsimp_question_responses qr, survsimp_responses_unique r -- where qr.response_id=r.response_id; --- --- constructor function for a survsimp_survey --- - -create or replace package survsimp_survey -as - function new ( - survey_id in survsimp_surveys.survey_id%TYPE default null, - name in survsimp_surveys.name%TYPE, - short_name in survsimp_surveys.short_name%TYPE, - description in survsimp_surveys.description%TYPE, - description_html_p in survsimp_surveys.description_html_p%TYPE default 'f', - single_response_p in survsimp_surveys.single_response_p%TYPE default 'f', - single_editable_p in survsimp_surveys.single_editable_p%TYPE default 't', - enabled_p in survsimp_surveys.enabled_p%TYPE default 'f', - type in survsimp_surveys.type%TYPE default 'general', - display_type in survsimp_surveys.display_type%TYPE - default 'list', - package_id in survsimp_surveys.package_id%TYPE, - object_type in acs_objects.object_type%TYPE default 'survsimp_survey', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE; - - procedure delete ( - survey_id in survsimp_surveys.survey_id%TYPE - ); -end survsimp_survey; -/ -show errors - -create or replace package body survsimp_survey -as - function new ( - survey_id in survsimp_surveys.survey_id%TYPE default null, - name in survsimp_surveys.name%TYPE, - short_name in survsimp_surveys.short_name%TYPE, - description in survsimp_surveys.description%TYPE, - description_html_p in survsimp_surveys.description_html_p%TYPE default 'f', - single_response_p in survsimp_surveys.single_response_p%TYPE default 'f', - single_editable_p in survsimp_surveys.single_editable_p%TYPE default 't', - enabled_p in survsimp_surveys.enabled_p%TYPE default 'f', - type in survsimp_surveys.type%TYPE default 'general', - display_type in survsimp_surveys.display_type%TYPE - default 'list', - package_id in survsimp_surveys.package_id%TYPE, - object_type in acs_objects.object_type%TYPE default 'survsimp_survey', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE - is - v_survey_id survsimp_surveys.survey_id%TYPE; - begin - v_survey_id := acs_object.new ( - object_id => survey_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); - insert into survsimp_surveys - (survey_id, name, short_name, description, description_html_p, - single_response_p, single_editable_p, enabled_p, type, display_type, package_id) - values - (v_survey_id, new.name, new.short_name, new.description, new.description_html_p, - new.single_response_p, new.single_editable_p, new.enabled_p, new.type, new.display_type, new.package_id); - - return v_survey_id; - end new; - - procedure delete ( - survey_id survsimp_surveys.survey_id%TYPE - ) - is - begin - delete from survsimp_surveys - where survey_id = survsimp_survey.delete.survey_id; - acs_object.delete(survey_id); - end delete; -end survsimp_survey; -/ -show errors - --- --- constructor for a survsimp_question --- -create or replace package survsimp_question -as - function new ( - question_id in survsimp_questions.question_id%TYPE default null, - survey_id in survsimp_questions.survey_id%TYPE default null, - sort_key in survsimp_questions.sort_key%TYPE default null, - question_text in survsimp_questions.question_text%TYPE default null, - abstract_data_type in survsimp_questions.abstract_data_type%TYPE default null, - required_p in survsimp_questions.required_p%TYPE default 't', - active_p in survsimp_questions.active_p%TYPE default 't', - presentation_type in survsimp_questions.presentation_type%TYPE default null, - presentation_options in survsimp_questions.presentation_options%TYPE default null, - presentation_alignment in survsimp_questions.presentation_alignment%TYPE default 'below', - object_type in acs_objects.object_type%TYPE default 'survsimp_question', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE; - - procedure delete ( - question_id in survsimp_questions.question_id%TYPE - ); -end survsimp_question; -/ -show errors - -create or replace package body survsimp_question -as - function new ( - question_id in survsimp_questions.question_id%TYPE default null, - survey_id in survsimp_questions.survey_id%TYPE default null, - sort_key in survsimp_questions.sort_key%TYPE default null, - question_text in survsimp_questions.question_text%TYPE default null, - abstract_data_type in survsimp_questions.abstract_data_type%TYPE default null, - required_p in survsimp_questions.required_p%TYPE default 't', - active_p in survsimp_questions.active_p%TYPE default 't', - presentation_type in survsimp_questions.presentation_type%TYPE default null, - presentation_options in survsimp_questions.presentation_options%TYPE default null, - presentation_alignment in survsimp_questions.presentation_alignment%TYPE default 'below', - object_type in acs_objects.object_type%TYPE default 'survsimp_question', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE - is - v_question_id survsimp_questions.question_id%TYPE; - begin - v_question_id := acs_object.new ( - object_id => question_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => survey_id - ); - insert into survsimp_questions - (question_id, survey_id, sort_key, question_text, abstract_data_type, - required_p, active_p, presentation_type, presentation_options, - presentation_alignment) - values - (v_question_id, new.survey_id, new.sort_key, new.question_text, new.abstract_data_type, - new.required_p, new.active_p, new.presentation_type, new.presentation_options, - new.presentation_alignment); - return v_question_id; - end new; - - procedure delete ( - question_id in survsimp_questions.question_id%TYPE - ) - is - begin - delete from survsimp_questions - where question_id = survsimp_question.delete.question_id; - acs_object.delete(question_id); - end delete; -end survsimp_question; -/ -show errors - --- --- constructor for a survsimp_response --- -create or replace package survsimp_response -as - function new ( - response_id in survsimp_responses.response_id %TYPE default null, - survey_id in survsimp_responses.survey_id%TYPE default null, - title in survsimp_responses.title%TYPE default null, - notify_on_comment_p in survsimp_responses.notify_on_comment_p%TYPE default 'f', - object_type in acs_objects.object_type%TYPE default 'survsimp_response', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE; - - procedure delete ( - response_id in survsimp_responses.response_id%TYPE - ); -end survsimp_response; -/ -show errors - -create or replace package body survsimp_response -as - function new ( - response_id in survsimp_responses.response_id %TYPE default null, - survey_id in survsimp_responses.survey_id%TYPE default null, - title in survsimp_responses.title%TYPE default null, - notify_on_comment_p in survsimp_responses.notify_on_comment_p%TYPE default 'f', - object_type in acs_objects.object_type%TYPE default 'survsimp_response', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE - is - v_response_id survsimp_responses.response_id%TYPE; - begin - v_response_id := acs_object.new ( - object_id => response_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); - insert into survsimp_responses (response_id, survey_id, title, notify_on_comment_p) - values - (v_response_id, new.survey_id, new.title, new.notify_on_comment_p); - return v_response_id; - end new; - - procedure delete ( - response_id in survsimp_responses.response_id%TYPE - ) - is - begin - delete from survsimp_responses - where response_id = survsimp_response.delete.response_id; - acs_object.delete(response_id); - end delete; -end survsimp_response; -/ -show errors - - - - - - +@@ simple-survey-package-create.sql