diff options
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 2fb7dfba29f..a6d376aa2a9 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -625,12 +625,23 @@ this.registerAction({ name: 'MoveCopy', - displayName: t('files', 'Move or copy'), + displayName: function(context) { + var permissions = context.fileInfoModel.attributes.permissions; + if (permissions & OC.PERMISSION_UPDATE) { + return t('files', 'Move or copy'); + } + return t('files', 'Copy'); + }, mime: 'all', order: -25, - permissions: OC.PERMISSION_UPDATE, + permissions: $('#isPublic').val() ? OC.PERMISSION_UPDATE : OC.PERMISSION_READ, iconClass: 'icon-external', actionHandler: function (filename, context) { + var permissions = context.fileInfoModel.attributes.permissions; + var actions = OC.dialogs.FILEPICKER_TYPE_COPY; + if (permissions & OC.PERMISSION_UPDATE) { + actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE; + } OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath, type) { if (type === OC.dialogs.FILEPICKER_TYPE_COPY) { context.fileList.copy(filename, targetPath); @@ -638,7 +649,7 @@ if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) { context.fileList.move(filename, targetPath); } - }, false, "httpd/unix-directory", true, OC.dialogs.FILEPICKER_TYPE_COPY_MOVE); + }, false, "httpd/unix-directory", true, actions); } }); |