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 | |
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')
-rw-r--r-- | settings/css/settings.css | 8 | ||||
-rw-r--r-- | settings/js/admin.js | 41 | ||||
-rw-r--r-- | settings/templates/admin/sharing.php | 10 |
3 files changed, 57 insertions, 2 deletions
diff --git a/settings/css/settings.css b/settings/css/settings.css index 6ed707f7c45..d66b0f82b55 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -499,6 +499,14 @@ table.grid td.date{ display: inline-block; } +#publicShareDisclaimerText { + width: calc(100% - 23px); /* 20 px left margin, 3 px right margin */ + max-width: 600px; + height: 150px; + margin-left: 20px; + box-sizing: border-box; +} + /* correctly display help icons next to headings */ .icon-info { padding: 11px 20px; 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)); diff --git a/settings/templates/admin/sharing.php b/settings/templates/admin/sharing.php index b8f8e920246..1c47d74770f 100644 --- a/settings/templates/admin/sharing.php +++ b/settings/templates/admin/sharing.php @@ -95,7 +95,7 @@ <label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/> </p> <p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>"> - <input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px"/> + <input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/> <br /> <em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em> </p> @@ -104,4 +104,12 @@ <?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> /> <label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username needs to be entered.'));?></label><br /> </p> + <p> + <input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate" + <?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> /> + <label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label> + <span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span> + <br/> + <textarea placeholder="This text will be shown on the public link upload page when the file list is hidden." id="publicShareDisclaimerText" <?php if ($_['publicShareDisclaimerText'] === null) { print_unescaped('class="hidden"'); } ?>><?php p($_['publicShareDisclaimerText']) ?></textarea> + </p> </div> |