Load viewer

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-12-08 13:15:21 +01:00
parent e92d34bfcb
commit d9ef7afa9e

View File

@@ -26,7 +26,10 @@ namespace OCA\Deck\Controller;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\Service\ConfigService; use OCA\Deck\Service\ConfigService;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCA\Files\Event\LoadSidebar;
use OCA\Viewer\Event\LoadViewer;
use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IInitialStateService; use OCP\IInitialStateService;
use OCP\IRequest; use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
@@ -34,23 +37,24 @@ use OCP\AppFramework\Controller;
class PageController extends Controller { class PageController extends Controller {
private $permissionService; private $permissionService;
private $userId;
private $l10n;
private $initialState; private $initialState;
private $configService; private $configService;
private $eventDispatcher;
public function __construct( public function __construct(
$AppName, $AppName,
IRequest $request, IRequest $request,
PermissionService $permissionService, PermissionService $permissionService,
IInitialStateService $initialStateService, IInitialStateService $initialStateService,
ConfigService $configService ConfigService $configService,
IEventDispatcher $eventDispatcher
) { ) {
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
$this->permissionService = $permissionService; $this->permissionService = $permissionService;
$this->initialState = $initialStateService; $this->initialState = $initialStateService;
$this->configService = $configService; $this->configService = $configService;
$this->eventDispatcher = $eventDispatcher;
} }
/** /**
@@ -65,6 +69,11 @@ class PageController extends Controller {
$this->initialState->provideInitialState(Application::APP_ID, 'canCreate', $this->permissionService->canCreate()); $this->initialState->provideInitialState(Application::APP_ID, 'canCreate', $this->permissionService->canCreate());
$this->initialState->provideInitialState(Application::APP_ID, 'config', $this->configService->getAll()); $this->initialState->provideInitialState(Application::APP_ID, 'config', $this->configService->getAll());
$this->eventDispatcher->dispatchTyped(new LoadSidebar());
if (class_exists(LoadViewer::class)) {
$this->eventDispatcher->dispatchTyped(new LoadViewer());
}
$response = new TemplateResponse('deck', 'main'); $response = new TemplateResponse('deck', 'main');
if (\OC::$server->getConfig()->getSystemValueBool('debug', false)) { if (\OC::$server->getConfig()->getSystemValueBool('debug', false)) {