'</div>' +
' {{/if}}' +
' {{/if}}' +
+ ' {{#if publicEditing}}' +
+ '<div id="allowPublicEditingWrapper">' +
+ ' <span class="icon-loading-small hidden"></span>' +
+ ' <input type="checkbox" value="1" name="allowPublicEditing" id="sharingDialogAllowPublicEditing-{{cid}}" class="checkbox publicEditingCheckbox" {{{publicEditingChecked}}} />' +
+ '<label for="sharingDialogAllowPublicEditing-{{cid}}">{{publicEditingLabel}}</label>' +
+ '</div>' +
+ ' {{/if}}' +
' {{#if showPasswordCheckBox}}' +
'<input type="checkbox" name="showPassword" id="showPassword-{{cid}}" class="checkbox showPasswordCheckbox" {{#if isPasswordSet}}checked="checked"{{/if}} value="1" />' +
'<label for="showPassword-{{cid}}">{{enablePasswordLabel}}</label>' +
'click .linkCheckbox': 'onLinkCheckBoxChange',
'click .linkText': 'onLinkTextClick',
'change .publicUploadCheckbox': 'onAllowPublicUploadChange',
+ 'change .publicEditingCheckbox': 'onAllowPublicEditingChange',
'change .hideFileListCheckbox': 'onHideFileListChange',
'click .showPasswordCheckbox': 'onShowPasswordClick'
},
'onLinkTextClick',
'onShowPasswordClick',
'onHideFileListChange',
- 'onAllowPublicUploadChange'
+ 'onAllowPublicUploadChange',
+ 'onAllowPublicEditingChange'
);
var clipboard = new Clipboard('.clipboardButton');
});
},
+ onAllowPublicEditingChange: function() {
+ var $checkbox = this.$('.publicEditingCheckbox');
+ $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
+
+ var permissions = OC.PERMISSION_READ;
+ if($checkbox.is(':checked')) {
+ permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_READ;
+ }
+
+ this.model.saveLinkShare({
+ permissions: permissions
+ });
+ },
+
onHideFileListChange: function () {
var $checkbox = this.$('.hideFileListCheckbox');
$checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
publicUploadChecked = 'checked="checked"';
}
+ var publicEditingChecked = '';
+ if(this.model.isPublicEditingAllowed()) {
+ publicEditingChecked = 'checked="checked"';
+ }
+
+
var hideFileList = publicUploadChecked;
var hideFileListChecked = '';
&& ( !this.configModel.get('enforcePasswordForPublicLink')
|| !this.model.get('linkShare').password);
+ var publicEditable =
+ !this.model.isFolder()
+ && isLinkShare
+ && this.model.updatePermissionPossible();
+
this.$el.html(linkShareTemplate({
cid: this.cid,
shareAllowed: true,
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')
return this.get('allowPublicUploadStatus');
},
+ isPublicEditingAllowed: function() {
+ return this.get('allowPublicEditingStatus');
+ },
+
/**
* @returns {boolean}
*/
});
}
+ var allowPublicEditingStatus = true;
+ if(!_.isUndefined(data.shares)) {
+ $.each(data.shares, function (key, value) {
+ if (value.share_type === OC.Share.SHARE_TYPE_LINK) {
+ allowPublicEditingStatus = (value.permissions & OC.PERMISSION_UPDATE) ? true : false;
+ return true;
+ }
+ });
+ }
+
+
var hideFileListStatus = false;
if(!_.isUndefined(data.shares)) {
$.each(data.shares, function (key, value) {
linkShare: linkShare,
permissions: permissions,
allowPublicUploadStatus: allowPublicUploadStatus,
+ allowPublicEditingStatus: allowPublicEditingStatus,
hideFileListStatus: hideFileListStatus
};
},