|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 /** 00028 * Displays the page/file tree for browsing database records or files. 00029 * Used from TCEFORMS an other elements 00030 * In other words: This is the ELEMENT BROWSER! 00031 * 00032 * $Id: browse_links.php 10121 2011-01-18 20:15:30Z ohader $ 00033 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj 00034 * XHTML compliant 00035 * 00036 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00037 */ 00038 /** 00039 * [CLASS/FUNCTION INDEX of SCRIPT] 00040 * 00041 * 00042 * 00043 * 78: class SC_browse_links 00044 * 99: function init () 00045 * 120: function main() 00046 * 174: function printContent() 00047 * 00048 * TOTAL FUNCTIONS: 3 00049 * (This index is automatically created/updated by the extension "extdeveval") 00050 * 00051 */ 00052 $BACK_PATH=''; 00053 require ('init.php'); 00054 require ('template.php'); 00055 $LANG->includeLLFile('EXT:lang/locallang_browse_links.xml'); 00056 00057 require_once (PATH_typo3.'/class.browse_links.php'); 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 /** 00072 * Script class for the Element Browser window. 00073 * 00074 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00075 * @package TYPO3 00076 * @subpackage core 00077 */ 00078 class SC_browse_links { 00079 00080 00081 /** 00082 * The mode determines the main kind of output from the element browser. 00083 * There are these options for values: rte, db, file, filedrag, wizard. 00084 * "rte" will show the link selector for the Rich Text Editor (see main_rte()) 00085 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db()) 00086 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file()) 00087 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1)) 00088 * 00089 * @see main() 00090 */ 00091 var $mode; 00092 00093 /** 00094 * holds Instance of main browse_links class 00095 * needed fo intercommunication between various classes that need access to variables via $GLOBALS['SOBE'] 00096 * Not the most nice solution but introduced since we don't have another general way to return class-instances or registry for now 00097 * 00098 * @var browse_links 00099 */ 00100 var $browser; 00101 00102 /** 00103 * document template object 00104 * 00105 * @var template 00106 */ 00107 var $doc; 00108 00109 /** 00110 * not really needed but for backwards compatibility ... 00111 * 00112 * @return void 00113 */ 00114 function init () { 00115 00116 // Find "mode" 00117 $this->mode = t3lib_div::_GP('mode'); 00118 if (!$this->mode) { 00119 $this->mode = 'rte'; 00120 } 00121 00122 // Creating backend template object: 00123 // this might not be needed but some classes refer to $GLOBALS['SOBE']->doc, so ... 00124 $this->doc = t3lib_div::makeInstance('template'); 00125 $this->doc->backPath = $GLOBALS['BACK_PATH']; 00126 } 00127 00128 00129 /** 00130 * Main function, detecting the current mode of the element browser and branching out to internal methods. 00131 * 00132 * @return void 00133 */ 00134 function main() { 00135 00136 // Clear temporary DB mounts 00137 $tmpMount = t3lib_div::_GET('setTempDBmount'); 00138 if (isset($tmpMount)) { 00139 $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', intval($tmpMount)); 00140 } 00141 00142 // Set temporary DB mounts 00143 $tempDBmount = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint')); 00144 if ($tempDBmount) { 00145 $altMountPoints = $tempDBmount; 00146 } 00147 00148 if ($altMountPoints) { 00149 $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints))); 00150 $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts(); 00151 } 00152 00153 $this->content = ''; 00154 00155 // look for alternativ mountpoints 00156 switch((string)$this->mode) { 00157 case 'rte': 00158 case 'db': 00159 case 'wizard': 00160 // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only") 00161 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints')); 00162 if ($altMountPoints) { 00163 $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints))); 00164 $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts(); 00165 } 00166 case 'file': 00167 case 'filedrag': 00168 case 'folder': 00169 // Setting additional read-only browsing file mounts 00170 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints')); 00171 if ($altMountPoints) { 00172 $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints); 00173 foreach($altMountPoints as $filePathRelativeToFileadmindir) { 00174 $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly'); 00175 } 00176 $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts(); 00177 } 00178 break; 00179 } 00180 00181 00182 // render type by user func 00183 $browserRendered = false; 00184 if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) { 00185 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) { 00186 $browserRenderObj = t3lib_div::getUserObj($classRef); 00187 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) { 00188 if ($browserRenderObj->isValid($this->mode, $this)) { 00189 $this->content.= $browserRenderObj->render($this->mode, $this); 00190 $browserRendered = true; 00191 break; 00192 } 00193 } 00194 } 00195 } 00196 00197 // if type was not rendered use default rendering functions 00198 if(!$browserRendered) { 00199 $this->browser = t3lib_div::makeInstance('browse_links'); 00200 $this->browser->init(); 00201 $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses'); 00202 list($modData, $store) = $this->browser->processSessionData($modData); 00203 $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData); 00204 00205 // Output the correct content according to $this->mode 00206 switch((string)$this->mode) { 00207 case 'rte': 00208 $this->content = $this->browser->main_rte(); 00209 break; 00210 case 'db': 00211 $this->content = $this->browser->main_db(); 00212 break; 00213 case 'file': 00214 case 'filedrag': 00215 $this->content = $this->browser->main_file(); 00216 break; 00217 case 'folder': 00218 $this->content = $this->browser->main_folder(); 00219 break; 00220 case 'wizard': 00221 $this->content = $this->browser->main_rte(1); 00222 break; 00223 } 00224 } 00225 } 00226 00227 /** 00228 * Print module content 00229 * 00230 * @return void 00231 */ 00232 function printContent() { 00233 echo $this->content; 00234 } 00235 00236 00237 } 00238 00239 00240 00241 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/browse_links.php'])) { 00242 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/browse_links.php']); 00243 } 00244 00245 00246 00247 // Make instance: 00248 $SOBE = t3lib_div::makeInstance('SC_browse_links'); 00249 $SOBE->init(); 00250 $SOBE->main(); 00251 $SOBE->printContent(); 00252 00253 ?>
1.8.0