2 /***************************************************************
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Displays the page/file tree for browsing database records or files.
29 * Used from TCEFORMS an other elements
30 * In other words: This is the ELEMENT BROWSER!
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
36 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
39 * [CLASS/FUNCTION INDEX of SCRIPT]
43 * 78: class SC_browse_links
44 * 99: function init ()
45 * 120: function main()
46 * 174: function printContent()
49 * (This index is automatically created/updated by the extension "extdeveval")
54 require ('template.php');
55 $LANG->includeLLFile('EXT:lang/locallang_browse_links.xml');
57 require_once (PATH_typo3
.'/class.browse_links.php');
72 * Script class for the Element Browser window.
74 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
78 class SC_browse_links
{
82 * The mode determines the main kind of output from the element browser.
83 * There are these options for values: rte, db, file, filedrag, wizard.
84 * "rte" will show the link selector for the Rich Text Editor (see main_rte())
85 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db())
86 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file())
87 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1))
94 * holds Instance of main browse_links class
95 * needed fo intercommunication between various classes that need access to variables via $GLOBALS['SOBE']
96 * Not the most nice solution but introduced since we don't have another general way to return class-instances or registry for now
105 * not really needed but for backwards compatibility ...
112 $this->mode
= t3lib_div
::_GP('mode');
117 // Creating backend template object:
118 // this might not be needed but some classes refer to $GLOBALS['SOBE']->doc, so ...
119 $this->doc
= t3lib_div
::makeInstance('template');
120 $this->doc
->docType
= 'xhtml_trans';
121 $this->doc
->backPath
= $GLOBALS['BACK_PATH'];
126 * Main function, detecting the current mode of the element browser and branching out to internal methods.
131 global $BE_USER, $BACK_PATH;
135 // render type by user func
136 $browserRendered = false
;
137 if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
138 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
139 $browserRenderObj = t3lib_div
::getUserObj($classRef);
140 if(is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
141 if ($browserRenderObj->isValid($this->mode
, $this)) {
142 $this->content
.= $browserRenderObj->render($this->mode
, $this);
143 $browserRendered = true
;
150 // if type was not rendered use default rendering functions
151 if(!$browserRendered) {
153 $this->browser
= t3lib_div
::makeInstance('browse_links');
154 $this->browser
->init();
156 $modData = $BE_USER->getModuleData('browse_links.php','ses');
157 list($modData, $store) = $this->browser
->processSessionData($modData);
158 $BE_USER->pushModuleData('browse_links.php',$modData);
160 // Output the correct content according to $this->mode
161 switch((string)$this->mode
) {
163 $this->content
= $this->browser
->main_rte();
166 $this->content
= $this->browser
->main_db();
170 $this->content
= $this->browser
->main_file();
173 $this->content
= $this->browser
->main_rte(1);
180 * Print module content
184 function printContent() {
192 // Include extension?
193 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/browse_links.php']) {
194 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/browse_links.php']);
205 $SOBE = t3lib_div
::makeInstance('SC_browse_links');
208 $SOBE->printContent();