diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-09-08 09:13:59 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-09-08 18:44:27 +0200 |
commit | 6bb95de1c50208d6cbaf1242f86a2fdab09c2246 (patch) | |
tree | 47fa17b753a672e6d93c2186c517df2fd5b355b2 /settings/js/admin.js | |
parent | b3d3a95bf3e11a4689884f72f6d6021d4dcff97c (diff) | |
download | nextcloud-server-6bb95de1c50208d6cbaf1242f86a2fdab09c2246.tar.gz nextcloud-server-6bb95de1c50208d6cbaf1242f86a2fdab09c2246.zip |
Adding a optional disclaimer to the anonymous upload page
Diffstat (limited to 'settings/js/admin.js')
-rw-r--r-- | settings/js/admin.js | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/settings/js/admin.js b/settings/js/admin.js index fb59b3ba026..a2a1cef531c 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -90,7 +90,7 @@ $(document).ready(function(){ } }); - $('#shareAPI input:not(#excludedGroups)').change(function() { + $('#shareAPI input:not(.noJSAutoUpdate)').change(function() { var value = $(this).val(); if ($(this).attr('type') === 'checkbox') { if (this.checked) { @@ -106,6 +106,45 @@ $(document).ready(function(){ $("#setDefaultExpireDate").toggleClass('hidden', !this.checked); }); + $('#publicShareDisclaimer').change(function() { + $("#publicShareDisclaimerText").toggleClass('hidden', !this.checked); + if(!this.checked) { + savePublicShareDisclaimerText(''); + } + }); + + var savePublicShareDisclaimerText = _.debounce(function(value) { + var data = { + app:'core', + key:'shareapi_public_link_disclaimertext' + }; + if (_.isString(value) && value !== '') { + data['action'] = 'setValue'; + data['value'] = value; + } else { + data['action'] = 'deleteKey'; + $('#publicShareDisclaimerText').val(''); + } + + OC.msg.startSaving('#publicShareDisclaimerStatus'); + $.post( + OC.AppConfig.url, + data, + function(result){ + if(result.status === 'success'){ + OC.msg.finishedSuccess('#publicShareDisclaimerStatus', t('core', 'Saved')) + } else { + OC.msg.finishedError('#publicShareDisclaimerStatus', t('core', 'Not saved')) + } + }, + 'json' + ); + }, 500); + + $('#publicShareDisclaimerText').on('change, keyup', function() { + savePublicShareDisclaimerText(this.value); + }); + $('#allowLinks').change(function() { $("#publicLinkSettings").toggleClass('hidden', !this.checked); $('#setDefaultExpireDate').toggleClass('hidden', !(this.checked && $('#shareapiDefaultExpireDate')[0].checked)); |