Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql 1 Jul 2004 16:33:38 -0000 1.17 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql 6 Jan 2005 14:58:27 -0000 1.18 @@ -13,7 +13,6 @@ create view content_template_globals as select -200 as c_root_folder_id; --- dont need a define_func_args for empty funcs... create or replace function content_template__get_root_folder() returns integer as ' begin return content_template_globals.c_root_folder_id; @@ -30,38 +29,16 @@ null, now(), null, - null, null ); end;' language 'plpgsql'; -create or replace function content_template__new (varchar,integer,integer,timestamptz,integer,varchar) -returns integer as ' -declare - new__name alias for $1; - new__parent_id alias for $2; -- default null - new__template_id alias for $3; -- default null - new__creation_date alias for $4; -- default now() - new__creation_user alias for $5; -- default null - new__creation_ip alias for $6; -- default null -begin - return content_template__new(new__name, - new__parent_id, - new__template_id, - new__creation_date, - new__creation_user, - new__creation_ip, - null - ); - -end;' language 'plpgsql'; - -- function new select define_function_args('content_template__new','name,parent_id,template_id,creation_date,creation_user,creation_ip'); -create or replace function content_template__new (varchar,integer,integer,timestamptz,integer,varchar,integer) +create or replace function content_template__new (varchar,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__name alias for $1; @@ -70,9 +47,7 @@ new__creation_date alias for $4; -- default now() new__creation_user alias for $5; -- default null new__creation_ip alias for $6; -- default null - new__package_id alias for $7; -- default null v_template_id cr_templates.template_id%TYPE; - v_package_id acs_objects.package_id%TYPE; v_parent_id cr_items.parent_id%TYPE; begin @@ -89,12 +64,6 @@ raise EXCEPTION ''-20000: This folder does not allow templates to be created''; else - if new__package_id is null then - v_package_id := acs_object__package_id(v_parent_id); - else - v_package_id := new__package_id; - end if; - v_template_id := content_item__new ( new__name, v_parent_id, @@ -111,8 +80,7 @@ ''text/plain'', null, null, - ''text'', - v_package_id + ''text'' ); insert into cr_templates ( @@ -128,27 +96,6 @@ end;' language 'plpgsql'; -create or replace function content_template__new(varchar,text,bool,integer) returns integer as ' -declare - new__name alias for $1; - new__text alias for $2; - new__is_live alias for $3; - new__package_id alias for $4; -- default null -begin - return content_template__new(new__name, - null, - null, - now(), - null, - null, - new__text, - new__is_live, - new__package_id - ); - -end;' language 'plpgsql'; - - create or replace function content_template__new(varchar,text,bool) returns integer as ' declare new__name alias for $1; @@ -162,13 +109,12 @@ null, null, new__text, - new__is_live, - null + new__is_live ); end;' language 'plpgsql'; - +select define_function_args('content_template__new','name,parent_id,template_id,creation_date,creation_user,creation_ip,text,is_live'); create or replace function content_template__new (varchar,integer,integer,timestamptz,integer,varchar,text,bool) returns integer as ' declare @@ -180,35 +126,7 @@ new__creation_ip alias for $6; -- default null new__text alias for $7; -- default null new__is_live alias for $8; -- default ''f'' -begin - return content_template__new(new__name, - new__parent_id, - new__template_id, - new__creation_date, - new__creation_user, - new__creation_ip, - new__text, - new__is_live, - null - ); - -end;' language 'plpgsql'; - - -create or replace function content_template__new (varchar,integer,integer,timestamptz,integer,varchar,text,bool,integer) -returns integer as ' -declare - new__name alias for $1; - new__parent_id alias for $2; -- default null - new__template_id alias for $3; -- default null - new__creation_date alias for $4; -- default now() - new__creation_user alias for $5; -- default null - new__creation_ip alias for $6; -- default null - new__text alias for $7; -- default null - new__is_live alias for $8; -- default ''f'' - new__package_id alias for $9; -- default null v_template_id cr_templates.template_id%TYPE; - v_package_id acs_objects.package_id%TYPE; v_parent_id cr_items.parent_id%TYPE; begin @@ -225,12 +143,6 @@ raise EXCEPTION ''-20000: This folder does not allow templates to be created''; else - if new__package_id is null then - v_package_id := acs_object__package_id(v_parent_id); - else - v_package_id := new__package_id; - end if; - v_template_id := content_item__new ( new__template_id, -- new__item_id new__name, -- new__name @@ -247,8 +159,7 @@ ''t'', -- new__security_inherit_p ''CR_FILES'', -- new__storage_area_key ''content_item'', -- new__item_subtype - ''content_template'', -- new__content_type - v_package_id -- new__package_id + ''content_template'' -- new__content_type ); insert into cr_templates ( @@ -265,7 +176,6 @@ -- procedure delete -select define_function_args('content_template__delete','template_id'); create or replace function content_template__delete (integer) returns integer as ' declare @@ -288,7 +198,6 @@ -- function is_template -select define_function_args('content_template__is_template','template_id'); create or replace function content_template__is_template (integer) returns boolean as ' declare @@ -302,7 +211,6 @@ -- function get_path -select define_function_args('content_template__get_path','template_id,root_folder_id;-200'); create or replace function content_template__get_path (integer,integer) returns varchar as ' declare