Added feature #16281: htmlArea RTE: Add context sensitive help to remove format dialo...
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 7 Nov 2010 00:32:20 +0000 (00:32 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 7 Nov 2010 00:32:20 +0000 (00:32 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9299 709f56b5-9817-0410-a4d7-c38de5d9e867

13 files changed:
ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/ext_tables.php
typo3/sysext/rtehtmlarea/extensions/RemoveFormat/locallang_csh.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/htmlarea.css
typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/clean.gif [deleted file]
typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/remove-format.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/RemoveFormat/locallang.xml
typo3/sysext/rtehtmlarea/htmlarea/plugins/RemoveFormat/remove-format.js
typo3/sysext/rtehtmlarea/htmlarea/skins/default/htmlarea.css
typo3/sysext/t3skin/rtehtmlarea/htmlarea.css

index 90e1710..f628d11 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-06  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #16281: htmlArea RTE: Add context sensitive help to remove format dialogue (BE only)
+
 2010-11-06  Steffen Kamper  <steffen@typo3.org>
 
        * Fixed bug #16187: Optimize stdWrap usage for TypoScript content element CASE (Thanks to Jo Hasenau)
index 8a2ffad..302bb95 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-06  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #16281: htmlArea RTE: Add context sensitive help to remove format dialogue (BE only)
+
 2010-11-05  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature #7872: htmlArea RTE: Allow CSS-styles for tables without having to activate blockstyle
index f96ec83..2bfb045 100644 (file)
@@ -235,6 +235,7 @@ $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['RemoveFormat'] = array();
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['RemoveFormat']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/RemoveFormat/class.tx_rtehtmlarea_removeformat.php:&tx_rtehtmlarea_removeformat';
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['RemoveFormat']['addIconsToSkin'] = 0;
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['RemoveFormat']['disableInFE'] = 0;
+$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['RemoveFormat']['contextHelpFile'] = 'EXT:' . $_EXTKEY . '/extensions/RemoveFormat/locallang_csh.xml';
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['PlainText'] = array();
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['PlainText']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/PlainText/class.tx_rtehtmlarea_plaintext.php:&tx_rtehtmlarea_plaintext';
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['PlainText']['addIconsToSkin'] = 0;
index 6ebfac3..bdb8db0 100644 (file)
@@ -5,22 +5,27 @@ if (!defined ('TYPO3_MODE'))  die ('Access denied.');
        t3lib_extMgm::addStaticFile($_EXTKEY,'static/clickenlarge/','Clickenlarge Rendering');
 
        $TCA['tx_rtehtmlarea_acronym'] = Array (
-       'ctrl' => Array (
-               'title' => 'LLL:EXT:rtehtmlarea/locallang_db.xml:tx_rtehtmlarea_acronym',
-               'label' => 'term',
-               'default_sortby' => 'ORDER BY term',
-               'sortby' => 'sorting',
-               'delete' => 'deleted',
-               'enablecolumns' => Array (
-                       'disabled' => 'hidden',
-                       'starttime' => 'starttime',
-                       'endtime' => 'endtime',
+               'ctrl' => Array (
+                       'title' => 'LLL:EXT:rtehtmlarea/locallang_db.xml:tx_rtehtmlarea_acronym',
+                       'label' => 'term',
+                       'default_sortby' => 'ORDER BY term',
+                       'sortby' => 'sorting',
+                       'delete' => 'deleted',
+                       'enablecolumns' => Array (
+                               'disabled' => 'hidden',
+                               'starttime' => 'starttime',
+                               'endtime' => 'endtime',
+                       ),
+                       'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
+                       'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'extensions/Acronym/skin/images/acronym.gif',
                ),
-               'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
-               'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'extensions/Acronym/skin/images/acronym.gif',
-               )
        );
-
        t3lib_extMgm::allowTableOnStandardPages('tx_rtehtmlarea_acronym');
 
+               // Add contextual help files
+       foreach ($TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins'] as $pluginName => $config) {
+               if ($config['contextHelpFile']) {
+                       t3lib_extMgm::addLLrefForTCAdescr('xEXT_' . $_EXTKEY . '_' . $pluginName, $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['RemoveFormat']['contextHelpFile']);
+               }
+       }
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/locallang_csh.xml b/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/locallang_csh.xml
new file mode 100644 (file)
index 0000000..b04d4e5
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>CSH for Remove Format Extension of htmlArea RTE</description>
+               <type>CSH</type>
+               <csh_table>xEXT_rtehtmlarea_RemoveFormat</csh_table>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index=".alttitle">htmlArea RTE &gt; Remove Format</label>
+                       <label index=".description">The Remove Format feature offers options for cleaning up the HTML markup of the text being edited.</label>
+                       <label index=".details">This feature may be useful in order to clean up text that was copied from some external source and pasted into the editing area.
+
+The feature is accessed by clicking on the "Remove format" button in the editor tool bar.
+
+In the dialogue window that opens when the button is clicked:
+- First, select the area to be cleaned;
+- Second, choose the format removal options that you wish to be applied to the selected area;
+- Press the OK button for the format removal operation to be performed. The dialogue window will be automatically closed.</label>
+                       <label index=".image">EXT:rtehtmlarea/extensions/RemoveFormat/skin/images/remove-format.gif</label>
+                       <label index=".image_descr">Remove format icon in the editor tool bar.</label>
+                       <label index=".seeAlso">xEXT_rtehtmlarea_RemoveFormat:area,xEXT_rtehtmlarea_RemoveFormat:options</label>
+                       <label index="area.alttitle">Select the area to be cleaned</label>
+                       <label index="area.description">The format removal operation may be applied either to the currently highlighted text or to the whole contents of the editing area.</label>
+                       <label index="area.details">Use one of these two radio buttons to select the area to which you wish to apply the format removal operation.</label>
+                       <label index="selection.alttitle">Remove format on selected text only</label>
+                       <label index="selection.description">Select this option to perform the format removal operation on the currently selected text only.</label>
+                       <label index="_selection.seeAlso">xEXT_rtehtmlarea_RemoveFormat:area</label>
+                       <label index="all.alttitle">Remove format on all contents</label>
+                       <label index="all.description">Select this option to perform the format removal operation on the whole contents of the editing area.</label>
+                       <label index="_all.seeAlso">xEXT_rtehtmlarea_RemoveFormat:area</label>
+                       <label index="options.alttitle">Select the types of format to be removed</label>
+                       <label index="options.description">The format removal operation may remove various types of format.</label>
+                       <label index="options.details">Check one or more of these check boxes to select the type(s) of format you wish to be removed.</label>
+                       <label index="options.seeAlso">xEXT_rtehtmlarea_RemoveFormat:htmlFormat,xEXT_rtehtmlarea_RemoveFormat:msWordFormat,xEXT_rtehtmlarea_RemoveFormat:typographicalPunctuation,xEXT_rtehtmlarea_RemoveFormat:nonBreakingSpace,xEXT_rtehtmlarea_RemoveFormat:images,xEXT_rtehtmlarea_RemoveFormat:allHtml</label>
+                       <label index="htmlFormat.alttitle">Remove all HTML inline markup and style</label>
+                       <label index="htmlFormat.description">Check this option if you wish to remove all HTML inline markup and style.</label>
+                       <label index="htmlFormat.details">This option removes:
+- the following HTML elements, but keeps their textual contents: abbr, acronym, b, big, cite, code, em, font, i, q, s, samp, small, span, strike, strong, sub, sup, tt, u, var;
+- the following attributes on all HTML elements: align, bgcolor, cellpadding, cellspacing, class, frame, style.</label>
+                       <label index="msWordFormat.alttitle">Remove all MS Word markup and style</label>
+                       <label index="msWordFormat.description">Check this option if you wish to remove all MS Word markup and style.</label>
+                       <label index="msWordFormat.details">This option removes:
+- all attributes on the following elements: b, em, i, li, p, strong, ul;
+- the following attributes on all HTML elements: align, class, style;
+- the following elements, but keeps their textual contents: div, link, meta, span, any element containing ":" in its name;
+- the following elements and their contents: style, title;
+- HTML comments;
+- the following elements whenever they have no textual contents: b, big, i, s, small, strike, tt, u;
+- double opening and double closing tags;
+- multiples spaces, replacing them by single spaces.</label>
+                       <label index="typographicalPunctuation.alttitle">Replace typographical punctuation</label>
+                       <label index="typographicalPunctuation.description">Check this option if you wish to replace typographical punctuation with ASCII character codes.</label>
+                       <label index="typographicalPunctuation.details">This option replaces typographical punctuation entities with ASCII character codes. The following substitutions are performed:
+- replace horizontal ellipsis with three periods;
+- replace en-dash and em-dash with hyphen;
+- replace double low-9, left double and right double quotation mark with double quote;
+- replace left single, right single and single low-9 quotation mark with single quote;
+- replace single left/right-pointing angle quotation mark with single quote;
+- replace left/right-pointing double angle quotation mark (also known as left/right pointing guillemet) with double quote;
+- replace grave accent (spacing grave) and acute accent (spacing acute) with single quote.</label>
+                       <label index="nonBreakingSpace.alttitle">Replace non-breaking spaces</label>
+                       <label index="nonBreakingSpace.description">Check this option if you wish to replace non-breaking spaces with normal spaces.</label>
+                       <label index="nonBreakingSpace.details">This option replaces any non-breaking space with a simple normal space.</label>
+                       <label index="images.alttitle">Remove images</label>
+                       <label index="images.description">Check this option if you wish to remove all images.</label>
+                       <label index="images.details">This option removes all images from the selected text.</label>
+                       <label index="allHtml.alttitle">Remove all HTML format</label>
+                       <label index="allHtml.description">Check this option if you wish to remove all HTML format.</label>
+                       <label index="allHtml.details">This option removes all HTML markup from the selected text.</label>
+               </languageKey>
+       </data>
+</T3locallang>
index 03f3173..c715c2b 100644 (file)
@@ -1,6 +1,6 @@
 /* Selectors for the RemoveFormat plugin of htmlArea RTE */
 /* TYPO3 SVN ID: $Id$ */
 .htmlarea-action-remove-format {
-       background-image: url('images/clean.gif') !important;
+       background-image: url('images/remove-format.gif') !important;
        background-position: 0 0 !important;
 }
diff --git a/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/clean.gif b/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/clean.gif
deleted file mode 100644 (file)
index 564bf0a..0000000
Binary files a/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/clean.gif and /dev/null differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/remove-format.gif b/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/remove-format.gif
new file mode 100644 (file)
index 0000000..564bf0a
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/RemoveFormat/skin/images/remove-format.gif differ
index 8a28ab6..5bee910 100644 (file)
@@ -4616,7 +4616,6 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
                return (function(arg1, arg2, arg3) {
                        return (self[functionName](arg1, arg2, arg3));});
        },
-
        /**
         * Localize a string
         *
@@ -4628,6 +4627,34 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
                return this.I18N[label] || HTMLArea.localize(label);
        },
        /**
+        * Get localized label wrapped with contextual help markup when available
+        *
+        * @param       string          fieldName: the name of the field in the CSH file
+        * @param       string          label: the name of the label to localize
+        * @param       string          pluginName: overrides this.name
+        *
+        * @return      string          localized label with CSH markup
+        */
+       getHelpTip: function (fieldName, label, pluginName) {
+               if (Ext.isDefined(TYPO3.ContextHelp)) {
+                       var pluginName = Ext.isDefined(pluginName) ? pluginName : this.name;
+                       return '<a class="t3-help-link" href="#" data-table="xEXT_rtehtmlarea_' + pluginName + '" data-field="' + fieldName + '"><abbr class="t3-help-teaser">' + this.localize(label) + '</abbr></a>';
+               } else {
+                       return this.localize(label);
+               }
+       },
+       /**
+        * Initiate context help listening on the dialogue window
+        * This is normally specified as render handler of the window
+        *
+        * @return      void
+        */
+       enableContextHelp: function () {
+               if (Ext.isDefined(TYPO3.ContextHelp) && Ext.isFunction(TYPO3.ContextHelp.openHelpWindow)) {
+                       Ext.select('div').on('click', TYPO3.ContextHelp.openHelpWindow, TYPO3.ContextHelp, {delegate: 'a.t3-help-link'});
+               }
+       },
+       /**
         * Load a Javascript file asynchronously
         *
         * @param       string          url: url of the file to load
index 322fb12..12a80e6 100644 (file)
@@ -6,19 +6,19 @@
        </meta>
        <data type="array">
                <languageKey index="default" type="array">
-                       <label index="RemoveFormatTooltip">Remove formatting</label>
+                       <label index="RemoveFormatTooltip">Remove format</label>
                        <label index="Cleaning Area">Cleaning Area</label>
-                       <label index="Selection">Selection</label>
+                       <label index="Selection">Selected text</label>
                        <label index="All">All</label>
-                       <label index="Remove formatting">Remove formatting</label>
-                       <label index="Cleaning options">Type of formatting to remove</label>
-                       <label index="Formatting:">HTML Formatting:</label>
-                       <label index="MS Word Formatting:">MS Word Formatting:</label>
+                       <label index="Remove formatting">Remove format</label>
+                       <label index="Cleaning options">Type(s) of format to remove</label>
+                       <label index="Formatting:">HTML Format:</label>
+                       <label index="MS Word Formatting:">MS Word Format:</label>
                        <label index="Typographical punctuation:">Typographical punctuation:</label>
                        <label index="Spaces">Non-breaking spaces:</label>
                        <label index="Images:">Images:</label>
                        <label index="All HTML:">All HTML tags:</label>
-                       <label index="Select the type of formatting you wish to remove.">Select the type of formatting to remove.</label>
+                       <label index="Select the type of formatting you wish to remove.">Select the type(s) of format to remove.</label>
                        <label index="OK">OK</label>
                        <label index="Cancel">Cancel</label>
                </languageKey>
index 924dd8f..f169870 100644 (file)
@@ -47,7 +47,8 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                        copyrightOwner  : 'Stanislas Rolland',
                        sponsor         : 'SJBR',
                        sponsorUrl      : 'http://www.sjbr.ca/',
-                       license         : 'GPL'
+                       license         : 'GPL',
+                       hasHelp         : true
                };
                this.registerPluginInformation(pluginInformation);
                /*
@@ -101,7 +102,7 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
         */
        openDialogue: function (buttonId, title, dimensions) {
                this.dialog = new Ext.Window({
-                       title: this.localize(title),
+                       title: this.getHelpTip('', title),
                        cls: 'htmlarea-window',
                        border: false,
                        width: dimensions.width,
@@ -110,6 +111,9 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                        resizable: !Ext.isIE,
                        iconCls: this.getButton(buttonId).iconCls,
                        listeners: {
+                               render: {
+                                       fn: this.enableContextHelp
+                               },
                                close: {
                                        fn: this.onClose,
                                        scope: this
@@ -117,7 +121,7 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                        },
                        items: [{
                                        xtype: 'fieldset',
-                                       title: this.localize('Cleaning Area'),
+                                       title: this.getHelpTip('area', 'Cleaning Area'),
                                        defaultType: 'radio',
                                        labelWidth: 140,
                                        defaults: {
@@ -125,11 +129,11 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                                        },
                                        items: [{
                                                        itemId: 'selection',
-                                                       fieldLabel: this.localize('Selection'),
+                                                       fieldLabel: this.getHelpTip('selection', 'Selection'),
                                                        name: 'htmlarea-removeFormat-area'
                                                },{
                                                        itemId: 'allContent',
-                                                       fieldLabel: this.localize('All'),
+                                                       fieldLabel: this.getHelpTip('all', 'All'),
                                                        checked: true,
                                                        name: 'htmlarea-removeFormat-area'
                                                }
@@ -137,30 +141,30 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                                },{
                                        xtype: 'fieldset',
                                        defaultType: 'checkbox',
-                                       title: this.localize('Cleaning options'),
+                                       title: this.getHelpTip('options', 'Cleaning options'),
                                        labelWidth: 170,
                                        defaults: {
                                                labelSeparator: ''
                                        },
                                        items: [{
                                                        itemId: 'formatting',
-                                                       fieldLabel: this.localize('Formatting:')
+                                                       fieldLabel: this.getHelpTip('htmlFormat', 'Formatting:')
                                                },{
                                                        itemId: 'msWordFormatting',
-                                                       fieldLabel: this.localize('MS Word Formatting:'),
+                                                       fieldLabel: this.getHelpTip('msWordFormat', 'MS Word Formatting:'),
                                                        checked: true
                                                },{
                                                        itemId: 'typographical',
-                                                       fieldLabel: this.localize('Typographical punctuation:')
+                                                       fieldLabel: this.getHelpTip('typographicalPunctuation', 'Typographical punctuation:')
                                                },{
                                                        itemId: 'spaces',
-                                                       fieldLabel: this.localize('Spaces')
+                                                       fieldLabel: this.getHelpTip('nonBreakingSpace', 'Spaces')
                                                },{
                                                        itemId: 'images',
-                                                       fieldLabel: this.localize('Images:')
+                                                       fieldLabel: this.getHelpTip('images', 'Images:')
                                                },{
                                                        itemId: 'allHtml',
-                                                       fieldLabel: this.localize('All HTML:')
+                                                       fieldLabel: this.getHelpTip('allHtml', 'All HTML:')
                                                }
                                        ]
                                }
@@ -282,7 +286,7 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                                        // Replace double low-9 / left double / right double quotation mark with double quote
                                SrcCd = String.fromCharCode(8222) + '|' + String.fromCharCode(8220) + '|' + String.fromCharCode(8221);
                                html = html.replace(new RegExp(SrcCd, 'g'), '"');
-                                       // Replace left single / right single / single low-9 quotation mark with sigle quote
+                                       // Replace left single / right single / single low-9 quotation mark with single quote
                                SrcCd = String.fromCharCode(8216) + '|' + String.fromCharCode(8217) + '|' + String.fromCharCode(8218);
                                html = html.replace(new RegExp(SrcCd, 'g'), "'");
                                        // Replace single left/right-pointing angle quotation mark with single quote
index 470d5f2..d1355f6 100644 (file)
@@ -227,6 +227,9 @@ body.ext-ie6 .htmlarea-context-menu .buttonActive,
 body.ext-ie6 .htmlarea-window .x-panel-icon {
        background-image: url("images/sprites/actions.gif");
 }
+.htmlarea-window .x-window-header .t3-help-link {
+       color: #fff;
+}
 .htmlarea-window ul.x-tab-strip {
        list-style: none;
 }
index 671bec9..62af8fe 100644 (file)
@@ -232,6 +232,9 @@ body.ext-ie6 .htmlarea-context-menu .buttonActive,
 body.ext-ie6 .htmlarea-window .x-panel-icon {
        background-image: url("images/sprites/actions.gif");
 }
+.htmlarea-window .x-window-header .t3-help-link {
+       color: #fff;
+}
 .htmlarea-window ul.x-tab-strip {
        list-style: none;
 }