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.35.2.5 -r1.35.2.6 --- openacs-4/packages/file-storage/www/file.tcl 19 Apr 2017 18:15:56 -0000 1.35.2.5 +++ openacs-4/packages/file-storage/www/file.tcl 25 Apr 2017 18:08:26 -0000 1.35.2.6 @@ -81,15 +81,14 @@ "Copy file" } -# add button only when available folders for move exist -if {[db_list_of_lists dbqd.file-storage.www.move.get_folder_tree {}] ne ""} { +if {$delete_p} { + # add button only when available folders for move exist. We + # lazily check for deletion, as a proper check of a suitable + # destination for moving would be too much effort lappend actions \ [_ file-storage.Move_File] \ [export_vars -base move {{object_id $file_id} {return_url $folder_view_url}}] \ "Move file" -} - -if {$delete_p} { lappend actions \ [_ file-storage.Delete_File] \ [export_vars -base delete {{object_id $file_id} {return_url $folder_view_url}}] \ Index: openacs-4/packages/file-storage/www/folder-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk.tcl,v diff -u -r1.49.2.7 -r1.49.2.8 --- openacs-4/packages/file-storage/www/folder-chunk.tcl 19 Apr 2017 18:15:56 -0000 1.49.2.7 +++ openacs-4/packages/file-storage/www/folder-chunk.tcl 25 Apr 2017 18:08:26 -0000 1.49.2.8 @@ -195,8 +195,16 @@ set bulk_actions {} if {$allow_bulk_actions} { set user_id [ad_conn user_id] - # add button only when available folders for move exist - if {[db_list_of_lists dbqd.file-storage.www.move.get_folder_tree {}] ne ""} { + set bulk_delete_p [db_string some_deletables { + select exists (select 1 from fs_objects + where parent_id = :folder_id + and acs_permission__permission_p(object_id, :viewing_user_id, 'delete')) + }] + + # add button only when available folders for move exist. We + # lazily check for deletion, as a proper check of a suitable + # destination for moving would be too much effort + if {$bulk_delete_p} { lappend bulk_actions \ [_ file-storage.Move] ${fs_url}move [_ file-storage.lt_Move_Checked_Items_to] } @@ -206,7 +214,7 @@ [_ file-storage.Copy] ${fs_url}copy [_ file-storage.lt_Copy_Checked_Items_to] } - if {$delete_p} { + if {$bulk_delete_p} { lappend bulk_actions \ [_ file-storage.Delete] ${fs_url}delete [_ file-storage.Delete_Checked_Items] }