* Cleanup: Character Map plugin now using new plugin API
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 5 Jan 2008 21:08:23 +0000 (21:08 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 5 Jan 2008 21:08:23 +0000 (21:08 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2863 709f56b5-9817-0410-a4d7-c38de5d9e867

12 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/CharacterMap/class.tx_rtehtmlarea_charactermap.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/CharacterMap/locallang.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/htmlarea.css [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/images/insertCharacter.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/locallang.xml
typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/popups/select_character.html

index 14175ba..c74df8a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
        * Added feature 3708 (partial): support for <blockquote>
        * Fixed issue 5977: align="center" (right or left) not any more supported by W3C
        * Fixed issue 6837: Strange layout for header N except the first one (Safari)
+       * Cleanup: Character Map plugin now using new plugin API
 
 2007-12-30  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
index 333124c..3a6cde6 100644 (file)
@@ -8,6 +8,7 @@
        * Added feature 3708 (partial): support for <blockquote>
        * Fixed issue 5977: align="center" (right or left) not any more supported by W3C
        * Fixed issue 6837: Strange layout for header N except the first one (Safari)
+       * Cleanup: Character Map plugin now using new plugin API
 
 2007-12-30  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
index c0ba8b1..8b61b94 100644 (file)
@@ -4,7 +4,7 @@
 *
 *  (c) 2004 Kasper Skaarhoj (kasper@typo3.com)
 *  (c) 2004 Philipp Borgmann <philipp.borgmann@gmx.de>
-*  (c) 2004-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -114,7 +114,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                'lefttoright'           => 'LeftToRight',
                'righttoleft'           => 'RightToLeft',
                'showhelp'              => 'ShowHelp',
-               'insertcharacter'       => 'InsertCharacter',
                'findreplace'           => 'FindReplace',
                'spellcheck'            => 'SpellCheck',
                'removeformat'          => 'RemoveFormat',
@@ -191,7 +190,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                'FindReplace'           => 'findreplace',
                'RemoveFormat'          => 'removeformat',
                'QuickTag'              => 'inserttag',
-               'CharacterMap'          => 'insertcharacter',
                'TableOperations'       => 'table, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit,
                                                columninsertbefore, columninsertafter, columndelete, columnsplit,
                                                cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge',
index 2ea15f9..b9073b0 100644 (file)
Binary files a/typo3/sysext/rtehtmlarea/doc/manual.sxw and b/typo3/sysext/rtehtmlarea/doc/manual.sxw differ
index acea33b..6b0a261 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2005-2007 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
@@ -59,6 +59,9 @@ $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DynamicCSS'] = array();
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DynamicCSS']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/DynamicCSS/class.tx_rtehtmlarea_dynamiccss.php:&tx_rtehtmlarea_dynamiccss';
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['BlockStyle'] = array();
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['BlockStyle']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/BlockStyle/class.tx_rtehtmlarea_blockstyle.php:&tx_rtehtmlarea_blockstyle';
+$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;
 
 $_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here:
 
diff --git a/typo3/sysext/rtehtmlarea/extensions/CharacterMap/class.tx_rtehtmlarea_charactermap.php b/typo3/sysext/rtehtmlarea/extensions/CharacterMap/class.tx_rtehtmlarea_charactermap.php
new file mode 100644 (file)
index 0000000..0a78aa5
--- /dev/null
@@ -0,0 +1,75 @@
+<?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!
+***************************************************************/
+/**
+ * CharacterMap plugin 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_charactermap extends tx_rtehtmlareaapi {
+
+       protected $extensionKey = 'rtehtmlarea';        // The key of the extension that is extending htmlArea RTE
+       protected $pluginName = 'CharacterMap';         // 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 = '';             // 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 = 'insertcharacter';
+       protected $convertToolbarForHtmlAreaArray = array (
+               'insertcharacter'       => 'InsertCharacter',
+               );
+       
+       /**
+        * 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
+        *
+        * 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) {
+               global $TSFE, $LANG;
+               
+               $registerRTEinJavascriptString = '';
+               return $registerRTEinJavascriptString;
+       }
+
+} // end of class
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/CharacterMap/class.tx_rtehtmlarea_charactermap.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/CharacterMap/class.tx_rtehtmlarea_charactermap.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/CharacterMap/locallang.xml b/typo3/sysext/rtehtmlarea/extensions/CharacterMap/locallang.xml
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/htmlarea.css b/typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/htmlarea.css
new file mode 100644 (file)
index 0000000..638fc51
--- /dev/null
@@ -0,0 +1,4 @@
+/* Selectors for the InsertCharacter plugin of htmlArea RTE */
+/* TYPO3 SVN ID: $Id$ */
+.htmlarea .toolbar .InsertCharacter {background-image:url("images/insertCharacter.gif");}
+
diff --git a/typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/images/insertCharacter.gif b/typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/images/insertCharacter.gif
new file mode 100644 (file)
index 0000000..5d36558
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/CharacterMap/skin/images/insertCharacter.gif differ
index 17045d8..864b3c8 100644 (file)
@@ -3,7 +3,7 @@
 *
 *  (c) 2004 Bernhard Pfeifer novocaine@gmx.net
 *  (c) 2004 systemconcept.de. Authored by Holger Hees based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/).
-*  (c) 2005, 2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2005-2007 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$
  */
-
-CharacterMap = function(editor) {
-       this.editor = editor;
-       var cfg = this.editor.config;
-       var actionHandlerFunctRef = CharacterMap.actionHandler(this);
-       cfg.registerButton({
-               id              : "InsertCharacter",
-               tooltip         : CharacterMap_langArray["CharacterMapTooltip"],
-               image           : editor.imgURL("ed_charmap.gif", "CharacterMap"),
-               textMode        : false,
-               action          : actionHandlerFunctRef
-       });
-};
-
-CharacterMap.I18N = CharacterMap_langArray;
-
-CharacterMap._pluginInfo = {
-       name            : "CharacterMap",
-       version         : "1.2",
-       developer       : "Holger Hees, Bernhard Pfeifer, Stanislas Rolland",
-       developer_url   : "http://www.fructifor.ca/",
-       c_owner         : "Holger Hees, Bernhard Pfeifer, Stanislas Rolland",
-       sponsor         : "System Concept GmbH, Bernhard Pfeifer, Fructifor Inc.",
-       sponsor_url     : "http://www.fructifor.ca/",
-       license         : "GPL"
-};
-
-CharacterMap.actionHandler = function(instance) {
-       return (function(editor) {
-               instance.buttonPress(editor);
-       });
-};
-
-CharacterMap.prototype.buttonPress = function(editor) {
-       var self = this;
-       var param = new Object();
-       param.editor = editor;
-       var insertCharHandlerFunctRef = CharacterMap.insertCharHandler(this);
-       editor._popupDialog( "plugin://CharacterMap/select_character", insertCharHandlerFunctRef, param, 485, 330);
-};
-
-CharacterMap.insertCharHandler = function(instance) {
-       return (function(entity) {
+CharacterMap = HTMLArea.Plugin.extend({
+               
+       constructor : function(editor, pluginName) {
+               this.base(editor, pluginName);
+       },
+       
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function(editor) {
+               
+               /*
+                * Registering plugin "About" information
+                */
+               var pluginInformation = {
+                       version         : "1.3",
+                       developer       : "Holger Hees, Bernhard Pfeifer, Stanislas Rolland",
+                       developerUrl    : "http://www.fructifor.ca/",
+                       copyrightOwner  : "Holger Hees, Bernhard Pfeifer, Stanislas Rolland",
+                       sponsor         : "System Concept GmbH, Bernhard Pfeifer, Fructifor Inc.",
+                       sponsorUrl      : "http://www.fructifor.ca/",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+               
+               /*
+                * Registering the button
+                */
+               var buttonId = "InsertCharacter";
+               var buttonConfiguration = {
+                       id              : buttonId,
+                       tooltip         : this.localize(buttonId + "-Tooltip"),
+                       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("InsertCharacter", this.makeUrlFromPopupName("select_character"), "insertCharacter", null, {width:485, height:330});
+               return false;
+       },
+       
+       /*
+        * Insert the selected entity
+        *
+        * @param       object          entity: the chosen entity
+        *
+        * @return      boolean         false
+        */
+       insertCharacter : function(entity) {
                if (typeof(entity) != "undefined") {
-                       instance.editor.focusEditor();
-                       instance.editor.insertHTML(entity);
+                       this.editor.focusEditor();
+                       this.editor.insertHTML(entity);
+                       this.dialog.focus();
                }
-       });
-};
\ No newline at end of file
+               return false;
+       }
+});
+
index e8a774a..8f1ef5d 100644 (file)
@@ -6,7 +6,7 @@
        </meta>
        <data type="array">
                <languageKey index="default" type="array">
-                       <label index="CharacterMapTooltip">Insert special character</label>
+                       <label index="InsertCharacter-Tooltip">Insert special character</label>
                        <label index="Insert special character">Insert special character</label>
                        <label index="HTML value:">HTML value:</label>
                        <label index="Close">Close</label>
@@ -14,7 +14,6 @@
        </data>
        <orig_hash type="array">
                <languageKey index="default" type="array">
-                       <label index="CharacterMapTooltip" type="integer">211069571</label>
                        <label index="Insert special character" type="integer">211069571</label>
                        <label index="HTML value:" type="integer">111194696</label>
                        <label index="Close" type="integer">222113377</label>
index 9a2cd1c..365b261 100644 (file)
@@ -4,7 +4,7 @@
 *
 *  (c) 2004 Bernhard Pfeifer novocaine@gmx.net
 *  (c) 2004 systemconcept.de. Authored by Holger Hees based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/).
-*  (c) 2005, 2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2005-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 <head>
        <title>Insert special character</title>
        <meta http-equiv="Content-Style-Type" content="text/css" />
-       <script type="text/javascript" src="../../../popups/popup.js"></script>
        <script type="text/javascript">
                /*<![CDATA[*/
                <!--
-               
-               HTMLArea = window.opener.HTMLArea;
-               _editor_CSS = window.opener._editor_CSS;
-               __dlg_loadStyle(_editor_CSS);
-               CharacterMap = window.opener.CharacterMap;
-
+               var dialog = window.opener.HTMLArea.Dialog["CharacterMap"];
                function Init() {
-                       __dlg_translate(CharacterMap.I18N);
-                       __dlg_init();
-                       document.body.onkeypress = __dlg_close_on_esc;
+                       dialog.initialize();
                        var character = '';
-                       View( null, character );
+                       View(null, character);
+                       return false;
                };
-
+               
                var oldView = null;
                function View(td, character) {
-                       if (oldView) oldView.className = oldView.className.replace(/\s+character-hilite/, '');
-                       document.getElementById( 'characterPreview' ).value = character;
-                       document.getElementById( 'showCharacter' ).value = character;
-                       if (td)
-                       (oldView = td).className += " character-hilite";
+                       if (oldView) {
+                               oldView.className = oldView.className.replace(/\s+character-hilite/, '');
+                       }
+                       document.getElementById("characterPreview").value = character;
+                       document.getElementById("showCharacter").value = character;
+                       if (td) {
+                               oldView = td;
+                               oldView.className += " character-hilite";
+                       }
                };
-
+               
                function Set(string) {
                        var character = string;
-                       if(window.opener && window.opener.Dialog) window.opener.Dialog._return(character);
+                       dialog.performAction(character);
                        return false;
                };
-
+               
                function onCancel() {
-                       __dlg_close(null);
+                       dialog.close();
                        return false;
                };
                // -->
@@ -87,6 +84,7 @@
        </style>
 </head>
 <body class="popupwin" onload="Init();">
+<div id="content">
 <div class="title">Insert special character</div>
 <form method="get" style="margin:2px; padding:2px" onSubmit="Set(document.getElementById('showCharacter').value); return false;">
 <table cellspacing="0" cellpadding="4" style="border-style: none; width: 100%;">
                <button type="button" name="cancel" onclick="return onCancel();">Close</button>
        </div>
 </form>
+</div>
 </body>
 </html>