summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-09-08 21:18:28 +0200
committerGitHub <noreply@github.com>2016-09-08 21:18:28 +0200
commitc16aefcff50b9e63fdc6aaa3c2307b0983bbd56e (patch)
tree3f14f6aaa6d54b437cc5d104f3fe61147280979f /apps
parent5ac26d12f0a771bcaf8a44acdb469b68daebc446 (diff)
parent268c5a0aa010cda1438a32fbbd9d433ebc555902 (diff)
downloadnextcloud-server-c16aefcff50b9e63fdc6aaa3c2307b0983bbd56e.tar.gz
nextcloud-server-c16aefcff50b9e63fdc6aaa3c2307b0983bbd56e.zip
Merge pull request #1317 from nextcloud/add-sharing-disclaimer
Adding a optional disclaimer to the anonymous upload page
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/css/public.css10
-rw-r--r--apps/files_sharing/lib/Controllers/ShareController.php1
-rw-r--r--apps/files_sharing/templates/public.php5
-rw-r--r--apps/files_sharing/tests/Controllers/ShareControllerTest.php8
4 files changed, 22 insertions, 2 deletions
diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css
index 4c5f847f9ff..1bb83106543 100644
--- a/apps/files_sharing/css/public.css
+++ b/apps/files_sharing/css/public.css
@@ -168,6 +168,10 @@ thead {
margin: 0 auto;
}
+#emptycontent.has-disclaimer {
+ margin-top: 10vh;
+}
+
#public-upload #emptycontent h2 {
margin: 10px 0 5px 0;
}
@@ -222,3 +226,9 @@ thead {
padding-left: 18px;
margin-right: 7px;
}
+
+.disclaimer {
+ margin: -20px auto 30px;
+ max-width: 400px;
+ text-align: left;
+}
diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php
index cd0d40048cf..5ccaab746fc 100644
--- a/apps/files_sharing/lib/Controllers/ShareController.php
+++ b/apps/files_sharing/lib/Controllers/ShareController.php
@@ -357,6 +357,7 @@ class ShareController extends Controller {
$shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true);
$shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024);
$shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024);
+ $shareTmpl['disclaimer'] = $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null);
// Load files we need
\OCP\Util::addScript('files', 'file-upload');
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 1b282f04a7a..bdedb04d244 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -104,10 +104,13 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
<?php } else { ?>
<input type="hidden" id="upload-only-interface" value="1"/>
<div id="public-upload">
- <div id="emptycontent" class="">
+ <div id="emptycontent" class="<?php if (!empty($_['disclaimer'])) { ?>has-disclaimer<?php } ?>">
<div id="displayavatar"><div class="avatardiv"></div></div>
<h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2>
<p><span class="icon-folder"></span> <?php p($_['filename']) ?></p>
+ <?php if (!empty($_['disclaimer'])) { ?>
+ <p class="disclaimer"><?php p($_['disclaimer']); ?></p>
+ <?php } ?>
<input type="file" name="files[]" class="hidden" multiple>
<a href="#" class="button icon-upload"><?php p($l->t('Select or drop files')) ?></a>
diff --git a/apps/files_sharing/tests/Controllers/ShareControllerTest.php b/apps/files_sharing/tests/Controllers/ShareControllerTest.php
index 34ed08629af..1b9fd401f78 100644
--- a/apps/files_sharing/tests/Controllers/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controllers/ShareControllerTest.php
@@ -357,6 +357,11 @@ class ShareControllerTest extends \Test\TestCase {
->method('getShareByToken')
->with('token')
->willReturn($share);
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('core', 'shareapi_public_link_disclaimertext', null)
+ ->willReturn('My disclaimer text');
$this->userManager->method('get')->with('ownerUID')->willReturn($owner);
@@ -385,7 +390,8 @@ class ShareControllerTest extends \Test\TestCase {
'previewMaxX' => 1024,
'previewMaxY' => 1024,
'hideFileList' => false,
- 'shareOwner' => 'ownerDisplay'
+ 'shareOwner' => 'ownerDisplay',
+ 'disclaimer' => 'My disclaimer text',
);
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();