‪TYPO3CMS  9.5
ElementBrowserFramesetController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use Psr\Http\Message\ResponseInterface;
18 use Psr\Http\Message\ServerRequestInterface;
24 
31 {
37  public ‪$content;
38 
42  protected ‪$pageRenderer;
43 
47  public function ‪__construct()
48  {
49  trigger_error(
50  self::class . ' will be removed in TYPO3 v10.0. Use route wizard_element_browser instead.',
51  E_USER_DEPRECATED
52  );
53  ‪$GLOBALS['SOBE'] = $this;
54  }
55 
63  public function ‪mainAction(ServerRequestInterface $request): ResponseInterface
64  {
65  $this->‪main();
66  return new ‪HtmlResponse($this->content);
67  }
68 
73  public function ‪main()
74  {
75  // Setting GPvars:
76  $mode = GeneralUtility::_GP('mode');
77  $bparams = GeneralUtility::_GP('bparams');
79  $uriBuilder = GeneralUtility::makeInstance(\‪TYPO3\CMS\Backend\Routing\UriBuilder::class);
80  $moduleUrl = (string)$uriBuilder->buildUriFromRoute('wizard_element_browser') . '&mode=';
81  $documentTemplate = $this->‪getDocumentTemplate();
82  $documentTemplate->JScode = GeneralUtility::wrapJS('
83  function closing() { //
84  close();
85  }
86  function setParams(mode,params) { //
87  parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params;
88  }
89  if (!window.opener) {
90  alert("ERROR: Sorry, no link to main window... Closing");
91  close();
92  }
93  ');
94 
95  // build the header part
96  $documentTemplate->startPage($this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:TYPO3_Element_Browser'));
97 
98  // URL for the inner main frame:
99  $url = $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
100 
101  // Create the frameset for the window
102  // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
103  $this->content = $this->‪getPageRenderer()->‪render(‪PageRenderer::PART_HEADER) .
104  '<frameset rows="*,1" framespacing="0" frameborder="0" border="0">
105  <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
106  <frame name="menu" src="' . htmlspecialchars((string)$uriBuilder->buildUriFromRoute('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
107  </frameset>
108  </html>
109  ';
110  }
111 
115  protected function ‪getDocumentTemplate()
116  {
117  return ‪$GLOBALS['TBE_TEMPLATE'];
118  }
119 
123  protected function ‪getLanguageService()
124  {
125  return ‪$GLOBALS['LANG'];
126  }
127 
131  protected function ‪getPageRenderer()
132  {
133  if ($this->pageRenderer === null) {
134  $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
135  }
136 
137  return ‪$this->pageRenderer;
138  }
139 }
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\getPageRenderer
‪PageRenderer getPageRenderer()
Definition: ElementBrowserFramesetController.php:129
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController
Definition: ElementBrowserFramesetController.php:31
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\getLanguageService
‪LanguageService getLanguageService()
Definition: ElementBrowserFramesetController.php:121
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\getDocumentTemplate
‪DocumentTemplate getDocumentTemplate()
Definition: ElementBrowserFramesetController.php:113
‪TYPO3
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\__construct
‪__construct()
Definition: ElementBrowserFramesetController.php:45
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\$content
‪string $content
Definition: ElementBrowserFramesetController.php:36
‪TYPO3\CMS\Core\Page\PageRenderer
Definition: PageRenderer.php:35
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\main
‪main()
Definition: ElementBrowserFramesetController.php:71
‪TYPO3\CMS\Backend\Template\DocumentTemplate
Definition: DocumentTemplate.php:48
‪TYPO3\CMS\Core\Page\PageRenderer\render
‪string render($part=self::PART_COMPLETE)
Definition: PageRenderer.php:1763
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\mainAction
‪ResponseInterface mainAction(ServerRequestInterface $request)
Definition: ElementBrowserFramesetController.php:61
‪TYPO3\CMS\Recordlist\Controller
Definition: AbstractLinkBrowserController.php:2
‪TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController\$pageRenderer
‪PageRenderer $pageRenderer
Definition: ElementBrowserFramesetController.php:40
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Page\PageRenderer\PART_HEADER
‪const PART_HEADER
Definition: PageRenderer.php:38
‪TYPO3\CMS\Core\Http\HtmlResponse
Definition: HtmlResponse.php:25