diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-03-04 15:51:40 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-03-11 11:28:27 +0300 |
commit | 92a6530c0f8bf50e94a0b5d23e3f334ac76a2941 (patch) | |
tree | 55f16ca60661fd6266668162712ba3d5bda4a7de /apps | |
parent | 6c968fe77db0ef96e16b103f47e318531f3d33be (diff) |
Properly emit Viewer event on files and files_sharing
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareController.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/list.php | 6 |
3 files changed, 17 insertions, 0 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 688db41f8b0..015f34941de 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -39,6 +39,7 @@ namespace OCA\Files\Controller; use OCA\Files\Activity\Helper; use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\Files\Event\LoadSidebar; +use OCA\Viewer\Event\LoadViewer; use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\ContentSecurityPolicy; @@ -281,6 +282,10 @@ class ViewController extends Controller { $this->eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, $event); $this->eventDispatcher->dispatch(LoadSidebar::class, new LoadSidebar()); + // Load Viewer scripts + if (class_exists(LoadViewer::class)) { + $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); + } $params = []; $params['usedSpacePercent'] = (int) $storageInfo['relative']; diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index 274d4bd23c0..3feb98f7f02 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -46,6 +46,7 @@ use OC_Util; use OC\Security\CSP\ContentSecurityPolicy; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\Files_Sharing\Activity\Providers\Downloads; +use OCA\Viewer\Event\LoadViewer; use OCP\AppFramework\AuthPublicShareController; use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\Template\ExternalShareMenuAction; @@ -453,6 +454,11 @@ class ShareController extends AuthPublicShareController { \OCP\Util::addScript('files', 'filelist'); \OCP\Util::addScript('files', 'keyboardshortcuts'); \OCP\Util::addScript('files', 'operationprogressbar'); + + // Load Viewer scripts + if (class_exists(LoadViewer::class)) { + $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); + } } // OpenGraph Support: http://ogp.me/ diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php index 8197224af52..370ca53c6b4 100644 --- a/apps/files_sharing/list.php +++ b/apps/files_sharing/list.php @@ -23,6 +23,7 @@ */ use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\Files\Event\LoadSidebar; +use OCA\Viewer\Event\LoadViewer; use OCP\EventDispatcher\GenericEvent; // Check if we are a user @@ -44,4 +45,9 @@ $eventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts' $eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, new LoadAdditionalScriptsEvent()); $eventDispatcher->dispatch(LoadSidebar::class, new LoadSidebar()); +// Load Viewer scripts +if (class_exists(LoadViewer::class)) { + $eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); +} + $tmpl->printPage(); |