restructure code
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
This commit is contained in:
parent
30d4024d9d
commit
5756d96ab9
|
@ -455,33 +455,30 @@ class ShareController extends AuthPublicShareController {
|
|||
|
||||
if ($isNoneFileDropFolder && !$share->getHideDownload()) {
|
||||
\OCP\Util::addScript('files_sharing', 'public_note');
|
||||
if ($shareIsFolder && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
|
||||
$response->setHeaderActions([
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download-white', $shareTmpl['downloadURL'], 0),
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']),
|
||||
new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']),
|
||||
new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $shareTmpl['owner'], $shareTmpl['displayName'], $shareTmpl['filename']),
|
||||
]);
|
||||
} elseif ($shareIsFolder && !$this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
|
||||
$response->setHeaderActions([
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download-white', $shareTmpl['downloadURL'], 0),
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']),
|
||||
new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']),
|
||||
]);
|
||||
} elseif (!$this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
|
||||
$response->setHeaderActions([
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download-white', $shareTmpl['downloadURL'], 0),
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']),
|
||||
new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']),
|
||||
]);
|
||||
} else {
|
||||
$response->setHeaderActions([
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download-white', $shareTmpl['downloadURL'], 0),
|
||||
new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']),
|
||||
new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']),
|
||||
new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $shareTmpl['owner'], $shareTmpl['displayName'], $shareTmpl['filename']),
|
||||
]);
|
||||
|
||||
|
||||
$downloadWhite = new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download-white', $shareTmpl['downloadURL'], 0);
|
||||
$downloadAllWhite = new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download-white', $shareTmpl['downloadURL'], 0);
|
||||
$download = new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']);
|
||||
$downloadAll = new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']);
|
||||
$directLink = new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']);
|
||||
$externalShare = new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $shareTmpl['owner'], $shareTmpl['displayName'], $shareTmpl['filename']);
|
||||
|
||||
$responseComposer = [];
|
||||
|
||||
if ($shareIsFolder) {
|
||||
$responseComposer[] = $downloadAllWhite;
|
||||
$responseComposer[] = $downloadAll;
|
||||
} else {
|
||||
$responseComposer[] = $downloadWhite;
|
||||
$responseComposer[] = $download;
|
||||
}
|
||||
$responseComposer[] = $directLink;
|
||||
if ($this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
|
||||
$responseComposer[] = $externalShare;
|
||||
}
|
||||
|
||||
$response->setHeaderActions($responseComposer);
|
||||
}
|
||||
|
||||
$response->setContentSecurityPolicy($csp);
|
||||
|
|
Loading…
Reference in New Issue