From 86fa65404cee8cdcb0b2f6ea1ceb93d29a44fd26 Mon Sep 17 00:00:00 2001 From: Dmitry Dulepov Date: Mon, 18 Aug 2008 15:59:20 +0000 Subject: [PATCH] Fixed bug #8232: Creating and editing of fields, forms, etc. in FCE's is impossible if there is a section inside git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3995 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + t3lib/class.t3lib_tceforms.php | 73 ++-- .../rtehtmlarea/class.tx_rtehtmlarea_base.php | 368 ++++++++++-------- .../pi2/class.tx_rtehtmlarea_pi2.php | 96 ++--- 4 files changed, 308 insertions(+), 230 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6451efc28ff..cac4686ffc80 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * Fixed bug #9141: Update Wizard uses wrong scheme to write compat_version to localconf.php * Fixed bug #9152: Deprecated code into stdgraphic * Fixed bug #9183: saveDocNew for all tables except the option is set to 0 + * Fixed bug #8232: Creating and editing of fields, forms, etc. in FCE's is impossible if there is a section inside 2008-08-16 Stanislas Rolland diff --git a/t3lib/class.t3lib_tceforms.php b/t3lib/class.t3lib_tceforms.php index 1c834de26062..feb3beced2bd 100755 --- a/t3lib/class.t3lib_tceforms.php +++ b/t3lib/class.t3lib_tceforms.php @@ -301,6 +301,7 @@ class t3lib_TCEforms { var $additionalJS_pre = array(); // Additional JavaScript, printed before the form var $additionalJS_post = array(); // Additional JavaScript printed after the form var $additionalJS_submit = array(); // Additional JavaScript executed on submit; If you set "OK" variable it will raise an error about RTEs not being loaded and offer to block further submission. + var $additionalJS_delete = array(); // Additional JavaScript executed when section element is deleted. This is neceessary, for example, to correctly clean up HTMLArea RTE (bug #8232) /** * Instance of t3lib_tceforms_inline @@ -980,7 +981,7 @@ function getSingleField_SW($table,$field,$row,&$PA) { $hookObject->getSingleField_beforeRender($table, $field, $row, $PA); } } - + switch($PA['fieldConf']['config']['form_type']) { case 'input': $item = $this->getSingleField_typeInput($table,$field,$row,$PA); @@ -1653,7 +1654,7 @@ function getSingleField_typeSelect_checkbox($table,$field,$row,&$PA,$config,$sel // Get values in an array (and make unique, which is fine because there can be no duplicates anyway): $itemArray = array_flip($this->extractValuesOnlyFromValueLabelList($PA['itemFormElValue'])); - + $disabled = ''; if($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; @@ -1674,7 +1675,7 @@ function getSingleField_typeSelect_checkbox($table,$field,$row,&$PA,$config,$sel ' . '' . htmlspecialchars($this->getLL('l_checkAll')) . - ' + ' ' . htmlspecialchars($this->getLL('l_uncheckAll')) . ' @@ -1712,13 +1713,13 @@ function getSingleField_typeSelect_checkbox($table,$field,$row,&$PA,$config,$sel $restoreCmd[] = $this->elName($PA['itemFormElName'] . '[' . $c . ']') . '.checked=' . ($sM ? 1 : 0) . ';' . '$(\'' . $rowId . '\').removeClassName(\'c-selectedItem\');$(\'' . $rowId . '\').removeClassName(\'c-unselectedItem\');' . '$(\'' . $rowId . '\').addClassName(\'c-' . ($sM ? '' : 'un') . 'selectedItem\');'; - + $hasHelp = ($p[3] !=''); - + $label = t3lib_div::deHSCentities(htmlspecialchars($p[0])); - $help = $hasHelp ? '' . $label . '' . + $help = $hasHelp ? '' . $label . '' . '' . $GLOBALS['LANG']->hscAndCharConv(nl2br(trim(htmlspecialchars($p[3]))), false) . '' : ''; - + if ($hasHelp && $this->edit_showFieldHelp == 'icon') { $helpIcon = ''; $helpIcon .= 'backPath, 'gfx/helpbubble.gif', 'width="14" height="14"'); @@ -1747,7 +1748,7 @@ function getSingleField_typeSelect_checkbox($table,$field,$row,&$PA,$config,$sel '. '' . htmlspecialchars($this->getLL('l_checkAll')) . - ' + ' ' . htmlspecialchars($this->getLL('l_uncheckAll')) . ' @@ -1777,7 +1778,7 @@ function getSingleField_typeSelect_checkbox($table,$field,$row,&$PA,$config,$sel // Add revert icon if (is_array($restoreCmd)) { $item .= '' . - 'backPath,'gfx/undo.gif','width="13" height="12"') . ' title="' . + 'backPath,'gfx/undo.gif','width="13" height="12"') . ' title="' . htmlspecialchars($this->getLL('l_revertSelection')) . '" alt="" />' .''; } // Implode rows in table: @@ -2317,7 +2318,7 @@ function getSingleField_typeFlex($table,$field,$row,&$PA) { if (!is_array($editData)) { // Must be XML parsing error... $editData=array(); } elseif (!isset($editData['meta']) || !is_array($editData['meta'])) { - $editData['meta'] = array(); + $editData['meta'] = array(); } // Find the data structure if sheets are found: @@ -2553,6 +2554,10 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,& // Traversing possible types of new content in the section: $newElementsLinks = array(); foreach($value['el'] as $nnKey => $nCfg) { + $additionalJS_post_saved = $this->additionalJS_post; + $this->additionalJS_post = array(); + $additionalJS_submit_saved = $this->additionalJS_submit; + $this->additionalJS_submit = array(); $newElementTemplate = $this->getSingleField_typeFlex_draw( array($nnKey => $nCfg), array(), @@ -2566,7 +2571,17 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,& ); // Makes a "Add new" link: - $onClickInsert = 'new Insertion.Bottom($("'.$idTagPrefix.'"), unescape("'.rawurlencode($newElementTemplate).'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-idx"+Math.floor(Math.random()*100000+1)+"-")); setActionStatus("'.$idTagPrefix.'"); return false;'; // Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works... + $var = uniqid('idvar'); + $replace = 'replace(/' . $idTagPrefix . '-/g,"' . $idTagPrefix . '"+' . $var . '+"-")'; + $onClickInsert = 'var ' . $var . ' = "' . $idTagPrefix . '-idx"+(new Date()).getTime();'; + // Do not replace $isTagPrefix in setActionStatus() because it needs section id! + $onClickInsert .= 'new Insertion.Bottom($("'.$idTagPrefix.'"), unescape("'.rawurlencode($newElementTemplate).'").' . $replace . '); setActionStatus("'.$idTagPrefix.'");'; + $onClickInsert .= 'eval(unescape("' . rawurlencode(implode(';', $this->additionalJS_post)) . '").' . $replace . ');'; + $onClickInsert .= 'TBE_EDITOR.addActionChecks("submit", unescape("' . rawurlencode(implode(';', $this->additionalJS_submit)) . '").' . $replace . ');'; + $onClickInsert .= 'return false;'; + // Kasper's comment (kept for history): Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works... + $this->additionalJS_post = $additionalJS_post_saved; + $this->additionalJS_submit = $additionalJS_submit_saved; $newElementsLinks[]= 'backPath,'gfx/new_el.gif','width="11" height="12"').' alt="New" title="New" align="absmiddle" />'.htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($nCfg['tx_templavoila']['title']),30)).''; } @@ -2583,15 +2598,15 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,&
'.implode('',$tRows).'
'; $output.= $mayRestructureFlexforms ? '
Add new: '.implode(' | ',$newElementsLinks).'
' : ''; - // If it's a container: } else { + // It is a container $toggleIcon_open = 'backPath,'gfx/pil2down.gif','width="12" height="7"').' hspace="2" alt="Open" title="Open" />'; $toggleIcon_close = 'backPath,'gfx/pil2right.gif','width="7" height="12"').' hspace="2" alt="Close" title="Close" />'; // Create on-click actions. - # $onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;'; // Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file. - $onClickRemove = 'if (confirm("Are you sure?")){$("'.$idTagPrefix.'").hide();setActionStatus("'.$idPrefix.'");} return false;'; + //$onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;'; // Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file. + $onClickRemove = 'if (confirm("Are you sure?")){/*###REMOVE###*/;$("'.$idTagPrefix.'").hide();setActionStatus("'.$idPrefix.'");} return false;'; $onClickToggle = 'flexFormToggle("'.$idTagPrefix.'"); return false;'; $onMove = 'flexFormSortable("'.$idPrefix.'")'; @@ -2622,6 +2637,7 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,& $actionFieldName = '_ACTION_FLEX_FORM'.$PA['itemFormElName'].$s[0].'][_ACTION]['.$s[1]; // Putting together the container: + $this->additionalJS_delete = array(); $output.= '
@@ -2641,6 +2657,7 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,&
'; + $output = str_replace('/*###REMOVE###*/', t3lib_div::slashJS(htmlspecialchars(implode('', $this->additionalJS_delete))), $output); // NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized" according to the data structure. It means that flexform XML will report unclean and a cleaning operation will remove the recorded togglestates. This is not a fatal problem. Ideally we should save the toggle states in meta-data but it is much harder to do that. And this implementation was easy to make and with no really harmful impact. } @@ -2663,7 +2680,7 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,& 'label' => $this->sL(trim($value['TCEforms']['label'])), 'config' => $value['TCEforms']['config'], 'defaultExtras' => $value['TCEforms']['defaultExtras'], - 'onChange' => $value['TCEforms']['onChange'] + 'onChange' => $value['TCEforms']['onChange'] ); if ($PA['_noEditDEF'] && $PA['_lang']==='lDEF') { $fakePA['fieldConf']['config'] = array( @@ -2673,7 +2690,7 @@ function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,& } if ( - $fakePA['fieldConf']['onChange'] == 'reload' || + $fakePA['fieldConf']['onChange'] == 'reload' || ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key,$GLOBALS['TCA'][$table]['ctrl']['type'])) || ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'],$key))) { if ($GLOBALS['BE_USER']->jsConfirmation(1)) { @@ -5092,29 +5109,29 @@ function flexFormToggle(id) { // Toggling flexform elements on/off: $(id+"-toggleClosed").value = 1; } - var previewContent = ""; - var children = $(id+"-content").getElementsByTagName("input"); - for (var i = 0, length = children.length; i < length; i++) { + var previewContent = ""; + var children = $(id+"-content").getElementsByTagName("input"); + for (var i = 0, length = children.length; i < length; i++) { if (children[i].type=="text" && children[i].value) previewContent+= (previewContent?" / ":"")+children[i].value; - } + } if (previewContent.length>80) { previewContent = previewContent.substring(0,67)+"..."; } $(id+"-preview").update(previewContent); } function flexFormToggleSubs(id) { // Toggling sub flexform elements on/off: - var descendants = $(id).immediateDescendants(); + var descendants = $(id).immediateDescendants(); var isOpen=0; var isClosed=0; // Traverse and find how many are open or closed: - for (var i = 0, length = descendants.length; i < length; i++) { + for (var i = 0, length = descendants.length; i < length; i++) { if (descendants[i].id) { if (Element.visible(descendants[i].id+"-content")) {isOpen++;} else {isClosed++;} } - } + } // Traverse and toggle - for (var i = 0, length = descendants.length; i < length; i++) { + for (var i = 0, length = descendants.length; i < length; i++) { if (descendants[i].id) { if (isOpen!=0 && isClosed!=0) { if (Element.visible(descendants[i].id+"-content")) {flexFormToggle(descendants[i].id);} @@ -5122,7 +5139,7 @@ function flexFormToggleSubs(id) { // Toggling sub flexform elements on/off: flexFormToggle(descendants[i].id); } } - } + } } function flexFormSortable(id) { // Create sortables for flexform sections Sortable.create(id, {tag:\'div\',constraint: false, onChange:function(){ @@ -5130,14 +5147,14 @@ function flexFormSortable(id) { // Create sortables for flexform sections } }); } function setActionStatus(id) { // Updates the "action"-status for a section. This is used to move and delete elements. - var descendants = $(id).immediateDescendants(); + var descendants = $(id).immediateDescendants(); // Traverse and find how many are open or closed: - for (var i = 0, length = descendants.length; i < length; i++) { + for (var i = 0, length = descendants.length; i < length; i++) { if (descendants[i].id) { $(descendants[i].id+"-action").value = descendants[i].visible() ? i : "DELETE"; } - } + } } TBE_EDITOR.images.req.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/required_h.gif','',1).'"; diff --git a/typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php b/typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php index 4fd60472044a..863da97b82b7 100644 --- a/typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php +++ b/typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php @@ -69,7 +69,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi { var $conf_toolbar_hide = array ( 'showhelp', // Has no content yet ); - + // Always show these toolbar buttons (TYPO3 button name) var $conf_toolbar_show = array ( 'undo', @@ -77,10 +77,10 @@ class tx_rtehtmlarea_base extends t3lib_rteapi { //'showhelp', 'about', ); - + // The order of the toolbar: the name is the TYPO3-button name var $defaultToolbarOrder; - + // Conversion array: TYPO3 button names to htmlArea button names var $convertToolbarForHtmlAreaArray = array ( 'line' => 'InsertHorizontalRule', @@ -91,11 +91,11 @@ class tx_rtehtmlarea_base extends t3lib_rteapi { 'bar' => 'separator', 'linebreak' => 'linebreak', ); - + var $pluginList; var $pluginButton = array(); var $pluginLabel = array(); - + // External: var $RTEdivStyle; // Alternative style for RTE
tag. public $httpTypo3Path; @@ -110,12 +110,12 @@ class tx_rtehtmlarea_base extends t3lib_rteapi { // For the editor var $client; - - /** - * Reference to parent object, which is an instance of the TCEforms - * - * @var t3lib_TCEforms - */ + + /** + * Reference to parent object, which is an instance of the TCEforms + * + * @var t3lib_TCEforms + */ var $TCEform; var $elementId; var $elementParts; @@ -138,17 +138,17 @@ class tx_rtehtmlarea_base extends t3lib_rteapi { protected $pluginEnabledArray = array(); // Array of plugin id's enabled in the current RTE editing area protected $pluginEnabledCumulativeArray = array(); // Cumulative array of plugin id's enabled so far in any of the RTE editing areas of the form protected $registeredPlugins = array(); // Array of registered plugins indexd by their plugin Id's - + /** * Returns true if the RTE is available. Here you check if the browser requirements are met. * If there are reasons why the RTE cannot be displayed you simply enter them as text in ->errorLog * * @return boolean TRUE if this RTE object offers an RTE in the current browser environment */ - + function isAvailable() { global $TYPO3_CONF_VARS; - + $this->client = $this->clientInfo(); $this->errorLog = array(); if (!$this->debugMode) { // If debug-mode, let any browser through @@ -176,7 +176,7 @@ function isAvailable() { } // End of Browser Check } // foreach: Browser Check } else { - // no Browser config for this RTE-Editor, so all Clients are allow + // no Browser config for this RTE-Editor, so all Clients are allow } if (!$rteIsAvailable) { $this->errorLog[] = 'rte: Browser not supported. Only msie Version 5 or higher and Mozilla based client 1. and higher.'; @@ -204,22 +204,22 @@ function isAvailable() { * @param integer PID value of record (true parent page id) * @return string HTML code for RTE! */ - + function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue) { global $BE_USER, $LANG, $TYPO3_DB, $TYPO3_CONF_VARS; - + $this->TCEform =& $parentObject; $inline =& $this->TCEform->inline; $LANG->includeLLFile('EXT:' . $this->ID . '/locallang.xml'); $this->client = $this->clientInfo(); $this->typoVersion = t3lib_div::int_from_ver(TYPO3_version); $this->userUid = 'BE_' . $BE_USER->user['uid']; - + // Draw form element: if ($this->debugMode) { // Draws regular text area (debug mode) $item = parent::drawRTE($this->TCEform, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue); } else { // Draw real RTE - + /* ======================================= * INIT THE EDITOR-SETTINGS * ======================================= @@ -256,14 +256,14 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi // Special configuration and default extras: $this->specConf = $specConf; - + if ($this->thisConfig['forceHTTPS']) { $this->httpTypo3Path = preg_replace('/^(http|https)/', 'https', $this->httpTypo3Path); $this->extHttpPath = preg_replace('/^(http|https)/', 'https', $this->extHttpPath); $this->siteURL = preg_replace('/^(http|https)/', 'https', $this->siteURL); $this->hostURL = preg_replace('/^(http|https)/', 'https', $this->hostURL); } - + /* ======================================= * LANGUAGES & CHARACTER SETS * ======================================= @@ -275,7 +275,7 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi $this->language='en'; } $this->contentTypo3Language = $this->language; - + $this->contentLanguageUid = ($row['sys_language_uid'] > 0) ? $row['sys_language_uid'] : 0; if (t3lib_extMgm::isLoaded('static_info_tables')) { if ($this->contentLanguageUid) { @@ -303,11 +303,11 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi } } } - + // Character sets: interface and content $this->charset = $LANG->charSet; $this->OutputCharset = $this->charset; - + $this->contentCharset = $LANG->csConvObj->charSetArray[$this->contentTypo3Language]; $this->contentCharset = $this->contentCharset ? $this->contentCharset : 'iso-8859-1'; $this->origContentCharSet = $this->contentCharset; @@ -317,7 +317,7 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi * TOOLBAR CONFIGURATION * ======================================= */ - + // htmlArea plugins list $this->pluginEnabledArray = t3lib_div::trimExplode(',', $this->pluginList, 1); $this->enableRegisteredPlugins(); @@ -337,13 +337,13 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi // Check if some plugins need to be disabled $this->setPlugins(); - + // Merge the list of enabled plugins with the lists from the previous RTE editing areas on the same form $this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = $this->pluginEnabledArray; if ($this->TCEform->RTEcounter > 1 && isset($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1]) && is_array($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1])) { $this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = array_unique(array_values(array_merge($this->pluginEnabledArray,$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1]))); } - + /* ======================================= * SET STYLES * ======================================= @@ -393,11 +393,11 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi $this->editedContentCSS = $skinDir . '/htmlarea-edited-content.css'; $this->TCEform->additionalCode_pre['loadCSS'] .= ' '; - + // Main skin $this->TCEform->additionalCode_pre['loadCSS'] .= ' '; - + // Additional icons from registered plugins foreach ($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] as $pluginId) { if (is_object($this->registeredPlugins[$pluginId])) { @@ -408,7 +408,7 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi } } } - + // Loading JavaScript files and code if ($this->TCEform->RTEcounter == 1) { $this->TCEform->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($this->TCEform->RTEcounter); @@ -422,7 +422,7 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi // Transform value: $value = $this->transformContent('rte',$PA['itemFormElValue'],$table,$field,$row,$specConf,$thisConfig,$RTErelPath,$thePidValue); - + // Further content transformation by registered plugins foreach ($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId) && method_exists($plugin, "transformContent")) { @@ -446,18 +446,22 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi $this->TCEform->additionalJS_post[] = $this->setRTEsizeByJS('RTEarea'.$this->TCEform->RTEcounter, $height, $width); } + $textAreaId = htmlspecialchars($PA['itemFormElName']); + // Register RTE in JS: - $this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, $table, $row['uid'], $field); + $this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, $table, $row['uid'], $field, $textAreaId); // Set the save option for the RTE: - $this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, htmlspecialchars($PA['itemFormElName'])); + $this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId); + $this->TCEform->additionalJS_delete[] = $this->setDeleteRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId); // Draw the textarea $visibility = 'hidden'; + $unuqid = uniqid('rte'); $item = $this->triggerField($PA['itemFormElName']).' - -
- + +
+
' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? '
' : '') . ' '; } @@ -465,7 +469,7 @@ function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfi // Return form item: return $item; } - + /** * Add registered plugins to the array of enabled plugins * @@ -507,7 +511,7 @@ function enableRegisteredPlugins() { } $this->pluginEnabledArray = array_diff($this->pluginEnabledArray, $hidePlugins); } - + /** * Set the toolbar config (only in this PHP-Object, not in JS): * @@ -515,7 +519,7 @@ function enableRegisteredPlugins() { function setToolbar() { global $BE_USER; - + $this->defaultToolbarOrder = 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak, bar, formattext, bold, strong, italic, emphasis, big, small, insertedtext, deletedtext, citation, code, definition, keyboard, monospaced, quotation, sample, variable, bidioverride, strikethrough, subscript, superscript, underline, span, bar, fontstyle, space, fontsize, bar, formatblock, insertparagraphbefore, insertparagraphafter, blockquote, @@ -523,11 +527,11 @@ function setToolbar() { bar, orderedlist, unorderedlist, definitionlist, definitionitem, outdent, indent, bar, lefttoright, righttoleft, bar, textcolor, bgcolor, textindicator, bar, emoticon, insertcharacter, line, link, unlink, 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, - bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, + bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, ' . ($this->thisConfig['hideTableOperationsInToolbar'] ? '': 'bar, toggleborders,') . ' bar, tableproperties, tablerestyle, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar, columnproperties, columninsertbefore, columninsertafter, columndelete, columnsplit, bar, cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'; - + // Special toolbar for Mozilla Wamcom on Mac OS 9 if($this->client['BROWSER'] == 'gecko' && $this->client['VERSION'] == '1.3') { $this->defaultToolbarOrder = $this->TCEform->docLarge ? 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak, @@ -549,7 +553,7 @@ function setToolbar() { columnproperties, columninsertbefore, columninsertafter, columndelete, columnsplit, bar, cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'; } - + // Additional buttons from registered plugins foreach($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId)) { @@ -590,7 +594,7 @@ function setToolbar() { $show = array_intersect($show, t3lib_div::trimExplode(',',$RTEkeyList,1)); } } - + // Hiding buttons of disabled plugins $hideButtons = array('space', 'bar', 'linebreak'); foreach ($this->pluginButton as $pluginId => $buttonList) { @@ -601,17 +605,17 @@ function setToolbar() { } } } - + // Hiding labels of disabled plugins foreach ($this->pluginLabel as $pluginId => $label) { if (!$this->isPluginEnabled($pluginId)) { $hideButtons[] = $label; } } - + // Hiding buttons $show = array_diff($show, $this->conf_toolbar_hide, t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1)); - + // Apply toolbar constraints from registered plugins foreach ($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId) && method_exists($plugin, "applyToolbarConstraints")) { @@ -624,7 +628,7 @@ function setToolbar() { foreach ($this->conf_toolbar_show as $buttonId) { if (!in_array($buttonId, $this->toolbarOrderArray)) $this->toolbarOrderArray[] = $buttonId; } - + // Getting rid of the buttons for which we have no position $show = array_intersect($show, $toolbarOrder); $this->toolbar = $show; @@ -635,7 +639,7 @@ function setToolbar() { * */ function setPlugins() { - + // Disabling a plugin that adds buttons if none of its buttons is in the toolbar $hidePlugins = array(); foreach ($this->pluginButton as $pluginId => $buttonList) { @@ -653,7 +657,7 @@ function setPlugins() { } } $this->pluginEnabledArray = array_diff($this->pluginEnabledArray, $hidePlugins); - + // Hiding labels of disabled plugins $hideLabels = array(); foreach ($this->pluginLabel as $pluginId => $label) { @@ -662,7 +666,7 @@ function setPlugins() { } } $this->toolbar = array_diff($this->toolbar, $hideLabels); - + // Completing the toolbar converion array for htmlArea foreach ($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId)) { @@ -673,7 +677,7 @@ function setPlugins() { /** * Convert the TYPO3 names of buttons into the names for htmlArea RTE - * + * * @param string buttonname (typo3-name) * @return string buttonname (htmlarea-name) */ @@ -705,16 +709,29 @@ function setRTEsizeByJS($divId, $height, $width) { */ function loadJSfiles($RTEcounter) { global $TYPO3_CONF_VARS; - + $loadJavascriptCode = '