|
|
|
|
@ -956,80 +956,6 @@ $(document).ready(function() { |
|
|
|
|
permissions); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(document).on('change', '#dropdown #linkCheckbox', function() { |
|
|
|
|
var $dropDown = $('#dropdown'); |
|
|
|
|
var itemType = $dropDown.data('item-type'); |
|
|
|
|
var itemSource = $dropDown.data('item-source'); |
|
|
|
|
var itemSourceName = $dropDown.data('item-source-name'); |
|
|
|
|
var $loading = $dropDown.find('#link .icon-loading-small'); |
|
|
|
|
var $button = $(this); |
|
|
|
|
|
|
|
|
|
if (!$loading.hasClass('hidden')) { |
|
|
|
|
// already in progress
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.checked) { |
|
|
|
|
// Reset password placeholder
|
|
|
|
|
$('#linkPassText').attr('placeholder', t('core', 'Choose a password for the public link')); |
|
|
|
|
// Reset link
|
|
|
|
|
$('#linkText').val(''); |
|
|
|
|
$('#showPassword').prop('checked', false); |
|
|
|
|
$('#linkPass').hide(); |
|
|
|
|
$('#sharingDialogAllowPublicUpload').prop('checked', false); |
|
|
|
|
$('#expirationCheckbox').prop('checked', false); |
|
|
|
|
$('#expirationDate').hide(); |
|
|
|
|
var expireDateString = ''; |
|
|
|
|
// Create a link
|
|
|
|
|
if (oc_appconfig.core.enforcePasswordForPublicLink === false) { |
|
|
|
|
expireDateString = OC.Share.getDefaultExpirationDate(); |
|
|
|
|
$loading.removeClass('hidden'); |
|
|
|
|
$button.addClass('hidden'); |
|
|
|
|
$button.prop('disabled', true); |
|
|
|
|
|
|
|
|
|
OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, itemSourceName, expireDateString, function(data) { |
|
|
|
|
$loading.addClass('hidden'); |
|
|
|
|
$button.removeClass('hidden'); |
|
|
|
|
$button.prop('disabled', false); |
|
|
|
|
OC.Share.showLink(data.token, null, itemSource); |
|
|
|
|
$('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); |
|
|
|
|
OC.Share.updateIcon(itemType, itemSource); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
$('#linkPass').slideToggle(OC.menuSpeed); |
|
|
|
|
// TODO drop with IE8 drop
|
|
|
|
|
if($('html').hasClass('ie8')) { |
|
|
|
|
$('#linkPassText').attr('placeholder', null); |
|
|
|
|
$('#linkPassText').val(''); |
|
|
|
|
} |
|
|
|
|
$('#linkPassText').focus(); |
|
|
|
|
} |
|
|
|
|
if (expireDateString !== '') { |
|
|
|
|
OC.Share.showExpirationDate(expireDateString); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// Delete private link
|
|
|
|
|
OC.Share.hideLink(); |
|
|
|
|
$('#expiration').slideUp(OC.menuSpeed); |
|
|
|
|
if ($('#linkText').val() !== '') { |
|
|
|
|
$loading.removeClass('hidden'); |
|
|
|
|
$button.addClass('hidden'); |
|
|
|
|
$button.prop('disabled', true); |
|
|
|
|
OC.Share.unshare(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', function() { |
|
|
|
|
$loading.addClass('hidden'); |
|
|
|
|
$button.removeClass('hidden'); |
|
|
|
|
$button.prop('disabled', false); |
|
|
|
|
OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = false; |
|
|
|
|
$('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); |
|
|
|
|
OC.Share.updateIcon(itemType, itemSource); |
|
|
|
|
if (typeof OC.Share.statuses[itemSource] === 'undefined') { |
|
|
|
|
$('#expiration').slideUp(OC.menuSpeed); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(document).on('click', '#dropdown #linkText', function() { |
|
|
|
|
$(this).focus(); |
|
|
|
|
$(this).select(); |
|
|
|
|
|