* Fixes and features to htmlArea RTE extension (see details in local ChangeLog)
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / mod4 / select_image.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 * (c) 2004-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
19 *
20 *
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
28 /**
29 * Displays image selector for the RTE
30 *
31 * @author Kasper Skaarhoj <kasper@typo3.com>
32 * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
33 *
34 * $Id$ *
35 */
36
37 error_reporting (E_ALL ^ E_NOTICE);
38 unset($MCONF);
39 require('conf.php');
40 require($BACK_PATH.'init.php');
41 require($BACK_PATH.'template.php');
42 require_once('class.tx_rtehtmlarea_select_image.php');
43 $LANG->includeLLFile('EXT:lang/locallang_browse_links.xml');
44 $LANG->includeLLFile('EXT:rtehtmlarea/mod4/locallang.xml');
45 $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
46
47 /**
48 * Script class for the Element Browser window.
49 *
50 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
51 * @package TYPO3
52 * @subpackage core
53 */
54 class tx_rtehtmlarea_SC_select_image {
55 var $mode;
56 var $button = 'image';
57
58 /**
59 * Main function, detecting the current mode of the element browser and branching out to internal methods.
60 *
61 * @return void
62 */
63 function main() {
64 global $BE_USER, $SOBE;
65
66
67 $this->mode = t3lib_div::_GP('mode');
68 if (!$this->mode) {
69 $this->mode = 'rte';
70 }
71
72 $this->content = '';
73
74 // render type by user func
75 $browserRendered = false;
76 if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
77 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
78 $browserRenderObj = t3lib_div::getUserObj($classRef);
79 if(is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
80 if ($browserRenderObj->isValid($this->mode, $this)) {
81 $this->content .= $browserRenderObj->render($this->mode, $this);
82 $browserRendered = true;
83 break;
84 }
85 }
86 }
87 }
88
89 // if type was not rendered use default rendering functions
90 if(!$browserRendered) {
91
92 $SOBE->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
93 $SOBE->browser->init();
94
95 $modData = $BE_USER->getModuleData('select_image.php','ses');
96 list($modData, $store) = $SOBE->browser->processSessionData($modData);
97 $BE_USER->pushModuleData('select_image.php',$modData);
98
99 $this->content = $SOBE->browser->main_rte();
100 }
101 }
102
103 /**
104 * Print module content
105 *
106 * @return void
107 */
108 function printContent() {
109 echo $this->content;
110 }
111
112 }
113
114 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']) {
115 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']);
116 }
117
118 // Make instance:
119 $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_select_image');
120 $SOBE->main();
121 $SOBE->printContent();
122
123 ?>