Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-content-types-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,165 @@ +-- @author Lars Pind (lars@collaboraid.biz) +-- @creation-date 2003-10-14 +-- @cvs-id $Id: simulation-content-types-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +---------------------------------------------------------------------- +-- drop everything in reverse order of creation +---------------------------------------------------------------------- +-- have to manually drop attributes because content_type__drop_type doesn't +-- bad, stupid content_type__drop_type + +---------------------------------------------------------------------- +-- sim_case +---------------------------------------------------------------------- + +select content_type__drop_type( + 'sim_case', + 't', + 't' +); + +---------------------------------------------------------------------- +-- sim_location +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'sim_location', -- target_type + 'is_located_in' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'thumbnail' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'sim_stylesheet', -- target_type + 'stylesheet' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'image' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'letterhead' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'logo' -- relation_tag +); + +select content_type__drop_type( + 'sim_location', + 't', + 't' +); + + +---------------------------------------------------------------------- +-- sim_message +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_message', -- content_type + 'sim_prop', -- target_type + 'attachment' -- relation_tag +); + +select content_type__drop_type( + 'sim_message', + 't', + 't' +); + + + +---------------------------------------------------------------------- +-- sim_prop +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_prop', -- content_type + 'image', -- target_type + 'thumbnail' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_prop', -- content_type + 'sim_stylesheet', -- target_type + 'stylesheet' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_prop', -- content_type + 'image', -- target_type + 'image' -- relation_tag +); + +select content_type__drop_type( + 'sim_prop', + 't', + 't' +); + + +---------------------------------------------------------------------- +-- sim_character +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'sim_location', -- target_type + 'resides_at' -- relation_tag +); + + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'sim_location', -- target_type + 'works_for' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'image', -- target_type + 'thumbnail' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'sim_stylesheet', -- target_type + 'stylesheet' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'image', -- target_type + 'image' -- relation_tag +); + +select content_type__drop_type( + 'sim_character', + 't', + 't' +); + +---------------------------------------------------------------------- +-- sim_stylesheet +---------------------------------------------------------------------- + +select content_type__drop_type( + 'sim_stylesheet', + 't', + 't' + +); Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-drop.sql,v diff -u -r1.17 -r1.18 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-drop.sql 18 Dec 2003 16:12:17 -0000 1.17 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-drop.sql 19 Dec 2003 10:23:11 -0000 1.18 @@ -2,223 +2,7 @@ -- @creation-date 2003-10-12 -- @cvs-id $Id$ ---drop independent tables -drop table sim_party_sim_map; -drop table sim_tasks; -drop table sim_role_party_map; -drop table sim_roles; -select acs_object_type__drop_type( - 'simulation', - 't' - ); -drop table sim_simulations; - --- drop content_types -create function inline_0 () returns integer as ' -declare - row record; -begin - for row in select folder_id - from cr_folders - where package_id in (select package_id - from apm_packages - where package_key = ''simulation'') loop - perform content_folder__unregister_content_type(v_id, ''sim_characters'',''t''); - end loop; - return 0; -end;' language 'plpgsql'; -select inline_0(); -drop function inline_0 (); - - - ----------------------------------------------------------------------- --- drop everything in reverse order of creation ----------------------------------------------------------------------- --- have to manually drop attributes because content_type__drop_type doesn't --- bad, stupid content_type__drop_type - ----------------------------------------------------------------------- --- sim_case ----------------------------------------------------------------------- - -select content_type__drop_type( - 'sim_case', - 't', - 't' -); - ----------------------------------------------------------------------- --- sim_location ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'sim_location', -- target_type - 'is_located_in' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'thumbnail' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'sim_stylesheet', -- target_type - 'stylesheet' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'image' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'letterhead' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'logo' -- relation_tag -); - -select content_type__drop_type( - 'sim_location', - 't', - 't' -); - - ----------------------------------------------------------------------- --- sim_message ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_message', -- content_type - 'sim_prop', -- target_type - 'attachment' -- relation_tag -); - -select content_type__drop_type( - 'sim_message', - 't', - 't' -); - - - ----------------------------------------------------------------------- --- sim_prop ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_prop', -- content_type - 'image', -- target_type - 'thumbnail' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_prop', -- content_type - 'sim_stylesheet', -- target_type - 'stylesheet' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_prop', -- content_type - 'image', -- target_type - 'image' -- relation_tag -); - -select content_type__drop_type( - 'sim_prop', - 't', - 't' -); - - ----------------------------------------------------------------------- --- sim_character ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'sim_location', -- target_type - 'resides_at' -- relation_tag -); - - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'sim_location', -- target_type - 'works_for' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'image', -- target_type - 'thumbnail' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'sim_stylesheet', -- target_type - 'stylesheet' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'image', -- target_type - 'image' -- relation_tag -); - -select content_type__drop_type( - 'sim_character', - 't', - 't' -); - ----------------------------------------------------------------------- --- sim_stylesheet ----------------------------------------------------------------------- - -select content_type__drop_type( - 'sim_stylesheet', - 't', - 't' - -); - - ----------------------------------------------------------------------- --- privileges ----------------------------------------------------------------------- - -create function inline_0 () -returns integer as ' -begin - perform acs_privilege__remove_child(''sim_admin'',''sim_template_create''); - perform acs_privilege__remove_child(''sim_admin'',''sim_inst''); - perform acs_privilege__remove_child(''sim_admin'',''sim_object_writer''); - perform acs_privilege__remove_child(''sim_admin'',''sim_set_map_p''); - perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_create''); - perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_write''); - perform acs_privilege__remove_child(''admin'',''sim_admin''); - - perform acs_privilege__drop_privilege(''sim_object_write''); - perform acs_privilege__drop_privilege(''sim_object_create''); - perform acs_privilege__drop_privilege(''sim_object_writer''); - perform acs_privilege__drop_privilege(''sim_set_map_p''); - perform acs_privilege__drop_privilege(''sim_template_create''); - perform acs_privilege__drop_privilege(''sim_inst''); - perform acs_privilege__drop_privilege(''sim_admin''); - return null; -end;' language 'plpgsql'; - -select inline_0(); -drop function inline_0 (); +\i simulation-tables-drop.sql +\i simulation-content-types-drop.sql +\i simulation-privs-drop.sql +\i simulation-packages-drop.sql Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-packages-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-create.sql 14 Oct 2003 13:58:03 -0000 1.1 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-create.sql 19 Dec 2003 10:23:11 -0000 1.2 @@ -2,3 +2,58 @@ -- @creation-date 2003-10-12 -- @cvs-id $Id$ +select define_function_args('sim_case__new','sim_case_id,label,package_id,object_type;sim_case,creation_user,creation_ip,context_id'); + +create function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer) +returns integer as ' +declare + p_sim_case_id alias for $1; + p_label alias for $2; + p_package_id alias for $3; + p_object_type alias for $4; + p_creation_user alias for $5; + p_creation_ip alias for $6; + p_context_id alias for $7; + + v_sim_case_id integer; +begin + v_sim_case_id:= acs_object__new( + p_sim_case_id, + ''sim_case'', + now(), + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert into sim_cases + (sim_case_id, label , package_id) + values + (v_sim_case_id, p_label, p_package_id); + + return v_sim_case_id; +end; +' language 'plpgsql'; + +select define_function_args('sim_case__name','sim_case_id'); + +create function sim_case__name(integer) +returns varchar as ' +declare + p_sim_case_id_id alias for $1; +begin + return label from sim_cases where sim_case_id = p_sim_case_id; +end; +' language 'plpgsql'; + +select define_function_args('sim_case__delete','sim_case_id'); + +create function sim_case__delete(integer) +returns integer as ' +declare + p_sim_case_id alias for $1; +begin + perform acs_object__delete(p_sim_case_id); + return 0; +end; +' language 'plpgsql'; Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-packages-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,7 @@ +-- @author peter@collaboraid.biz +-- @creation-date 2003-12-19 +-- @cvs-id $Id: simulation-packages-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +drop function sim_case__delete(integer); +drop function sim_case__name(integer); +drop function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer); Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-privs-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-privs-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-privs-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,31 @@ +-- @author joel@collaboraid.net +-- @creation-date 2003-10-12 +-- @cvs-id $Id: simulation-privs-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +---------------------------------------------------------------------- +-- privileges +---------------------------------------------------------------------- + +create function inline_0 () +returns integer as ' +begin + perform acs_privilege__remove_child(''sim_admin'',''sim_template_create''); + perform acs_privilege__remove_child(''sim_admin'',''sim_inst''); + perform acs_privilege__remove_child(''sim_admin'',''sim_object_writer''); + perform acs_privilege__remove_child(''sim_admin'',''sim_set_map_p''); + perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_create''); + perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_write''); + perform acs_privilege__remove_child(''admin'',''sim_admin''); + + perform acs_privilege__drop_privilege(''sim_object_write''); + perform acs_privilege__drop_privilege(''sim_object_create''); + perform acs_privilege__drop_privilege(''sim_object_writer''); + perform acs_privilege__drop_privilege(''sim_set_map_p''); + perform acs_privilege__drop_privilege(''sim_template_create''); + perform acs_privilege__drop_privilege(''sim_inst''); + perform acs_privilege__drop_privilege(''sim_admin''); + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0 (); Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-tables-create.sql,v diff -u -r1.18 -r1.19 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 19 Dec 2003 09:24:27 -0000 1.18 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 19 Dec 2003 10:23:11 -0000 1.19 @@ -163,18 +163,20 @@ null, -- package_name 'f', -- abstract_p null, -- type_extension_table - 'acs_object__name' -- name_method + 'sim_case__name' -- name_method ); create table sim_cases ( - sim_case_id integer constraint sim_case_fk + sim_case_id integer constraint sim_case_sci_fk references acs_objects + on delete cascade constraint sim_case_pk primary key, - workflow_id integer constraint sim_case_workflow_fk - references workflows, - sort_order integer, - constraint sim_case_workflow_sort_order_un unique (workflow_id, sort_order) + label varchar(200), + package_id integer constraint sim_case_pid_fk + references apm_packages(package_id) + constraint sim_case_pid_nn + not null ); comment on table sim_cases is 'The object behind a simulation case.'; Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-tables-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,31 @@ +-- @author joel@collaboraid.net +-- @creation-date 2003-10-12 +-- @cvs-id $Id: simulation-tables-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +--drop independent tables +drop table sim_party_sim_map; +drop table sim_tasks; +drop table sim_role_party_map; +drop table sim_roles; +select acs_object_type__drop_type( + 'simulation', + 't' + ); +drop table sim_simulations; + +-- drop content_types +create function inline_0 () returns integer as ' +declare + row record; +begin + for row in select folder_id + from cr_folders + where package_id in (select package_id + from apm_packages + where package_key = ''simulation'') loop + perform content_folder__unregister_content_type(row.folder_id, ''sim_characters'',''t''); + end loop; + return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0 (); Index: openacs-4/packages/simulation/sql/postgresql/simulation-content-types-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-content-types-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/sql/postgresql/simulation-content-types-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,165 @@ +-- @author Lars Pind (lars@collaboraid.biz) +-- @creation-date 2003-10-14 +-- @cvs-id $Id: simulation-content-types-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +---------------------------------------------------------------------- +-- drop everything in reverse order of creation +---------------------------------------------------------------------- +-- have to manually drop attributes because content_type__drop_type doesn't +-- bad, stupid content_type__drop_type + +---------------------------------------------------------------------- +-- sim_case +---------------------------------------------------------------------- + +select content_type__drop_type( + 'sim_case', + 't', + 't' +); + +---------------------------------------------------------------------- +-- sim_location +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'sim_location', -- target_type + 'is_located_in' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'thumbnail' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'sim_stylesheet', -- target_type + 'stylesheet' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'image' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'letterhead' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_location', -- content_type + 'image', -- target_type + 'logo' -- relation_tag +); + +select content_type__drop_type( + 'sim_location', + 't', + 't' +); + + +---------------------------------------------------------------------- +-- sim_message +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_message', -- content_type + 'sim_prop', -- target_type + 'attachment' -- relation_tag +); + +select content_type__drop_type( + 'sim_message', + 't', + 't' +); + + + +---------------------------------------------------------------------- +-- sim_prop +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_prop', -- content_type + 'image', -- target_type + 'thumbnail' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_prop', -- content_type + 'sim_stylesheet', -- target_type + 'stylesheet' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_prop', -- content_type + 'image', -- target_type + 'image' -- relation_tag +); + +select content_type__drop_type( + 'sim_prop', + 't', + 't' +); + + +---------------------------------------------------------------------- +-- sim_character +---------------------------------------------------------------------- + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'sim_location', -- target_type + 'resides_at' -- relation_tag +); + + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'sim_location', -- target_type + 'works_for' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'image', -- target_type + 'thumbnail' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'sim_stylesheet', -- target_type + 'stylesheet' -- relation_tag +); + +select content_type__unregister_relation_type ( + 'sim_character', -- content_type + 'image', -- target_type + 'image' -- relation_tag +); + +select content_type__drop_type( + 'sim_character', + 't', + 't' +); + +---------------------------------------------------------------------- +-- sim_stylesheet +---------------------------------------------------------------------- + +select content_type__drop_type( + 'sim_stylesheet', + 't', + 't' + +); Index: openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql 18 Dec 2003 16:12:17 -0000 1.17 +++ openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql 19 Dec 2003 10:23:11 -0000 1.18 @@ -2,223 +2,7 @@ -- @creation-date 2003-10-12 -- @cvs-id $Id$ ---drop independent tables -drop table sim_party_sim_map; -drop table sim_tasks; -drop table sim_role_party_map; -drop table sim_roles; -select acs_object_type__drop_type( - 'simulation', - 't' - ); -drop table sim_simulations; - --- drop content_types -create function inline_0 () returns integer as ' -declare - row record; -begin - for row in select folder_id - from cr_folders - where package_id in (select package_id - from apm_packages - where package_key = ''simulation'') loop - perform content_folder__unregister_content_type(v_id, ''sim_characters'',''t''); - end loop; - return 0; -end;' language 'plpgsql'; -select inline_0(); -drop function inline_0 (); - - - ----------------------------------------------------------------------- --- drop everything in reverse order of creation ----------------------------------------------------------------------- --- have to manually drop attributes because content_type__drop_type doesn't --- bad, stupid content_type__drop_type - ----------------------------------------------------------------------- --- sim_case ----------------------------------------------------------------------- - -select content_type__drop_type( - 'sim_case', - 't', - 't' -); - ----------------------------------------------------------------------- --- sim_location ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'sim_location', -- target_type - 'is_located_in' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'thumbnail' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'sim_stylesheet', -- target_type - 'stylesheet' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'image' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'letterhead' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_location', -- content_type - 'image', -- target_type - 'logo' -- relation_tag -); - -select content_type__drop_type( - 'sim_location', - 't', - 't' -); - - ----------------------------------------------------------------------- --- sim_message ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_message', -- content_type - 'sim_prop', -- target_type - 'attachment' -- relation_tag -); - -select content_type__drop_type( - 'sim_message', - 't', - 't' -); - - - ----------------------------------------------------------------------- --- sim_prop ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_prop', -- content_type - 'image', -- target_type - 'thumbnail' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_prop', -- content_type - 'sim_stylesheet', -- target_type - 'stylesheet' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_prop', -- content_type - 'image', -- target_type - 'image' -- relation_tag -); - -select content_type__drop_type( - 'sim_prop', - 't', - 't' -); - - ----------------------------------------------------------------------- --- sim_character ----------------------------------------------------------------------- - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'sim_location', -- target_type - 'resides_at' -- relation_tag -); - - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'sim_location', -- target_type - 'works_for' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'image', -- target_type - 'thumbnail' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'sim_stylesheet', -- target_type - 'stylesheet' -- relation_tag -); - -select content_type__unregister_relation_type ( - 'sim_character', -- content_type - 'image', -- target_type - 'image' -- relation_tag -); - -select content_type__drop_type( - 'sim_character', - 't', - 't' -); - ----------------------------------------------------------------------- --- sim_stylesheet ----------------------------------------------------------------------- - -select content_type__drop_type( - 'sim_stylesheet', - 't', - 't' - -); - - ----------------------------------------------------------------------- --- privileges ----------------------------------------------------------------------- - -create function inline_0 () -returns integer as ' -begin - perform acs_privilege__remove_child(''sim_admin'',''sim_template_create''); - perform acs_privilege__remove_child(''sim_admin'',''sim_inst''); - perform acs_privilege__remove_child(''sim_admin'',''sim_object_writer''); - perform acs_privilege__remove_child(''sim_admin'',''sim_set_map_p''); - perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_create''); - perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_write''); - perform acs_privilege__remove_child(''admin'',''sim_admin''); - - perform acs_privilege__drop_privilege(''sim_object_write''); - perform acs_privilege__drop_privilege(''sim_object_create''); - perform acs_privilege__drop_privilege(''sim_object_writer''); - perform acs_privilege__drop_privilege(''sim_set_map_p''); - perform acs_privilege__drop_privilege(''sim_template_create''); - perform acs_privilege__drop_privilege(''sim_inst''); - perform acs_privilege__drop_privilege(''sim_admin''); - return null; -end;' language 'plpgsql'; - -select inline_0(); -drop function inline_0 (); +\i simulation-tables-drop.sql +\i simulation-content-types-drop.sql +\i simulation-privs-drop.sql +\i simulation-packages-drop.sql Index: openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql 14 Oct 2003 13:58:03 -0000 1.1 +++ openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql 19 Dec 2003 10:23:11 -0000 1.2 @@ -2,3 +2,58 @@ -- @creation-date 2003-10-12 -- @cvs-id $Id$ +select define_function_args('sim_case__new','sim_case_id,label,package_id,object_type;sim_case,creation_user,creation_ip,context_id'); + +create function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer) +returns integer as ' +declare + p_sim_case_id alias for $1; + p_label alias for $2; + p_package_id alias for $3; + p_object_type alias for $4; + p_creation_user alias for $5; + p_creation_ip alias for $6; + p_context_id alias for $7; + + v_sim_case_id integer; +begin + v_sim_case_id:= acs_object__new( + p_sim_case_id, + ''sim_case'', + now(), + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert into sim_cases + (sim_case_id, label , package_id) + values + (v_sim_case_id, p_label, p_package_id); + + return v_sim_case_id; +end; +' language 'plpgsql'; + +select define_function_args('sim_case__name','sim_case_id'); + +create function sim_case__name(integer) +returns varchar as ' +declare + p_sim_case_id_id alias for $1; +begin + return label from sim_cases where sim_case_id = p_sim_case_id; +end; +' language 'plpgsql'; + +select define_function_args('sim_case__delete','sim_case_id'); + +create function sim_case__delete(integer) +returns integer as ' +declare + p_sim_case_id alias for $1; +begin + perform acs_object__delete(p_sim_case_id); + return 0; +end; +' language 'plpgsql'; Index: openacs-4/packages/simulation/sql/postgresql/simulation-packages-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-packages-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/sql/postgresql/simulation-packages-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,7 @@ +-- @author peter@collaboraid.biz +-- @creation-date 2003-12-19 +-- @cvs-id $Id: simulation-packages-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +drop function sim_case__delete(integer); +drop function sim_case__name(integer); +drop function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer); Index: openacs-4/packages/simulation/sql/postgresql/simulation-privs-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-privs-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/sql/postgresql/simulation-privs-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,31 @@ +-- @author joel@collaboraid.net +-- @creation-date 2003-10-12 +-- @cvs-id $Id: simulation-privs-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +---------------------------------------------------------------------- +-- privileges +---------------------------------------------------------------------- + +create function inline_0 () +returns integer as ' +begin + perform acs_privilege__remove_child(''sim_admin'',''sim_template_create''); + perform acs_privilege__remove_child(''sim_admin'',''sim_inst''); + perform acs_privilege__remove_child(''sim_admin'',''sim_object_writer''); + perform acs_privilege__remove_child(''sim_admin'',''sim_set_map_p''); + perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_create''); + perform acs_privilege__remove_child(''sim_object_writer'',''sim_object_write''); + perform acs_privilege__remove_child(''admin'',''sim_admin''); + + perform acs_privilege__drop_privilege(''sim_object_write''); + perform acs_privilege__drop_privilege(''sim_object_create''); + perform acs_privilege__drop_privilege(''sim_object_writer''); + perform acs_privilege__drop_privilege(''sim_set_map_p''); + perform acs_privilege__drop_privilege(''sim_template_create''); + perform acs_privilege__drop_privilege(''sim_inst''); + perform acs_privilege__drop_privilege(''sim_admin''); + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0 (); Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 19 Dec 2003 09:24:27 -0000 1.18 +++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 19 Dec 2003 10:23:11 -0000 1.19 @@ -163,18 +163,20 @@ null, -- package_name 'f', -- abstract_p null, -- type_extension_table - 'acs_object__name' -- name_method + 'sim_case__name' -- name_method ); create table sim_cases ( - sim_case_id integer constraint sim_case_fk + sim_case_id integer constraint sim_case_sci_fk references acs_objects + on delete cascade constraint sim_case_pk primary key, - workflow_id integer constraint sim_case_workflow_fk - references workflows, - sort_order integer, - constraint sim_case_workflow_sort_order_un unique (workflow_id, sort_order) + label varchar(200), + package_id integer constraint sim_case_pid_fk + references apm_packages(package_id) + constraint sim_case_pid_nn + not null ); comment on table sim_cases is 'The object behind a simulation case.'; Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql 19 Dec 2003 10:23:11 -0000 1.1 @@ -0,0 +1,31 @@ +-- @author joel@collaboraid.net +-- @creation-date 2003-10-12 +-- @cvs-id $Id: simulation-tables-drop.sql,v 1.1 2003/12/19 10:23:11 peterm Exp $ + +--drop independent tables +drop table sim_party_sim_map; +drop table sim_tasks; +drop table sim_role_party_map; +drop table sim_roles; +select acs_object_type__drop_type( + 'simulation', + 't' + ); +drop table sim_simulations; + +-- drop content_types +create function inline_0 () returns integer as ' +declare + row record; +begin + for row in select folder_id + from cr_folders + where package_id in (select package_id + from apm_packages + where package_key = ''simulation'') loop + perform content_folder__unregister_content_type(row.folder_id, ''sim_characters'',''t''); + end loop; + return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0 ();