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.11.2.3 -r1.11.2.4 --- openacs-4/packages/file-storage/www/copy.tcl 28 Aug 2019 14:31:41 -0000 1.11.2.3 +++ openacs-4/packages/file-storage/www/copy.tcl 28 Aug 2019 15:06:32 -0000 1.11.2.4 @@ -141,21 +141,23 @@ set object_id $objects_to_copy set cancel_url "[ad_conn url]?[ad_conn query]" db_multirow -extend {copy_url} folder_tree get_folder_tree { - with recursive folder_tree (folder_id, parent_id, label) as ( - select cf.folder_id, cif.parent_id, cf.label, 1 as level_num + with recursive folder_tree (folder_id, parent_id, label, level_num, tree_sortkey) as ( + select cf.folder_id, cif.parent_id, cf.label, 0 as level_num, cast(cif.parent_id as text) as tree_sortkey from cr_folders cf, cr_items cif where cf.folder_id = :root_folder_id and cf.folder_id = cif.item_id and acs_permission.permission_p(cf.folder_id, :user_id, 'write') union all - select cf.folder_id, cif.parent_id, cf.label, level_num + 1 as level_num + select cf.folder_id, cif.parent_id, cf.label, level_num + 1 as level_num, t.tree_sortkey || '|' || cif.parent_id as tree_sortkey from cr_folders cf, cr_items cif, folder_tree t where cif.parent_id = t.folder_id and cf.folder_id = cif.item_id and acs_permission.permission_p(cf.folder_id, :user_id, 'write') - ) select * from folder_tree + ) select folder_id, parent_id, label, level_num + from folder_tree + order by tree_sortkey asc, label asc } { if {$folder_id in [concat $not_allowed_parents $not_allowed_children] || $parent_id in $not_allowed_children