[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Classes / Controller / ElementBrowserFramesetController.php
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 use TYPO3\CMS\Backend\Utility\BackendUtility;
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * Script Class, putting the frameset together.
21 *
22 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
23 */
24 class ElementBrowserFramesetController {
25
26 // Internal, dynamic
27 /**
28 * @todo Define visibility
29 */
30 public $content;
31
32 /**
33 * Main function.
34 * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames.
35 *
36 * @return void
37 */
38 public function main() {
39 // Setting GPvars:
40 $mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode');
41 $bparams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('bparams');
42 $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode=';
43 // Set doktype:
44 $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_frames';
45 $GLOBALS['TBE_TEMPLATE']->JScode = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
46 function closing() { //
47 close();
48 }
49 function setParams(mode,params) { //
50 parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params;
51 }
52 if (!window.opener) {
53 alert("ERROR: Sorry, no link to main window... Closing");
54 close();
55 }
56 ');
57 $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:TYPO3_Element_Browser'));
58 // URL for the inner main frame:
59 $url = $GLOBALS['BACK_PATH'] . $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
60 // Create the frameset for the window:
61 // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
62 $this->content .= '
63 <frameset rows="*,1" framespacing="0" frameborder="0" border="0">
64 <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
65 <frame name="menu" src="' . $GLOBALS['BACK_PATH'] . 'dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
66 </frameset>
67 ';
68 $this->content .= '
69 </html>';
70 }
71
72 /**
73 * Outputs the page content.
74 *
75 * @return void
76 */
77 public function printContent() {
78 echo $this->content;
79 }
80
81 }