Loading lib/Listeners/BeforeTemplateRenderedListener.php +13 −6 Original line number Diff line number Diff line Loading @@ -8,18 +8,22 @@ use \OCP\EventDispatcher\IEventListener; use OCP\Util; use OCP\IUserSession; use OCP\IRequest; use OCP\App\IAppManager; class BeforeTemplateRenderedListener implements IEventListener { private $util; private $userSession; private $request; private $appName; private Util $util; private IUserSession $userSession; private IRequest $request; private string $appName; private IAppManager $appManager; private const ONLYOFFICE_APP_ID = 'onlyoffice'; public function __construct($appName, Util $util, IUserSession $userSession, IRequest $request) { public function __construct($appName, Util $util, IUserSession $userSession, IRequest $request, IAppManager $appManager) { $this->appName = $appName; $this->util = $util; $this->userSession = $userSession; $this->request = $request; $this->appManager = $appManager; } public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent)) { Loading @@ -28,9 +32,12 @@ class BeforeTemplateRenderedListener implements IEventListener { $pathInfo = $this->request->getPathInfo(); if ($this->userSession->isLoggedIn()) { $this->util->addStyle($this->appName, 'icons'); $this->util->addScript($this->appName, $this->appName . '-onlyoffice-handler'); $this->util->addScript($this->appName, $this->appName . '-unified-search-encryption-message'); $this->util->addStyle($this->appName, 'unified-search-encryption-message'); if($this->appManager->isEnabledForUser(self::ONLYOFFICE_APP_ID)) { $this->util->addScript($this->appName, $this->appName . '-onlyoffice-handler'); } } if (strpos($pathInfo, '/apps/files/') !== false) { $this->util->addStyle($this->appName, 'files'); Loading Loading
lib/Listeners/BeforeTemplateRenderedListener.php +13 −6 Original line number Diff line number Diff line Loading @@ -8,18 +8,22 @@ use \OCP\EventDispatcher\IEventListener; use OCP\Util; use OCP\IUserSession; use OCP\IRequest; use OCP\App\IAppManager; class BeforeTemplateRenderedListener implements IEventListener { private $util; private $userSession; private $request; private $appName; private Util $util; private IUserSession $userSession; private IRequest $request; private string $appName; private IAppManager $appManager; private const ONLYOFFICE_APP_ID = 'onlyoffice'; public function __construct($appName, Util $util, IUserSession $userSession, IRequest $request) { public function __construct($appName, Util $util, IUserSession $userSession, IRequest $request, IAppManager $appManager) { $this->appName = $appName; $this->util = $util; $this->userSession = $userSession; $this->request = $request; $this->appManager = $appManager; } public function handle(Event $event): void { if (!($event instanceof BeforeTemplateRenderedEvent)) { Loading @@ -28,9 +32,12 @@ class BeforeTemplateRenderedListener implements IEventListener { $pathInfo = $this->request->getPathInfo(); if ($this->userSession->isLoggedIn()) { $this->util->addStyle($this->appName, 'icons'); $this->util->addScript($this->appName, $this->appName . '-onlyoffice-handler'); $this->util->addScript($this->appName, $this->appName . '-unified-search-encryption-message'); $this->util->addStyle($this->appName, 'unified-search-encryption-message'); if($this->appManager->isEnabledForUser(self::ONLYOFFICE_APP_ID)) { $this->util->addScript($this->appName, $this->appName . '-onlyoffice-handler'); } } if (strpos($pathInfo, '/apps/files/') !== false) { $this->util->addStyle($this->appName, 'files'); Loading