Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql	4 Mar 2004 14:52:36 -0000	1.15
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql	12 Mar 2004 18:48:47 -0000	1.16
@@ -12,7 +12,7 @@
 
 select define_function_args('content_extlink__new','name,url,label,description,parent_id,extlink_id,creation_date;now,creation_user,creation_ip');
 
-create or replace function content_extlink__new (varchar,varchar,varchar,varchar,integer,integer,timestamptz,integer,varchar)
+create or replace function content_extlink__new (varchar,varchar,varchar,varchar,integer,integer,timestamptz,integer,varchar,integer)
 returns integer as '
 declare
   new__name                   alias for $1;  -- default null  
@@ -24,7 +24,9 @@
   new__creation_date          alias for $7;  -- default now()
   new__creation_user          alias for $8;  -- default null
   new__creation_ip            alias for $9;  -- default null
+  new__package_id             alias for $10; -- default null
   v_extlink_id                cr_extlinks.extlink_id%TYPE;
+  v_package_id                acs_objects.package_id%TYPE;
   v_label                     cr_extlinks.label%TYPE;
   v_name                      cr_items.name%TYPE;
 begin
@@ -42,6 +44,12 @@
     v_name := new__name;
   end if;
 
+  if new__package_id is null then
+    v_package_id := acs_object__package_id(new__parent_id);
+  else
+    v_package_id := new__package_id;
+  end if;
+
   v_extlink_id := content_item__new(
       v_name, 
       new__parent_id,
@@ -58,18 +66,50 @@
       ''text/plain'',
       null,
       null,
-      ''text''
+      ''text'',
+      v_package_id
   );
 
   insert into cr_extlinks
     (extlink_id, url, label, description)
   values
     (v_extlink_id, new__url, v_label, new__description);
 
+  update acs_objects
+  set title = v_label
+  where object_id = v_extlink_id;
+
   return v_extlink_id;
 
 end;' language 'plpgsql';
 
+create or replace function content_extlink__new (varchar,varchar,varchar,varchar,integer,integer,timestamptz,integer,varchar)
+returns integer as '
+declare
+  new__name                   alias for $1;  -- default null  
+  new__url                    alias for $2;  
+  new__label                  alias for $3;  -- default null
+  new__description            alias for $4;  -- default null
+  new__parent_id              alias for $5;  
+  new__extlink_id             alias for $6;  -- default null
+  new__creation_date          alias for $7;  -- default now()
+  new__creation_user          alias for $8;  -- default null
+  new__creation_ip            alias for $9;  -- default null
+begin
+  return content_extlink__new(new__name,
+                              new__url,
+                              new__label,
+                              new__description,
+                              new__parent_id,
+                              new__extlink_id,
+                              new__creation_date,
+                              new__creation_user,
+                              new__creation_ip,
+                              null
+  );
+
+end;' language 'plpgsql';
+
 create or replace function content_extlink__delete (integer)
 returns integer as '
 declare
@@ -186,7 +226,8 @@
             null,
             current_timestamp,
 	    copy__creation_user,
-	    copy__creation_ip
+	    copy__creation_ip,
+            null
         );
 
       end if;
