b68f40b9bac14cc579b9307ea2718f8f0cf4ee31
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Classes / Controller / ElementBrowserFramesetController.php
1 <?php
2 namespace TYPO3\CMS\Recordlist\Controller;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 /**
31 * Script Class, putting the frameset together.
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35 class ElementBrowserFramesetController {
36
37 // Internal, dynamic
38 /**
39 * @todo Define visibility
40 */
41 public $content;
42
43 /**
44 * Main function.
45 * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames.
46 *
47 * @return void
48 * @todo Define visibility
49 */
50 public function main() {
51 // Setting GPvars:
52 $mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode');
53 $bparams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('bparams');
54 // Set doktype:
55 $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_frames';
56 $GLOBALS['TBE_TEMPLATE']->JScode = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
57 function closing() { //
58 close();
59 }
60 function setParams(mode,params) { //
61 parent.content.location.href = "browse_links.php?mode="+mode+"&bparams="+params;
62 }
63 if (!window.opener) {
64 alert("ERROR: Sorry, no link to main window... Closing");
65 close();
66 }
67 ');
68 $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:TYPO3_Element_Browser'));
69 // URL for the inner main frame:
70 $url = $GLOBALS['BACK_PATH'] . 'browse_links.php?mode=' . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
71 // Create the frameset for the window:
72 // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
73 $this->content .= '
74 <frameset rows="*,1" framespacing="0" frameborder="0" border="0">
75 <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
76 <frame name="menu" src="' . $GLOBALS['BACK_PATH'] . 'dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
77 </frameset>
78 ';
79 $this->content .= '
80 </html>';
81 }
82
83 /**
84 * Outputs the page content.
85 *
86 * @return void
87 * @todo Define visibility
88 */
89 public function printContent() {
90 echo $this->content;
91 }
92
93 }
94
95
96 ?>