From 294274adc6f10373f2dcd0edd97c449b3898e6d3 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 18 Jul 2016 23:47:01 +0200 Subject: [PATCH] Use event dispatcher Registers the JS via event dispatchers. Otherwise the JS is not loaded when somebody has pretty URLs configured. --- appinfo/app.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index 674f286d..d52a1628 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -43,15 +43,14 @@ $navigationEntry = function () use ($c) { $c->getServer()->getNavigationManager()->add($navigationEntry); //Script for registering file actions -$request = \OC::$server->getRequest(); -if (isset($request->server['REQUEST_URI'])) { - $url = $request->server['REQUEST_URI']; - - if (preg_match('%index.php/apps/files(/.*)?%', $url)) { +$eventDispatcher = \OC::$server->getEventDispatcher(); +$eventDispatcher->addListener( + 'OCA\Files::loadAdditionalScripts', + function() { \OCP\Util::addScript('richdocuments', 'viewer/viewer'); \OCP\Util::addStyle('richdocuments', 'viewer/odfviewer'); } -} +); //Listen to delete file signal \OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Richdocuments\Storage", "onDelete");