Adding a optional disclaimer to the anonymous upload page
This commit is contained in:
parent
b3d3a95bf3
commit
6bb95de1c5
|
@ -168,6 +168,10 @@ thead {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#emptycontent.has-disclaimer {
|
||||||
|
margin-top: 10vh;
|
||||||
|
}
|
||||||
|
|
||||||
#public-upload #emptycontent h2 {
|
#public-upload #emptycontent h2 {
|
||||||
margin: 10px 0 5px 0;
|
margin: 10px 0 5px 0;
|
||||||
}
|
}
|
||||||
|
@ -222,3 +226,10 @@ thead {
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
margin-right: 7px;
|
margin-right: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.disclaimer {
|
||||||
|
margin: -20px auto 30px;
|
||||||
|
max-width: 400px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
|
@ -357,6 +357,7 @@ class ShareController extends Controller {
|
||||||
$shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true);
|
$shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true);
|
||||||
$shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024);
|
$shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024);
|
||||||
$shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 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
|
// Load files we need
|
||||||
\OCP\Util::addScript('files', 'file-upload');
|
\OCP\Util::addScript('files', 'file-upload');
|
||||||
|
|
|
@ -104,10 +104,13 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<input type="hidden" id="upload-only-interface" value="1"/>
|
<input type="hidden" id="upload-only-interface" value="1"/>
|
||||||
<div id="public-upload">
|
<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>
|
<div id="displayavatar"><div class="avatardiv"></div></div>
|
||||||
<h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2>
|
<h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2>
|
||||||
<p><span class="icon-folder"></span> <?php p($_['filename']) ?></p>
|
<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>
|
<input type="file" name="files[]" class="hidden" multiple>
|
||||||
|
|
||||||
<a href="#" class="button icon-upload"><?php p($l->t('Select or drop files')) ?></a>
|
<a href="#" class="button icon-upload"><?php p($l->t('Select or drop files')) ?></a>
|
||||||
|
|
|
@ -65,6 +65,7 @@ class Sharing implements ISettings {
|
||||||
'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'),
|
'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'),
|
||||||
'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false,
|
'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false,
|
||||||
'shareExcludedGroupsList' => $excludeGroupsList,
|
'shareExcludedGroupsList' => $excludeGroupsList,
|
||||||
|
'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null),
|
||||||
];
|
];
|
||||||
|
|
||||||
return new TemplateResponse('settings', 'admin/sharing', $parameters, '');
|
return new TemplateResponse('settings', 'admin/sharing', $parameters, '');
|
||||||
|
|
|
@ -499,6 +499,14 @@ table.grid td.date{
|
||||||
display: inline-block;
|
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 */
|
/* correctly display help icons next to headings */
|
||||||
.icon-info {
|
.icon-info {
|
||||||
padding: 11px 20px;
|
padding: 11px 20px;
|
||||||
|
|
|
@ -90,7 +90,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shareAPI input:not(#excludedGroups)').change(function() {
|
$('#shareAPI input:not(.noJSAutoUpdate)').change(function() {
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if ($(this).attr('type') === 'checkbox') {
|
if ($(this).attr('type') === 'checkbox') {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
|
@ -106,6 +106,45 @@ $(document).ready(function(){
|
||||||
$("#setDefaultExpireDate").toggleClass('hidden', !this.checked);
|
$("#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() {
|
$('#allowLinks').change(function() {
|
||||||
$("#publicLinkSettings").toggleClass('hidden', !this.checked);
|
$("#publicLinkSettings").toggleClass('hidden', !this.checked);
|
||||||
$('#setDefaultExpireDate').toggleClass('hidden', !(this.checked && $('#shareapiDefaultExpireDate')[0].checked));
|
$('#setDefaultExpireDate').toggleClass('hidden', !(this.checked && $('#shareapiDefaultExpireDate')[0].checked));
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
|
<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
|
||||||
</p>
|
</p>
|
||||||
<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
|
<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 />
|
<br />
|
||||||
<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
|
<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
|
||||||
</p>
|
</p>
|
||||||
|
@ -104,4 +104,12 @@
|
||||||
<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> />
|
<?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 />
|
<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>
|
||||||
|
<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>
|
</div>
|
||||||
|
|
|
@ -109,6 +109,11 @@ class SharingTest extends TestCase {
|
||||||
->method('getAppValue')
|
->method('getAppValue')
|
||||||
->with('core', 'shareapi_exclude_groups', 'no')
|
->with('core', 'shareapi_exclude_groups', 'no')
|
||||||
->willReturn('no');
|
->willReturn('no');
|
||||||
|
$this->config
|
||||||
|
->expects($this->at(13))
|
||||||
|
->method('getAppValue')
|
||||||
|
->with('core', 'shareapi_public_link_disclaimertext', null)
|
||||||
|
->willReturn('Lorem ipsum');
|
||||||
|
|
||||||
$expected = new TemplateResponse(
|
$expected = new TemplateResponse(
|
||||||
'settings',
|
'settings',
|
||||||
|
@ -129,6 +134,7 @@ class SharingTest extends TestCase {
|
||||||
'shareEnforceExpireDate' => 'no',
|
'shareEnforceExpireDate' => 'no',
|
||||||
'shareExcludeGroups' => false,
|
'shareExcludeGroups' => false,
|
||||||
'shareExcludedGroupsList' => '',
|
'shareExcludedGroupsList' => '',
|
||||||
|
'publicShareDisclaimer' => 'Lorem ipsum',
|
||||||
],
|
],
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
@ -202,6 +208,11 @@ class SharingTest extends TestCase {
|
||||||
->method('getAppValue')
|
->method('getAppValue')
|
||||||
->with('core', 'shareapi_exclude_groups', 'no')
|
->with('core', 'shareapi_exclude_groups', 'no')
|
||||||
->willReturn('yes');
|
->willReturn('yes');
|
||||||
|
$this->config
|
||||||
|
->expects($this->at(13))
|
||||||
|
->method('getAppValue')
|
||||||
|
->with('core', 'shareapi_public_link_disclaimertext', null)
|
||||||
|
->willReturn('Lorem ipsum');
|
||||||
|
|
||||||
$expected = new TemplateResponse(
|
$expected = new TemplateResponse(
|
||||||
'settings',
|
'settings',
|
||||||
|
@ -222,6 +233,7 @@ class SharingTest extends TestCase {
|
||||||
'shareEnforceExpireDate' => 'no',
|
'shareEnforceExpireDate' => 'no',
|
||||||
'shareExcludeGroups' => true,
|
'shareExcludeGroups' => true,
|
||||||
'shareExcludedGroupsList' => 'NoSharers|OtherNoSharers',
|
'shareExcludedGroupsList' => 'NoSharers|OtherNoSharers',
|
||||||
|
'publicShareDisclaimer' => 'Lorem ipsum',
|
||||||
],
|
],
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue