‪TYPO3CMS  ‪main
OpenDocumentController.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseInterface;
21 use Psr\Http\Message\ServerRequestInterface;
26 
33 #[AsController]
35 {
36  public function ‪__construct(
37  protected readonly ‪OpenDocumentService $documents,
38  protected readonly ‪OpendocsToolbarItem $toolbarItem
39  ) {}
40 
44  public function ‪renderMenu(ServerRequestInterface $request): ResponseInterface
45  {
46  $this->toolbarItem->setRequest($request);
47  return new ‪HtmlResponse($this->toolbarItem->getDropDown());
48  }
49 
53  public function ‪closeDocument(ServerRequestInterface $request): ResponseInterface
54  {
55  ‪$identifier = $request->getParsedBody()['md5sum'] ?? $request->getQueryParams()['md5sum'] ?? null;
56  if (‪$identifier) {
57  $this->documents->closeDocument(‪$identifier);
58  } else {
59  $this->documents->closeAllDocuments();
60  }
61  return $this->‪renderMenu($request);
62  }
63 }
‪TYPO3\CMS\Opendocs\Backend\ToolbarItems\OpendocsToolbarItem
Definition: OpendocsToolbarItem.php:37
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\closeDocument
‪closeDocument(ServerRequestInterface $request)
Definition: OpenDocumentController.php:53
‪TYPO3\CMS\Opendocs\Service\OpenDocumentService
Definition: OpenDocumentService.php:27
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController
Definition: OpenDocumentController.php:35
‪TYPO3\CMS\Opendocs\Controller
Definition: OpenDocumentController.php:18
‪TYPO3\CMS\Backend\Attribute\AsController
Definition: AsController.php:25
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\__construct
‪__construct(protected readonly OpenDocumentService $documents, protected readonly OpendocsToolbarItem $toolbarItem)
Definition: OpenDocumentController.php:36
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\renderMenu
‪renderMenu(ServerRequestInterface $request)
Definition: OpenDocumentController.php:44
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37
‪TYPO3\CMS\Core\Http\HtmlResponse
Definition: HtmlResponse.php:28