Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql,v
diff -u -r1.35 -r1.36
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql	4 Mar 2004 14:52:36 -0000	1.35
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql	12 Mar 2004 18:48:47 -0000	1.36
@@ -19,7 +19,7 @@
 -- than the standard package_instantiate_object.  So we don't bother calling define_function_args
 -- here.
 
-create or replace function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar)
+create or replace function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar,integer)
 returns integer as '
 declare
   new__title                  alias for $1;  
@@ -34,19 +34,30 @@
   new__creation_date          alias for $9;  -- default now()
   new__creation_user          alias for $10; -- default null
   new__creation_ip            alias for $11; -- default null
+  new__package_id             alias for $12; -- default null  
   v_revision_id               integer;       
+  v_package_id                acs_objects.package_id%TYPE;
   v_content_type              acs_object_types.object_type%TYPE;
 begin
 
   v_content_type := content_item__get_content_type(new__item_id);
 
+  if new__package_id is null then
+    v_package_id := acs_object__package_id(new__item_id);
+  else
+    v_package_id := new__package_id;
+  end if;
+
   v_revision_id := acs_object__new(
       new__revision_id,
       v_content_type, 
       new__creation_date, 
       new__creation_user, 
       new__creation_ip, 
-      new__item_id
+      new__item_id,
+      ''t'',
+      new__title,
+      v_package_id
   );
 
   -- binary data is stored in cr_revisions using Dons lob hack.
@@ -71,6 +82,64 @@
 
 end;' language 'plpgsql';
 
+create or replace function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar)
+returns integer as '
+declare
+  new__title                  alias for $1;  
+  new__description            alias for $2;  -- default null 
+  new__publish_date           alias for $3;  -- default now()
+  new__mime_type              alias for $4;  -- default ''text/plain''
+  new__nls_language           alias for $5;  -- default null
+  -- lob id 
+  new__data                   alias for $6;  
+  new__item_id                alias for $7;  
+  new__revision_id            alias for $8;  -- default null
+  new__creation_date          alias for $9;  -- default now()
+  new__creation_user          alias for $10; -- default null
+  new__creation_ip            alias for $11; -- default null
+begin
+        return content_revision__new(new__title,
+                                     new__description,
+                                     new__publish_date,
+                                     new__mime_type,
+                                     new__nls_language,
+                                     new__data,
+                                     new__item_id,
+                                     new__revision_id,
+                                     new__creation_date,
+                                     new__creation_user,
+                                     new__creation_ip,
+                                     null
+               );
+end;' language 'plpgsql';
+
+create or replace function content_revision__new(varchar,varchar,timestamptz,varchar,text,integer,integer) returns integer as '
+declare
+        new__title              alias for $1;
+        new__description        alias for $2;  -- default null
+        new__publish_date       alias for $3;  -- default now()
+        new__mime_type          alias for $4;  -- default ''text/plain''
+        new__text               alias for $5;  -- default '' ''
+        new__item_id            alias for $6;
+        new__package_id         alias for $7;  -- default null
+begin
+        return content_revision__new(new__title,
+                                     new__description,
+                                     new__publish_date,
+                                     new__mime_type,
+                                     null,
+                                     new__text,
+                                     new__item_id,
+                                     null,
+                                     now(),
+                                     null,
+                                     null,
+                                     null,
+                                     new__package_id
+               );
+
+end;' language 'plpgsql';
+
 create or replace function content_revision__new(varchar,varchar,timestamptz,varchar,text,integer) returns integer as '
 declare
         new__title              alias for $1;
@@ -90,6 +159,8 @@
                                      null,
                                      now(),
                                      null,
+                                     null,
+                                     null,
                                      null
                );
 
@@ -121,11 +192,11 @@
                                      new__creation_date,
                                      new__creation_user,
                                      new__creation_ip,
+                                     null,
                                      null
                                      );
 end;' language 'plpgsql';
 
--- function new
 create or replace function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,text,integer,integer,timestamptz,integer,varchar,integer)
 returns integer as '
 declare
@@ -141,21 +212,65 @@
   new__creation_user          alias for $10; -- default null
   new__creation_ip            alias for $11; -- default null
   new__content_length         alias for $12; -- default null
+begin
+        return content_revision__new(new__title,
+                                     new__description,
+                                     new__publish_date,
+                                     new__mime_type,
+                                     new__nls_language,
+                                     new__text,
+                                     new__item_id,
+                                     new__revision_id,
+                                     new__creation_date,
+                                     new__creation_user,
+                                     new__creation_ip,
+                                     new__content_length,
+                                     null
+                                     );
+end;' language 'plpgsql';
+
+-- function new
+create or replace function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,text,integer,integer,timestamptz,integer,varchar,integer,integer)
+returns integer as '
+declare
+  new__title                  alias for $1;  
+  new__description            alias for $2;  -- default null  
+  new__publish_date           alias for $3;  -- default now()
+  new__mime_type              alias for $4;  -- default ''text/plain''
+  new__nls_language           alias for $5;  -- default null
+  new__text                   alias for $6;  -- default '' ''
+  new__item_id                alias for $7;  
+  new__revision_id            alias for $8;  -- default null
+  new__creation_date          alias for $9;  -- default now()
+  new__creation_user          alias for $10; -- default null
+  new__creation_ip            alias for $11; -- default null
+  new__content_length         alias for $12; -- default null
+  new__package_id             alias for $13; -- default null  
   v_revision_id               integer;       
+  v_package_id                acs_objects.package_id%TYPE;
   v_content_type              acs_object_types.object_type%TYPE;
   v_storage_type              cr_items.storage_type%TYPE;
   v_length                    cr_revisions.content_length%TYPE;
 begin
 
   v_content_type := content_item__get_content_type(new__item_id);
 
+  if new__package_id is null then
+    v_package_id := acs_object__package_id(new__item_id);
+  else
+    v_package_id := new__package_id;
+  end if;
+
   v_revision_id := acs_object__new(
       new__revision_id,
       v_content_type, 
       new__creation_date, 
       new__creation_user, 
       new__creation_ip, 
-      new__item_id
+      new__item_id,
+      ''t'',
+      v_package_id,
+      new__title
   );
 
   select storage_type into v_storage_type
@@ -266,7 +381,9 @@
          copy__creation_ip as creation_ip,
          now() as last_modified, 
          copy__creation_user as modifying_user, 
-         copy__creation_ip as modifying_ip 
+         copy__creation_ip as modifying_ip,
+         title,
+         package_id
        from
          acs_objects 
        where 
