diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-07-19 00:47:01 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-07-19 00:47:01 +0300 |
commit | 294274adc6f10373f2dcd0edd97c449b3898e6d3 (patch) | |
tree | 6239046451a39d57e2bdd57bc3a1f1e2f641aacd /appinfo | |
parent | e906c47ef5204882bf1ad9931a7c6d38ad6ef47a (diff) |
Use event dispatcher
Registers the JS via event dispatchers. Otherwise the JS is not loaded when somebody has pretty URLs configured.
Diffstat (limited to 'appinfo')
-rw-r--r-- | appinfo/app.php | 11 |
1 files 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"); |