TYPO3 API  SVNRelease
select_image.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasper@typo3.com)
00006 *  (c) 2004-2011 Stanislas Rolland <typo3(arobas)jbr.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 image selector for the RTE
00030  *
00031  * @author  Kasper Skårhøj <kasper@typo3.com>
00032  * @author  Stanislas Rolland <typo3(arobas)jbr.ca>
00033  *
00034  * $Id: select_image.php 10120 2011-01-18 20:03:36Z ohader $  *
00035  */
00036 
00037 error_reporting (E_ALL ^ E_NOTICE);
00038 unset($MCONF);
00039 require('conf.php');
00040 require($BACK_PATH.'init.php');
00041 require($BACK_PATH.'template.php');
00042 $LANG->includeLLFile('EXT:lang/locallang_browse_links.xml');
00043 $LANG->includeLLFile('EXT:rtehtmlarea/mod4/locallang.xml');
00044 $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
00045 
00046 /**
00047  * Script class for the Element Browser window.
00048  *
00049  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00050  * @package TYPO3
00051  * @subpackage core
00052  */
00053 class tx_rtehtmlarea_SC_select_image {
00054     public $mode = 'rte';
00055     public $button = 'image';
00056     protected $content = '';
00057 
00058     /**
00059      * Main function, rendering the element browser in RTE mode.
00060      *
00061      * @return  void
00062      */
00063     function main() {
00064             // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
00065         $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
00066         if ($altMountPoints) {
00067             $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
00068             foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
00069                 $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
00070             }
00071             $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
00072         }
00073             // Rendering type by user function
00074         $browserRendered = false;
00075         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
00076             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
00077                 $browserRenderObj = t3lib_div::getUserObj($classRef);
00078                 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
00079                     if ($browserRenderObj->isValid($this->mode, $this)) {
00080                         $this->content .=  $browserRenderObj->render($this->mode, $this);
00081                         $browserRendered = true;
00082                         break;
00083                     }
00084                 }
00085             }
00086         }
00087             // If type was not rendered, use default rendering functions
00088         if (!$browserRendered) {
00089             $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
00090             $GLOBALS['SOBE']->browser->init();
00091             $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php','ses');
00092             list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
00093             $GLOBALS['BE_USER']->pushModuleData('select_image.php',$modData);
00094             $this->content = $GLOBALS['SOBE']->browser->main_rte();
00095         }
00096     }
00097 
00098     /**
00099      * Print module content
00100      *
00101      * @return  void
00102      */
00103     function printContent() {
00104         echo $this->content;
00105     }
00106 }
00107 
00108 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php'])) {
00109     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']);
00110 }
00111 
00112     // Make instance:
00113 $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_select_image');
00114 $SOBE->main();
00115 $SOBE->printContent();
00116 
00117 ?>