* Feature/Cleanup: Acronym plugin of htmlArea RTE using new plugin API and enabled...
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 6 Jan 2008 07:40:51 +0000 (07:40 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 6 Jan 2008 07:40:51 +0000 (07:40 +0000)
* Fixed issue 6154: Plugin Acronym enables class abbr for span
* Added feature 1927: Activate Acronym Plugin for IE

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2864 709f56b5-9817-0410-a4d7-c38de5d9e867

19 files changed:
ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/doc/manual.sxw
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/Acronym/skin/htmlarea.css [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/Acronym/skin/images/acronym.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/CharacterMap/locallang.xml [deleted file]
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js
typo3/sysext/rtehtmlarea/htmlarea/skins/default/htmlarea-edited-content.css
typo3/sysext/rtehtmlarea/mod2/acronym.php
typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym.php [deleted file]
typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php
typo3/sysext/t3skin/rtehtmlarea/htmlarea-edited-content.css
typo3/sysext/t3skin/rtehtmlarea/htmlarea.css

index c74df8a..e8bce82 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-06  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Feature/Cleanup: Acronym plugin of htmlArea RTE using new plugin API and enabled in IE7
+       * Fixed issue 6154: Plugin Acronym enables class abbr for span
+       * Added feature 1927: Activate Acronym Plugin for IE
+
 2008-01-05  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * (major) Feature: Improved behaviour and configuration options of formatblock and blockstyle drop-down lists
index 3a6cde6..9fc9456 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-06  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Feature/Cleanup: Acronym plugin of htmlArea RTE using new plugin API and enabled in IE7
+       * Fixed issue 6154: Plugin Acronym enables class abbr for span
+       * Added feature 1927: Activate Acronym Plugin for IE
+
 2008-01-05  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * (major) Feature: Improved behaviour and configuration options of formatblock and blockstyle drop-down lists
index 8b61b94..a1e89c1 100644 (file)
@@ -118,7 +118,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                'spellcheck'            => 'SpellCheck',
                'removeformat'          => 'RemoveFormat',
                'inserttag'             => 'InsertTag',
-               'acronym'               => 'Acronym',
                'splitblock'            => 'SplitBlock',
                'toggleborders'         => 'TO-toggle-borders',
                'tableproperties'       => 'TO-table-prop',
@@ -182,7 +181,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                '7'     =>      'xxx-large (48px)',
                );
        
-       var $pluginList = 'TableOperations, ContextMenu, SpellChecker, SelectColor, TYPO3Browsers, InsertSmiley, FindReplace, RemoveFormat, CharacterMap, QuickTag, UserElements, Acronym, TYPO3HtmlParser';
+       var $pluginList = 'TableOperations, ContextMenu, SpellChecker, SelectColor, TYPO3Browsers, InsertSmiley, FindReplace, RemoveFormat, CharacterMap, QuickTag, UserElements, TYPO3HtmlParser';
        
        var $pluginButton = array(
                'SpellChecker'          => 'spellcheck',
@@ -194,7 +193,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                                columninsertbefore, columninsertafter, columndelete, columnsplit,
                                                cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge',
                'UserElements'          => 'user',
-               'Acronym'               => 'acronym',
                'SelectColor'           => 'textcolor,bgcolor',
                );
 
@@ -433,9 +431,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        $hidePlugins = array();
                        if (!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
                        if ($this->client['BROWSER'] == 'msie') {
-                               //if ($this->client['VERSION'] < 7) {
-                                       $hidePlugins[] = 'Acronym';
-                               //}
                                $this->thisConfig['keepButtonGroupTogether'] = 0;
                        }
                        if ($this->client['BROWSER'] == 'opera') {
@@ -562,17 +557,12 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                // 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")) {
                                        $value = $plugin->transformContent($value);
                                }
                        }
-                       //if ($this->client['BROWSER'] == 'msie') {
-                       if ($this->client['BROWSER'] == 'msie' && $this->client['VERSION'] < 7) {
-                                       // change <abbr> to <acronym>
-                               $value = preg_replace('/<(\/?)abbr/i', "<$1acronym", $value);
-                       }
-
                                // Register RTE windows
                        $this->TCEform->RTEwindows[] = $PA['itemFormElName'];
 
@@ -658,7 +648,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                global $BE_USER;
                
                $this->defaultToolbarOrder = 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
-                       bar, inlineelement, bold,  strong, italic, emphasis, big, small, insertedtext, deletedtext, citation, code, definition, keyboard, monospaced, quotation, sample, variable, bidioverride, strikethrough, subscript, superscript, underline, span,
+                       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,
                        bar, left, center, right, justifyfull,
                        bar, orderedlist, unorderedlist, outdent, indent,  bar, lefttoright, righttoleft,
@@ -921,7 +911,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                return (!$this->is_FE() ? '' : '
                ' . '/*<![CDATA[*/') . ($this->is_FE() ? '' : '
                        RTEarea[0]["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
-                       RTEarea[0]["pathAcronymModule"] = "../../mod2/acronym.php";
                        RTEarea[0]["pathLinkModule"] = "../../mod3/browse_links.php";
                        RTEarea[0]["pathImageModule"] = "../../mod4/select_image.php";
                        RTEarea[0]["pathUserModule"] = "../../mod5/user.php";
@@ -1134,11 +1123,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        }
                }
                
-               if ($this->isPluginEnabled('Acronym')) {
-                       $configureRTEInJavascriptString .= '
-                       RTEarea['.$RTEcounter.']["acronymUrl"] = "' . $this->writeTemporaryFile('', 'acronym_'.$this->contentLanguageUid, 'js', $this->buildJSAcronymArray()) . '";';
-               }
-               
                if ($this->isPluginEnabled('TYPO3Browsers')) {
                        $configureRTEInJavascriptString .= $this->buildJSClassesAnchorConfig($RTEcounter);
                }
@@ -1530,39 +1514,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                }
                return $JSLanguageArray;
        }
-
-       /**
-        * Return an acronym array for the Acronym plugin
-        *
-        * @return      string          acronym Javascript array
-        */
-
-       function buildJSAcronymArray() {
-               global $TYPO3_CONF_VARS, $TYPO3_DB;
-               
-               $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
-               $acronymIndex = 0;
-               $abbraviationIndex = 0;
-               $JSAcronymArray .= 'acronyms = { ' . $linebreak;
-               $JSAbbreviationArray .= 'abbreviations = { ' . $linebreak;
-               $table = 'tx_rtehtmlarea_acronym';
-               if($this->contentLanguageUid > -1) {
-                       $whereClause = '(sys_language_uid='.$this->contentLanguageUid . ' OR sys_language_uid=-1)';
-               } else {
-                       $whereClause = '1 = 1';
-               }
-               $whereClause .= t3lib_BEfunc::BEenableFields($table);
-               $whereClause .= t3lib_BEfunc::deleteClause($table);
-               $res = $TYPO3_DB->exec_SELECTquery('type,term,acronym', $table, $whereClause);
-               while($acronymRow = $TYPO3_DB->sql_fetch_assoc($res))    {
-                       if($acronymRow['type'] == 1) $JSAcronymArray .= (($acronymIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
-                       if($acronymRow['type'] == 2) $JSAbbreviationArray .= (($AbbreviationIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
-               }
-               $JSAcronymArray .= '};' . $linebreak;
-               $JSAbbreviationArray .= '};' . $linebreak;
-
-               return $JSAcronymArray . $JSAbbreviationArray;
-       }
        
        /**
         * Return Javascript configuration of special anchor classes
@@ -1634,7 +1585,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
         *
         * @return      string          The name of the file writtten to typo3temp/rtehtmlarea
         */
-       private function writeTemporaryFile($sourceFileName='', $label, $fileExtension='js', $contents='') {
+       public function writeTemporaryFile($sourceFileName='', $label, $fileExtension='js', $contents='') {
                global $TYPO3_CONF_VARS;
                
                if ($sourceFileName) {
index b9073b0..6c3429e 100644 (file)
Binary files a/typo3/sysext/rtehtmlarea/doc/manual.sxw and b/typo3/sysext/rtehtmlarea/doc/manual.sxw differ
index 6b0a261..7bb4caf 100644 (file)
@@ -62,6 +62,14 @@ $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['BlockStyle']['objectRefer
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['CharacterMap'] = array();
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['CharacterMap']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/CharacterMap/class.tx_rtehtmlarea_charactermap.php:&tx_rtehtmlarea_charactermap';
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['CharacterMap']['addIconsToSkin'] = 0;
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['Acronym'] = array();
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['Acronym']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/Acronym/class.tx_rtehtmlarea_acronym.php:&tx_rtehtmlarea_acronym';
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['Acronym']['addIconsToSkin'] = 0;
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['Acronym']['disableInFE'] = 1;
+//$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['InlineElements'] = array();
+//$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['InlineElements']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/InlineElements/class.tx_rtehtmlarea_inlineelements.php:&tx_rtehtmlarea_inlineelements';
+//$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TextStyle'] = array();
+//$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TextStyle']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/TextStyle/class.tx_rtehtmlarea_textstyle.php:&tx_rtehtmlarea_textstyle';
 
 $_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here:
 
diff --git a/typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php b/typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php
new file mode 100644 (file)
index 0000000..7ff79e1
--- /dev/null
@@ -0,0 +1,140 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  All rights reserved
+*
+*  This script is part of the Typo3 project. The Typo3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Acronym extension for htmlArea RTE
+ *
+ * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ *
+ * TYPO3 SVN ID: $Id$
+ *
+ */
+
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');
+
+class tx_rtehtmlarea_acronym extends tx_rtehtmlareaapi {
+
+       protected $extensionKey = 'rtehtmlarea';                // The key of the extension that is extending htmlArea RTE
+       protected $pluginName = 'Acronym';                      // The name of the plugin registered by the extension
+       protected $relativePathToLocallangFile = '';            // Path to this main locallang file of the extension relative to the extension dir.
+       protected $relativePathToSkin = 'extensions/Acronym/skin/htmlarea.css';         // Path to the skin (css) file relative to the extension dir
+       protected $htmlAreaRTE;                                 // Reference to the invoking object
+       protected $thisConfig;                                  // Reference to RTE PageTSConfig
+       protected $toolbar;                                     // Reference to RTE toolbar array
+       protected $LOCAL_LANG;                                  // Frontend language array
+       
+       protected $pluginButtons = 'acronym';
+       protected $convertToolbarForHtmlAreaArray = array (
+               'acronym'       => 'Acronym',
+               );
+       
+       public function main($parentObject) {
+               return parent::main($parentObject) && !($this->htmlAreaRTE->client['BROWSER'] == 'msie' && $this->htmlAreaRTE->client['VERSION'] < 7);
+               
+       }
+       
+       /**
+        * Return tranformed content
+        *
+        * @param       string          $content: The content that is about to be sent to the RTE
+        *
+        * @return      string          the transformed content
+        */
+       public function transformContent($content) {
+               
+                       // <abbr> was not supported by IE before verison 7
+               if ($this->htmlAreaRTE->client['BROWSER'] == 'msie' && $this->htmlAreaRTE->client['VERSION'] < 7) {
+                               // change <abbr> to <acronym>
+                       $content = preg_replace('/<(\/?)abbr/i', "<$1acronym", $content);
+               }
+               
+               return $content;
+       }
+       
+       /**
+        * Return JS configuration of the htmlArea plugins registered by the extension
+        *
+        * @param       integer         Relative id of the RTE editing area in the form
+        *
+        * @return      string          JS configuration for registered plugins, in this case, JS configuration of block elements
+        *
+        * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s)
+        * Each of the instructions should be of the form:
+        *      RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";
+        */
+       public function buildJavascriptConfiguration($RTEcounter) {
+               
+               $registerRTEinJavascriptString = '';
+               $button = 'acronym';
+               if (in_array($button, $this->toolbar)) {
+                       if (!is_array( $this->thisConfig['buttons.']) || !is_array( $this->thisConfig['buttons.'][$button.'.'])) {
+                                       $registerRTEinJavascriptString .= '
+                       RTEarea['.$RTEcounter.']["buttons"]["'. $button .'"] = new Object();';
+                       }
+                       $registerRTEinJavascriptString .= '
+                       RTEarea['.$RTEcounter.'].buttons.'. $button .'.pathAcronymModule = "../../mod2/acronym.php";
+                       RTEarea['.$RTEcounter.'].buttons.'. $button .'.acronymUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('', 'acronym_'.$this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSAcronymArray($this->htmlAreaRTE->contentLanguageUid)) . '";';
+               }
+               
+               return $registerRTEinJavascriptString;
+       }
+       
+       /**
+        * Return an acronym array for the Acronym plugin
+        *
+        * @return      string          acronym Javascript array
+        */
+       function buildJSAcronymArray($languageUid) {
+               global $TYPO3_CONF_VARS, $TYPO3_DB;
+               
+               $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->htmlAreaRTE->ID]['enableCompressedScripts'] ? '' : chr(10);
+               $acronymIndex = 0;
+               $abbraviationIndex = 0;
+               $JSAcronymArray .= 'acronyms = { ' . $linebreak;
+               $JSAbbreviationArray .= 'abbreviations = { ' . $linebreak;
+               $table = 'tx_rtehtmlarea_acronym';
+               if ($languageUid > -1) {
+                       $whereClause = '(sys_language_uid=' . $languageUid . ' OR sys_language_uid=-1)';
+               } else {
+                       $whereClause = '1 = 1';
+               }
+               $whereClause .= t3lib_BEfunc::BEenableFields($table);
+               $whereClause .= t3lib_BEfunc::deleteClause($table);
+               $res = $TYPO3_DB->exec_SELECTquery('type,term,acronym', $table, $whereClause);
+               while($acronymRow = $TYPO3_DB->sql_fetch_assoc($res))    {
+                       if($acronymRow['type'] == 1) $JSAcronymArray .= (($acronymIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
+                       if($acronymRow['type'] == 2) $JSAbbreviationArray .= (($AbbreviationIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
+               }
+               $JSAcronymArray .= '};' . $linebreak;
+               $JSAbbreviationArray .= '};' . $linebreak;
+
+               return $JSAcronymArray . $JSAbbreviationArray;
+       }
+
+} // end of class
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/Acronym/skin/htmlarea.css b/typo3/sysext/rtehtmlarea/extensions/Acronym/skin/htmlarea.css
new file mode 100644 (file)
index 0000000..a5ee154
--- /dev/null
@@ -0,0 +1,3 @@
+/* Selectors for the Acronym extension of htmlArea RTE */
+/* TYPO3 SVN ID: $Id$ */
+.htmlarea .toolbar .Acronym {background-image:url("images/acronym.gif");}
diff --git a/typo3/sysext/rtehtmlarea/extensions/Acronym/skin/images/acronym.gif b/typo3/sysext/rtehtmlarea/extensions/Acronym/skin/images/acronym.gif
new file mode 100644 (file)
index 0000000..7d76a61
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/Acronym/skin/images/acronym.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/CharacterMap/locallang.xml b/typo3/sysext/rtehtmlarea/extensions/CharacterMap/locallang.xml
deleted file mode 100644 (file)
index e69de29..0000000
index 25deb54..f6d6284 100644 (file)
@@ -280,12 +280,16 @@ HTMLArea.prototype.getParentElement = function(selection, range) {
  * @returns null | element
  * Borrowed from Xinha (is not htmlArea) - http://xinha.gogo.co.nz/
  */
-HTMLArea.prototype._activeElement = function(sel) {
-       if(sel == null) return null;
-       if(this._selectionEmpty(sel)) return null;
-               // Check if the selection is not collapsed (something is selected) and if the anchor (start of selection) is an element.
-       if(!sel.isCollapsed && sel.anchorNode.nodeType == 1) return sel.anchorNode;
-               else return null;
+HTMLArea.prototype._activeElement = function(selection) {
+       if (this._selectionEmpty(selection)) {
+               return null;
+       }
+               // Check if the anchor (start of selection) is an element.
+       if (selection.anchorNode.nodeType == 1) {
+               return selection.anchorNode;
+       } else {
+               return null;
+       }
 };
 
 /*
@@ -400,41 +404,11 @@ HTMLArea.prototype.selectRange = function (range) {
  */
 HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) {
        this.focusEditor();
-       var sel = this._getSelection(),
-               range = this._createRange(sel),
-               node = range.startContainer,
-               pos = range.startOffset,
-               selectNode = node;
-       this.emptySelection(sel);
+       var range = this._createRange(this._getSelection());
        range.deleteContents();
-       if (toBeInserted.nodeType == 11) {
-               selectNode = toBeInserted.lastChild;
-       }
-       if (node.nodeName.toLowerCase() === "table") {
-               selectNode = node.getElementsByTagName("tbody")[0];
-               selectNode = selectNode.rows[0].cells[0];
-       }
-       switch (node.nodeType) {
-           case 3: // Node.TEXT_NODE: we have to split it at the caret position.
-               if(toBeInserted.nodeType == 3) {
-                       node.insertData(pos,toBeInserted.data);
-                       range = this._createRange();
-                       range.setEnd(node, pos + toBeInserted.length);
-                       range.setStart(node, pos + toBeInserted.length);
-                       this.addRangeToSelection(sel, range);
-               } else {
-                       node = node.splitText(pos);
-                       node = node.parentNode.insertBefore(toBeInserted, node);
-                       this.selectNode(selectNode, false);
-                       this.updateToolbar();
-               }
-               break;
-           case 1:
-               node = node.insertBefore(toBeInserted, node.childNodes[pos]);
-               this.selectNode(selectNode, false);
-               this.updateToolbar();
-               break;
-       }
+       var toBeSelected = (toBeInserted.nodeType === 11) ? toBeInserted.lastChild : toBeInserted;
+       range.insertNode(toBeInserted);
+       this.selectNodeContents(toBeSelected, false);
 };
 
 /* 
@@ -446,7 +420,9 @@ HTMLArea.prototype.insertHTML = function(html) {
        var fragment = this._doc.createDocumentFragment();
        var div = this._doc.createElement("div");
        div.innerHTML = html;
-       while (div.firstChild) {fragment.appendChild(div.firstChild);}
+       while (div.firstChild) {
+               fragment.appendChild(div.firstChild);
+       }
        this.insertNodeAtSelection(fragment);
 };
 
index f4852b1..985c8be 100644 (file)
@@ -3925,6 +3925,9 @@ HTMLArea.Dialog = HTMLArea.Base.extend({
                        }
                        this.releaseEvents(this.dialogWindow);
                        HTMLArea.Dialog[this.plugin.name] = null;
+                       if (HTMLArea.is_safari) {
+                               this.dialogWindow.blur();
+                       }
                        this.dialogWindow.close();
                        this.dialogWindow.dialog = null;
                        this.plugin.editor.updateToolbar();
index 2512372..3af1fcd 100644 (file)
@@ -1,7 +1,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2005, 2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  *
  * TYPO3 CVS ID: $Id$
  */
+Acronym = HTMLArea.Plugin.extend({
+       
+       constructor : function(editor, pluginName) {
+               this.base(editor, pluginName);
+       },
+       
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function(editor) {
+               
+               this.pageTSconfiguration = this.editorConfiguration.buttons.acronym;
+               this.acronymUrl = this.pageTSconfiguration.acronymUrl;
+               this.acronymModulePath = this.pageTSconfiguration.pathAcronymModule;
+               
+               /*
+                * Registering plugin "About" information
+                */
+               var pluginInformation = {
+                       version         : "1.6",
+                       developer       : "Stanislas Rolland",
+                       developerUrl    : "http://www.fructifor.ca/",
+                       copyrightOwner  : "Stanislas Rolland",
+                       sponsor         : "Fructifor Inc.",
+                       sponsorUrl      : "http://www.fructifor.ca/",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+               
+               /*
+                * Registering the button
+                */
+               var buttonId = "Acronym";
+               var buttonConfiguration = {
+                       id              : buttonId,
+                       tooltip         : this.localize("Insert/Modify Acronym"),
+                       action          : "onButtonPress",
+                       dialog          : true
+               };
+               this.registerButton(buttonConfiguration);
+               
+               return true;
+        },
+        
+       /*
+        * This function gets called when the button was pressed
+        *
+        * @param       object          editor: the editor instance
+        * @param       string          id: the button id or the key
+        *
+        * @return      boolean         false if action is completed
+        */
+       onButtonPress : function(editor, id) {
+               this.dialog = this.openDialog("Acronym", this.makeUrlFromModulePath(this.acronymModulePath), null, null, {width:570, height:280});
+               return false;
+       },
+       
+       /*
+        * This function removes the given markup element
+        */
+       removeMarkup : function(element) {
+               var bookmark = this.editor.getBookmark(this.editor._createRange(this.editor._getSelection()));
+               var parent = element.parentNode;
+               while (element.firstChild) {
+                       parent.insertBefore(element.firstChild, element);
+               }
+               parent.removeChild(element);
+               this.editor.selectRange(this.editor.moveToBookmark(bookmark));
+       }
+});
 
-Acronym = function(editor) {
-       this.editor = editor;
-       var cfg = editor.config;
-       var actionHandlerFunctRef = Acronym.actionHandler(this);
-       cfg.registerButton("Acronym",
-                               Acronym_langArray["Insert/Modify Acronym"], 
-                               editor.imgURL("ed_acronym.gif", "Acronym"), 
-                               false,
-                               actionHandlerFunctRef
-       );
-};
-Acronym.I18N = Acronym_langArray;
-
-Acronym._pluginInfo = {
-       name            : "Acronym",
-       version         : "1.4",
-       developer       : "Stanislas Rolland",
-       developer_url   : "http://www.fructifor.ca/",
-       c_owner         : "Stanislas Rolland",
-       sponsor         : "Fructifor Inc.",
-       sponsor_url     : "http://www.fructifor.ca/",
-       license         : "GPL"
-};
-
-Acronym.actionHandler = function(instance) {
-       return (function(editor) {
-               instance.buttonPress(editor);
-       });
-};
-
-Acronym.prototype.buttonPress = function(editor) {
-       var editorNo = editor._doc._editorNo;
-       var backreturn;
-       var addUrlParams = "?" + RTEarea[editorNo]["RTEtsConfigParams"];
-       editor._popupDialog(RTEarea[0]["pathAcronymModule"] + addUrlParams + "&editorNo=" + editorNo, null, null, 570, 280);
-       return false;
-};
index ffbae3f..9d7adad 100644 (file)
 }
 
 /* Selectors for the Abbreviation plugin */
-abbr, acronym, span.abbr {
-       width:18px;
-       height:18px;
-       background-image:url("images/Acronym/ed_acronym.gif");
-       background-repeat:no-repeat;
-       background-position:left top;
-       white-space:nowrap;
-       cursor:help;
+abbr, acronym {
        border-bottom:1px dashed #000;
-       padding-left:19px;
+       cursor:help;
 }
\ No newline at end of file
index 1cdb146..a67240f 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2005-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is 
@@ -37,12 +37,12 @@ unset($MCONF);
 require('conf.php');
 require($BACK_PATH.'init.php');
 require($BACK_PATH.'template.php');
-require_once('class.tx_rtehtmlarea_acronym.php');
+require_once('class.tx_rtehtmlarea_acronym_mod.php');
 $LANG->includeLLFile('EXT:rtehtmlarea/mod2/locallang.xml');
 $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
 
 // Make instance:
-$SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_acronym');
+$SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_acronym_mod');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
diff --git a/typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym.php b/typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym.php
deleted file mode 100644 (file)
index 5a2e39f..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2005-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is 
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license 
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/** 
- * Acronym content for htmlArea RTE
- *
- * @author     Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
- *
- * $Id$  *
- */
-
-class tx_rtehtmlarea_acronym {
-       var $content;
-       var $modData;
-
-       /**
-        * document template object
-        *
-        * @var template
-        */
-       var $doc;
-
-       /**
-        * @return      [type]          ...
-        */
-       function init() {
-               global $BE_USER,$LANG,$BACK_PATH;
-               
-               $this->editorNo = t3lib_div::_GP('editorNo');
-               
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->docType = 'xhtml_trans';
-               $this->doc->backPath = $BACK_PATH;
-               
-               if ($this->doc->styleSheetFile_post) {
-                       $styleDir = dirname(dirname($this->doc->styleSheetFile_post));
-                       $this->doc->styleSheetFile_post = $styleDir.'/rtehtmlarea/htmlarea.css';
-               } else {
-                       $this->doc->styleSheetFile_post = $BACK_PATH . t3lib_extMgm::extRelPath('rtehtmlarea') . 'htmlarea/skins/default/htmlarea.css'; 
-               }
-               
-               $this->doc->JScode = '<script type="text/javascript" src="'. $BACK_PATH . t3lib_extMgm::extRelPath('rtehtmlarea') . 'htmlarea/popups/popup.js"></script>';
-               
-               $this->doc->bodyTagAdditions = 'class="popupwin" onload="init();"';
-               $this->doc->form = '<form action="" id="acronymForm" name="acronymForm" method="POST">';
-               $JScode='
-                       var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
-                       var HTMLArea = window.opener.HTMLArea;
-                       var param = null;
-                       var html = editor.getSelectedHTML();
-                       var sel = editor._getSelection();
-                       var range = editor._createRange(sel);
-                       var abbr = editor._activeElement(sel);
-                       var abbrType = null;
-                       var acronyms = new Object();
-                       var abbreviations = new Object();
-                       if(!(abbr != null && (abbr.tagName.toLowerCase() == "acronym" || abbr.tagName.toLowerCase() == "abbr"))) { 
-                               abbr = editor._getFirstAncestor(sel, ["acronym", "abbr"]);
-                               if(abbr != null && (abbr.tagName.toLowerCase() == "acronym" || abbr.tagName.toLowerCase() == "abbr")) { 
-                                       param = { title : abbr.title, text : abbr.innerHTML};
-                                       abbrType = abbr.tagName.toLowerCase();
-                               } else {
-                                       param = { title : "", text : html};
-                               }
-                       }
-                       
-                       function setType() {
-                               if(document.acronymForm.acronym.checked) {
-                                       abbrType = "acronym";
-                                       document.getElementById("abbrType").innerHTML = "' . $LANG->getLL('Acronym') . '";
-                               } else {
-                                       abbrType = "abbr";
-                                       document.getElementById("abbrType").innerHTML = "' . $LANG->getLL('Abbreviation') . '";
-                               }
-                               document.getElementById("title").value = param["title"];
-                               fillSelect(param["text"]);
-                               __dlg_init(null, false);
-                       }
-                       
-                       function init() {
-                               if(abbrType != null) document.getElementById("type").style.display = "none";
-                                       else abbrType = "abbr";
-                               if(HTMLArea.is_ie) document.getElementById("type").style.display = "none";
-                               if(abbrType == "acronym") document.acronymForm.acronym.checked = true;
-                                       else  document.acronymForm.abbreviation.checked = true;
-                               var acronymUrl = window.opener.RTEarea[editor._doc._editorNo]["acronymUrl"];
-                               var abbrData = HTMLArea._getScript(0, false, acronymUrl);
-                               if(abbrData) eval(abbrData);
-                               setType();
-                               HTMLArea._addEvents(document.acronymForm.title,["keypress", "keydown", "dragdrop", "drop", "paste", "change"],function(ev) { document.acronymForm.termSelector.selectedIndex=-1; document.acronymForm.acronymSelector.selectedIndex=-1; });
-                               document.body.onkeypress = __dlg_close_on_esc;
-                               document.getElementById("title").focus();
-                       };
-                       
-                       function fillSelect(text) {
-                               var termSelector = document.getElementById("termSelector");
-                               var acronymSelector = document.getElementById("acronymSelector");
-                               while(termSelector.options.length>1) termSelector.options[termSelector.length-1] = null;
-                               while(acronymSelector.options.length>1) acronymSelector.options[acronymSelector.length-1] = null;
-                               if(abbrType == "acronym") var abbrObj = acronyms;
-                                       else var abbrObj = abbreviations;
-                               if(abbrObj != "") {
-                                       for(var i in abbrObj) {
-                                               same = (i==text);
-                                               termSelector.options[termSelector.options.length] = new Option(abbrObj[i], abbrObj[i], false, same);
-                                               acronymSelector.options[acronymSelector.options.length] = new Option(i, i, false, same);
-                                               if(same) document.acronymForm.title.value = abbrObj[i];
-                                       }
-                               }
-                               if(acronymSelector.options.length == 1) {
-                                       document.getElementById("selector").style.display = "none";
-                               } else {
-                                       document.getElementById("selector").style.display = "block";
-                               }
-                       };
-                       
-                       function processAcronym(title) {
-                               if (title == "" || title == null) {
-                                       if (abbr) {
-                                               var child = abbr.innerHTML;
-                                               abbr.parentNode.removeChild(abbr);
-                                               editor.insertHTML(child);
-                                       }
-                               } else {
-                                       var doc = editor._doc;
-                                       if (!abbr) {
-                                               abbr = doc.createElement(abbrType);
-                                               abbr.title = title;
-                                               if(document.acronymForm.acronymSelector.options.length != 1 && document.acronymForm.termSelector.selectedIndex > 0 && document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value == title) html = document.acronymForm.acronymSelector.options[document.acronymForm.acronymSelector.selectedIndex].value;
-                                               abbr.innerHTML = html;
-                                               if (HTMLArea.is_ie) range.pasteHTML(abbr.outerHTML);
-                                                       else editor.insertNodeAtSelection(abbr);
-                                       } else {
-                                               abbr.title = title;
-                                               if(document.acronymForm.acronymSelector.options.length != 1 && document.acronymForm.termSelector.selectedIndex > 0 && document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value == title) abbr.innerHTML = document.acronymForm.acronymSelector.options[document.acronymForm.acronymSelector.selectedIndex].value;
-                                       }
-                               }
-                       };
-                       
-                       function onOK() {
-                               processAcronym(document.getElementById("title").value);
-                               __dlg_close(null);
-                               return false;
-                       };
-                       
-                       function onDelete() {
-                               processAcronym("");
-                               __dlg_close(null);
-                               return false;
-                       };
-                       function onCancel() {
-                               __dlg_close(null);
-                               return false;
-                       };
-               ';
-               
-               $this->doc->JScode .= $this->doc->wrapScriptTags($JScode);
-               
-               $this->modData = $BE_USER->getModuleData('acronym.php','ses');
-               $BE_USER->pushModuleData('acronym.php',$this->modData);
-       }
-       
-       /**
-        * [Describe function...]
-        * 
-        * @return      [type]          ...
-        */
-       function main() {
-               
-               $this->content='';
-               $this->content.=$this->main_acronym($this->modData['openKeys']);
-       }
-       
-       /**
-        * [Describe function...]
-        * 
-        * @return      [type]          ...
-        */
-       function printContent() {
-               echo $this->content;
-       }
-       
-       /**
-        * Rich Text Editor (RTE) acronym selector
-        * 
-        * @param       [type]          $openKeys: ...
-        * @return      [type]          ...
-        */
-       function main_acronym($openKeys)        {
-               global $LANG, $BE_USER;
-
-               $content.=$this->doc->startPage($LANG->getLL('Insert/Modify Acronym',1));
-               
-               $RTEtsConfigParts = explode(':',t3lib_div::_GP('RTEtsConfigParams'));
-               $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
-               $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
-               
-               $content.='
-       <div class="title" id="abbrType">' . $LANG->getLL('Acronym',1) . '</div>
-       <fieldset id="type">
-               <legend>' . $LANG->getLL('Type_of_abridged_form',1) . '</legend>
-               <label for="abbreviation" class="checkbox">' . $LANG->getLL('Abbreviation',1) . '</label><input type="radio" name="type" id="abbreviation" value="abbreviation" checked="checked" onclick="setType();" />
-               <label for="acronym" class="checkbox">' . $LANG->getLL('Acronym',1) . '</label><input type="radio" name="type" id="acronym" value="acronym" onclick="setType();" />
-       </fieldset>
-       <fieldset id="selector">
-               <legend>' . $LANG->getLL('Defined_term',1) . '</legend>
-               <label for="termSelector" class="fl" id="termSelectorLabel" title="' . $LANG->getLL('Select_a_term',1) . '">' . $LANG->getLL('Unabridged_term',1) . '</label>
-               <select id="termSelector" name="termSelector"  title="' . $LANG->getLL('Select_a_term',1) . '"
-                       onChange="document.acronymForm.acronymSelector.selectedIndex=document.acronymForm.termSelector.selectedIndex; document.acronymForm.title.value=document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value;">
-                       <option value=""></option>
-               </select>
-               <label for="acronymSelector" id="acronymSelectorLabel" title="' . $LANG->getLL('Select_an_acronym',1) . '">' . $LANG->getLL('Abridged_term',1) . '</label>
-               <select id="acronymSelector" name="acronymSelector"  title="' . $LANG->getLL('Select_an_acronym',1) . '"
-                       onChange="document.acronymForm.termSelector.selectedIndex=document.acronymForm.acronymSelector.selectedIndex; document.acronymForm.title.value=document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value;">
-                       <option value=""></option>
-               </select>
-       </fieldset>
-       <fieldset>
-               <legend>' . $LANG->getLL('Term_to_abridge',1) . '</legend>
-               <label for="title" class="fl" title="' . $LANG->getLL('Use_this_term_explain',1) . '">' . $LANG->getLL('Use_this_term',1) . '</label>
-               <input type="text" id="title" name="title" size="60" title="' . $LANG->getLL('Use_this_term_explain',1) . '" />
-       </fieldset>
-       <div class="buttons">
-               <button type="button" title="' . $LANG->getLL('OK',1) . '"onclick="return onOK();">' . $LANG->getLL('OK',1) . '</button>
-               <button type="button" title="' . $LANG->getLL('Delete',1) . '" onclick="return onDelete();">' . $LANG->getLL('Delete',1) . '</button>
-               <button type="button" title="' . $LANG->getLL('Cancel',1)  . '" onclick="return onCancel();">' . $LANG->getLL('Cancel',1) . '</button>
-       </div>';
-       
-               $content.= $this->doc->endPage();
-               return $content;
-       }
-}
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym.php'])  {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym.php']);
-}
-
-?>
diff --git a/typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php b/typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php
new file mode 100644 (file)
index 0000000..43607c5
--- /dev/null
@@ -0,0 +1,257 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is 
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license 
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/** 
+ * Acronym content for htmlArea RTE
+ *
+ * @author     Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ *
+ * $Id$  *
+ */
+
+class tx_rtehtmlarea_acronym_mod {
+       var $content;
+       var $modData;
+
+       /**
+        * document template object
+        *
+        * @var template
+        */
+       var $doc;
+
+       /**
+        * @return      [type]          ...
+        */
+       function init() {
+               global $BE_USER,$LANG,$BACK_PATH;
+               
+               $this->doc = t3lib_div::makeInstance('template');
+               $this->doc->docType = 'xhtml_trans';
+               $this->doc->backPath = $BACK_PATH;
+               if ($this->doc->styleSheetFile_post) {
+                       $styleDir = dirname(dirname($this->doc->styleSheetFile_post));
+                       $this->doc->styleSheetFile_post = $styleDir.'/rtehtmlarea/htmlarea.css';
+               } else {
+                       $this->doc->styleSheetFile_post = $BACK_PATH . t3lib_extMgm::extRelPath('rtehtmlarea') . 'htmlarea/skins/default/htmlarea.css';
+               }
+               $this->doc->bodyTagAdditions = 'class="popupwin" onload="init();"';
+               $this->doc->form = '<form action="" id="acronymForm" name="acronymForm" method="POST">';
+               $JScode='
+                       var dialog = window.opener.HTMLArea.Dialog["Acronym"];
+                       var editor = dialog.plugin.editor;
+                       var param = null;
+                       var html = editor.getSelectedHTML();
+                       var sel = editor._getSelection();
+                       var range = editor._createRange(sel);
+                       var abbr = editor._activeElement(sel);
+                               // Working around Safari issue
+                       if (!abbr && editor._statusBarTree.selected) {
+                               abbr = editor._statusBarTree.selected;
+                       }
+                       var abbrType = null;
+                       var acronyms = new Object();
+                       var abbreviations = new Object();
+                       if (!(abbr != null && /^(acronym|abbr)$/i.test(abbr.nodeName))) {
+                               abbr = editor._getFirstAncestor(sel, ["acronym", "abbr"]);
+                       }
+                       if (abbr != null && /^(acronym|abbr)$/i.test(abbr.nodeName)) {
+                               param = { title : abbr.title, text : abbr.innerHTML};
+                               abbrType = abbr.nodeName.toLowerCase();
+                       } else {
+                               param = { title : "", text : html};
+                       }
+                       
+                       function setType() {
+                               if(document.acronymForm.acronym.checked) {
+                                       abbrType = "acronym";
+                                       document.getElementById("abbrType").innerHTML = "' . $LANG->getLL('Acronym') . '";
+                               } else {
+                                       abbrType = "abbr";
+                                       document.getElementById("abbrType").innerHTML = "' . $LANG->getLL('Abbreviation') . '";
+                               }
+                               document.getElementById("title").value = param["title"];
+                               fillSelect(param["text"]);
+                               dialog.resize();
+                       }
+                       
+                       function init() {
+                               dialog.initialize("noLocalize", "noResize");
+                               var abbrData = dialog.plugin.getJavascriptFile(dialog.plugin.acronymUrl, "noEval");
+                               if (abbrData) eval(abbrData);
+                               if (abbrType != null) document.getElementById("type").style.display = "none";
+                                       else abbrType = "abbr";
+                               if (abbrType == "acronym") document.acronymForm.acronym.checked = true;
+                                       else  document.acronymForm.abbreviation.checked = true;
+                               setType();
+                               HTMLArea._addEvents(document.acronymForm.title,["keypress", "keydown", "dragdrop", "drop", "paste", "change"],function(ev) { document.acronymForm.termSelector.selectedIndex=-1; document.acronymForm.acronymSelector.selectedIndex=-1; });
+                               document.getElementById("title").focus();
+                       };
+                       
+                       function fillSelect(text) {
+                               var termSelector = document.getElementById("termSelector");
+                               var acronymSelector = document.getElementById("acronymSelector");
+                               while(termSelector.options.length>1) termSelector.options[termSelector.length-1] = null;
+                               while(acronymSelector.options.length>1) acronymSelector.options[acronymSelector.length-1] = null;
+                               if(abbrType == "acronym") var abbrObj = acronyms;
+                                       else var abbrObj = abbreviations;
+                               if(abbrObj != "") {
+                                       for(var i in abbrObj) {
+                                               same = (i==text);
+                                               termSelector.options[termSelector.options.length] = new Option(abbrObj[i], abbrObj[i], false, same);
+                                               acronymSelector.options[acronymSelector.options.length] = new Option(i, i, false, same);
+                                               if(same) document.acronymForm.title.value = abbrObj[i];
+                                       }
+                               }
+                               if(acronymSelector.options.length == 1) {
+                                       document.getElementById("selector").style.display = "none";
+                               } else {
+                                       document.getElementById("selector").style.display = "block";
+                               }
+                       };
+                       
+                       function processAcronym(title) {
+                               if (title == "" || title == null) {
+                                       if (abbr) {
+                                               dialog.plugin.removeMarkup(abbr);
+                                       }
+                               } else {
+                                       var doc = editor._doc;
+                                       if (!abbr) {
+                                               abbr = doc.createElement(abbrType);
+                                               abbr.title = title;
+                                               if(document.acronymForm.acronymSelector.options.length != 1 && document.acronymForm.termSelector.selectedIndex > 0 && document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value == title) {
+                                                       html = document.acronymForm.acronymSelector.options[document.acronymForm.acronymSelector.selectedIndex].value;
+                                               }
+                                               abbr.innerHTML = html;
+                                               if (HTMLArea.is_ie) range.pasteHTML(abbr.outerHTML);
+                                                       else editor.insertNodeAtSelection(abbr);
+                                       } else {
+                                               abbr.title = title;
+                                               if(document.acronymForm.acronymSelector.options.length != 1 && document.acronymForm.termSelector.selectedIndex > 0 && document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value == title) abbr.innerHTML = document.acronymForm.acronymSelector.options[document.acronymForm.acronymSelector.selectedIndex].value;
+                                       }
+                               }
+                       };
+                       
+                       function onOK() {
+                               processAcronym(document.getElementById("title").value);
+                               dialog.close();
+                               return false;
+                       };
+                       
+                       function onDelete() {
+                               processAcronym("");
+                               dialog.close();
+                               return false;
+                       };
+                       function onCancel() {
+                               dialog.close();
+                               return false;
+                       };
+               ';
+               
+               $this->doc->JScode .= $this->doc->wrapScriptTags($JScode);
+               
+               $this->modData = $BE_USER->getModuleData('acronym.php','ses');
+               $BE_USER->pushModuleData('acronym.php',$this->modData);
+       }
+       
+       /**
+        * [Describe function...]
+        * 
+        * @return      [type]          ...
+        */
+       function main() {
+               
+               $this->content='';
+               $this->content.=$this->main_acronym($this->modData['openKeys']);
+       }
+       
+       /**
+        * [Describe function...]
+        * 
+        * @return      [type]          ...
+        */
+       function printContent() {
+               echo $this->content;
+       }
+       
+       /**
+        * Rich Text Editor (RTE) acronym selector
+        * 
+        * @param       [type]          $openKeys: ...
+        * @return      [type]          ...
+        */
+       function main_acronym($openKeys)        {
+               global $LANG, $BE_USER;
+
+               $content.=$this->doc->startPage($LANG->getLL('Insert/Modify Acronym',1));
+               
+               $RTEtsConfigParts = explode(':',t3lib_div::_GP('RTEtsConfigParams'));
+               $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
+               $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
+               
+               $content.='
+       <div class="title" id="abbrType">' . $LANG->getLL('Acronym',1) . '</div>
+       <fieldset id="type">
+               <legend>' . $LANG->getLL('Type_of_abridged_form',1) . '</legend>
+               <label for="abbreviation" class="checkbox">' . $LANG->getLL('Abbreviation',1) . '</label><input type="radio" name="type" id="abbreviation" value="abbreviation" checked="checked" onclick="setType();" />
+               <label for="acronym" class="checkbox">' . $LANG->getLL('Acronym',1) . '</label><input type="radio" name="type" id="acronym" value="acronym" onclick="setType();" />
+       </fieldset>
+       <fieldset id="selector">
+               <legend>' . $LANG->getLL('Defined_term',1) . '</legend>
+               <label for="termSelector" class="fl" id="termSelectorLabel" title="' . $LANG->getLL('Select_a_term',1) . '">' . $LANG->getLL('Unabridged_term',1) . '</label>
+               <select id="termSelector" name="termSelector"  title="' . $LANG->getLL('Select_a_term',1) . '"
+                       onChange="document.acronymForm.acronymSelector.selectedIndex=document.acronymForm.termSelector.selectedIndex; document.acronymForm.title.value=document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value;">
+                       <option value=""></option>
+               </select>
+               <label for="acronymSelector" id="acronymSelectorLabel" title="' . $LANG->getLL('Select_an_acronym',1) . '">' . $LANG->getLL('Abridged_term',1) . '</label>
+               <select id="acronymSelector" name="acronymSelector"  title="' . $LANG->getLL('Select_an_acronym',1) . '"
+                       onChange="document.acronymForm.termSelector.selectedIndex=document.acronymForm.acronymSelector.selectedIndex; document.acronymForm.title.value=document.acronymForm.termSelector.options[document.acronymForm.termSelector.selectedIndex].value;">
+                       <option value=""></option>
+               </select>
+       </fieldset>
+       <fieldset>
+               <legend>' . $LANG->getLL('Term_to_abridge',1) . '</legend>
+               <label for="title" class="fl" title="' . $LANG->getLL('Use_this_term_explain',1) . '">' . $LANG->getLL('Use_this_term',1) . '</label>
+               <input type="text" id="title" name="title" size="60" title="' . $LANG->getLL('Use_this_term_explain',1) . '" />
+       </fieldset>
+       <div class="buttons">
+               <button type="button" title="' . $LANG->getLL('OK',1) . '"onclick="return onOK();">' . $LANG->getLL('OK',1) . '</button>
+               <button type="button" title="' . $LANG->getLL('Delete',1) . '" onclick="return onDelete();">' . $LANG->getLL('Delete',1) . '</button>
+               <button type="button" title="' . $LANG->getLL('Cancel',1)  . '" onclick="return onCancel();">' . $LANG->getLL('Cancel',1) . '</button>
+       </div>';
+       
+               $content.= $this->doc->endPage();
+               return $content;
+       }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php']);
+}
+
+?>
index 84991d1..9fe0909 100644 (file)
@@ -144,7 +144,7 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                        // htmlArea plugins list
                $this->pluginEnabledArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
                $this->enableRegisteredPlugins();
-               $hidePlugins = array('TYPO3Browsers', 'UserElements', 'Acronym', 'TYPO3HtmlParser');
+               $hidePlugins = array('TYPO3Browsers', 'UserElements', 'TYPO3HtmlParser');
                if ($this->client['BROWSER'] == 'opera') {
                        $hidePlugins[] = 'ContextMenu';
                        $this->thisConfig['hideTableOperationsInToolbar'] = 0;
@@ -281,11 +281,12 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                 */
                        // Transform value:
                $value = $this->transformContent('rte',$PA['itemFormElValue'],$table,$field,$row,$specConf,$thisConfig,$RTErelPath,$thePidValue);
-               if ($this->client['BROWSER'] == 'gecko') {
-                               // change <strong> to <b>
-                       $value = preg_replace('/<(\/?)strong/i', "<$1b", $value);
-                               // change <em> to <i>
-                       $value = preg_replace('/<(\/?)em([^b>]*>)/i', "<$1i$2", $value);
+               
+                       // Further content transformation by registered plugins
+               foreach ($this->registeredPlugins as $pluginId => $plugin) {
+                       if ($this->isPluginEnabled($pluginId) && method_exists($plugin, "transformContent")) {
+                               $value = $plugin->transformContent($value);
+                       }
                }
                
                        // Register RTE windows:
index 3e987e6..9d7adad 100644 (file)
@@ -15,6 +15,7 @@
 }
 
 /* Selectors for the Abbreviation plugin */
-abbr, acronym, span.abbr {
+abbr, acronym {
        border-bottom:1px dashed #000;
+       cursor:help;
 }
\ No newline at end of file
index a150c54..57a325c 100644 (file)
@@ -62,7 +62,7 @@
        vertical-align:top;
        background-color:transparent;color:ButtonText;background-position:1px 1px;background-repeat:no-repeat;
        width:22px;height:22px;
-       border-style:solid;border-color:#EFEFF4;;border-width:0px 1px;margin:0;padding:0;
+       border-style:solid;border-color:#EFEFF4;border-width:0px 1px;margin:0;padding:0;
 }
 .htmlarea .toolbar button div.buttonImgContainer {
        position:relative;top:0;left:0;