make 'Allow editing' (aka public upload) checkbox work
This commit is contained in:
parent
6d832359b6
commit
7ae84e0e5c
|
@ -956,46 +956,6 @@ $(document).ready(function() {
|
|||
permissions);
|
||||
});
|
||||
|
||||
// Handle the Allow Public Upload Checkbox
|
||||
$(document).on('click', '#sharingDialogAllowPublicUpload', function() {
|
||||
|
||||
// Gather data
|
||||
var $dropDown = $('#dropdown');
|
||||
var allowPublicUpload = $(this).is(':checked');
|
||||
var itemType = $dropDown.data('item-type');
|
||||
var itemSource = $dropDown.data('item-source');
|
||||
var itemSourceName = $dropDown.data('item-source-name');
|
||||
var expirationDate = '';
|
||||
if ($('#expirationCheckbox').is(':checked') === true) {
|
||||
expirationDate = $( "#expirationDate" ).val();
|
||||
}
|
||||
var permissions = 0;
|
||||
var $button = $(this);
|
||||
var $loading = $dropDown.find('#allowPublicUploadWrapper .icon-loading-small');
|
||||
|
||||
if (!$loading.hasClass('hidden')) {
|
||||
// already in progress
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculate permissions
|
||||
if (allowPublicUpload) {
|
||||
permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ;
|
||||
} else {
|
||||
permissions = OC.PERMISSION_READ;
|
||||
}
|
||||
|
||||
// Update the share information
|
||||
$button.addClass('hidden');
|
||||
$button.prop('disabled', true);
|
||||
$loading.removeClass('hidden');
|
||||
OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, expirationDate, function(data) {
|
||||
$loading.addClass('hidden');
|
||||
$button.removeClass('hidden');
|
||||
$button.prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '#dropdown #expirationCheckbox', function() {
|
||||
if (this.checked) {
|
||||
OC.Share.showExpirationDate('');
|
||||
|
|
|
@ -94,7 +94,8 @@
|
|||
throw 'missing OC.Share.ShareConfigModel';
|
||||
}
|
||||
|
||||
_.bindAll(this, 'onLinkCheckBoxChange', 'onPasswordEntered', 'onShowPasswordClick');
|
||||
_.bindAll(this, 'onLinkCheckBoxChange', 'onPasswordEntered',
|
||||
'onShowPasswordClick', 'onAllowPublicUploadChange');
|
||||
},
|
||||
|
||||
onLinkCheckBoxChange: function() {
|
||||
|
@ -149,6 +150,12 @@
|
|||
this.model.addLinkShare({password: password});
|
||||
},
|
||||
|
||||
onAllowPublicUploadChange: function() {
|
||||
this.$el.find('#sharingDialogAllowPublicUpload')
|
||||
.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
|
||||
this.model.setPublicUpload(this.$el.find('#sharingDialogAllowPublicUpload').is(':checked'));
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var linkShareTemplate = this.template();
|
||||
|
||||
|
@ -199,6 +206,7 @@
|
|||
}));
|
||||
|
||||
this.$el.find('#linkCheckbox').change(this.onLinkCheckBoxChange);
|
||||
this.$el.find('#sharingDialogAllowPublicUpload').change(this.onAllowPublicUploadChange);
|
||||
this.$el.find('#linkText').click(this.onLinkTextClick);
|
||||
this.$el.find('#showPassword').click(this.onShowPasswordClick);
|
||||
this.$el.find('#linkPassText').focusout(this.onPasswordEntered);
|
||||
|
|
|
@ -132,6 +132,15 @@
|
|||
});
|
||||
},
|
||||
|
||||
setPublicUpload: function(allow) {
|
||||
var permissions = OC.PERMISSION_READ;
|
||||
if(allow) {
|
||||
permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ;
|
||||
}
|
||||
|
||||
this.addLinkShare({permissions: permissions});
|
||||
},
|
||||
|
||||
addShare: function(event, selected, options) {
|
||||
event.preventDefault();
|
||||
|
||||
|
|
Loading…
Reference in New Issue