Documentation TYPO3 par Ameos

class.tx_rtehtmlarea_base.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2004 Kasper Skaarhoj (kasper@typo3.com)
00006 *  (c) 2004 Philipp Borgmann <philipp.borgmann@gmx.de>
00007 *  (c) 2004, 2005, 2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
00008 *  All rights reserved
00009 *
00010 *  This script is part of the TYPO3 project. The TYPO3 project is
00011 *  free software; you can redistribute it and/or modify
00012 *  it under the terms of the GNU General Public License as published by
00013 *  the Free Software Foundation; either version 2 of the License, or
00014 *  (at your option) any later version.
00015 *
00016 *  The GNU General Public License can be found at
00017 *  http://www.gnu.org/copyleft/gpl.html.
00018 *  A copy is found in the textfile GPL.txt and important notices to the license
00019 *  from the author is found in LICENSE.txt distributed with these scripts.
00020 *
00021 *
00022 *  This script is distributed in the hope that it will be useful,
00023 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025 *  GNU General Public License for more details.
00026 *
00027 *  This copyright notice MUST APPEAR in all copies of the script!
00028 ***************************************************************/
00038 require_once(PATH_t3lib.'class.t3lib_rteapi.php');
00039 require_once(PATH_t3lib.'class.t3lib_cs.php');
00040 
00041 class tx_rtehtmlarea_base extends t3lib_rteapi {
00042 
00043                 // Configuration of supported browsers
00044         var $conf_supported_browser = array (
00045                         'msie' => array (
00046                                 1 => array (
00047                                         'version' => 5.5,
00048                                         'system' => 'win'
00049                                 )
00050                         ),
00051                         'gecko' => array (
00052                                 1 => array (
00053                                         'version' => 1.3
00054                                 )
00055                         ),
00056                         'safari' => array (
00057                                 1 => array (
00058                                         'version' => 312
00059                                 )
00060                         ),
00061                         'opera' => array (
00062                                 1 => array (
00063                                         'version' => 9,
00064                                         'system' => 'win'
00065                                 )
00066                         )
00067                 );
00068 
00069                 // Always hide these toolbar buttons (TYPO3 button name)
00070         var $conf_toolbar_hide = array (
00071                 'showhelp',             // Has no content yet
00072                 );
00073         
00074                 // Hide these toolbar buttons not implemented in Safari
00075         var $conf_toolbar_safari_hide = array (
00076                 'strikethrough',
00077                 'line',
00078                 'orderedlist',
00079                 'unorderedlist',
00080                 );
00081         
00082                 // Hide these toolbar buttons not implemented in Opera
00083         var $conf_toolbar_opera_hide = array (
00084                 'textstyle',
00085                 'blockstyle',
00086                 'copy',
00087                 'cut',
00088                 'paste',
00089                 );
00090         
00091                 // Always show these toolbar buttons (TYPO3 button name)
00092         var $conf_toolbar_show = array (
00093                 'undo',
00094                 'redo',
00095                 //'showhelp',
00096                 'about',
00097                 );
00098         
00099                 // The order of the toolbar: the name is the TYPO3-button name
00100         var $defaultToolbarOrder;
00101 
00102                 // The default hotkeys: the name is the TYPO3-button name
00103         var $defaultHotKeyList = 'selectall, bold, italic, underline, strikethrough, left, center, right, justifyfull, formatblock, paste, cleanword, undo, redo';
00104 
00105                 // Conversion array: TYPO3 button names to htmlArea button names
00106         var $conf_toolbar_convert = array (
00107                         // 'TYPO3 name' => 'htmlArea name'
00108                 'fontstyle'             => 'FontName',
00109                 'fontsize'              => 'FontSize',
00110                 'textcolor'             => 'ForeColor',
00111                 'bgcolor'               => 'HiliteColor',
00112                 'bold'                  => 'Bold',
00113                 'italic'                => 'Italic',
00114                 'underline'             => 'Underline',
00115                 'left'                  => 'JustifyLeft',
00116                 'center'                => 'JustifyCenter',
00117                 'right'                 => 'JustifyRight',
00118                 'orderedlist'           => 'InsertOrderedList',
00119                 'unorderedlist'         => 'InsertUnorderedList',
00120                 'outdent'               => 'Outdent',
00121                 'indent'                => 'Indent',
00122                 'emoticon'              => 'InsertSmiley',
00123                 'line'                  => 'InsertHorizontalRule',
00124                 'link'                  => 'CreateLink',
00125                 'table'                 => 'InsertTable',
00126                 'image'                 => 'InsertImage',
00127                 'cut'                   => 'Cut',
00128                 'copy'                  => 'Copy',
00129                 'paste'                 => 'Paste',
00130                 'formatblock'           => 'FormatBlock',
00131                 'chMode'                => 'HtmlMode',
00132                 'user'                  => 'UserElements',
00133                 
00134                         // htmlArea extra buttons
00135                 'lefttoright'           => 'LeftToRight',
00136                 'righttoleft'           => 'RightToLeft',
00137                 'justifyfull'           => 'JustifyFull',
00138                 'strikethrough'         => 'StrikeThrough',
00139                 'superscript'           => 'Superscript',
00140                 'subscript'             => 'Subscript',
00141                 'showhelp'              => 'ShowHelp',
00142                 'insertcharacter'       => 'InsertCharacter',
00143                 'findreplace'           => 'FindReplace',
00144                 'spellcheck'            => 'SpellCheck',
00145                 'removeformat'          => 'RemoveFormat',
00146                 'inserttag'             => 'InsertTag',
00147                 'acronym'               => 'Acronym',
00148                 'splitblock'            => 'SplitBlock',
00149                 'blockstylelabel'       => 'I[style]',  
00150                 'blockstyle'            => 'DynamicCSS-class',
00151                 'textstylelabel'        => 'I[text_style]',
00152                 'textstyle'             => 'InlineCSS-class',
00153                 'toggleborders'         => 'TO-toggle-borders',
00154                 'tableproperties'       => 'TO-table-prop',
00155                 'rowproperties'         => 'TO-row-prop',
00156                 'rowinsertabove'        => 'TO-row-insert-above',
00157                 'rowinsertunder'        => 'TO-row-insert-under',
00158                 'rowdelete'             => 'TO-row-delete',
00159                 'rowsplit'              => 'TO-row-split',
00160                 'columninsertbefore'    => 'TO-col-insert-before',
00161                 'columninsertafter'     => 'TO-col-insert-after',
00162                 'columndelete'          => 'TO-col-delete',
00163                 'columnsplit'           => 'TO-col-split',
00164                 'cellproperties'        => 'TO-cell-prop',
00165                 'cellinsertbefore'      => 'TO-cell-insert-before',
00166                 'cellinsertafter'       => 'TO-cell-insert-after',
00167                 'celldelete'            => 'TO-cell-delete',
00168                 'cellsplit'             => 'TO-cell-split',
00169                 'cellmerge'             => 'TO-cell-merge',
00170 
00171                         // Toolbar formating
00172                 'space'                 => 'space',
00173                 'bar'                   => 'separator',
00174                 'linebreak'             => 'linebreak',
00175 
00176                         // Always show
00177                 'undo'                  => 'Undo',
00178                 'redo'                  => 'Redo',
00179                 'textindicator'         => 'TextIndicator',
00180                 'about'                 => 'About',
00181                 );
00182         
00183         var $defaultParagraphs = array(
00184                 'p'             => 'Normal',
00185                 'h1'            => 'Heading 1',
00186                 'h2'            => 'Heading 2',
00187                 'h3'            => 'Heading 3',
00188                 'h4'            => 'Heading 4',
00189                 'h5'            => 'Heading 5',
00190                 'h6'            => 'Heading 6',
00191                 'pre'           => 'Preformatted',
00192                 'address'       => 'Address',
00193                 );
00194         
00195         var $defaultFontFaces = array(
00196                 'Arial'                 => 'Arial,sans-serif',
00197                 'Arial Black'           => 'Arial Black,sans-serif',
00198                 'Verdana'               => 'Verdana,Arial,sans-serif',
00199                 'Times New Roman'       => 'Times New Roman,Times,serif',
00200                 'Garamond'              => 'Garamond',
00201                 'Lucida Handwriting'    => 'Lucida Handwriting',
00202                 'Courier'               => 'Courier',
00203                 'Webdings'              => 'Webdings',
00204                 'Wingdings'             => 'Wingdings',
00205                 );
00206                                 
00207         var $defaultFontSizes = array(
00208                 '1'     =>      '1 (8 pt)',
00209                 '2'     =>      '2 (10 pt)',
00210                 '3'     =>      '3 (12 pt)',
00211                 '4'     =>      '4 (14 pt)',
00212                 '5'     =>      '5 (18 pt)',
00213                 '6'     =>      '6 (24 pt)',
00214                 '7'     =>      '7 (36 pt)',
00215                 );
00216         
00217         var $defaultFontSizes_safari = array(
00218                 '1'     =>      'xx-small',
00219                 '2'     =>      'x-small',
00220                 '3'     =>      'small',
00221                 '4'     =>      'medium',
00222                 '5'     =>      'large',
00223                 '6'     =>      'x-large',
00224                 '7'     =>      'xx-large',
00225                 );
00226         
00227         var $pluginList = 'TableOperations, ContextMenu, SpellChecker, SelectColor, TYPO3Browsers, InsertSmiley, FindReplace, RemoveFormat, CharacterMap, QuickTag, InlineCSS, DynamicCSS, UserElements, Acronym, TYPO3HtmlParser';
00228         
00229         var $pluginButton = array(
00230                 'InlineCSS'             => 'textstyle',
00231                 'DynamicCSS'            => 'blockstyle',
00232                 'SpellChecker'          => 'spellcheck',
00233                 'InsertSmiley'          => 'emoticon',
00234                 'FindReplace'           => 'findreplace',
00235                 'RemoveFormat'          => 'removeformat',
00236                 'QuickTag'              => 'inserttag',
00237                 'CharacterMap'          => 'insertcharacter',
00238                 'TableOperations'       => 'table, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit,
00239                                                 columninsertbefore, columninsertafter, columndelete, columnsplit,
00240                                                 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge',
00241                 'UserElements'          => 'user',
00242                 'Acronym'               => 'acronym',
00243                 );
00244 
00245         var $pluginLabel = array(
00246                 'InlineCSS'     => 'textstylelabel',
00247                 'DynamicCSS'    => 'blockstylelabel',
00248                 );
00249 
00250         var $spellCheckerModes = array( 'ultra', 'fast', 'normal', 'bad-spellers');
00251 
00252                 // External:
00253         var $RTEdivStyle;                       // Alternative style for RTE <div> tag.
00254         var $extHttpPath;                       // full Path to this extension for http (so no Server path). It ends with "/"
00255         var $siteURL;                           // TYPO3 site url
00256         var $hostURL;                           // TYPO3 host url
00257         var $typoVersion;                       // Typo3 version
00258 
00259                 // Internal, static:
00260         var $ID = 'rtehtmlarea';                // Identifies the RTE as being the one from the "rte" extension if any external code needs to know...
00261         var $debugMode = FALSE;                 // If set, the content goes into a regular TEXT area field - for developing testing of transformations. (Also any browser will load the field!)
00262 
00263                 // For the editor
00264         var $client;
00265         var $TCEform;
00266         var $elementId;
00267         var $elementParts;
00268         var $tscPID;
00269         var $typeVal;
00270         var $thePid;
00271         var $RTEsetup;
00272         var $thisConfig;
00273         var $confValues;
00274         var $language;
00275         var $BECharset;
00276         var $OutputCharset;
00277         var $editorCSS;
00278         var $spellCheckerLanguage;
00279         var $spellCheckerCharset;
00280         var $spellCheckerMode;
00281         var $quickTagHideTags;
00282         var $specConf;
00283         var $toolBar = array();                 // Save the buttons for the toolbar
00284         var $toolbar_level_size;                // The size for each level in the toolbar:
00285         var $toolbarOrderArray = array();
00286         var $pluginEnableList;
00287         var $pluginEnableArray = array();
00288 
00296         function isAvailable()  {
00297                 $this->client = $this->clientInfo();
00298                 $this->errorLog = array();
00299                 if (!$this->debugMode)  {       // If debug-mode, let any browser through
00300                         $rteIsAvailable = 0;
00301                         $rteConfBrowser = $this->conf_supported_browser;
00302                         if (is_array($rteConfBrowser)) {
00303                                 reset($rteConfBrowser);
00304                                 while(list ($browser, $browserConf) = each($rteConfBrowser)){
00305                                         if ($browser == $this->client['BROWSER']) {
00306                                                         // Config for Browser found, check it:
00307                                                 if (is_array($browserConf)) {
00308                                                         reset($browserConf);
00309                                                         while(list ($browserConfNr, $browserConfSub) = each($browserConf)){
00310                                                                 if ($browserConfSub['version'] <= $this->client['VERSION'] || empty($browserConfSub['version'])) {
00311                                                                         // Version is correct
00312                                                                         if ($browserConfSub['system'] == $this->client['SYSTEM'] || empty($browserConfSub['system'])) {
00313                                                                                         // System is correctly
00314                                                                                 $rteIsAvailable = 1;
00315                                                                         }// End of System
00316                                                                 }// End of Version
00317                                                         }// End of while-BrowserSubpart
00318                                                 } else {
00319                                                         // no config for this browser found, so all versions or system with this browsers are allow
00320                                                         $rteIsAvailable = 1;
00321                                                 }
00322                                         } // End of Browser Check
00323                                 } // while: Browser Check
00324                         } else {
00325                                 // no Browser config for this RTE-Editor, so all Clients are allow                         
00326                         }
00327                         if (!$rteIsAvailable) {
00328                                 $this->errorLog[] = 'rte: Browser not supported. Only msie Version 5 or higher and Mozilla based client 1. and higher.';
00329                         }
00330                         if (t3lib_div::int_from_ver(TYPO3_version) < 3007000) {
00331                                 $rteIsAvailable = 0;
00332                                 $this->errorLog[] = 'rte: This version of htmlArea RTE cannot run under this version of TYPO3.';
00333                         }
00334                 }
00335                 if ($rteIsAvailable)    return true;
00336         }
00337 
00354         function drawRTE(&$pObj,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue)      {
00355                 global $BE_USER,$LANG, $TYPO3_DB, $TYPO3_CONF_VARS;
00356 
00357                 $this->TCEform = $pObj;
00358                 $LANG->includeLLFile('EXT:' . $this->ID . '/locallang.xml');
00359                 $this->client = $this->clientInfo();
00360                 $this->typoVersion = t3lib_div::int_from_ver(TYPO3_version);
00361                 $this->userUid = 'BE_' . $BE_USER->user['uid'];
00362                 
00363                         // Draw form element:
00364                 if ($this->debugMode)   {       // Draws regular text area (debug mode)
00365                         $item = parent::drawRTE($pObj,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue);
00366                 } else {        // Draw real RTE
00367                 
00368                         /* =======================================
00369                          * INIT THE EDITOR-SETTINGS
00370                          * =======================================
00371                          */
00372 
00373                                 // first get the http-path to typo3:
00374                         $this->httpTypo3Path = substr( substr( t3lib_div::getIndpEnv('TYPO3_SITE_URL'), strlen( t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST') ) ), 0, -1 );
00375                         if (strlen($this->httpTypo3Path) == 1) {
00376                                 $this->httpTypo3Path = '/';
00377                         } else {
00378                                 $this->httpTypo3Path .= '/';
00379                         }
00380                                 // Get the path to this extension:
00381                         $this->extHttpPath = $this->httpTypo3Path . t3lib_extMgm::siteRelPath($this->ID);
00382                                 // Get the site URL
00383                         $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
00384                                 // Get the host URL
00385                         $this->hostURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST');
00386 
00387                                 // Element ID + pid
00388                         $this->elementId = $PA['itemFormElName']; // Form element name
00389                         $this->elementParts = explode('][',ereg_replace('\]$','',ereg_replace('^(TSFE_EDIT\[data\]\[|data\[)','',$this->elementId)));
00390 
00391                                 // Find the page PIDs:
00392                         list($this->tscPID,$this->thePid) = t3lib_BEfunc::getTSCpid(trim($this->elementParts[0]),trim($this->elementParts[1]),$thePidValue);
00393 
00394                                 // Record "types" field value:
00395                         $this->typeVal = $RTEtypeVal; // TCA "types" value for record
00396 
00397                                 // Find "thisConfig" for record/editor:
00398                         unset($this->RTEsetup);
00399                         $this->RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($this->tscPID));
00400                         $this->thisConfig = $thisConfig;
00401 
00402                                 // Special configuration and default extras:
00403                         $this->specConf = $specConf;
00404                         
00405                         /* =======================================
00406                          * LANGUAGES & CHARACTER SETS
00407                          * =======================================
00408                          */
00409 
00410                                 // Languages: interface and content
00411                         $this->language = $LANG->lang;
00412                         if ($this->language=='default' || !$this->language)     {
00413                                 $this->language='en';
00414                         }
00415                         $this->contentTypo3Language = $this->language;
00416                         
00417                         $this->contentLanguageUid = ($row['sys_language_uid'] > 0) ? $row['sys_language_uid'] : 0;
00418                         if (t3lib_extMgm::isLoaded('sr_static_info')) {
00419                                 if ($this->contentLanguageUid) {
00420                                         $tableA = 'sys_language';
00421                                         $tableB = 'static_languages';
00422                                         $languagesUidsList = $this->contentLanguageUid;
00423                                         $selectFields = $tableA . '.uid,' . $tableB . '.lg_iso_2,' . $tableB . '.lg_country_iso_2,' . $tableB . '.lg_typo3';
00424                                         $table = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
00425                                         $whereClause = $tableA . '.uid IN (' . $languagesUidsList . ') ';
00426                                         $whereClause .= t3lib_BEfunc::BEenableFields($tableA);
00427                                         $whereClause .= t3lib_BEfunc::deleteClause($tableA);
00428                                         $res = $TYPO3_DB->exec_SELECTquery($selectFields, $table, $whereClause);
00429                                         while($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
00430                                                 $this->contentISOLanguage = strtolower(trim($languageRow['lg_iso_2']).(trim($languageRow['lg_country_iso_2'])?'_'.trim($languageRow['lg_country_iso_2']):''));
00431                                                 $this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
00432                                         }
00433                                 } else {
00434                                         $this->contentISOLanguage = trim($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['defaultDictionary']) ? trim($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['defaultDictionary']) : 'en';
00435                                         $selectFields = 'lg_iso_2, lg_typo3';
00436                                         $table = 'static_languages';
00437                                         $whereClause = 'lg_iso_2 = ' . $TYPO3_DB->fullQuoteStr(strtoupper($this->contentISOLanguage), $table);
00438                                         $res = $TYPO3_DB->exec_SELECTquery($selectFields, $table, $whereClause);
00439                                         while($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
00440                                                 $this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
00441                                         }
00442                                 }
00443                         }
00444 
00445                                 // Character sets: interface and content
00446                         $this->charset = $LANG->csConvObj->charSetArray[$this->language];
00447                         $this->charset = $this->charset ? $this->charset : 'iso-8859-1';
00448                         $this->BECharset = trim($TYPO3_CONF_VARS['BE']['forceCharset']) ? trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->charset;
00449                         $this->OutputCharset = $this->BECharset;
00450                         
00451                         $this->contentCharset = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];
00452                         $this->contentCharset = $this->contentCharset ? $this->contentCharset : 'iso-8859-1';
00453                         $this->origContentCharSet = $this->contentCharset;
00454                         $this->contentCharset = (trim($TYPO3_CONF_VARS['BE']['forceCharset']) ? trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->contentCharset);
00455 
00456                         /* =======================================
00457                          * TOOLBAR CONFIGURATION
00458                          * =======================================
00459                          */
00460 
00461                                 // htmlArea plugins list
00462                         $this->pluginEnableArray = array_intersect(t3lib_div::trimExplode(',', $this->pluginList , 1), t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['HTMLAreaPluginList'], 1));
00463                         $hidePlugins = array();
00464                         if(!t3lib_extMgm::isLoaded('sr_static_info') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
00465                         if ($this->client['BROWSER'] == 'msie') $hidePlugins[] = 'Acronym';
00466                         if ($this->client['BROWSER'] == 'opera') {
00467                                 $hidePlugins[] = 'ContextMenu';
00468                                 $this->thisConfig['hideTableOperationsInToolbar'] = 0;
00469                         }
00470                         $this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins);
00471                         $this->pluginEnableArrayMultiple = $this->pluginEnableArray;
00472 
00473                                 // Toolbar
00474                         $this->setToolBar();
00475 
00476                                 // Check if some plugins need to be disabled
00477                         $this->setPlugins();
00478 
00479                         /* =======================================
00480                          * PLUGIN-SPECIFIC CONFIGURATION
00481                          * =======================================
00482                          */
00483                         
00484                         if ($this->isPluginEnable('SpellChecker')) {
00485                                         // Set the language of the content for the SpellChecker
00486                                 $this->spellCheckerLanguage = $this->contentISOLanguage;
00487                                 $this->spellCheckerTypo3Language = $this->contentTypo3Language;
00488                                 
00489                                         // Set the charset of the content for the SpellChecker
00490                                 $this->spellCheckerCharset = $this->contentCharset;
00491                                 $this->spellCheckerCharset = trim($TYPO3_CONF_VARS['BE']['forceCharset']) ? trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->spellCheckerCharset;
00492                                 
00493                                         // Set the SpellChecker mode
00494                                 $this->spellCheckerMode = isset($BE_USER->userTS['options.']['HTMLAreaPspellMode']) ? trim($BE_USER->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
00495                                 if( !in_array($this->spellCheckerMode, $this->spellCheckerModes)) {
00496                                         $this->spellCheckerMode = 'normal';
00497                                 }
00498                                 
00499                                         // Set the use of personal dictionary
00500                                 $this->spellCheckerPersonalDicts = $this->thisConfig['enablePersonalDicts'] ? (isset($BE_USER->userTS['options.']['enablePersonalDicts']) ? true : false) : false;
00501                                 if (ini_get('safe_mode')) {
00502                                         $this->spellCheckerPersonalDicts = false;
00503                                 }
00504                         }
00505 
00506                         if ($this->isPluginEnable('QuickTag') && trim($this->thisConfig['hideTags'])) {
00507                                 $this->quickTagHideTags = implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1));
00508                         }
00509 
00510                         /* =======================================
00511                          * SET STYLES
00512                          * =======================================
00513                          */
00514 
00515                         $RTEWidth = isset($BE_USER->userTS['options.']['RTESmallWidth']) ? $BE_USER->userTS['options.']['RTESmallWidth'] : '530';
00516                         $RTEHeight = isset($BE_USER->userTS['options.']['RTESmallHeight']) ? $BE_USER->userTS['options.']['RTESmallHeight'] : '380';
00517                         $RTEWidth  = $RTEWidth + ($pObj->docLarge ? (isset($BE_USER->userTS['options.']['RTELargeWidthIncrement']) ? $BE_USER->userTS['options.']['RTELargeWidthIncrement'] : '150') : 0);
00518                         $RTEHeight = $RTEHeight + ($pObj->docLarge ?  (isset($BE_USER->userTS['options.']['RTELargeHeightIncrement']) ? $BE_USER->userTS['options.']['RTELargeHeightIncrement'] : 0) : 0);
00519                         $editorWrapWidth = $RTEWidth . 'px';
00520                         $editorWrapHeight = $RTEHeight . 'px';
00521                         $this->RTEdivStyle = $this->RTEdivStyle ? $this->RTEdivStyle : 'position:relative; left:0px; top:0px; height:' . $RTEHeight . 'px; width:'.$RTEWidth.'px; border: 1px solid black; padding: 2px 0px 2px 2px;';
00522                         $this->toolbar_level_size = $RTEWidth;
00523 
00524                         /* =======================================
00525                          * LOAD CSS AND JAVASCRIPT
00526                          * =======================================
00527                          */
00528 
00529                                 // Preloading the pageStyle
00530                         $filename = trim($this->thisConfig['contentCSS']) ? trim($this->thisConfig['contentCSS']) : 'EXT:' . $this->ID . '/htmlarea/plugins/DynamicCSS/dynamiccss.css';
00531                         $pObj->additionalCode_pre['loadCSS'] = '
00532                 <link rel="alternate stylesheet" type="text/css" href="' . $this->getFullFileName($filename) . '" />';
00533 
00534                                 // Loading the editor skin
00535                         $skinFilename = trim($this->thisConfig['skin']) ? trim($this->thisConfig['skin']) : 'EXT:' . $this->ID . '/htmlarea/skins/default/htmlarea.css';
00536                         if($this->client['BROWSER'] == 'gecko' && $this->client['VERSION'] == '1.3' && substr($skinFilename,0,4) == 'EXT:')  {
00537                                 $skinFilename = 'EXT:' . $this->ID . '/htmlarea/skins/default/htmlarea.css';
00538                         }
00539                         if (substr($skinFilename,0,4) == 'EXT:')      {       // extension
00540                                 list($extKey,$local) = explode('/',substr($skinFilename,4),2);
00541                                 $skinFilename='';
00542                                 if (strcmp($extKey,'') &&  t3lib_extMgm::isLoaded($extKey) && strcmp($local,'')) {
00543                                         $skinFilename = $this->httpTypo3Path . t3lib_extMgm::siteRelPath($extKey) . $local;
00544                                         $skinDir = $this->siteURL . t3lib_extMgm::siteRelPath($extKey) . dirname($local);
00545                                 }
00546                         } elseif (substr($skinFilename,0,1) != '/') {
00547                                 $skinDir = $this->siteURL.dirname($skinFilename);
00548                                 $skinFilename = $this->siteURL . $skinFilename;
00549                         } else {
00550                                 $skinDir = substr($this->siteURL,0,-1) . dirname($skinFilename);
00551                         }
00552                         $this->editorCSS = $skinFilename;
00553                         $this->editedContentCSS = $skinDir . '/htmlarea-edited-content.css';
00554                         $pObj->additionalCode_pre['loadCSS'] .= '
00555                 <link rel="alternate stylesheet" type="text/css" href="' . $this->editedContentCSS . '" />';
00556 
00557                         $pObj->additionalCode_pre['loadCSS'] .= '
00558                 <link rel="stylesheet" type="text/css" href="' . $this->editorCSS . '" />';
00559 
00560                                 // Loading JavaScript files and code
00561                         $pObj->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($pObj->RTEcounter);
00562                         $pObj->additionalJS_pre['loadJScode'] = $this->loadJScode($pObj->RTEcounter);
00563 
00564                         /* =======================================
00565                          * DRAW THE EDITOR
00566                          * =======================================
00567                          */
00568 
00569                                 // Transform value:
00570                         $value = $this->transformContent('rte',$PA['itemFormElValue'],$table,$field,$row,$specConf,$thisConfig,$RTErelPath,$thePidValue);
00571                         
00572                                 // Change some tags
00573                         if ($this->client['BROWSER'] == 'gecko') {
00574                                         // change <strong> to <b>
00575                                 $value = preg_replace('/<(\/?)strong/i', "<$1b", $value);
00576                                         // change <em> to <i>
00577                                 $value = preg_replace('/<(\/?)em([^b>]*>)/i', "<$1i$2", $value);
00578                         }
00579                         if ($this->client['BROWSER'] == 'msie') {
00580                                         // change <abbr> to <acronym>
00581                                 $value = preg_replace('/<(\/?)abbr/i', "<$1acronym", $value);
00582                         }
00583 
00584                                 // Register RTE windows
00585                         $pObj->RTEwindows[] = $PA['itemFormElName'];
00586 
00587                                 // Check if wizard_rte called this for fullscreen edtition; if so, change the size of the RTE to fullscreen using JS
00588                         if (basename(PATH_thisScript) == 'wizard_rte.php') {
00589                                 $height = 'window.innerHeight';
00590                                 $width = 'window.innerWidth';
00591                                 if ($this->client['BROWSER'] == 'msie') {
00592                                         $height = 'document.body.offsetHeight';
00593                                         $width = 'document.body.offsetWidth';
00594                                 }
00595                                 $editorWrapWidth = '100%';
00596                                 $editorWrapHeight = '100%';
00597                                 $this->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border: 1px solid black; padding: 2px 0px 2px 2px;';
00598                                 $pObj->additionalJS_post[] = $this->setRTEsizeByJS('RTEarea'.$pObj->RTEcounter, $height, $width);
00599                         }
00600 
00601                                 // Register RTE in JS:
00602                         $pObj->additionalJS_post[] = $this->registerRTEinJS($pObj->RTEcounter);
00603 
00604                                 // Set the save option for the RTE:
00605                         $pObj->additionalJS_submit[] = $this->setSaveRTE($pObj->RTEcounter, $pObj->formName, htmlspecialchars($PA['itemFormElName']));
00606 
00607                                 // Draw the textarea
00608                         $visibility = 'hidden';
00609                         $item = $this->triggerField($PA['itemFormElName']).'
00610                                 <div id="pleasewait' . $pObj->RTEcounter . '" class="pleasewait">' . $LANG->getLL('Please wait') . '</div>
00611                                 <div id="editorWrap' . $pObj->RTEcounter . '" class="editorWrap" style="visibility:' . $visibility . '; width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
00612                                 <textarea id="RTEarea'.$pObj->RTEcounter.'" name="'.htmlspecialchars($PA['itemFormElName']).'" style="'.t3lib_div::deHSCentities(htmlspecialchars($this->RTEdivStyle)).'">'.t3lib_div::formatForTextarea($value).'</textarea>
00613                                 </div>' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? '<div id="HTMLAreaLog"></div>' : '') . '
00614                                 ';
00615                 }
00616 
00617                         // Return form item:
00618                 return $item;
00619         }
00620 
00626         function setToolBar() {
00627                 global $BE_USER;
00628                 
00629                 $this->defaultToolbarOrder = 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
00630                         bar, fontstyle, space, fontsize, space, formatblock,
00631                         bar, bold, italic, underline, strikethrough, subscript, superscript,
00632                         bar, lefttoright, righttoleft, bar, left, center, right, justifyfull,
00633                         bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator,
00634                         bar, emoticon, insertcharacter, line, link, image, table,' . (trim($this->thisConfig['hideTableOperationsInToolbar'] && trim($this->thisConfig['keepToggleBordersInToolbar'])) ? ' toggleborders,': '') . ' user, acronym, bar, findreplace, spellcheck,
00635                         bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, 
00636                         ' . (trim($this->thisConfig['hideTableOperationsInToolbar']) ? '': 'bar, toggleborders,') . ' bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
00637                         columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
00638                         cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
00639                 
00640                         // Special toolbar for Mozilla Wamcom on Mac OS 9
00641                 if($this->client['BROWSER'] == 'gecko' && $this->client['VERSION'] == '1.3')  {
00642                         $this->defaultToolbarOrder = $this->TCEform->docLarge ? 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
00643                                 bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough,
00644                                 subscript, superscript, lefttoright, righttoleft, bar, left, center, right, justifyfull, linebreak,
00645                                 bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon,
00646                                 insertcharacter, line, link, image, table, user, acronym, bar, findreplace, spellcheck, bar, chMode, inserttag,
00647                                 removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
00648                                 bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
00649                                 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
00650                                 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'
00651                                 : 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
00652                                 bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough,
00653                                 subscript, superscript, linebreak, bar, lefttoright, righttoleft, bar, left, center, right, justifyfull,
00654                                 orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon,
00655                                 insertcharacter, line, link, image, table, user, acronym, linebreak, bar, findreplace, spellcheck, bar, chMode, inserttag,
00656                                 removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
00657                                 bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
00658                                 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
00659                                 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
00660                 }
00661                 $toolbarOrder = $this->thisConfig['toolbarOrder'] ? $this->thisConfig['toolbarOrder'] : $this->defaultToolbarOrder;
00662 
00663                         // Getting rid of undefined buttons
00664                 $this->toolbarOrderArray = array_intersect(t3lib_div::trimExplode(',', $toolbarOrder, 1), t3lib_div::trimExplode(',', $this->defaultToolbarOrder, 1));
00665                 $toolbarOrder = array_unique(array_values($this->toolbarOrderArray));
00666 
00667                         // Fetching specConf for field from backend
00668                 $pList = is_array($this->specConf['richtext']['parameters']) ? implode(',',$this->specConf['richtext']['parameters']) : '';
00669                 if ($pList != '*') {    // If not all
00670                         $show = is_array($this->specConf['richtext']['parameters']) ? $this->specConf['richtext']['parameters'] : array();
00671                         if ($this->thisConfig['showButtons'])   {
00672                                 if ($this->thisConfig['showButtons'] != '*') {
00673                                         $show = array_unique(array_merge($show,t3lib_div::trimExplode(',',$this->thisConfig['showButtons'],1)));
00674                                 } else {
00675                                         $show = array_unique(array_merge($show, $toolbarOrder));
00676                                 }
00677                         }
00678                         if (is_array($this->thisConfig['showButtons.'])) {
00679                                 reset($this->thisConfig['showButtons.']);
00680                                 while(list($button,$value) = each($this->thisConfig['showButtons.'])) {
00681                                         if ($value) $show[] = $button;
00682                                 }
00683                                 $show = array_unique($show);
00684                         }
00685                 } else {
00686                         $show = $toolbarOrder;
00687                 }
00688 
00689                         // Resticting to RTEkeyList for backend user
00690                 if(is_object($BE_USER)) {
00691                         $RTEkeyList = isset($BE_USER->userTS['options.']['RTEkeyList']) ? $BE_USER->userTS['options.']['RTEkeyList'] : '*';
00692                         if ($RTEkeyList != '*') {       // If not all
00693                                 $show = array_intersect($show, t3lib_div::trimExplode(',',$RTEkeyList,1));
00694                         }
00695                 }
00696                 
00697                         // Hiding buttons of disabled plugins
00698                 $hideButtons = array('space', 'bar', 'linebreak');
00699                 reset($this->pluginButton);
00700                 while(list($plugin, $buttonList) = each($this->pluginButton) ) {
00701                         if(!$this->isPluginEnable($plugin)) {
00702                                 $buttonArray = t3lib_div::trimExplode(',',$buttonList,1);
00703                                 foreach($buttonArray as $button) {
00704                                         $hideButtons[] = $button;
00705                                 }
00706                         }
00707                 }
00708 
00709                         // Hiding labels of disabled plugins
00710                 reset($this->pluginLabel);
00711                 while(list($plugin, $label) = each($this->pluginLabel) ) {
00712                         if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label;
00713                 }
00714 
00715                         // Hiding buttons not implemented in Safari
00716                 if ($this->client['BROWSER'] == 'safari') {
00717                         reset($this->conf_toolbar_safari_hide);
00718                         while(list(, $button) = each($this->conf_toolbar_safari_hide) ) {
00719                                 $hideButtons[] = $button;
00720                         }
00721                 }
00722                 
00723                         // Hiding buttons not implemented in Opera
00724                 if ($this->client['BROWSER'] == 'opera') {
00725                         reset($this->conf_toolbar_opera_hide);
00726                         while(list(, $button) = each($this->conf_toolbar_opera_hide) ) {
00727                                 $hideButtons[] = $button;
00728                         }
00729                 }
00730 
00731                         // Hiding the buttons
00732                 $show = array_diff($show, $this->conf_toolbar_hide, $hideButtons, t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1));
00733 
00734                         // Adding the always show buttons
00735                 $show = array_unique(array_merge($show, $this->conf_toolbar_show));
00736                 $toolbarOrder = array_unique(array_merge($toolbarOrder, $this->conf_toolbar_show));
00737                 reset($this->conf_toolbar_show);
00738                 while(list(,$button) = each($this->conf_toolbar_show)) {
00739                         if(!in_array($button, $this->toolbarOrderArray)) $this->toolbarOrderArray[] = $button;
00740                 }
00741 
00742                         // Getting rid of the buttons for which we have no position
00743                 $show = array_intersect($show, $toolbarOrder);
00744                 $this->toolBar = $show;
00745         }
00746 
00752         function setPlugins() {
00753                 global $TYPO3_CONF_VARS;
00754                 
00755                 $hideButtons = array();
00756                         // Disabling the plugins if their buttons are not in the toolbar
00757                 $hidePlugins = array();
00758                 reset($this->pluginButton);
00759                 while(list($plugin, $buttonList) = each($this->pluginButton) ) {
00760                         $buttonArray = t3lib_div::trimExplode(',',$buttonList,1);
00761                         if(!in_array($buttonArray[0],$this->toolBar)) {
00762                                 $hidePlugins[] = $plugin;
00763                                 foreach($buttonArray as $button) {
00764                                         $hideButtons[] = $button;
00765                                 }
00766                         }
00767                 }
00768                 
00769                 if($this->thisConfig['disableContextMenu'] || $this->thisConfig['disableRightClick']) $hidePlugins[] = 'ContextMenu';
00770                 if($this->thisConfig['disableSelectColor']) $hidePlugins[] = 'SelectColor';
00771                 if($this->thisConfig['disableTYPO3Browsers']) $hidePlugins[] = 'TYPO3Browsers';
00772                 if(!$this->thisConfig['enableWordClean'] || !is_array($this->thisConfig['enableWordClean.'])) $hidePlugins[] = 'TYPO3HtmlParser';
00773                 if(!t3lib_extMgm::isLoaded('sr_static_info') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
00774                 
00775                 $this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins);
00776                 
00777                         // Hiding labels of disabled plugins
00778                 reset($this->pluginLabel);
00779                 while(list($plugin, $label) = each($this->pluginLabel) ) {
00780                         if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label;
00781                 }
00782                 $this->toolBar = array_diff($this->toolBar, $hideButtons);
00783 
00784                         // Renaming buttons of replacement plugins
00785                 if( $this->isPluginEnable('SelectColor') ) {
00786                         $this->conf_toolbar_convert['textcolor'] = 'CO-forecolor';
00787                         $this->conf_toolbar_convert['bgcolor'] = 'CO-hilitecolor';
00788                 }
00789         }
00790 
00798          function convertToolBarForHTMLArea($button) {
00799                 return $this->conf_toolbar_convert[$button];
00800          }
00801 
00810         function setRTEsizeByJS($divId, $height, $width) {
00811                 return '
00812                         setRTEsizeByJS(\''.$divId.'\','.$height.', '.$width.');
00813                 ';
00814         }
00815 
00821         function loadJSfiles($number) {
00822                 global $TYPO3_CONF_VARS;
00823                 
00824                 return '
00825                 <script type="text/javascript">
00826                 /*<![CDATA[*/
00827                         var RTEarea = new Array();
00828                         RTEarea[0] = new Array();
00829                         RTEarea[0]["version"] = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '";
00830                         RTEarea[0]["popupwin"] = "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/popupwin' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "popupwin", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'])  . '";
00831                         RTEarea[0]["htmlarea-gecko"] = "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea-gecko' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea-gecko", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'])  . '";
00832                         RTEarea[0]["htmlarea-ie"] = "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea-ie' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea-ie", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'])  . '";
00833                         var _editor_url = "' . $this->extHttpPath . 'htmlarea";
00834                         var _editor_lang = "' . $this->language . '";
00835                         var _editor_CSS = "' . $this->editorCSS . '";
00836                         var _editor_skin = "' . dirname($this->editorCSS) . '";
00837                         var _editor_edited_content_CSS = "' .  $this->editedContentCSS  . '";
00838                         var _typo3_host_url = "' . $this->hostURL . '";
00839                         var _editor_debug_mode = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? 'true' : 'false') . ';
00840                         var _editor_compressed_scripts = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? 'true' : 'false') . ';
00841                         var _editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardUrl'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardUrl'] : '') . '";
00842                         var _spellChecker_lang = "' . $this->spellCheckerLanguage . '";
00843                         var _spellChecker_charset = "' . $this->spellCheckerCharset . '";
00844                         var _spellChecker_mode = "' . $this->spellCheckerMode . '";
00845                         var _quickTag_hideTags = "' . $this->quickTagHideTags . '";
00846                 /*]]>*/
00847                 </script>
00848                 <script type="text/javascript" src="' . $this->buildJSMainLangFile($number) . '"></script>
00849                 <script type="text/javascript" src="' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '"></script>
00850                 ';
00851         }
00852         
00859         function loadJScode($number) {
00860                 global $TSFE, $TYPO3_CONF_VARS;
00861                 
00862                 $loadPluginCode = '';
00863                 $pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
00864                 while( list(,$plugin) = each($pluginArray) ) {
00865                         if ($this->isPluginEnable($plugin) || (intval($number) > 1 && in_array($plugin, $this->pluginEnableArrayMultiple))) {
00866                                 $loadPluginCode .= '
00867                         HTMLArea.loadPlugin("' . $plugin . '", true, "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/plugins/' . $plugin . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $plugin)) . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', $plugin, $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '");';
00868                         }
00869                 }
00870                 return (!is_object($TSFE) ? '' : '
00871                 ' . '/*<![CDATA[*/') . '
00872                         var conf_RTEtsConfigParams = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
00873                         var rtePathImageFile = "../mod4/select_image.php";
00874                         var rtePathLinkFile = "../mod3/browse_links.php";
00875                         var rtePathUserFile = "../mod5/user.php";
00876                         var rtePathAcronymFile = "../mod2/acronym.php";
00877                         var rtePathParseHtmlFile = "' . $this->extHttpPath . 'mod6/parse_html.php";'
00878                         . $loadPluginCode .  '
00879                         HTMLArea.init();' . (!is_object($TSFE) ? '' : '
00880                 /*]]>*/
00881                 ');
00882         }
00883 
00890         function registerRTEinJS($number) {
00891                 global $TSFE, $TYPO3_CONF_VARS;
00892                 
00893                 $registerRTEinJSString = (!is_object($TSFE) ? '' : '
00894                         ' . '/*<![CDATA[*/') . '
00895                         RTEarea['.$number.'] = new Array();
00896                         RTEarea['.$number.']["number"] = '.$number.';
00897                         RTEarea['.$number.']["id"] = "RTEarea'.$number.'";
00898                         RTEarea['.$number.']["enableWordClean"] = ' . (trim($this->thisConfig['enableWordClean'])?'true':'false') . ';
00899                         RTEarea['.$number.']["htmlRemoveComments"] = ' . (trim($this->thisConfig['removeComments'])?'true':'false') . ';
00900                         RTEarea['.$number.']["disableEnterParagraphs"] = ' . (trim($this->thisConfig['disableEnterParagraphs'])?'true':'false') . ';
00901                         RTEarea['.$number.']["removeTrailingBR"] = ' . (trim($this->thisConfig['removeTrailingBR'])?'true':'false') . ';
00902                         RTEarea['.$number.']["useCSS"] = ' . (trim($this->thisConfig['useCSS'])?'true':'false') . ';
00903                         RTEarea['.$number.']["keepButtonGroupTogether"] = ' . (trim($this->thisConfig['keepButtonGroupTogether'])?'true':'false') . ';
00904                         RTEarea['.$number.']["disablePCexamples"] = ' . (trim($this->thisConfig['disablePCexamples'])?'true':'false') . ';
00905                         RTEarea['.$number.']["statusBar"] = ' . (trim($this->thisConfig['showStatusBar'])?'true':'false') . ';
00906                         RTEarea['.$number.']["showTagFreeClasses"] = ' . (trim($this->thisConfig['showTagFreeClasses'])?'true':'false') . ';
00907                         RTEarea['.$number.']["useHTTPS"] = ' . (trim(stristr($this->siteURL, 'https'))?'true':'false') . ';
00908                         RTEarea['.$number.']["enableMozillaExtension"] = ' . (($this->client['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'])?'true':'false') . ';';
00909                 
00910                         // The following properties apply only to the backend
00911                 if (!is_object($TSFE)) {
00912                         $registerRTEinJSString .= '
00913                         RTEarea['.$number.']["typo3ContentLanguage"] = "' . $this->contentTypo3Language . '";
00914                         RTEarea['.$number.']["typo3ContentCharset"] = "' . $this->contentCharset . '";
00915                         RTEarea['.$number.']["enablePersonalDicts"] = ' . ($this->spellCheckerPersonalDicts ? 'true' : 'false') . ';
00916                         RTEarea['.$number.']["userUid"] = "' . $this->userUid . '";';
00917                 }
00918                 
00919                         // Setting the plugin flags
00920                 $registerRTEinJSString .= '
00921                         RTEarea['.$number.']["plugin"] = new Array();';
00922                 
00923                 $pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
00924                 while( list(,$plugin) = each($pluginArray) ) {
00925                         if ($this->isPluginEnable($plugin)) {
00926                                 $registerRTEinJSString .= '
00927                         RTEarea['.$number.']["plugin"]["'.$plugin.'"] = true;';
00928                         }
00929                 }
00930 
00931                         // Setting the list of tags to be removed if specified in the RTE config
00932                 if (trim($this->thisConfig['removeTags']))  {
00933                         $registerRTEinJSString .= '
00934                         RTEarea['.$number.']["htmlRemoveTags"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTags'], 1)) . ')$/i;';
00935                 }
00936 
00937                         // Setting the list of tags to be removed with their contents if specified in the RTE config
00938                 if (trim($this->thisConfig['removeTagsAndContents']))  {
00939                         $registerRTEinJSString .= '
00940                         RTEarea['.$number.']["htmlRemoveTagsAndContents"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTagsAndContents'], 1)) . ')$/i;';
00941                 }
00942                 
00943                         // Process default style configuration
00944                 $registerRTEinJSString .= '
00945                         RTEarea['.$number.']["defaultPageStyle"] = "' . $this->hostURL . $this->buildJSFile('css', $this->buildStyleSheet(), 'css') . '";';
00946                         
00947                         // Setting the pageStyle
00948                 $filename = trim($this->thisConfig['contentCSS']) ? trim($this->thisConfig['contentCSS']) : 'EXT:' . $this->ID . '/htmlarea/plugins/DynamicCSS/dynamiccss.css';
00949                 $registerRTEinJSString .= '
00950                         RTEarea['.$number.']["pageStyle"] = "' . $this->getFullFileName($filename) .'";';
00951                 
00952                         // Process colors configuration
00953                 if ( $this->isPluginEnable('SelectColor') ) {
00954                         $registerRTEinJSString .= $this->buildJSColorsConfig($number);
00955                 }
00956                 
00957                         // Process classes configuration
00958                 if ($this->isPluginEnable('InlineCSS') || $this->isPluginEnable('DynamicCSS')) {
00959                         $registerRTEinJSString .= $this->buildJSClassesConfig($number);
00960                 }
00961                 
00962                         // Process font faces configuration
00963                 $registerRTEinJSString .= $this->buildJSFontFacesConfig($number);
00964                 
00965                         // Process paragraphs configuration
00966                 $registerRTEinJSString .= $this->buildJSParagraphsConfig($number);
00967                 
00968                         // Process font sizes configuration
00969                 $registerRTEinJSString .= $this->buildJSFontSizesConfig($number);
00970                 
00971                 if ($this->isPluginEnable('TableOperations')) {
00972                         $registerRTEinJSString .= '
00973                         RTEarea['.$number.']["hideTableOperationsInToolbar"] = ' . (trim($this->thisConfig['hideTableOperationsInToolbar']) ? 'true' : 'false') . ';
00974                         RTEarea['.$number.']["keepToggleBordersInToolbar"] = ' . (trim($this->thisConfig['keepToggleBordersInToolbar'])?'true':'false') . ';
00975                         RTEarea['.$number.']["disableLayoutFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableLayoutFieldsetInTableOperations'])?'true':'false') . ';
00976                         RTEarea['.$number.']["disableAlignmentFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableAlignmentFieldsetInTableOperations'])?'true':'false') . ';
00977                         RTEarea['.$number.']["disableSpacingFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableSpacingFieldsetInTableOperations'])?'true':'false') . ';
00978                         RTEarea['.$number.']["disableBordersFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableBordersFieldsetInTableOperations'])?'true':'false') . ';
00979                         RTEarea['.$number.']["disableColorFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableColorFieldsetInTableOperations'])?'true':'false') . ';';
00980                 }
00981                 
00982                 if ($this->isPluginEnable('Acronym')) {
00983                         $registerRTEinJSString .= '
00984                         RTEarea['.$number.']["acronymUrl"] = "' . $this->buildJSFile('acronym_'.$this->contentLanguageUid, $this->buildJSAcronymArray()) . '";';
00985                 }
00986                 
00987                 if ($this->isPluginEnable('TYPO3Browsers')) {
00988                         $registerRTEinJSString .= $this->buildJSClassesAnchorConfig($number);
00989                 }
00990                 
00991                 $registerRTEinJSString .= '
00992                         RTEarea['.$number.']["toolbar"] = '.$this->getJSToolbarArray().';
00993                         HTMLArea.initEditor('.$number.');' . (!is_object($TSFE) ? '' : '
00994                         /*]]>*/');
00995                 return $registerRTEinJSString;
00996         }
00997 
01004         function isPluginEnable($plugin) { 
01005                 return in_array($plugin, $this->pluginEnableArray);
01006         }
01007         
01008         
01014         function buildJSFontSizesConfig($number) {
01015                 global $LANG, $TSFE;
01016                 $registerRTEinJSString = '';
01017                 
01018                         // Builing JS array of default font sizes
01019                 $HTMLAreaFontSizes = array();
01020                 if (is_object($TSFE)) {
01021                         $HTMLAreaFontSizes[0] = $TSFE->csConvObj->conv($TSFE->getLLL('No size',$this->LOCAL_LANG), $TSFE->labelsCharset, $TSFE->renderCharset);
01022                 } else {
01023                         $HTMLAreaFontSizes[0] = $LANG->getLL('No size');
01024                 }
01025 
01026                 reset($this->defaultFontSizes);
01027                 while( list($FontSizeItem,$FontSizeLabel) = each($this->defaultFontSizes)) {
01028                         if ($this->client['BROWSER'] == 'safari') {
01029                                 $HTMLAreaFontSizes[$this->defaultFontSizes_safari[$FontSizeItem]] = $FontSizeLabel;
01030                         } else {
01031                                 $HTMLAreaFontSizes[$FontSizeItem] = $FontSizeLabel;
01032                         }
01033                 }
01034                 if ($this->thisConfig['hideFontSizes'] ) {
01035                         $hideFontSizes =  t3lib_div::trimExplode(',', $this->cleanList($this->thisConfig['hideFontSizes']), 1);
01036                         foreach($hideFontSizes as $item)  {
01037                                 if ($HTMLAreaFontSizes[strtolower($item)]) {
01038                                         if ($this->client['BROWSER'] == 'safari') {
01039                                                 unset($HTMLAreaFontSizes[$this->defaultFontSizes_safari[strtolower($item)]]);
01040                                         } else {
01041                                                 unset($HTMLAreaFontSizes[strtolower($item)]);
01042                                         }
01043                                 } else {
01044                                         
01045                                 }
01046                         }
01047                 }
01048                 
01049                 $HTMLAreaJSFontSize = '{';
01050                 if ($this->cleanList($this->thisConfig['hideFontSizes']) != '*') {
01051                         reset($HTMLAreaFontSizes);
01052                         $HTMLAreaParagraphIndex = 0;
01053                         while( list($FontSizeItem,$FontSizeLabel) = each($HTMLAreaFontSizes)) {
01054                                 if($HTMLAreaFontSizeIndex) { 
01055                                         $HTMLAreaJSFontSize .= ',';
01056                                 }
01057                                 $HTMLAreaJSFontSize .= '
01058                                 "' . $FontSizeLabel . '" : "' . ($FontSizeItem?$FontSizeItem:'') . '"';
01059                                 $HTMLAreaFontSizeIndex++;
01060                         }
01061                 }
01062                 $HTMLAreaJSFontSize .= '};';
01063                 $registerRTEinJSString .= '
01064                         RTEarea['.$number.']["fontsize"] = '. $HTMLAreaJSFontSize;
01065                         
01066                 return $registerRTEinJSString;
01067         }
01073         function buildJSParagraphsConfig($number) {
01074                 global $TSFE, $LANG;
01075                 $registerRTEinJSString = '';
01076                 
01077                         // Paragraphs
01078                 $HTMLAreaParagraphs = $this->defaultParagraphs;
01079                 if ($this->thisConfig['hidePStyleItems']) {
01080                         $hidePStyleItems =  t3lib_div::trimExplode(',', $this->cleanList($this->thisConfig['hidePStyleItems']), 1);
01081                         foreach($hidePStyleItems as $item)  unset($HTMLAreaParagraphs[strtolower($item)]);
01082                 }
01083                 $HTMLAreaJSParagraph = '{';
01084                 if ($this->cleanList($this->thisConfig['hidePStyleItems']) != '*') {
01085                         reset($HTMLAreaParagraphs);
01086                         $HTMLAreaParagraphIndex = 0;
01087                         while( list($PStyleItem,$PStyleLabel) = each($HTMLAreaParagraphs)) {
01088                                 if($HTMLAreaParagraphIndex) { 
01089                                         $HTMLAreaJSParagraph .= ',';
01090                                 }
01091                                 if (is_object($TSFE)) {
01092