Index: openacs-4/contrib/packages/portal/sql/postgresql/layout-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/layout-package-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/portal/sql/postgresql/layout-package-create.sql	25 Oct 2002 21:29:17 -0000	1.1
+++ openacs-4/contrib/packages/portal/sql/postgresql/layout-package-create.sql	25 Sep 2003 02:12:16 -0000	1.2
@@ -25,26 +25,30 @@
 
 select define_function_args('portal_layout__new', 'layout_id,name,description,filename,resource_dir,object_type;portal_layout,creation_date,creation_user,creation_ip,context_id');
 
-create or replace function portal_layout__new (integer,varchar,varchar,varchar,varchar,varchar,timestamp,integer,varchar,integer)
+create or replace function portal_layout__new (integer,varchar,varchar,varchar,varchar,varchar,timestamptz,integer,varchar,integer)
 returns integer as '
 declare
-    p_layout_id                     alias for $1;
+    p_layout_id                     alias for $1;  -- default null
     p_name                          alias for $2;
-    p_description                   alias for $3;
+    p_description                   alias for $3;  -- default null
     p_filename                      alias for $4;
     p_resource_dir                  alias for $5;
-    p_object_type                   alias for $6;
-    p_creation_date                 alias for $7;
-    p_creation_user                 alias for $8;
-    p_creation_ip                   alias for $9;
-    p_context_id                    alias for $10;
+    p_object_type                   alias for $6;  -- default ''portal_layout''
+    p_creation_date                 alias for $7;  -- default current_timestamp
+    p_creation_user                 alias for $8;  -- default null
+    p_creation_ip                   alias for $9;  -- default null
+    p_context_id                    alias for $10; -- default null
     v_layout_id                     portal_layouts.layout_id%TYPE;
+    v_object_type                   acs_objects.object_type%TYPE;
+    v_creation_date                 acs_objects.creation_date%TYPE;
 begin
+    v_object_type = coalesce(p_object_type, ''portal_layout'');
+    v_creation_date = coalesce(p_creation_date, current_timestamp);
 
     v_layout_id := acs_object__new(
         p_layout_id,
-        p_object_type,
-        p_creation_date,
+        v_object_type,
+        v_creation_date,
         p_creation_user,
         p_creation_ip,
         p_context_id,
@@ -60,10 +64,28 @@
 
 end;' language 'plpgsql';
 
+select define_function_args('portal_layout__add_region', 'layout_id,region');
+
+create or replace function portal_layout__add_region(integer,varchar)
+returns integer as '
+declare
+    p_layout_id                     alias for $1;
+    p_region                        alias for $2;
+begin
+    insert into portal_layout_regions
+    (layout_id, region)
+    values
+    (p_layout_id, p_region);
+
+    return 0;
+end;' language 'plpgsql';
+
+
 select define_function_args('portal_layout__delete', 'layout_id');
 
 create or replace function portal_layout__delete (integer)
 returns integer as '
+declare
     p_layout_id                     alias for $1;
 begin
 
