Index: openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql	30 Sep 2003 12:10:01 -0000	1.7
+++ openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql	2 Mar 2004 17:01:47 -0000	1.8
@@ -112,7 +112,8 @@
     height		in images.height%TYPE default null,
     width		in images.width%TYPE default null,
     file_size		in cr_revisions.content_length%TYPE default null,
-    storage_type        in cr_items.storage_type%TYPE default 'file'
+    storage_type        in cr_items.storage_type%TYPE default 'file',
+    package_id          in acs_objects.package_id%TYPE
   ) return cr_items.item_id%TYPE;
 
   function new_revision (
@@ -131,7 +132,8 @@
     filename		in cr_revisions.filename%TYPE default null,
     height		in images.height%TYPE default null,
     width		in images.width%TYPE default null,
-    file_size		in cr_revisions.content_length%TYPE default null
+    file_size		in cr_revisions.content_length%TYPE default null,
+    package_id          in acs_objects.package_id%TYPE
   ) return cr_revisions.revision_id%TYPE;
 
   --/**
@@ -182,17 +184,26 @@
     height		in images.height%TYPE default null,
     width		in images.width%TYPE default null,
     file_size		in cr_revisions.content_length%TYPE default null,
-    storage_type        in cr_items.storage_type%TYPE default 'file'
+    storage_type        in cr_items.storage_type%TYPE default 'file',
+    package_id          in acs_objects.package_id%TYPE
   ) return cr_items.item_id%TYPE
   is
     v_item_id	      cr_items.item_id%TYPE;
     v_revision_id     cr_revisions.revision_id%TYPE;
+    v_package_id      acs_objects.package_id%TYPE;
   begin
     
+    if package_id is null then
+      v_package_id := acs_object.package_id(new.parent_id);
+    else
+      v_package_id := package_id;
+    end if;
+
     v_item_id := content_item.new (
       name           => name,
       item_id	     => item_id,
       parent_id	     => parent_id,
+      package_id     => v_package_id,
       relation_tag   => relation_tag,
       content_type   => content_type,
       creation_date  => creation_date,
@@ -208,6 +219,7 @@
       description   => description,
       item_id	    => v_item_id,
       revision_id   => revision_id,
+      package_id    => v_package_id,
       publish_date  => publish_date,
       mime_type	    => mime_type,
       nls_language  => nls_language,
@@ -257,17 +269,26 @@
     filename		in cr_revisions.filename%TYPE default null,
     height		in images.height%TYPE default null,
     width		in images.width%TYPE default null,
-    file_size		in cr_revisions.content_length%TYPE default null
+    file_size		in cr_revisions.content_length%TYPE default null,
+    package_id          in acs_objects.package_id%TYPE
   ) return cr_revisions.revision_id%TYPE
   is
     v_revision_id     cr_revisions.revision_id%TYPE;
+    v_package_id      acs_objects.package_id%TYPE;
 
   begin
+    if package_id is null then
+      v_package_id := acs_object.package_id(new_revision.item_id);
+    else
+      v_package_id := package_id;
+    end if;
+
     v_revision_id := content_revision.new (
       title => title,
       description   => description,
       item_id	    => item_id,
       revision_id   => revision_id,
+      package_id    => v_package_id,
       publish_date  => publish_date,
       mime_type	    => mime_type,
       nls_language  => nls_language,
