From 8a13851da8906a4eed3c7b59d01f5a172c90371c Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Thu, 25 Jan 2018 18:53:09 +0100 Subject: Use PublicTemplateResponse for files_sharing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/lib/Controller/ShareController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'apps/files_sharing/lib/Controller') diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index 795d069c1b8..0b0c551a153 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -38,6 +38,10 @@ namespace OCA\Files_Sharing\Controller; use OC_Files; use OC_Util; use OCA\FederatedFileSharing\FederatedShareProvider; +use OCA\Files_Sharing\Template\ExternalShareMenuAction; +use OCA\Files_Sharing\Template\LinkMenuAction; +use OCP\AppFramework\Http\Template\SimpleMenuAction; +use OCP\AppFramework\Http\Template\PublicTemplateResponse; use OCP\Defaults; use OCP\IL10N; use OCP\Template; @@ -435,7 +439,17 @@ class ShareController extends Controller { $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); - $response = new TemplateResponse($this->appName, 'public', $shareTmpl, 'base'); + + $response = new PublicTemplateResponse($this->appName, 'public', $shareTmpl); + $response->setHeaderTitle($share->getNode()->getName()); + $response->setHeaderDetails($this->l10n->t('shared by %s', [$shareTmpl['displayName']])); + $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']), + ]); + $response->setContentSecurityPolicy($csp); $this->emitAccessShareHook($share); -- cgit v1.2.3