Index: openacs-4/packages/file-storage/www/file-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-oracle.xql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/file-storage/www/file-oracle.xql 23 Nov 2017 10:07:57 -0000 1.16 +++ openacs-4/packages/file-storage/www/file-oracle.xql 15 Jun 2018 09:27:55 -0000 1.17 @@ -3,23 +3,6 @@ oracle8.1.6 - - - - select person.name(o.creation_user) as owner, - i.name as title, - r.title as name, - acs_permission.permission_p(:file_id,:user_id,'write') as write_p, - acs_permission.permission_p(:file_id,:user_id,'delete') as delete_p, - acs_permission.permission_p(:file_id,:user_id,'admin') as admin_p, - content_item.get_path(o.object_id, :root_folder_id) as file_url, i.live_revision - from acs_objects o, cr_revisions r, cr_items i - where o.object_id = :file_id - and i.item_id = o.object_id - and r.revision_id = i.live_revision - - - Index: openacs-4/packages/file-storage/www/file-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-postgresql.xql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/file-storage/www/file-postgresql.xql 23 Nov 2017 10:06:32 -0000 1.18 +++ openacs-4/packages/file-storage/www/file-postgresql.xql 15 Jun 2018 09:27:55 -0000 1.19 @@ -3,49 +3,6 @@ postgresql7.1 - - - - select person__name(o.creation_user) as owner, - f.name as title, - f.parent_id, - coalesce(f.url,f.file_upload_name) as name, - acs_permission__permission_p(:file_id,:user_id,'write') as write_p, - acs_permission__permission_p(:file_id,:user_id,'delete') as delete_p, - acs_permission__permission_p(:file_id,:user_id,'admin') as admin_p, - content_item__get_path(o.object_id, :root_folder_id) as file_url, f.live_revision - from acs_objects o, fs_objects f - where o.object_id = :file_id - and f.object_id = o.object_id - - - - - - - select r.title, - r.revision_id as version_id, - person__name(o.creation_user) as author, - o.creation_user as author_id, - r.mime_type as type, - m.label as pretty_type, - to_char(o.last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - r.description, - acs_permission__permission_p(r.revision_id,:user_id,'admin') as admin_p, - acs_permission__permission_p(r.revision_id,:user_id,'delete') as delete_p, - coalesce(r.content_length,0) as content_size - from acs_objects o, cr_items i,cr_revisions r - left join cr_mime_types m on r.mime_type=m.mime_type - where o.object_id = r.revision_id - and r.item_id = i.item_id - and r.item_id = :file_id - and acs_permission__permission_p(r.revision_id, :user_id, 'read') - - $show_versions order by last_modified desc - - - - postgresql8.4 Index: openacs-4/packages/file-storage/www/file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.tcl,v diff -u -r1.37 -r1.38 --- openacs-4/packages/file-storage/www/file.tcl 23 Nov 2017 10:06:32 -0000 1.37 +++ openacs-4/packages/file-storage/www/file.tcl 15 Jun 2018 09:27:55 -0000 1.38 @@ -34,8 +34,27 @@ set show_administer_permissions_link_p [parameter::get -parameter "ShowAdministerPermissionsLinkP"] set root_folder_id [fs::get_root_folder] -db_1row file_info "" +db_1row file_info { + select (select creation_user from acs_objects + where object_id = f.object_id) as creation_user, + name as title, + parent_id, + coalesce(url,file_upload_name) as name, + live_revision + from fs_objects f + where f.object_id = :file_id +} +set write_p [permission::permission_p -party_id $user_id -object_id $file_id -privilege "write"] +set delete_p [permission::permission_p -party_id $user_id -object_id $file_id -privilege "delete"] +set admin_p [permission::permission_p -party_id $user_id -object_id $file_id -privilege "admin"] + +set owner [acs_user::get_element \ + -user_id $creation_user -element name] + +set file_url [content::item::get_path -item_id $file_id \ + -root_folder_id $root_folder_id] + # get folder id so we can implement a back link set folder_id [content::item::get_parent_folder -item_id $file_id] set folder_write_p [permission::permission_p -object_id $folder_id -privilege write] @@ -54,13 +73,8 @@ set return_url [export_vars -base [ad_conn url] file_id] set categories_p [parameter::get -parameter CategoriesP -package_id [ad_conn package_id] -default 0] -if { $categories_p } { - set rename_name [_ file-storage.Edit_File] -} else { - set rename_name [_ file-storage.Rename_File] -} +set rename_name [expr { $categories_p ? [_ file-storage.Edit_File] : [_ file-storage.Rename_File]}] - set actions {} if {$write_p} {