diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 84a3d18942f84..7fe7b2311a907 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -29,20 +29,23 @@
'' +
'' +
'' +
- ' {{#if publicUpload}}' +
- '
' +
- ' ' +
- ' ' +
- '' +
- '
' +
- ' {{#if hideFileList}}' +
- '' +
- ' ' +
- ' ' +
- '' +
- '
' +
- ' {{/if}}' +
- ' {{/if}}' +
+ '{{#if publicUpload}}' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '
' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '
' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '
' +
+ '{{/if}}' +
' {{#if publicEditing}}' +
'' +
' ' +
@@ -93,10 +96,9 @@
'keyup input.linkPassText': 'onPasswordKeyUp',
'click .linkCheckbox': 'onLinkCheckBoxChange',
'click .linkText': 'onLinkTextClick',
- 'change .publicUploadCheckbox': 'onAllowPublicUploadChange',
'change .publicEditingCheckbox': 'onAllowPublicEditingChange',
- 'change .hideFileListCheckbox': 'onHideFileListChange',
- 'click .showPasswordCheckbox': 'onShowPasswordClick'
+ 'click .showPasswordCheckbox': 'onShowPasswordClick',
+ 'change .publicUploadRadio': 'onPublicUploadChange'
},
initialize: function(options) {
@@ -135,9 +137,8 @@
'onPasswordKeyUp',
'onLinkTextClick',
'onShowPasswordClick',
- 'onHideFileListChange',
- 'onAllowPublicUploadChange',
- 'onAllowPublicEditingChange'
+ 'onAllowPublicEditingChange',
+ 'onPublicUploadChange'
);
var clipboard = new Clipboard('.clipboardButton');
@@ -261,20 +262,6 @@
});
},
- onAllowPublicUploadChange: function() {
- var $checkbox = this.$('.publicUploadCheckbox');
- $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
-
- var permissions = OC.PERMISSION_READ;
- if($checkbox.is(':checked')) {
- permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE;
- }
-
- this.model.saveLinkShare({
- permissions: permissions
- });
- },
-
onAllowPublicEditingChange: function() {
var $checkbox = this.$('.publicEditingCheckbox');
$checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
@@ -289,15 +276,9 @@
});
},
- onHideFileListChange: function () {
- var $checkbox = this.$('.hideFileListCheckbox');
- $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
-
- var permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE;
- if ($checkbox.is(':checked')) {
- permissions = OC.PERMISSION_CREATE;
- }
+ onPublicUploadChange: function(e) {
+ var permissions = e.currentTarget.value;
this.model.saveLinkShare({
permissions: permissions
});
@@ -325,9 +306,20 @@
&& this.model.createPermissionPossible()
&& this.configModel.isPublicUploadEnabled();
- var publicUploadChecked = '';
- if(this.model.isPublicUploadAllowed()) {
- publicUploadChecked = 'checked="checked"';
+ var publicUploadRWChecked = '';
+ var publicUploadRChecked = '';
+ var publicUploadWChecked = '';
+
+ switch (this.model.linkSharePermissions()) {
+ case OC.PERMISSION_READ:
+ publicUploadRChecked = 'checked';
+ break;
+ case OC.PERMISSION_CREATE:
+ publicUploadWChecked = 'checked';
+ break;
+ case OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE:
+ publicUploadRWChecked = 'checked';
+ break;
}
var publicEditingChecked = '';
@@ -335,14 +327,6 @@
publicEditingChecked = 'checked="checked"';
}
-
- var hideFileList = publicUploadChecked;
-
- var hideFileListChecked = '';
- if(this.model.isHideFileListSet()) {
- hideFileListChecked = 'checked="checked"';
- }
-
var isLinkShare = this.model.get('linkShare').isLinkShare;
var isPasswordSet = !!this.model.get('linkShare').password;
var showPasswordCheckBox = isLinkShare
@@ -357,7 +341,6 @@
this.$el.html(linkShareTemplate({
cid: this.cid,
shareAllowed: true,
- hideFileList: hideFileList,
isLinkShare: isLinkShare,
shareLinkURL: this.model.get('linkShare').link,
linkShareLabel: t('core', 'Share link'),
@@ -368,15 +351,20 @@
isPasswordSet: isPasswordSet,
showPasswordCheckBox: showPasswordCheckBox,
publicUpload: publicUpload && isLinkShare,
- publicUploadChecked: publicUploadChecked,
- hideFileListChecked: hideFileListChecked,
- publicUploadLabel: t('core', 'Allow upload and editing'),
publicEditing: publicEditable,
publicEditingChecked: publicEditingChecked,
publicEditingLabel: t('core', 'Allow editing'),
- hideFileListLabel: t('core', 'File drop (upload only)'),
mailPrivatePlaceholder: t('core', 'Email link to person'),
- mailButtonText: t('core', 'Send')
+ mailButtonText: t('core', 'Send'),
+ publicUploadRWLabel: t('core', 'Allow upload and editing'),
+ publicUploadRLabel: t('core', 'Read only'),
+ publicUploadWLabel: t('core', 'File drop (upload only)'),
+ publicUploadRWValue: OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE,
+ publicUploadRValue: OC.PERMISSION_READ,
+ publicUploadWValue: OC.PERMISSION_CREATE,
+ publicUploadRWChecked: publicUploadRWChecked,
+ publicUploadRChecked: publicUploadRChecked,
+ publicUploadWChecked: publicUploadWChecked
}));
this.$el.find('.clipboardButton').tooltip({placement: 'bottom', title: t('core', 'Copy'), trigger: 'hover'});
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index ae4c07e3f4e52..c1bb2bf01622c 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -449,6 +449,13 @@
return (share.permissions & permission) === permission;
},
+ /**
+ * @return {int}
+ */
+ getPermissions: function() {
+ return this.get('permissions');
+ },
+
/**
* @returns {boolean}
*/
@@ -527,6 +534,17 @@
|| this.hasDeletePermission(shareIndex);
},
+ /**
+ * @returns {int}
+ */
+ linkSharePermissions: function() {
+ if (!this.hasLinkShare()) {
+ return -1;
+ } else {
+ return this.get('linkShare').permissions;
+ }
+ },
+
_getUrl: function(base, params) {
params = _.extend({format: 'json'}, params || {});
return OC.linkToOCS('apps/files_sharing/api/v1', 2) + base + '?' + OC.buildQueryString(params);