Index: openacs-4/packages/assessment/sql/oracle/assessment-actions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-actions-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/assessment-actions-create.sql 28 Jan 2005 20:37:19 -0000 1.1 @@ -0,0 +1,94 @@ +-- Assessment Package +-- @author annyflores@viaro.net +-- @creation-date 2005-01-06 + + +------------------------------------------------ +-- table as_actions +------------------------------------------------ + + +create table as_actions( + action_id integer + constraint as_actions_pk + primary key, + name varchar(200), + description varchar(200), + tcl_code varchar(400) + constraint as_actions_tcl_code_nn not null +); + +------------------------------------------------ +-- table as_action_map +------------------------------------------------ + +create table as_action_map ( + inter_item_check_id integer, + action_id integer, + order_by integer, + user_message varchar(200), + action_perform varchar(2) +); + + +------------------------------------------------ +-- table as_action_params +------------------------------------------------ + +create table as_action_params ( + parameter_id integer + constraint as_action_params_pk + primary key, + action_id integer, + type varchar(1) not null, + varname varchar(50) not null, + description varchar(200), + query varchar(400) +); + + + +------------------------------------------------ +-- table as_param_map +------------------------------------------------ + +create table as_param_map ( + parameter_id integer, + value integer, + item_id integer, + inter_item_check_id integer +); + + + +----------------------------------------------- +-- table as_actions_log +------------------------------------------------ + +create table as_actions_log ( + action_log_id integer + constraint as_actions_log_pk + primary key, + inter_item_check_id integer not null, + action_id integer not null, + finally_executed_by integer, + date_requested date, + date_processed date, + approved_p varchar(1) not null, + failed_p varchar(1) not null, + error_txt varchar(100), + session_id integer +); + +-------------------------------------------------------- +-- SEQUENCE FOR PRIMARY KEY +-------------------------------------------------------- + + create sequence action_log_id + minvalue 1 + maxvalue 999999999 + start with 1 + increment by 1 + cache 20; + + Index: openacs-4/packages/assessment/sql/oracle/assessment-checks-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-checks-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/assessment-checks-create.sql 28 Jan 2005 20:37:19 -0000 1.1 @@ -0,0 +1,120 @@ +-- Assessment Package +-- @author annyflores@viaro.net +-- @creation-date 2005-01-06 + +begin + -- create the inter_item_check object + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'as_inter_item_check', + pretty_name => 'As_Inter_item_check', + pretty_plural => 'As_Inter_item_checks', + table_name => 'as_inter_items_checks', + id_column => 'inter_item_check_id' +); +end; +/ +show errors; + +declare + + attr_id acs_attributes.attribute_id%TYPE; + +begin + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'name', + pretty_name => 'Name', + pretty_plural => 'Names', + datatype => 'string' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'action_p', + pretty_name => 'Action_p', + pretty_plural => 'Action_p', + datatype => 'string' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'section_id_from', + pretty_name => 'From', + pretty_plural => 'from', + datatype => 'integer' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'section_id_to', + pretty_name => 'To', + pretty_plural => 'to', + datatype => 'integer' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'check_sql', + pretty_name => 'check_sql', + pretty_plural => 'check_sql', + datatype => 'string' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'description', + pretty_name => 'Description', + pretty_plural => 'descriptions', + datatype => 'string' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'postcheck_p', + pretty_name => 'postcheck_p', + pretty_plural => 'postcheck_p', + datatype => 'string' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'item_id', + pretty_name => 'item_id', + pretty_plural => 'item_id', + datatype => 'integer' + ); + attr_id := acs_attribute.create_attribute ( + object_type => 'inter_item_check', + attribute_name => 'assessment_id', + pretty_name => 'assessment_id', + pretty_plural => 'assessment_id', + datatype => 'integer' + ); + +end; +/ +show errors; + + +---------------------------------------------------------- +-- table as_inter_item_checks +---------------------------------------------------------- + +create table as_inter_item_checks ( + inter_item_check_id integer + constraint as_inter_item_checks_id_fk + references acs_objects(object_id) + on delete cascade + constraint as_inter_item_checks_pk + primary key, + action_p varchar(1) not null, + section_id_from integer not null, + section_id_to integer, + check_sql varchar(4000) + constraint as_inter_item_checks_nn not null, + name varchar(200), + description varchar(200), + postcheck_p varchar(1) not null, + item_id integer, + assessment_id integer +); + + + + + + \ No newline at end of file Index: openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql 28 Jan 2005 20:37:19 -0000 1.1 @@ -0,0 +1,88 @@ +-- Assessment Package +-- @author annyflores@viaro.net +-- @creation-date 2005-01-06 + +create or replace package as_inter_item_check +as + function new ( + inter_item_check_id in acs_objects.object_id%TYPE default null, + action_p in as_inter_item_checks.action_p%TYPE, + section_id_from in as_inter_item_checks.section_id_from%TYPE, + section_id_to in as_inter_item_checks.section_id_to%TYPE, + check_sql in as_inter_item_checks.check_sql%TYPE, + name in as_inter_item_checks.name%TYPE, + description in as_inter_item_checks.description%TYPE, + postcheck_p in as_inter_item_checks.postcheck_p%TYPE, + item_id in as_inter_item_checks.item_id%TYPE, + assessment_id in as_inter_item_checks.assessment_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + context_id in acs_objects.context_id%TYPE, + object_type in acs_objects.object_type%TYPE, + creation_date in acs_objects.creation_date%TYPE + ) return as_inter_item_checks.inter_item_check_id%TYPE; + + procedure delete ( + inter_item_check_id in as_inter_item_checks.inter_item_check_id%TYPE + ); +end as_inter_item_check; +/ +show errors; + +create or replace package body as_inter_item_check +as + function new ( + inter_item_check_id in acs_objects.object_id%TYPE default null, + action_p in as_inter_item_checks.action_p%TYPE, + section_id_from in as_inter_item_checks.section_id_from%TYPE, + section_id_to in as_inter_item_checks.section_id_to%TYPE, + check_sql in as_inter_item_checks.check_sql%TYPE, + name in as_inter_item_checks.name%TYPE, + description in as_inter_item_checks.description%TYPE, + postcheck_p in as_inter_item_checks.postcheck_p%TYPE, + item_id in as_inter_item_checks.item_id%TYPE, + assessment_id in as_inter_item_checks.assessment_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + context_id in acs_objects.context_id%TYPE, + object_type in acs_objects.object_type%TYPE, + creation_date in acs_objects.creation_date%TYPE + ) return as_inter_item_checks.inter_item_check_id%TYPE + is + v_inter_item_check_id as_inter_item_checks.inter_item_check_id%TYPE; + begin + + v_inter_item_check_id := acs_object.new ( + object_id => inter_item_check_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => null, + context_id => context_id + ); + + insert into as_inter_item_checks + (inter_item_check_id,action_p,section_id_from,section_id_to,check_sql,name,description,postcheck_p,item_id,assessment_id) + values (v_inter_item_check_id,action_p,section_id_from,section_id_to,check_sql,name,description,postcheck_p,item_id,assessment_id); + + return v_inter_item_check_id; + + end new; + + -- body for procedure delete + procedure delete ( + inter_item_check_id in as_inter_item_checks.inter_item_check_id%TYPE + ) is + begin + delete from as_actions_log where + inter_item_check_id = as_inter_item_check.delete.inter_item_check_id; + + delete from as_param_map where inter_item_check_id= as_inter_item_check.delete.inter_item_check_id; + + delete from as_action_map where inter_item_check_id = as_inter_item_check.delete.inter_item_check_id; + + delete from as_inter_item_checks where inter_item_check_id = as_inter_item_check.delete.inter_item_check_id; + acs_object.del (as_inter_item_check.delete.inter_item_check_id); + end delete; + +end as_inter_item_check; +/ +show errors; Index: openacs-4/packages/assessment/sql/oracle/assessment-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/sql/oracle/assessment-create.sql 26 Nov 2004 20:44:54 -0000 1.1 +++ openacs-4/packages/assessment/sql/oracle/assessment-create.sql 28 Jan 2005 20:37:19 -0000 1.2 @@ -10,3 +10,6 @@ @ assessment-section-create.sql @ assessment-collected-data-create.sql @ assessment-files.sql +@ assessment-checks-create.sql +@ assessment-actions-create.sql +@ assessment-checks-package-create.sql \ No newline at end of file Index: openacs-4/packages/assessment/sql/oracle/assessment-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/sql/oracle/assessment-drop.sql 5 Dec 2004 17:08:57 -0000 1.2 +++ openacs-4/packages/assessment/sql/oracle/assessment-drop.sql 28 Jan 2005 20:37:19 -0000 1.3 @@ -15,3 +15,23 @@ drop table as_assessments; drop table as_sections; drop table as_section_display_types; +drop table as_param_map; + +drop table as_action_params; +drop table as_actions_log; +drop table as_action_map; +drop table as_actions; + + +drop package as_inter_item_check; + + +declare begin + acs_object_type.drop_type (object_type => 'as_inter_item_checks'); +end; +/ +show errors; + + +drop table as_inter_item_checks; + Index: openacs-4/packages/assessment/sql/postgresql/assessment-checks-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-checks-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/sql/postgresql/assessment-checks-create.sql 24 Jan 2005 21:34:15 -0000 1.1 +++ openacs-4/packages/assessment/sql/postgresql/assessment-checks-create.sql 28 Jan 2005 20:36:56 -0000 1.2 @@ -37,13 +37,14 @@ name varchar(200), description varchar(200), postcheck_p boolean not null, - item_id integer + item_id integer, + assessment_id integer ); -create or replace function as_inter_item_check__new (integer,boolean,integer,integer,varchar,varchar,varchar,boolean,integer,integer,integer) +create or replace function as_inter_item_check__new (integer,boolean,integer,integer,varchar,varchar,varchar,boolean,integer,integer,integer,integer) returns integer as ' declare new__inter_item_check_id alias for $1; @@ -56,7 +57,8 @@ new__postcheck_p alias for $8; new__item_id alias for $9; new__creation_user alias for $10; - new__context_id alias for $11; + new__context_id alias for $11; + new__assessment_id alias for $12; v_inter_item_check_id integer; begin v_inter_item_check_id := acs_object__new ( @@ -68,8 +70,8 @@ new__context_id ); insert into as_inter_item_checks - (inter_item_check_id,action_p,section_id_from,section_id_to,check_sql,name,description,postcheck_p,item_id) - values (v_inter_item_check_id,new__action_p,new__section_id_from,new__section_id_to,new__check_sql,new__name,new__description,new__postcheck_p,new__item_id); + (inter_item_check_id,action_p,section_id_from,section_id_to,check_sql,name,description,postcheck_p,item_id,assessment_id) + values (v_inter_item_check_id,new__action_p,new__section_id_from,new__section_id_to,new__check_sql,new__name,new__description,new__postcheck_p,new__item_id,new__assessment_id); return v_inter_item_check_id; end;' language 'plpgsql'; Index: openacs-4/packages/assessment/sql/postgresql/assessment-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-create.sql,v diff -u -r1.15 -r1.16 --- openacs-4/packages/assessment/sql/postgresql/assessment-create.sql 25 Jan 2005 12:42:20 -0000 1.15 +++ openacs-4/packages/assessment/sql/postgresql/assessment-create.sql 28 Jan 2005 20:36:56 -0000 1.16 @@ -3,7 +3,7 @@ -- -- @author eperez@it.uc3m.es -- @creation-date 2004-07-20 --- +-- @modified by annyflores@viaro.net on 2005-01-07 \i assessment-item-type-create.sql \i assessment-item-create.sql @@ -12,3 +12,4 @@ \i assessment-types-create.sql \i assessment-checks-create.sql \i assessment-actions-create.sql + Index: openacs-4/packages/assessment/sql/postgresql/assessment-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-drop.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/sql/postgresql/assessment-drop.sql 5 Dec 2004 17:08:57 -0000 1.4 +++ openacs-4/packages/assessment/sql/postgresql/assessment-drop.sql 28 Jan 2005 20:36:56 -0000 1.5 @@ -15,3 +15,43 @@ drop table as_assessments; drop table as_sections; drop table as_section_display_types; +drop table as_param_map; +drop table as_action_params; +drop table as_actions_log; +drop table as_action_map; +drop table as_actions; + +-- drop functions + +drop function as_inter_item_check__new (integer,boolean,integer,integer,varchar,varchar,varchar,boolean,integer,integer,integer,integer); + +drop function as_inter_item_check__delete (integer); + +create function inline_0() +returns integer as ' +declare + object_rec record; +begin + + -- drop objects + for object_rec in select object_id from acs_objects where object_type = ''as_inter_item_check'' + loop + PERFORM acs_object__delete ( object_rec.object_id ); + end loop; + + return 0; +end;' language 'plpgsql'; + +select inline_0(); + +drop function inline_0(); + +-- drop type + +select acs_object_type__drop_type ( + 'as_inter_item_check', + 't' + ); + +drop table as_inter_item_checks; +