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                                 )
00065                         )
00066                 );
00067 
00068                 // Always hide these toolbar buttons (TYPO3 button name)
00069         var $conf_toolbar_hide = array (
00070                 'showhelp',             // Has no content yet
00071                 );
00072         
00073                 // Hide these toolbar buttons not implemented in Safari
00074         var $conf_toolbar_safari_hide = array (
00075                 'strikethrough',
00076                 'line',
00077                 'orderedlist',
00078                 'unorderedlist',
00079                 );
00080         
00081                 // Hide these toolbar buttons not implemented in Opera
00082         var $conf_toolbar_opera_hide = array (
00083                 'copy',
00084                 'cut',
00085                 'paste',
00086                 );
00087         
00088                 // Always show these toolbar buttons (TYPO3 button name)
00089         var $conf_toolbar_show = array (
00090                 'undo',
00091                 'redo',
00092                 //'showhelp',
00093                 'about',
00094                 );
00095         
00096                 // The order of the toolbar: the name is the TYPO3-button name
00097         var $defaultToolbarOrder;
00098 
00099                 // The default hotkeys: the name is the TYPO3-button name
00100         var $defaultHotKeyList = 'selectall, bold, italic, underline, strikethrough, left, center, right, justifyfull, formatblock, paste, cleanword, undo, redo';
00101 
00102                 // Conversion array: TYPO3 button names to htmlArea button names
00103         var $conf_toolbar_convert = array (
00104                         // 'TYPO3 name' => 'htmlArea name'
00105                 'fontstyle'             => 'FontName',
00106                 'fontsize'              => 'FontSize',
00107                 'textcolor'             => 'ForeColor',
00108                 'bgcolor'               => 'HiliteColor',
00109                 'bold'                  => 'Bold',
00110                 'italic'                => 'Italic',
00111                 'underline'             => 'Underline',
00112                 'left'                  => 'JustifyLeft',
00113                 'center'                => 'JustifyCenter',
00114                 'right'                 => 'JustifyRight',
00115                 'orderedlist'           => 'InsertOrderedList',
00116                 'unorderedlist'         => 'InsertUnorderedList',
00117                 'outdent'               => 'Outdent',
00118                 'indent'                => 'Indent',
00119                 'emoticon'              => 'InsertSmiley',
00120                 'line'                  => 'InsertHorizontalRule',
00121                 'link'                  => 'CreateLink',
00122                 'table'                 => 'InsertTable',
00123                 'image'                 => 'InsertImage',
00124                 'cut'                   => 'Cut',
00125                 'copy'                  => 'Copy',
00126                 'paste'                 => 'Paste',
00127                 'formatblock'           => 'FormatBlock',
00128                 'chMode'                => 'HtmlMode',
00129                 'user'                  => 'UserElements',
00130                 
00131                         // htmlArea extra buttons
00132                 'lefttoright'           => 'LeftToRight',
00133                 'righttoleft'           => 'RightToLeft',
00134                 'justifyfull'           => 'JustifyFull',
00135                 'strikethrough'         => 'StrikeThrough',
00136                 'superscript'           => 'Superscript',
00137                 'subscript'             => 'Subscript',
00138                 'showhelp'              => 'ShowHelp',
00139                 'insertcharacter'       => 'InsertCharacter',
00140                 'findreplace'           => 'FindReplace',
00141                 'spellcheck'            => 'SpellCheck',
00142                 'removeformat'          => 'RemoveFormat',
00143                 'inserttag'             => 'InsertTag',
00144                 'acronym'               => 'Acronym',
00145                 'splitblock'            => 'SplitBlock',
00146                 'blockstylelabel'       => 'I[style]',  
00147                 'blockstyle'            => 'DynamicCSS-class',
00148                 'textstylelabel'        => 'I[text_style]',
00149                 'textstyle'             => 'InlineCSS-class',
00150                 'toggleborders'         => 'TO-toggle-borders',
00151                 'tableproperties'       => 'TO-table-prop',
00152                 'rowproperties'         => 'TO-row-prop',
00153                 'rowinsertabove'        => 'TO-row-insert-above',
00154                 'rowinsertunder'        => 'TO-row-insert-under',
00155                 'rowdelete'             => 'TO-row-delete',
00156                 'rowsplit'              => 'TO-row-split',
00157                 'columninsertbefore'    => 'TO-col-insert-before',
00158                 'columninsertafter'     => 'TO-col-insert-after',
00159                 'columndelete'          => 'TO-col-delete',
00160                 'columnsplit'           => 'TO-col-split',
00161                 'cellproperties'        => 'TO-cell-prop',
00162                 'cellinsertbefore'      => 'TO-cell-insert-before',
00163                 'cellinsertafter'       => 'TO-cell-insert-after',
00164                 'celldelete'            => 'TO-cell-delete',
00165                 'cellsplit'             => 'TO-cell-split',
00166                 'cellmerge'             => 'TO-cell-merge',
00167 
00168                         // Toolbar formating
00169                 'space'                 => 'space',
00170                 'bar'                   => 'separator',
00171                 'linebreak'             => 'linebreak',
00172 
00173                         // Always show
00174                 'undo'                  => 'Undo',
00175                 'redo'                  => 'Redo',
00176                 'textindicator'         => 'TextIndicator',
00177                 'about'                 => 'About',
00178                 );
00179         
00180         var $defaultParagraphs = array(
00181                 'p'             => 'Normal',
00182                 'h1'            => 'Heading 1',
00183                 'h2'            => 'Heading 2',
00184                 'h3'            => 'Heading 3',
00185                 'h4'            => 'Heading 4',
00186                 'h5'            => 'Heading 5',
00187                 'h6'            => 'Heading 6',
00188                 'pre'           => 'Preformatted',
00189                 'address'       => 'Address',
00190                 );
00191         
00192         var $defaultFontFaces = array(
00193                 'Arial'                 => 'Arial,sans-serif',
00194                 'Arial Black'           => 'Arial Black,sans-serif',
00195                 'Verdana'               => 'Verdana,Arial,sans-serif',
00196                 'Times New Roman'       => 'Times New Roman,Times,serif',
00197                 'Garamond'              => 'Garamond',
00198                 'Lucida Handwriting'    => 'Lucida Handwriting',
00199                 'Courier'               => 'Courier',
00200                 'Webdings'              => 'Webdings',
00201                 'Wingdings'             => 'Wingdings',
00202                 );
00203                                 
00204         var $defaultFontSizes = array(
00205                 '1'     =>      '1 (8 pt)',
00206                 '2'     =>      '2 (10 pt)',
00207                 '3'     =>      '3 (12 pt)',
00208                 '4'     =>      '4 (14 pt)',
00209                 '5'     =>      '5 (18 pt)',
00210                 '6'     =>      '6 (24 pt)',
00211                 '7'     =>      '7 (36 pt)',
00212                 );
00213         
00214         var $defaultFontSizes_safari = array(
00215                 '1'     =>      'xx-small',
00216                 '2'     =>      'x-small',
00217                 '3'     =>      'small',
00218                 '4'     =>      'medium',
00219                 '5'     =>      'large',
00220                 '6'     =>      'x-large',
00221                 '7'     =>      'xx-large',
00222                 );
00223         
00224         var $pluginList = 'TableOperations, ContextMenu, SpellChecker, SelectColor, TYPO3Browsers, InsertSmiley, FindReplace, RemoveFormat, CharacterMap, QuickTag, InlineCSS, DynamicCSS, UserElements, Acronym, TYPO3HtmlParser';
00225         
00226         var $pluginButton = array(
00227                 'InlineCSS'             => 'textstyle',
00228                 'DynamicCSS'            => 'blockstyle',
00229                 'SpellChecker'          => 'spellcheck',
00230                 'InsertSmiley'          => 'emoticon',
00231                 'FindReplace'           => 'findreplace',
00232                 'RemoveFormat'          => 'removeformat',
00233                 'QuickTag'              => 'inserttag',
00234                 'CharacterMap'          => 'insertcharacter',
00235                 'TableOperations'       => 'table, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit,
00236                                                 columninsertbefore, columninsertafter, columndelete, columnsplit,
00237                                                 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge',
00238                 'UserElements'          => 'user',
00239                 'Acronym'               => 'acronym',
00240                 );
00241 
00242         var $pluginLabel = array(
00243                 'InlineCSS'     => 'textstylelabel',
00244                 'DynamicCSS'    => 'blockstylelabel',
00245                 );
00246 
00247         var $spellCheckerModes = array( 'ultra', 'fast', 'normal', 'bad-spellers');
00248 
00249                 // External:
00250         var $RTEdivStyle;                       // Alternative style for RTE <div> tag.
00251         var $extHttpPath;                       // full Path to this extension for http (so no Server path). It ends with "/"
00252         var $siteURL;                           // TYPO3 site url
00253         var $hostURL;                           // TYPO3 host url
00254         var $typoVersion;                       // Typo3 version
00255 
00256                 // Internal, static:
00257         var $ID = 'rtehtmlarea';                // Identifies the RTE as being the one from the "rte" extension if any external code needs to know...
00258         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!)
00259 
00260                 // For the editor
00261         var $client;
00262         var $TCEform;
00263         var $elementId;
00264         var $elementParts;
00265         var $tscPID;
00266         var $typeVal;
00267         var $thePid;
00268         var $RTEsetup;
00269         var $thisConfig;
00270         var $confValues;
00271         var $language;
00272         var $BECharset;
00273         var $OutputCharset;
00274         var $editorCSS;
00275         var $spellCheckerLanguage;
00276         var $spellCheckerCharset;
00277         var $spellCheckerMode;
00278         var $quickTagHideTags;
00279         var $specConf;
00280         var $toolBar = array();                 // Save the buttons for the toolbar
00281         var $toolbar_level_size;                // The size for each level in the toolbar:
00282         var $toolbarOrderArray = array();
00283         var $pluginEnableList;
00284         var $pluginEnableArray = array();
00285 
00293         function isAvailable()  {
00294                 global $TYPO3_CONF_VARS;
00295                 
00296                 $this->client = $this->clientInfo();
00297                 $this->errorLog = array();
00298                 if (!$this->debugMode)  {       // If debug-mode, let any browser through
00299                         $rteIsAvailable = 0;
00300                         $rteConfBrowser = $this->conf_supported_browser;
00301                         if (!$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['enableInOpera9']) unset($rteConfBrowser['opera']);
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                 $inline =& $this->TCEform->inline;
00359                 
00360                 $LANG->includeLLFile('EXT:' . $this->ID . '/locallang.xml');
00361                 $this->client = $this->clientInfo();
00362                 $this->typoVersion = t3lib_div::int_from_ver(TYPO3_version);
00363                 $this->userUid = 'BE_' . $BE_USER->user['uid'];
00364                 
00365                         // Draw form element:
00366                 if ($this->debugMode)   {       // Draws regular text area (debug mode)
00367                         $item = parent::drawRTE($pObj,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue);
00368                 } else {        // Draw real RTE
00369                 
00370                         /* =======================================
00371                          * INIT THE EDITOR-SETTINGS
00372                          * =======================================
00373                          */
00374 
00375                                 // first get the http-path to typo3:
00376                         $this->httpTypo3Path = substr( substr( t3lib_div::getIndpEnv('TYPO3_SITE_URL'), strlen( t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST') ) ), 0, -1 );
00377                         if (strlen($this->httpTypo3Path) == 1) {
00378                                 $this->httpTypo3Path = '/';
00379                         } else {
00380                                 $this->httpTypo3Path .= '/';
00381                         }
00382                                 // Get the path to this extension:
00383                         $this->extHttpPath = $this->httpTypo3Path . t3lib_extMgm::siteRelPath($this->ID);
00384                                 // Get the site URL
00385                         $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
00386                                 // Get the host URL
00387                         $this->hostURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST');
00388 
00389                                 // Element ID + pid
00390                         $this->elementId = $PA['itemFormElName']; // Form element name
00391                         $this->elementParts = explode('][',ereg_replace('\]$','',ereg_replace('^(TSFE_EDIT\[data\]\[|data\[)','',$this->elementId)));
00392 
00393                                 // Find the page PIDs:
00394                         list($this->tscPID,$this->thePid) = t3lib_BEfunc::getTSCpid(trim($this->elementParts[0]),trim($this->elementParts[1]),$thePidValue);
00395 
00396                                 // Record "types" field value:
00397                         $this->typeVal = $RTEtypeVal; // TCA "types" value for record
00398 
00399                                 // Find "thisConfig" for record/editor:
00400                         unset($this->RTEsetup);
00401                         $this->RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($this->tscPID));
00402                         $this->thisConfig = $thisConfig;
00403 
00404                                 // Special configuration and default extras:
00405                         $this->specConf = $specConf;
00406                         
00407                         if ($this->thisConfig['forceHTTPS']) {
00408                                 $this->httpTypo3Path = preg_replace('/^(http|https)/', 'https', $this->httpTypo3Path);
00409                                 $this->extHttpPath = preg_replace('/^(http|https)/', 'https', $this->extHttpPath);
00410                                 $this->siteURL = preg_replace('/^(http|https)/', 'https', $this->siteURL);
00411                                 $this->hostURL = preg_replace('/^(http|https)/', 'https', $this->hostURL);
00412                         }
00413                         
00414                         /* =======================================
00415                          * LANGUAGES & CHARACTER SETS
00416                          * =======================================
00417                          */
00418 
00419                                 // Languages: interface and content
00420                         $this->language = $LANG->lang;
00421                         if ($this->language=='default' || !$this->language)     {
00422                                 $this->language='en';
00423                         }
00424                         $this->contentTypo3Language = $this->language;
00425                         
00426                         $this->contentLanguageUid = ($row['sys_language_uid'] > 0) ? $row['sys_language_uid'] : 0;
00427                         if (t3lib_extMgm::isLoaded('static_info_tables')) {
00428                                 if ($this->contentLanguageUid) {
00429                                         $tableA = 'sys_language';
00430                                         $tableB = 'static_languages';
00431                                         $languagesUidsList = $this->contentLanguageUid;
00432                                         $selectFields = $tableA . '.uid,' . $tableB . '.lg_iso_2,' . $tableB . '.lg_country_iso_2,' . $tableB . '.lg_typo3';
00433                                         $tableAB = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
00434                                         $whereClause = $tableA . '.uid IN (' . $languagesUidsList . ') ';
00435                                         $whereClause .= t3lib_BEfunc::BEenableFields($tableA);
00436                                         $whereClause .= t3lib_BEfunc::deleteClause($tableA);
00437                                         $res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
00438                                         while($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
00439                                                 $this->contentISOLanguage = strtolower(trim($languageRow['lg_iso_2']).(trim($languageRow['lg_country_iso_2'])?'_'.trim($languageRow['lg_country_iso_2']):''));
00440                                                 $this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
00441                                         }
00442                                 } else {
00443                                         $this->contentISOLanguage = trim($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['defaultDictionary']) ? trim($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['defaultDictionary']) : 'en';
00444                                         $selectFields = 'lg_iso_2, lg_typo3';
00445                                         $tableAB = 'static_languages';
00446                                         $whereClause = 'lg_iso_2 = ' . $TYPO3_DB->fullQuoteStr(strtoupper($this->contentISOLanguage), $tableAB);
00447                                         $res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
00448                                         while($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
00449                                                 $this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
00450                                         }
00451                                 }
00452                         }
00453 
00454                                 // Character sets: interface and content
00455                         $this->charset = $LANG->csConvObj->charSetArray[$this->language];
00456                         $this->charset = $this->charset ? $this->charset : 'iso-8859-1';
00457                         $this->BECharset = trim($TYPO3_CONF_VARS['BE']['forceCharset']) ? trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->charset;
00458                         $this->OutputCharset = $this->BECharset;
00459                         
00460                         $this->contentCharset = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];
00461                         $this->contentCharset = $this->contentCharset ? $this->contentCharset : 'iso-8859-1';
00462                         $this->origContentCharSet = $this->contentCharset;
00463                         $this->contentCharset = (trim($TYPO3_CONF_VARS['BE']['forceCharset']) ? trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->contentCharset);
00464 
00465                         /* =======================================
00466                          * TOOLBAR CONFIGURATION
00467                          * =======================================
00468                          */
00469 
00470                                 // htmlArea plugins list
00471                         $this->pluginEnableArray = array_intersect(t3lib_div::trimExplode(',', $this->pluginList , 1), t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['HTMLAreaPluginList'], 1));
00472                         $hidePlugins = array();
00473                         if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
00474                         if ($this->client['BROWSER'] == 'msie') $hidePlugins[] = 'Acronym';
00475                         if ($this->client['BROWSER'] == 'opera') {
00476                                 $hidePlugins[] = 'ContextMenu';
00477                                 $this->thisConfig['hideTableOperationsInToolbar'] = 0;
00478                                 $this->thisConfig['disableEnterParagraphs'] = 1;
00479                         }
00480                         $this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins);
00481                         $this->pluginEnableArrayMultiple = $this->pluginEnableArray;
00482 
00483                                 // Toolbar
00484                         $this->setToolBar();
00485 
00486                                 // Check if some plugins need to be disabled
00487                         $this->setPlugins();
00488 
00489                         /* =======================================
00490                          * PLUGIN-SPECIFIC CONFIGURATION
00491                          * =======================================
00492                          */
00493                         
00494                         if ($this->isPluginEnable('SpellChecker')) {
00495                                         // Set the language of the content for the SpellChecker
00496                                 $this->spellCheckerLanguage = $this->contentISOLanguage;
00497                                 $this->spellCheckerTypo3Language = $this->contentTypo3Language;
00498                                 
00499                                         // Set the charset of the content for the SpellChecker
00500                                 $this->spellCheckerCharset = $this->contentCharset;
00501                                 $this->spellCheckerCharset = trim($TYPO3_CONF_VARS['BE']['forceCharset']) ? trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->spellCheckerCharset;
00502                                 
00503                                         // Set the SpellChecker mode
00504                                 $this->spellCheckerMode = isset($BE_USER->userTS['options.']['HTMLAreaPspellMode']) ? trim($BE_USER->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
00505                                 if( !in_array($this->spellCheckerMode, $this->spellCheckerModes)) {
00506                                         $this->spellCheckerMode = 'normal';
00507                                 }
00508                                 
00509                                         // Set the use of personal dictionary
00510                                 $this->spellCheckerPersonalDicts = $this->thisConfig['enablePersonalDicts'] ? (isset($BE_USER->userTS['options.']['enablePersonalDicts']) ? true : false) : false;
00511                                 if (ini_get('safe_mode')) {
00512                                         $this->spellCheckerPersonalDicts = false;
00513                                 }
00514                         }
00515 
00516                         /* =======================================
00517                          * SET STYLES
00518                          * =======================================
00519                          */
00520 
00521                         $RTEWidth = isset($BE_USER->userTS['options.']['RTESmallWidth']) ? $BE_USER->userTS['options.']['RTESmallWidth'] : '530';
00522                         $RTEHeight = isset($BE_USER->userTS['options.']['RTESmallHeight']) ? $BE_USER->userTS['options.']['RTESmallHeight'] : '380';
00523                         $RTEWidth  = $RTEWidth + ($pObj->docLarge ? (isset($BE_USER->userTS['options.']['RTELargeWidthIncrement']) ? $BE_USER->userTS['options.']['RTELargeWidthIncrement'] : '150') : 0);
00524                         $RTEWidth -= ($inline->getStructureDepth() > 0 ? ($inline->getStructureDepth()+1)*$inline->getLevelMargin() : 0);
00525                         $RTEHeight = $RTEHeight + ($pObj->docLarge ?  (isset($BE_USER->userTS['options.']['RTELargeHeightIncrement']) ? $BE_USER->userTS['options.']['RTELargeHeightIncrement'] : 0) : 0);
00526                         $editorWrapWidth = $RTEWidth . 'px';
00527                         $editorWrapHeight = $RTEHeight . 'px';
00528                         $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;';
00529                         $this->toolbar_level_size = $RTEWidth;
00530 
00531                         /* =======================================
00532                          * LOAD CSS AND JAVASCRIPT
00533                          * =======================================
00534                          */
00535 
00536                                 // Preloading the pageStyle
00537                         $filename = trim($this->thisConfig['contentCSS']) ? trim($this->thisConfig['contentCSS']) : 'EXT:' . $this->ID . '/htmlarea/plugins/DynamicCSS/dynamiccss.css';
00538                         $pObj->additionalCode_pre['loadCSS'] = '
00539                 <link rel="alternate stylesheet" type="text/css" href="' . $this->getFullFileName($filename) . '" />';
00540 
00541                                 // Loading the editor skin
00542                         $skinFilename = trim($this->thisConfig['skin']) ? trim($this->thisConfig['skin']) : 'EXT:' . $this->ID . '/htmlarea/skins/default/htmlarea.css';
00543                         if($this->client['BROWSER'] == 'gecko' && $this->client['VERSION'] == '1.3' && substr($skinFilename,0,4) == 'EXT:')  {
00544                                 $skinFilename = 'EXT:' . $this->ID . '/htmlarea/skins/default/htmlarea.css';
00545                         }
00546                         if (substr($skinFilename,0,4) == 'EXT:')      {       // extension
00547                                 list($extKey,$local) = explode('/',substr($skinFilename,4),2);
00548                                 $skinFilename='';
00549                                 if (strcmp($extKey,'') &&  t3lib_extMgm::isLoaded($extKey) && strcmp($local,'')) {
00550                                         $skinFilename = $this->httpTypo3Path . t3lib_extMgm::siteRelPath($extKey) . $local;
00551                                         $skinDir = $this->siteURL . t3lib_extMgm::siteRelPath($extKey) . dirname($local);
00552                                 }
00553                         } elseif (substr($skinFilename,0,1) != '/') {
00554                                 $skinDir = $this->siteURL.dirname($skinFilename);
00555                                 $skinFilename = $this->siteURL . $skinFilename;
00556                         } else {
00557                                 $skinDir = substr($this->siteURL,0,-1) . dirname($skinFilename);
00558                         }
00559                         $this->editorCSS = $skinFilename;
00560                         $this->editedContentCSS = $skinDir . '/htmlarea-edited-content.css';
00561                         $pObj->additionalCode_pre['loadCSS'] .= '
00562                 <link rel="alternate stylesheet" type="text/css" href="' . $this->editedContentCSS . '" />';
00563 
00564                         $pObj->additionalCode_pre['loadCSS'] .= '
00565                 <link rel="stylesheet" type="text/css" href="' . $this->editorCSS . '" />';
00566 
00567                                 // Loading JavaScript files and code
00568                         $pObj->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($pObj->RTEcounter);
00569                         $pObj->additionalJS_pre['loadJScode'] = $this->loadJScode($pObj->RTEcounter);
00570 
00571                         /* =======================================
00572                          * DRAW THE EDITOR
00573                          * =======================================
00574                          */
00575 
00576                                 // Transform value:
00577                         $value = $this->transformContent('rte',$PA['itemFormElValue'],$table,$field,$row,$specConf,$thisConfig,$RTErelPath,$thePidValue);
00578                         
00579                                 // Change some tags
00580                         if ($this->client['BROWSER'] == 'gecko') {
00581                                         // change <strong> to <b>
00582                                 $value = preg_replace('/<(\/?)strong/i', "<$1b", $value);
00583                                         // change <em> to <i>
00584                                 $value = preg_replace('/<(\/?)em([^b>]*>)/i', "<$1i$2", $value);
00585                         }
00586                         if ($this->client['BROWSER'] == 'msie') {
00587                                         // change <abbr> to <acronym>
00588                                 $value = preg_replace('/<(\/?)abbr/i', "<$1acronym", $value);
00589                         }
00590 
00591                                 // Register RTE windows
00592                         $pObj->RTEwindows[] = $PA['itemFormElName'];
00593 
00594                                 // Check if wizard_rte called this for fullscreen edtition; if so, change the size of the RTE to fullscreen using JS
00595                         if (basename(PATH_thisScript) == 'wizard_rte.php') {
00596                                 $height = 'window.innerHeight';
00597                                 $width = 'window.innerWidth';
00598                                 if ($this->client['BROWSER'] == 'msie') {
00599                                         $height = 'document.body.offsetHeight';
00600                                         $width = 'document.body.offsetWidth';
00601                                 }
00602                                 $editorWrapWidth = '100%';
00603                                 $editorWrapHeight = '100%';
00604                                 $this->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border: 1px solid black; padding: 2px 0px 2px 2px;';
00605                                 $pObj->additionalJS_post[] = $this->setRTEsizeByJS('RTEarea'.$pObj->RTEcounter, $height, $width);
00606                         }
00607 
00608                                 // Register RTE in JS:
00609                         $pObj->additionalJS_post[] = $this->registerRTEinJS($pObj->RTEcounter, $table, $row['uid'], $field);
00610 
00611                                 // Set the save option for the RTE:
00612                         $pObj->additionalJS_submit[] = $this->setSaveRTE($pObj->RTEcounter, $pObj->formName, htmlspecialchars($PA['itemFormElName']));
00613 
00614                                 // Draw the textarea
00615                         $visibility = 'hidden';
00616                         $item = $this->triggerField($PA['itemFormElName']).'
00617                                 <div id="pleasewait' . $pObj->RTEcounter . '" class="pleasewait" style="display: none;" >' . $LANG->getLL('Please wait') . '</div>
00618                                 <div id="editorWrap' . $pObj->RTEcounter . '" class="editorWrap" style="width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
00619                                 <textarea id="RTEarea'.$pObj->RTEcounter.'" name="'.htmlspecialchars($PA['itemFormElName']).'" style="'.t3lib_div::deHSCentities(htmlspecialchars($this->RTEdivStyle)).'">'.t3lib_div::formatForTextarea($value).'</textarea>
00620                                 </div>' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? '<div id="HTMLAreaLog"></div>' : '') . '
00621                                 ';
00622                 }
00623 
00624                         // Return form item:
00625                 return $item;
00626         }
00627 
00633         function setToolBar() {
00634                 global $BE_USER;
00635                 
00636                 $this->defaultToolbarOrder = 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
00637                         bar, fontstyle, space, fontsize, space, formatblock,
00638                         bar, bold, italic, underline, strikethrough, subscript, superscript,
00639                         bar, lefttoright, righttoleft, bar, left, center, right, justifyfull,
00640                         bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator,
00641                         bar, emoticon, insertcharacter, line, link, image, table,' . (($this->thisConfig['hideTableOperationsInToolbar'] && is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['toggleborders.']) && $this->thisConfig['buttons.']['toggleborders.']['keepInToolbar']) ? ' toggleborders,': '') . ' user, acronym, bar, findreplace, spellcheck,
00642                         bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, 
00643                         ' . ($this->thisConfig['hideTableOperationsInToolbar'] ? '': 'bar, toggleborders,') . ' bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
00644                         columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
00645                         cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
00646                 
00647                         // Special toolbar for Mozilla Wamcom on Mac OS 9
00648                 if($this->client['BROWSER'] == 'gecko' && $this->client['VERSION'] == '1.3')  {
00649                         $this->defaultToolbarOrder = $this->TCEform->docLarge ? 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
00650                                 bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough,
00651                                 subscript, superscript, lefttoright, righttoleft, bar, left, center, right, justifyfull, linebreak,
00652                                 bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon,
00653                                 insertcharacter, line, link, image, table, user, acronym, bar, findreplace, spellcheck, bar, chMode, inserttag,
00654                                 removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
00655                                 bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
00656                                 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
00657                                 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'
00658                                 : 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
00659                                 bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough,
00660                                 subscript, superscript, linebreak, bar, lefttoright, righttoleft, bar, left, center, right, justifyfull,
00661                                 orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon,
00662                                 insertcharacter, line, link, image, table, user, acronym, linebreak, bar, findreplace, spellcheck, bar, chMode, inserttag,
00663                                 removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
00664                                 bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
00665                                 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
00666                                 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
00667                 }
00668                 $toolbarOrder = $this->thisConfig['toolbarOrder'] ? $this->thisConfig['toolbarOrder'] : $this->defaultToolbarOrder;
00669 
00670                         // Getting rid of undefined buttons
00671                 $this->toolbarOrderArray = array_intersect(t3lib_div::trimExplode(',', $toolbarOrder, 1), t3lib_div::trimExplode(',', $this->defaultToolbarOrder, 1));
00672                 $toolbarOrder = array_unique(array_values($this->toolbarOrderArray));
00673 
00674                         // Fetching specConf for field from backend
00675                 $pList = is_array($this->specConf['richtext']['parameters']) ? implode(',',$this->specConf['richtext']['parameters']) : '';
00676                 if ($pList != '*') {    // If not all
00677                         $show = is_array($this->specConf['richtext']['parameters']) ? $this->specConf['richtext']['parameters'] : array();
00678                         if ($this->thisConfig['showButtons'])   {
00679                                 if (!t3lib_div::inList($this->thisConfig['showButtons'],'*')) {
00680                                         $show = array_unique(array_merge($show,t3lib_div::trimExplode(',',$this->thisConfig['showButtons'],1)));
00681                                 } else {
00682                                         $show = array_unique(array_merge($show, $toolbarOrder));
00683                                 }
00684                         }
00685                         if (is_array($this->thisConfig['showButtons.'])) {
00686                                 reset($this->thisConfig['showButtons.']);
00687                                 while(list($button,$value) = each($this->thisConfig['showButtons.'])) {
00688                                         if ($value) $show[] = $button;
00689                                 }
00690                                 $show = array_unique($show);
00691                         }
00692                 } else {
00693                         $show = $toolbarOrder;
00694                 }
00695 
00696                         // Resticting to RTEkeyList for backend user
00697                 if(is_object($BE_USER)) {
00698                         $RTEkeyList = isset($BE_USER->userTS['options.']['RTEkeyList']) ? $BE_USER->userTS['options.']['RTEkeyList'] : '*';
00699                         if ($RTEkeyList != '*') {       // If not all
00700                                 $show = array_intersect($show, t3lib_div::trimExplode(',',$RTEkeyList,1));
00701                         }
00702                 }
00703                 
00704                         // Hiding buttons of disabled plugins
00705                 $hideButtons = array('space', 'bar', 'linebreak');
00706                 reset($this->pluginButton);
00707                 while(list($plugin, $buttonList) = each($this->pluginButton) ) {
00708                         if(!$this->isPluginEnable($plugin)) {
00709                                 $buttonArray = t3lib_div::trimExplode(',',$buttonList,1);
00710                                 foreach($buttonArray as $button) {
00711                                         $hideButtons[] = $button;
00712                                 }
00713                         }
00714                 }
00715 
00716                         // Hiding labels of disabled plugins
00717                 reset($this->pluginLabel);
00718                 while(list($plugin, $label) = each($this->pluginLabel) ) {
00719                         if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label;
00720                 }
00721 
00722                         // Hiding buttons not implemented in Safari
00723                 if ($this->client['BROWSER'] == 'safari') {
00724                         reset($this->conf_toolbar_safari_hide);
00725                         while(list(, $button) = each($this->conf_toolbar_safari_hide) ) {
00726                                 $hideButtons[] = $button;
00727                         }
00728                 }
00729                 
00730                         // Hiding buttons not implemented in Opera
00731                 if ($this->client['BROWSER'] == 'opera') {
00732                         reset($this->conf_toolbar_opera_hide);
00733                         while(list(, $button) = each($this->conf_toolbar_opera_hide) ) {
00734                                 $hideButtons[] = $button;
00735                         }
00736                 }
00737 
00738                         // Hiding the buttons
00739                 $show = array_diff($show, $this->conf_toolbar_hide, $hideButtons, t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1));
00740 
00741                         // Adding the always show buttons
00742                 $show = array_unique(array_merge($show, $this->conf_toolbar_show));
00743                 $toolbarOrder = array_unique(array_merge($toolbarOrder, $this->conf_toolbar_show));
00744                 reset($this->conf_toolbar_show);
00745                 while(list(,$button) = each($this->conf_toolbar_show)) {
00746                         if(!in_array($button, $this->toolbarOrderArray)) $this->toolbarOrderArray[] = $button;
00747                 }
00748 
00749                         // Getting rid of the buttons for which we have no position
00750                 $show = array_intersect($show, $toolbarOrder);
00751                 $this->toolBar = $show;
00752         }
00753 
00759         function setPlugins() {
00760                 global $TYPO3_CONF_VARS;
00761                 
00762                 $hideButtons = array();
00763                         // Disabling the plugins if their buttons are not in the toolbar
00764                 $hidePlugins = array();
00765                 reset($this->pluginButton);
00766                 while(list($plugin, $buttonList) = each($this->pluginButton) ) {
00767                         $buttonArray = t3lib_div::trimExplode(',',$buttonList,1);
00768                         if(!in_array($buttonArray[0],$this->toolBar)) {
00769                                 $hidePlugins[] = $plugin;
00770                                 foreach($buttonArray as $button) {
00771                                         $hideButtons[] = $button;
00772                                 }
00773                         }
00774                 }
00775                 
00776                 if($this->thisConfig['disableContextMenu'] || $this->thisConfig['disableRightClick']) $hidePlugins[] = 'ContextMenu';
00777                 if($this->thisConfig['disableSelectColor']) $hidePlugins[] = 'SelectColor';
00778                 if($this->thisConfig['disableTYPO3Browsers']) $hidePlugins[] = 'TYPO3Browsers';
00779                 if(!$this->thisConfig['enableWordClean'] || !is_array($this->thisConfig['enableWordClean.'])) $hidePlugins[] = 'TYPO3HtmlParser';
00780                 if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
00781                 
00782                 $this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins);
00783                 
00784                         // Hiding labels of disabled plugins
00785                 reset($this->pluginLabel);
00786                 while(list($plugin, $label) = each($this->pluginLabel) ) {
00787                         if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label;
00788                 }
00789                 $this->toolBar = array_diff($this->toolBar, $hideButtons);
00790 
00791                         // Renaming buttons of replacement plugins
00792                 if( $this->isPluginEnable('SelectColor') ) {
00793                         $this->conf_toolbar_convert['textcolor'] = 'CO-forecolor';
00794                         $this->conf_toolbar_convert['bgcolor'] = 'CO-hilitecolor';
00795                 }
00796         }
00797 
00805          function convertToolBarForHTMLArea($button) {
00806                 return $this->conf_toolbar_convert[$button];
00807          }
00808 
00817         function setRTEsizeByJS($divId, $height, $width) {
00818                 return '
00819                         setRTEsizeByJS(\''.$divId.'\','.$height.', '.$width.');
00820                 ';
00821         }
00822 
00828         function loadJSfiles($number) {
00829                 global $TYPO3_CONF_VARS;
00830                 
00831                 return '
00832                 <script type="text/javascript">
00833                 /*<![CDATA[*/
00834                         var i=1;
00835                         while (document.getElementById("pleasewait" + i)) {
00836                                 document.getElementById("pleasewait" + i).style.display = "block";
00837                                 document.getElementById("editorWrap" + i).style.visibility = "hidden";
00838                                 i++;
00839                         };
00840                         var RTEarea = new Array();
00841                         RTEarea[0] = new Object();
00842                         RTEarea[0]["version"] = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '";
00843                         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'])  . '";
00844                         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'])  . '";
00845                         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'])  . '";
00846                         var _editor_url = "' . $this->extHttpPath . 'htmlarea";
00847                         var _editor_lang = "' . $this->language . '";
00848                         var _editor_CSS = "' . $this->editorCSS . '";
00849                         var _editor_skin = "' . dirname($this->editorCSS) . '";
00850                         var _editor_edited_content_CSS = "' .  $this->editedContentCSS  . '";
00851                         var _typo3_host_url = "' . $this->hostURL . '";
00852                         var _editor_debug_mode = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? 'true' : 'false') . ';
00853                         var _editor_compressed_scripts = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? 'true' : 'false') . ';
00854                         var _editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardUrl'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardUrl'] : '') . '";
00855                         var _spellChecker_lang = "' . $this->spellCheckerLanguage . '";
00856                         var _spellChecker_charset = "' . $this->spellCheckerCharset . '";
00857                         var _spellChecker_mode = "' . $this->spellCheckerMode . '";
00858                 /*]]>*/
00859                 </script>
00860                 <script type="text/javascript" src="' . $this->buildJSMainLangFile($number) . '"></script>
00861                 <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>
00862                 ';
00863         }
00864         
00871         function loadJScode($number) {
00872                 global $TSFE, $TYPO3_CONF_VARS;
00873                 
00874                 $loadPluginCode = '';
00875                 $pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
00876                 while( list(,$plugin) = each($pluginArray) ) {
00877                         if ($this->isPluginEnable($plugin) || (intval($number) > 1 && in_array($plugin, $this->pluginEnableArrayMultiple))) {
00878                                 $loadPluginCode .= '
00879                         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']) . '");';
00880                         }
00881                 }
00882                 return (!is_object($TSFE) ? '' : '
00883                 ' . '/*<![CDATA[*/') . (is_object($TSFE) ? '' : '
00884                         RTEarea[0]["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
00885                         RTEarea[0]["pathAcronymModule"] = "../../mod2/acronym.php";
00886                         RTEarea[0]["pathLinkModule"] = "../../mod3/browse_links.php";
00887                         RTEarea[0]["pathImageModule"] = "../../mod4/select_image.php";
00888                         RTEarea[0]["pathUserModule"] = "../../mod5/user.php";
00889                         RTEarea[0]["pathParseHtmlModule"] = "' . $this->extHttpPath . 'mod6/parse_html.php";')
00890                         . $loadPluginCode .  '
00891                         HTMLArea.init();' . (!is_object($TSFE) ? '' : '
00892                 /*]]>*/
00893                 ');
00894         }
00895         
00907         function registerRTEinJS($number, $table='', $uid='', $field='') {
00908                 global $TSFE, $TYPO3_CONF_VARS;
00909 
00910                         // if this RTE is shown inline of an IRRE record, the JS functions need to know about that
00911                 if ($this->TCEform->inline->inlineNames['object']) {
00912                         $tceformsInlineObject = $this->TCEform->inline->inlineNames['object'].'['.$table.']['.$uid.']_fields';
00913                 }
00914                 
00915                 $registerRTEinJSString = (!is_object($TSFE) ? '' : '
00916                         ' . '/*<![CDATA[*/') . '
00917                         RTEarea['.$number.'] = new Object();
00918                         RTEarea['.$number.']["number"] = '.$number.';
00919                         RTEarea['.$number.']["id"] = "RTEarea'.$number.'";
00920                         RTEarea['.$number.']["enableWordClean"] = ' . (trim($this->thisConfig['enableWordClean'])?'true':'false') . ';
00921                         RTEarea['.$number.']["htmlRemoveComments"] = ' . (trim($this->thisConfig['removeComments'])?'true':'false') . ';
00922                         RTEarea['.$number.']["disableEnterParagraphs"] = ' . (trim($this->thisConfig['disableEnterParagraphs'])?'true':'false') . ';
00923                         RTEarea['.$number.']["removeTrailingBR"] = ' . (trim($this->thisConfig['removeTrailingBR'])?'true':'false') . ';
00924                         RTEarea['.$number.']["useCSS"] = ' . (trim($this->thisConfig['useCSS'])?'true':'false') . ';
00925                         RTEarea['.$number.']["keepButtonGroupTogether"] = ' . (trim($this->thisConfig['keepButtonGroupTogether'])?'true':'false') . ';
00926                         RTEarea['.$number.']["disablePCexamples"] = ' . (trim($this->thisConfig['disablePCexamples'])?'true':'false') . ';
00927                         RTEarea['.$number.']["statusBar"] = ' . (trim($this->thisConfig['showStatusBar'])?'true':'false') . ';
00928                         RTEarea['.$number.']["showTagFreeClasses"] = ' . (trim($this->thisConfig['showTagFreeClasses'])?'true':'false') . ';
00929                         RTEarea['.$number.']["useHTTPS"] = ' . ((trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'])?'true':'false') . ';
00930                         RTEarea['.$number.']["enableMozillaExtension"] = ' . (($this->client['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'])?'true':'false') . ';
00931                         RTEarea['.$number.']["tceformsInlineObject"] = "' . $tceformsInlineObject . '";
00932                         RTEarea['.$number.']["tceformsDynTabs"] = "' . $this->TCEform->getDynTabLevelState('-DIV') . '";';
00933                 
00934                         // The following properties apply only to the backend
00935                 if (!is_object($TSFE)) {
00936                         $registerRTEinJSString .= '
00937                         RTEarea['.$number.']["sys_language_content"] = "' . $this->contentLanguageUid . '";
00938                         RTEarea['.$number.']["typo3ContentLanguage"] = "' . $this->contentTypo3Language . '";
00939                         RTEarea['.$number.']["typo3ContentCharset"] = "' . $this->contentCharset . '";
00940                         RTEarea['.$number.']["enablePersonalDicts"] = ' . ($this->spellCheckerPersonalDicts ? 'true' : 'false') . ';
00941                         RTEarea['.$number.']["userUid"] = "' . $this->userUid . '";';
00942                 }
00943                 
00944                         // Setting the plugin flags
00945                 $registerRTEinJSString .= '
00946                         RTEarea['.$number.']["plugin"] = new Object();';
00947                 
00948                 $pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
00949                 reset($pluginArray);
00950                 while( list(,$plugin) = each($pluginArray) ) {
00951                         if ($this->isPluginEnable($plugin)) {
00952                                 $registerRTEinJSString .= '
00953                         RTEarea['.$number.']["plugin"]["'.$plugin.'"] = true;';
00954                         }
00955                 }
00956                 
00957                         // Setting the buttons configuration
00958                 $registerRTEinJSString .= '
00959                         RTEarea['.$number.']["buttons"] = new Object();';
00960                 if (is_array($this->thisConfig['buttons.'])) {
00961                         reset($this->thisConfig['buttons.']);
00962                         while( list($buttonIndex,$conf) = each($this->thisConfig['buttons.']) ) {
00963                                 $button = substr($buttonIndex, 0, -1);
00964                                 if (in_array($button,$this->toolBar)) {
00965                                         $indexButton = 0;
00966                                         $registerRTEinJSString .= '
00967                         RTEarea['.$number.']["buttons"]["'.$button.'"] = {';
00968                                         if (is_array($conf)) {
00969                                                 reset($conf);
00970                                                 while (list($propertyName,$conf1) = each($conf)) {
00971                                                         $property = $propertyName;
00972                                                         if ($indexButton) {
00973                                                                 $registerRTEinJSString .= ', ';
00974                                                         }
00975                                                         if (is_array($conf1)) {
00976                                                                 $property = substr($property, 0, -1);
00977                                                                 $indexProperty = 0;
00978                                                                 $registerRTEinJSString .= '"'.$property.'" : {';
00979                                                                 reset($conf1);
00980                                                                 while (list($property1Name,$conf2) = each($conf1)) {
00981                                                                         $property1 = $property1Name;
00982                                                                         if ($indexProperty) {
00983                                                                                 $registerRTEinJSString .= ', ';
00984                                                                         }
00985                                                                         if (is_array($conf2)) {
00986                                                                                 $property1 = substr($property1, 0, -1);
00987                                                                                 $indexProperty1 = 0;
00988                                                                                 $registerRTEinJSString .= '"'.$property1.'" : {';
00989                                                                                 reset($conf2);
00990                                                                                 while (list($property2Name,$conf3) = each($conf2)) {
00991                                                                                         $property2 = $property2Name;
00992                                                                                         if ($indexProperty1) {
00993                                                                                                 $registerRTEinJSString .= ', ';
00994                                                                                         }
00995                                                                                         if (is_array($conf3)) {
00996                                                                                                 $property2 = substr($property2, 0, -1);
00997                                                                                                 $indexProperty2 = 0;
00998                                                                                                 $registerRTEinJSString .= '"'.$property2.'" : {';
00999                                                                                                 reset($conf3);
01000                                                                                                 while (list($property3Name,$conf4) = each($conf3)) {
01001                                                                                                         $property3 = $property3Name;
01002                                                                                                         if ($indexProperty2) {
01003                                                                                                                 $registerRTEinJSString .= ', ';
01004                                                                                                         }
01005                                                                                                         if (!is_array($conf4)) {
01006                                                                                                                 $registerRTEinJSString .= '"'.$property3.'" : '.($conf4?'"'.$conf4.'"':'false');
01007                                                                                                         }
01008                                                                                                         $indexProperty2++;
01009                                                                                                 }
01010                                                                                                 $registerRTEinJSString .= '}';
01011                                                                                         } else {
01012                                                                                                 $registerRTEinJSString .= '"'.$property2.'" : '.($conf3?'"'.$conf3.'"':'false');                                                                                                
01013                                                                                         }
01014                                                                                         $indexProperty1++;
01015                                                                                 }
01016                                                                                 $registerRTEinJSString .= '}';
01017                                                                         } else {
01018                                                                                 $registerRTEinJSString .= '"'.$property1.'" : '.($conf2?'"'.$conf2.'"':'false');
01019                                                                         }
01020                                                                         $indexProperty++;
01021                                                                 }
01022                                                                 $registerRTEinJSString .= '}';
01023                                                         } else {
01024                                                                 $registerRTEinJSString .= '"'.$property.'" : '.($conf1?'"'.$conf1.'"':'false');
01025                                                         }
01026                                                         $indexButton++;
01027                                                 }
01028                                         }
01029                                         $registerRTEinJSString .= '};';
01030                                 }
01031                         }
01032                 }
01033                 
01034                         // Deprecated inserttag button configuration
01035                 if (in_array('inserttag', $this->toolBar) && trim($this->thisConfig['hideTags'])) {
01036                         if (!is_array($this->thisConfig['buttons.']['inserttag.'])) {
01037                                 $registerRTEinJSString .= '
01038                         RTEarea['.$number.']["buttons"]["inserttag"] = new Object();
01039                         RTEarea['.$number.']["buttons"]["inserttag"]["denyTags"] = "'.implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1)).'";';
01040                         } elseif (!$this->thisConfig['buttons.']['inserttag.']['denyTags']) {
01041                                 $registerRTEinJSString .= '
01042                         RTEarea['.$number.']["buttons"]["inserttag"]["denyTags"] = "'.implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1)).'";';
01043                         }
01044                 }
01045                 
01046                         // Setting the list of tags to be removed if specified in the RTE config
01047                 if (trim($this->thisConfig['removeTags']))  {
01048                         $registerRTEinJSString .= '
01049                         RTEarea['.$number.']["htmlRemoveTags"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTags'], 1)) . ')$/i;';
01050                 }
01051                 
01052                         // Setting the list of tags to be removed with their contents if specified in the RTE config
01053                 if (trim