Index: openacs-4/packages/acs-content-repository/acs-content-repository.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v
diff -u -r1.109.2.34 -r1.109.2.35
--- openacs-4/packages/acs-content-repository/acs-content-repository.info 21 Apr 2017 14:53:07 -0000 1.109.2.34
+++ openacs-4/packages/acs-content-repository/acs-content-repository.info 21 Apr 2017 17:14:16 -0000 1.109.2.35
@@ -9,7 +9,7 @@
f
t
-
+
OpenACS
The canonical repository for OpenACS content.
2017-02-27
@@ -21,7 +21,7 @@
GPL
3
-
+
@@ -31,7 +31,7 @@
-
+
Index: openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql,v
diff -u -r1.22 -r1.22.10.1
--- openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql 3 Feb 2009 02:25:02 -0000 1.22
+++ openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql 21 Apr 2017 17:14:16 -0000 1.22.10.1
@@ -284,7 +284,8 @@
target_folder_id in cr_folders.folder_id%TYPE,
creation_user in acs_objects.creation_user%TYPE,
creation_ip in acs_objects.creation_ip%TYPE default null,
- name in cr_items.name%TYPE default null
+ name in cr_items.name%TYPE default null,
+ label in cr_folders.label%TYPE default null
) is
v_valid_folders_p integer := 0;
v_current_folder_id cr_folders.folder_id%TYPE;
@@ -363,7 +364,7 @@
v_new_folder_id := content_folder.new(
parent_id => copy.target_folder_id,
name => nvl(copy.name,v_name),
- label => v_label,
+ label => nvl(copy.label,v_label),
description => v_description,
creation_user => copy.creation_user,
creation_ip => copy.creation_ip
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1b4-5.9.1b5.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql,v
diff -u -r1.51.4.1 -r1.51.4.2
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 10 Feb 2016 09:22:03 -0000 1.51.4.1
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 21 Apr 2017 17:14:16 -0000 1.51.4.2
@@ -621,58 +621,25 @@
END;
$$ LANGUAGE plpgsql;
+
-- procedure copy
-
-- added
+select define_function_args('content_folder__copy','folder_id,target_folder_id,creation_user,creation_ip;null,name;null,label;null');
--
--- procedure content_folder__copy/4
+-- procedure content_folder__copy/6
--
CREATE OR REPLACE FUNCTION content_folder__copy(
copy__folder_id integer,
copy__target_folder_id integer,
copy__creation_user integer,
- copy__creation_ip varchar -- default null
+ copy__creation_ip varchar default null,
+ copy__name cr_items.name%TYPE default null,
+ copy__label cr_folders.label%TYPE default null
) RETURNS integer AS $$
DECLARE
- v_valid_folders_p integer;
- v_current_folder_id cr_folders.folder_id%TYPE;
- v_name cr_items.name%TYPE;
- v_label cr_folders.label%TYPE;
- v_description cr_folders.description%TYPE;
- v_new_folder_id cr_folders.folder_id%TYPE;
- v_folder_contents_val record;
-BEGIN
- v_new_folder_id := content_folder__copy (
- copy__folder_id,
- copy__target_folder_id,
- copy__creation_user,
- copy__creation_ip,
- NULL
- );
- return v_new_folder_id;
-END;
-$$ LANGUAGE plpgsql;
-
-
-
--- added
-select define_function_args('content_folder__copy','folder_id,target_folder_id,creation_user,creation_ip;null,name;null');
-
---
--- procedure content_folder__copy/5
---
-CREATE OR REPLACE FUNCTION content_folder__copy(
- copy__folder_id integer,
- copy__target_folder_id integer,
- copy__creation_user integer,
- copy__creation_ip varchar, -- default null
- copy__name varchar -- default null
-
-) RETURNS integer AS $$
-DECLARE
v_valid_folders_p integer;
v_current_folder_id cr_folders.folder_id%TYPE;
v_name cr_items.name%TYPE;
@@ -735,7 +702,7 @@
-- create the new folder
v_new_folder_id := content_folder__new(
coalesce (copy__name, v_name),
- v_label,
+ coalesce (copy__label, v_label),
v_description,
copy__target_folder_id,
copy__target_folder_id,
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.9.1b4-5.9.1b5.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/file-storage/file-storage.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v
diff -u -r1.58.2.8 -r1.58.2.9
--- openacs-4/packages/file-storage/file-storage.info 27 Feb 2017 07:42:03 -0000 1.58.2.8
+++ openacs-4/packages/file-storage/file-storage.info 21 Apr 2017 17:14:16 -0000 1.58.2.9
@@ -7,7 +7,7 @@
f
f
-
+
OpenACS
Collaborative document storage
2017-02-27
@@ -17,10 +17,10 @@
2
#file-storage.file-storage#
-
+
-
+
Index: openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql,v
diff -u -r1.16 -r1.16.10.1
--- openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql 8 Aug 2006 21:26:48 -0000 1.16
+++ openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql 21 Apr 2017 17:14:16 -0000 1.16.10.1
@@ -6,155 +6,6 @@
-- @version $Id$
--
-create or replace package file_storage
-as
-
- function get_root_folder(
- --
- -- Returns the root folder corresponding to a particular
- -- package instance.
- --
- package_id in apm_packages.package_id%TYPE
- ) return fs_root_folders.folder_id%TYPE;
-
- function get_package_id(
- item_id in cr_items.item_id%TYPE
- ) return fs_root_folders.package_id%TYPE;
-
- function new_root_folder(
- --
- -- Creates a new root folder
- --
- package_id in apm_packages.package_id%TYPE,
- folder_name in cr_folders.label%TYPE default null,
- folder_url in cr_items.name%TYPE default null,
- description in cr_folders.description%TYPE default null
- ) return fs_root_folders.folder_id%TYPE;
-
- function new_file(
- --
- -- Create a file in CR in preparation for actual storage
- -- Wrapper for content_item.new
- --
- item_id in cr_items.item_id%TYPE default null,
- title in cr_items.name%TYPE,
- folder_id in cr_items.parent_id%TYPE,
- creation_user in acs_objects.creation_user%TYPE,
- creation_ip in acs_objects.creation_ip%TYPE,
- indb_p in char default 't',
- package_id in acs_objects.package_id%TYPE default null
- ) return cr_items.item_id%TYPE;
-
- procedure delete_file(
- --
- -- Delete a file and all its version
- -- Wrapper to content_item.delete
- --
- file_id in cr_items.item_id%TYPE
- );
-
- procedure rename_file(
- --
- -- Rename a file and all
- -- Wrapper to content_item__edit_name
- --
- file_id in cr_items.item_id%TYPE,
- title in cr_items.name%TYPE
- );
-
- function copy_file(
- --
- -- Copy a file, but only copy the live_revision
- --
- file_id in cr_items.item_id%TYPE,
- target_folder_id in cr_items.parent_id%TYPE,
- creation_user in acs_objects.creation_user%TYPE,
- creation_ip in acs_objects.creation_ip%TYPE
- ) return cr_revisions.revision_id%TYPE;
-
- procedure move_file(
- --
- -- Move a file, and all its versions, to a new folder
- --
- file_id in cr_items.item_id%TYPE,
- target_folder_id in cr_items.parent_id%TYPE,
- creation_user in acs_objects.creation_user%TYPE,
- creation_ip in acs_objects.creation_ip%TYPE
- );
-
- function get_title(
- --
- -- Unfortunately, title in the file-storage context refers
- -- to the name attribute in cr_items, not the title attribute in
- -- cr_revisions
- item_id in cr_items.item_id%TYPE
- ) return varchar;
-
- function get_parent_id(
- item_id in cr_items.item_id%TYPE
- ) return cr_items.item_id%TYPE;
-
- function get_content_type(
- --
- -- Wrapper for content_item. get_content_type
- --
- item_id in cr_items.item_id%TYPE
- ) return cr_items.content_type%TYPE;
-
- function get_folder_name(
- --
- -- Wrapper for content_folder.get_label
- --
- folder_id in cr_folders.folder_id%TYPE
- ) return cr_folders.label%TYPE;
-
- function new_version(
- --
- -- Create a new version of a file
- -- Wrapper for content_revision.new
- --
- filename in cr_revisions.title%TYPE,
- description in cr_revisions.description%TYPE,
- mime_type in cr_revisions.mime_type%TYPE,
- item_id in cr_items.item_id%TYPE,
- creation_user in acs_objects.creation_user%TYPE,
- creation_ip in acs_objects.creation_ip%TYPE
- ) return cr_revisions.revision_id%TYPE;
-
- function delete_version(
- --
- -- Delete a version of a file
- --
- file_id in cr_items.item_id%TYPE,
- version_id in cr_revisions.revision_id%TYPE
- ) return cr_items.parent_id%TYPE;
-
- function new_folder(
- --
- -- Create a folder
- --
- name in cr_items.name%TYPE,
- folder_name in cr_folders.label%TYPE,
- parent_id in cr_items.parent_id%TYPE,
- creation_user in acs_objects.creation_user%TYPE,
- creation_ip in acs_objects.creation_ip%TYPE
- ) return cr_folders.folder_id%TYPE;
-
- procedure delete_folder(
- --
- -- Delete a folder
- -- adding cascade_p but defaulting to false
- -- this will fail if a folder contains anything
- -- but just in case some other application uses
- -- this api it will not change the behavior
- folder_id in cr_folders.folder_id%TYPE,
- cascade_p in char default 'f'
- );
-
-end file_storage;
-/
-show errors
-
create or replace package body file_storage
as
@@ -308,10 +159,12 @@
--
-- Copy a file, but only copy the live_revision
--
- file_id in cr_items.item_id%TYPE,
+ file_id in cr_items.item_id%TYPE,
target_folder_id in cr_items.parent_id%TYPE,
- creation_user in acs_objects.creation_user%TYPE,
- creation_ip in acs_objects.creation_ip%TYPE
+ creation_user in acs_objects.creation_user%TYPE,
+ creation_ip in acs_objects.creation_ip%TYPE,
+ name in cr_items.name%TYPE default null,
+ title in cr_revisions.title%TYPE default null
) return cr_revisions.revision_id%TYPE
is
v_title cr_items.name%TYPE;
@@ -339,6 +192,9 @@
and r.revision_id = i.live_revision
and i.item_id = file_storage.copy_file.file_id;
+ v_filename := nvl(copy.name, v_filename);
+ v_title := nvl(copy.title, v_title);
+
-- We should probably use the copy functions of CR
-- when we optimize this function
v_new_file_id := file_storage.new_file(
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-5.9.1b3-5.9.1b4.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql,v
diff -u -r1.28.2.1 -r1.28.2.2
--- openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql 1 Nov 2016 17:21:18 -0000 1.28.2.1
+++ openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql 21 Apr 2017 17:14:16 -0000 1.28.2.2
@@ -306,12 +306,11 @@
$$ LANGUAGE plpgsql;
-
-- added
-select define_function_args('file_storage__copy_file','file_id,target_folder_id,creation_user,creation_ip');
+select define_function_args('file_storage__copy_file','file_id,target_folder_id,creation_user,creation_ip,name;null,title;null');
--
--- procedure file_storage__copy_file/4
+-- procedure file_storage__copy_file/6
--
--
-- Copy a file, but only copy the live_revision
@@ -320,7 +319,9 @@
copy_file__file_id integer,
copy_file__target_folder_id integer,
copy_file__creation_user integer,
- copy_file__creation_ip varchar
+ copy_file__creation_ip varchar,
+ copy_file__name cr_items.name%TYPE default null,
+ copy_file__title cr_revisions.title%TYPE default null
)
RETURNS integer AS $$
DECLARE
@@ -334,7 +335,7 @@
v_new_lob_id cr_revisions.lob%TYPE;
v_file_path cr_revisions.content%TYPE;
v_new_file_id cr_items.item_id%TYPE;
- v_new_version_id cr_revisions.revision_id%TYPE;
+ v_new_version_id cr_revisions.revision_id%TYPE;
v_indb_p boolean;
v_isurl boolean;
v_content_type cr_items.content_type%TYPE;
@@ -364,8 +365,11 @@
select package_id into v_package_id from acs_objects where object_id = copy_file__file_id;
+ v_name := coalesce(copy_file__name, v_name);
+ v_filename := coalesce(copy_file__title, v_filename);
+
v_new_file_id := file_storage__new_file(
- v_name, -- name
+ v_name, -- name
copy_file__target_folder_id, -- folder_id
copy_file__creation_user, -- creation_user
copy_file__creation_ip, -- creation_ip
@@ -426,7 +430,6 @@
$$ LANGUAGE plpgsql;
-
-- added
select define_function_args('file_storage__move_file','file_id,target_folder_id,creation_user,creation_ip');
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.9.1b3-5.9.1b4.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/file-storage/www/copy-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy-oracle.xql,v
diff -u -r1.6 -r1.6.6.1
--- openacs-4/packages/file-storage/www/copy-oracle.xql 23 Oct 2008 13:59:02 -0000 1.6
+++ openacs-4/packages/file-storage/www/copy-oracle.xql 21 Apr 2017 17:14:16 -0000 1.6.6.1
@@ -15,7 +15,7 @@
- select fs.object_id, fs.name, fs.parent_id,
+ select fs.object_id, fs.name, fs.parent_id, fs.file_upload_name,
acs_permission.permission_p(fs.object_id, :user_id, 'read') as copy_p, fs.type
from fs_objects fs
where fs.object_id in ([template::util::tcl_to_sql_list $object_id])
@@ -30,7 +30,9 @@
:object_id,
:folder_id,
:user_id,
- :peer_addr);
+ :peer_addr,
+ :file_upload_name,
+ :name);
end;
@@ -42,7 +44,9 @@
:object_id,
:folder_id,
:user_id,
- :peer_addr );
+ :peer_addr,
+ :file_upload_name,
+ :name);
end;
@@ -68,4 +72,4 @@
-
\ No newline at end of file
+
Index: openacs-4/packages/file-storage/www/copy-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy-postgresql.xql,v
diff -u -r1.8.4.1 -r1.8.4.2
--- openacs-4/packages/file-storage/www/copy-postgresql.xql 3 Jul 2016 18:16:29 -0000 1.8.4.1
+++ openacs-4/packages/file-storage/www/copy-postgresql.xql 21 Apr 2017 17:14:16 -0000 1.8.4.2
@@ -14,7 +14,7 @@
- select fs.object_id, fs.name, fs.parent_id,
+ select fs.object_id, fs.name, fs.parent_id, fs.file_upload_name,
acs_permission__permission_p(fs.object_id, :user_id, 'read') as copy_p, fs.type
from fs_objects fs
where fs.object_id in ([template::util::tcl_to_sql_list $object_id])
@@ -28,7 +28,9 @@
:object_id,
:folder_id,
:user_id,
- :peer_addr
+ :peer_addr,
+ :file_upload_name,
+ :name
)
@@ -39,7 +41,9 @@
:object_id,
:folder_id,
:user_id,
- :peer_addr
+ :peer_addr,
+ :file_upload_name,
+ :name
)
Index: openacs-4/packages/file-storage/www/copy.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy.tcl,v
diff -u -r1.10.2.2 -r1.10.2.3
--- openacs-4/packages/file-storage/www/copy.tcl 2 Feb 2017 15:15:09 -0000 1.10.2.2
+++ openacs-4/packages/file-storage/www/copy.tcl 21 Apr 2017 17:14:16 -0000 1.10.2.3
@@ -37,7 +37,7 @@
}
if {$type eq "folder"} {
lappend not_allowed_children $object_id
- lappend not_allowed_parents $parent_id
+ # lappend not_allowed_parents $parent_id
}
}
@@ -61,9 +61,25 @@
set error_items [list]
template::multirow foreach copy_objects {
db_transaction {
+ # Allow to copy files into folders that already contain
+ # one with the same name by appending a numeric suffix
+ set suffix 1
+ set orig_file_upload_name $file_upload_name
+ set orig_name $name
+ while {[content::item::get_id_by_name \
+ -name $file_upload_name \
+ -parent_id $folder_id] ne ""} {
+ set file_upload_name ${orig_file_upload_name}-${suffix}
+ set name ${orig_name}-${suffix}
+ incr suffix
+ }
+
if {$type ne "folder" } {
set file_rev_id [db_exec_plsql copy_item {}]
- callback fs::file_revision_new -package_id $package_id -file_id $object_id -parent_id $folder_id
+ callback fs::file_revision_new \
+ -package_id $package_id \
+ -file_id $object_id \
+ -parent_id $folder_id
} else {
db_exec_plsql copy_folder {}
}