TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ElementBrowserFramesetController.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Recordlist\Controller;
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 
29 {
35  public $content;
36 
40  protected $pageRenderer = null;
41 
45  public function __construct()
46  {
47  $GLOBALS['SOBE'] = $this;
48  }
49 
58  public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
59  {
60  $this->main();
61 
62  $response->getBody()->write($this->content);
63  return $response;
64  }
65 
72  public function main()
73  {
74  // Setting GPvars:
75  $mode = GeneralUtility::_GP('mode');
76  $bparams = GeneralUtility::_GP('bparams');
77  $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode=';
78  $documentTemplate = $this->getDocumentTemplate();
79  $documentTemplate->JScode = GeneralUtility::wrapJS('
80  function closing() { //
81  close();
82  }
83  function setParams(mode,params) { //
84  parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params;
85  }
86  if (!window.opener) {
87  alert("ERROR: Sorry, no link to main window... Closing");
88  close();
89  }
90  ');
91 
92  // build the header part
93  $documentTemplate->startPage($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:TYPO3_Element_Browser'));
94 
95  // URL for the inner main frame:
96  $url = $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
97 
98  // Create the frameset for the window
99  // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
100  $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) .
101  '<frameset rows="*,1" framespacing="0" frameborder="0" border="0">
102  <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
103  <frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
104  </frameset>
105  </html>
106  ';
107  }
108 
112  protected function getDocumentTemplate()
113  {
114  return $GLOBALS['TBE_TEMPLATE'];
115  }
116 
120  protected function getLanguageService()
121  {
122  return $GLOBALS['LANG'];
123  }
124 
128  protected function getPageRenderer()
129  {
130  if ($this->pageRenderer === null) {
131  $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
132  }
133 
134  return $this->pageRenderer;
135  }
136 }
mainAction(ServerRequestInterface $request, ResponseInterface $response)
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)