mirror of
https://github.com/nextcloud/tables.git
synced 2026-01-17 13:31:56 +00:00
Signed-off-by: Julius Härtl <jus@bitgrid.net> fix: Imports Signed-off-by: Julius Härtl <jus@bitgrid.net> chore: Move to new file picker api for esm compatibility Signed-off-by: Julius Härtl <jus@bitgrid.net> fix: Make CI pass Signed-off-by: Julius Härtl <jus@bitgrid.net> fix: Update file picker usage Signed-off-by: Julius Härtl <jus@bitgrid.net> ci: Fix cypress Signed-off-by: Julius Härtl <jus@bitgrid.net> fix file picker Signed-off-by: Julius Härtl <jus@bitgrid.net> fix cypress Signed-off-by: Julius Härtl <jus@bitgrid.net> fix: Proper css for all entrypoints Signed-off-by: Julius Härtl <jus@bitgrid.net> fix: Properly load styles Signed-off-by: Julius Härtl <jus@bitgrid.net>
76 lines
2.0 KiB
PHP
76 lines
2.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\Tables\Controller;
|
|
|
|
use OCA\Tables\AppInfo\Application;
|
|
use OCA\Text\Event\LoadEditor;
|
|
use OCA\Viewer\Event\LoadViewer;
|
|
use OCP\AppFramework\Controller;
|
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
|
use OCP\AppFramework\Http\Attribute\OpenAPI;
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
|
use OCP\AppFramework\Services\IInitialState;
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
|
use OCP\INavigationManager;
|
|
use OCP\IRequest;
|
|
use OCP\Util;
|
|
|
|
class PageController extends Controller {
|
|
|
|
public function __construct(
|
|
IRequest $request,
|
|
protected IEventDispatcher $eventDispatcher,
|
|
protected INavigationManager $navigationManager,
|
|
protected IInitialState $initialState,
|
|
) {
|
|
parent::__construct(Application::APP_ID, $request);
|
|
}
|
|
|
|
/**
|
|
* Render default template
|
|
*/
|
|
#[NoAdminRequired]
|
|
#[NoCSRFRequired]
|
|
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
|
public function index(): TemplateResponse {
|
|
Util::addScript(Application::APP_ID, 'tables-main');
|
|
Util::addStyle(Application::APP_ID, 'grid');
|
|
Util::addStyle(Application::APP_ID, 'modal');
|
|
Util::addStyle(Application::APP_ID, 'tiptap');
|
|
Util::addStyle(Application::APP_ID, 'tables-style');
|
|
|
|
if (class_exists(LoadViewer::class)) {
|
|
$this->eventDispatcher->dispatchTyped(new LoadViewer());
|
|
}
|
|
|
|
if (class_exists(LoadEditor::class)) {
|
|
$this->eventDispatcher->dispatchTyped(new LoadEditor());
|
|
}
|
|
|
|
return new TemplateResponse(Application::APP_ID, 'main');
|
|
}
|
|
|
|
/**
|
|
* Render default template
|
|
*
|
|
* @psalm-param int<0, max> $appId
|
|
*/
|
|
#[NoAdminRequired]
|
|
#[NoCSRFRequired]
|
|
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
|
public function context(int $contextId): TemplateResponse {
|
|
$navId = Application::APP_ID . '_application_' . $contextId;
|
|
$this->navigationManager->setActiveEntry($navId);
|
|
|
|
$this->initialState->provideInitialState('contextId', $contextId);
|
|
|
|
return $this->index();
|
|
}
|
|
}
|