TYPO3 API  SVNRelease
browse_links.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  (c) 2005-2011 Stanislas Rolland <typo3(arobas)sjbr.ca>
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the script!
00027 ***************************************************************/
00028 /**
00029  * Displays the page/file tree for browsing database records or files.
00030  * Used from TCEFORMS an other elements
00031  * In other words: This is the ELEMENT BROWSER!
00032  *
00033  * Adapted for htmlArea RTE by Stanislas Rolland
00034  *
00035  * $Id: browse_links.php 10120 2011-01-18 20:03:36Z ohader $
00036  *
00037  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00038  * @author  Stanislas Rolland <typo3(arobas)sjbr.ca>
00039  */
00040 
00041 error_reporting (E_ALL ^ E_NOTICE);
00042 unset($MCONF);
00043 require('conf.php');
00044 require($BACK_PATH.'init.php');
00045 require($BACK_PATH.'template.php');
00046 $LANG->includeLLFile('EXT:rtehtmlarea/mod3/locallang.xml');
00047 $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
00048 
00049 /**
00050  * Script class for the Element Browser window.
00051  *
00052  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00053  * @package TYPO3
00054  * @subpackage core
00055  */
00056 class tx_rtehtmlarea_SC_browse_links {
00057     public $mode = 'rte';
00058     public $button = 'link';
00059     protected $content = '';
00060 
00061     /**
00062      * Main function, rendering the element browser in RTE mode.
00063      *
00064      * @return  void
00065      */
00066     function main() {
00067             // Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
00068         $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
00069 
00070         // Clear temporary DB mounts
00071         $tmpMount = t3lib_div::_GET('setTempDBmount');
00072         if (isset($tmpMount)) {
00073             $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', intval($tmpMount));
00074         }
00075 
00076         // Set temporary DB mounts
00077         $tempDBmount = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'));
00078         if ($tempDBmount) {
00079             $altMountPoints = $tempDBmount;
00080         }
00081 
00082         if ($altMountPoints) {
00083             $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
00084             $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
00085         }
00086             // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
00087         $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
00088         if ($altMountPoints) {
00089             $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
00090             foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
00091                 $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
00092             }
00093             $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
00094         }
00095             // Render type by user function
00096         $browserRendered = false;
00097         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
00098             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
00099                 $browserRenderObj = t3lib_div::getUserObj($classRef);
00100                 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render'))  {
00101                     if ($browserRenderObj->isValid($this->mode, $this)) {
00102                         $this->content .=  $browserRenderObj->render($this->mode, $this);
00103                         $browserRendered = true;
00104                         break;
00105                     }
00106                 }
00107             }
00108         }
00109             // If type was not rendered, use default rendering functions
00110         if (!$browserRendered) {
00111             $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_browse_links');
00112             $GLOBALS['SOBE']->browser->init();
00113             $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php','ses');
00114             list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
00115             $GLOBALS['BE_USER']->pushModuleData('browse_links.php',$modData);
00116             $this->content = $GLOBALS['SOBE']->browser->main_rte();
00117         }
00118     }
00119 
00120     /**
00121      * Print module content
00122      *
00123      * @return  void
00124      */
00125     function printContent() {
00126         echo $this->content;
00127     }
00128 }
00129 
00130 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php'])) {
00131     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php']);
00132 }
00133 
00134     // Make instance:
00135 $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_browse_links');
00136 $SOBE->main();
00137 $SOBE->printContent();
00138 
00139 ?>