diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-09-12 17:02:03 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:28 +0200 |
commit | 9fe6d7c568221a77686de80634870e4a40e6ac29 (patch) | |
tree | c20cb643ed3b4c8ad3816d5826b296d68f414e48 /core/js/share.js | |
parent | 5dfaa0c82d93a075d063cc24ea4345a5943b0b1f (diff) | |
download | nextcloud-server-9fe6d7c568221a77686de80634870e4a40e6ac29.tar.gz nextcloud-server-9fe6d7c568221a77686de80634870e4a40e6ac29.zip |
implements setting and removing password for link shares, including forced ones
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/core/js/share.js b/core/js/share.js index 4b1e773c1ac..f97a91bd3ab 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -996,76 +996,6 @@ $(document).ready(function() { }); }); - $(document).on('click', '#dropdown #showPassword', function() { - $('#linkPass').slideToggle(OC.menuSpeed); - if (!$('#showPassword').is(':checked') ) { - var itemType = $('#dropdown').data('item-type'); - var itemSource = $('#dropdown').data('item-source'); - var itemSourceName = $('#dropdown').data('item-source-name'); - var allowPublicUpload = $('#sharingDialogAllowPublicUpload').is(':checked'); - var permissions = 0; - var $loading = $('#showPassword .icon-loading-small'); - - // Calculate permissions - if (allowPublicUpload) { - permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ; - } else { - permissions = OC.PERMISSION_READ; - } - - $loading.removeClass('hidden'); - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName).then(function() { - $loading.addClass('hidden'); - $('#linkPassText').attr('placeholder', t('core', 'Choose a password for the public link')); - }); - } else { - $('#linkPassText').focus(); - } - }); - - $(document).on('focusout keyup', '#dropdown #linkPassText', function(event) { - var linkPassText = $('#linkPassText'); - if ( linkPassText.val() != '' && (event.type == 'focusout' || event.keyCode == 13) ) { - var allowPublicUpload = $('#sharingDialogAllowPublicUpload').is(':checked'); - var dropDown = $('#dropdown'); - var itemType = dropDown.data('item-type'); - var itemSource = dropDown.data('item-source'); - var itemSourceName = $('#dropdown').data('item-source-name'); - var permissions = 0; - var $loading = dropDown.find('#linkPass .icon-loading-small'); - - // Calculate permissions - if (allowPublicUpload) { - permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ; - } else { - permissions = OC.PERMISSION_READ; - } - - var expireDateString = OC.Share.getDefaultExpirationDate(); - - $loading.removeClass('hidden'); - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $('#linkPassText').val(), permissions, itemSourceName, expireDateString, function(data) { - $loading.addClass('hidden'); - linkPassText.val(''); - linkPassText.attr('placeholder', t('core', 'Password protected')); - - if (oc_appconfig.core.enforcePasswordForPublicLink) { - OC.Share.showLink(data.token, "password set", itemSource); - OC.Share.updateIcon(itemType, itemSource); - } - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); - }, function(result) { - $loading.addClass('hidden'); - linkPassText.val(''); - linkPassText.attr('placeholder', result.data.message); - }); - - if (expireDateString !== '') { - OC.Share.showExpirationDate(expireDateString); - } - } - }); - $(document).on('click', '#dropdown #expirationCheckbox', function() { if (this.checked) { OC.Share.showExpirationDate(''); |