Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-simple-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/Attic/file-storage-simple-package-create.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/file-storage/sql/postgresql/file-storage-simple-package-create.sql	25 May 2002 14:27:49 -0000	1.3
+++ openacs-4/packages/file-storage/sql/postgresql/file-storage-simple-package-create.sql	29 May 2002 23:02:19 -0000	1.4
@@ -69,7 +69,9 @@
 
 select define_function_args('fs_url__delete','url_id');
 
+select define_function_args('fs_url__copy','url_id;target_object_id');
 
+
 create function fs_url__new(integer,varchar,varchar,integer,varchar,varchar,timestamp,integer,varchar,integer)
 returns integer as '
 DECLARE
@@ -118,3 +120,58 @@
         return 0;
 END;
 ' language 'plpgsql';
+
+
+create function fs_url__copy(integer,integer)
+returns integer as '
+DECLARE
+        p_url_id                alias for $1;
+        p_target_folder_id      alias for $2;
+        v_new_url_id            integer;
+        v_url                   varchar;
+        v_name                  varchar;
+        v_description           varchar;
+        v_creation_user         integer;
+        v_creation_ip           varchar;
+BEGIN
+        select url
+        into v_url
+        from fs_urls
+        where url_id = p_url_id;
+
+        select name
+        into v_name
+        from fs_simple_objects
+        where object_id = p_url_id;
+
+        select description
+        into v_description
+        from fs_simple_objects
+        where object_id = p_url_id;
+
+        select creation_user
+        into v_creation_user
+        from acs_objects
+        where object_id = p_url_id;
+
+        select creation_ip
+        into v_creation_ip
+        from acs_objects
+        where object_id = p_url_id;
+
+        v_new_url_id:= fs_url__new (
+            NULL,
+            ''fs_url'',
+            v_url,
+            p_target_folder_id,
+            v_name,
+            v_description,
+            NULL,
+            v_creation_user,
+            v_creation_ip,
+            p_target_folder_id
+        );
+           
+        return v_new_url_id;
+END;
+' language 'plpgsql';
