summaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Controller
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-08-02 20:08:54 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2019-09-23 10:09:57 +0200
commit606b4d5bf3a1c51b3e71a42dfc4add3596464ae9 (patch)
treea5c60be75b9b40163d5ab337f1471053a40262b5 /apps/files/lib/Controller
parent48a00b88e18919232430a7f44881594da6d971da (diff)
downloadnextcloud-server-606b4d5bf3a1c51b3e71a42dfc4add3596464ae9.tar.gz
nextcloud-server-606b4d5bf3a1c51b3e71a42dfc4add3596464ae9.zip
Add new LoadAdditionalScriptsEvent
This adds a new event that is in the new style of event dispatching. This should allow more lazy loading and better sepeartion of concerns Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files/lib/Controller')
-rw-r--r--apps/files/lib/Controller/ViewController.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 509f927a295..518bbc1bf08 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -29,13 +29,14 @@
namespace OCA\Files\Controller;
use OCA\Files\Activity\Helper;
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
-use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\App\IAppManager;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
@@ -44,8 +45,6 @@ use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserSession;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class ViewController
@@ -63,7 +62,7 @@ class ViewController extends Controller {
protected $l10n;
/** @var IConfig */
protected $config;
- /** @var EventDispatcherInterface */
+ /** @var IEventDispatcher */
protected $eventDispatcher;
/** @var IUserSession */
protected $userSession;
@@ -79,7 +78,7 @@ class ViewController extends Controller {
IURLGenerator $urlGenerator,
IL10N $l10n,
IConfig $config,
- EventDispatcherInterface $eventDispatcherInterface,
+ IEventDispatcher $eventDispatcher,
IUserSession $userSession,
IAppManager $appManager,
IRootFolder $rootFolder,
@@ -91,7 +90,7 @@ class ViewController extends Controller {
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
$this->config = $config;
- $this->eventDispatcher = $eventDispatcherInterface;
+ $this->eventDispatcher = $eventDispatcher;
$this->userSession = $userSession;
$this->appManager = $appManager;
$this->rootFolder = $rootFolder;
@@ -267,8 +266,8 @@ class ViewController extends Controller {
];
}
- $event = new GenericEvent(null, ['hiddenFields' => []]);
- $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event);
+ $event = new LoadAdditionalScriptsEvent();
+ $this->eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, $event);
$params = [];
$params['usedSpacePercent'] = (int) $storageInfo['relative'];
@@ -285,7 +284,7 @@ class ViewController extends Controller {
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
$params['appNavigation'] = $nav;
$params['appContents'] = $contentItems;
- $params['hiddenFields'] = $event->getArgument('hiddenFields');
+ $params['hiddenFields'] = $event->getHiddenFields();
$response = new TemplateResponse(
$this->appName,