Index: typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php =================================================================== --- typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php (révision 7270) +++ typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php (copie de travail) @@ -177,7 +177,7 @@ $whereClause .= t3lib_BEfunc::deleteClause($tableB); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $tableAB, $whereClause); while ($acronymRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - $item = array($GLOBALS['LANG']->csConvObj->utf8_encode($acronymRow['term'], $charset), $GLOBALS['LANG']->csConvObj->utf8_encode($acronymRow['acronym'], $charset), $GLOBALS['LANG']->csConvObj->utf8_encode(strtolower($acronymRow['lg_iso_2']), $charset) . ($acronymRow['lg_country_iso_2'] ? ('-' . $acronymRow['lg_country_iso_2']) : '')); + $item = array('term' => $GLOBALS['LANG']->csConvObj->utf8_encode($acronymRow['term'], $charset), 'abbr' => $GLOBALS['LANG']->csConvObj->utf8_encode($acronymRow['acronym'], $charset), 'language' => $GLOBALS['LANG']->csConvObj->utf8_encode(strtolower($acronymRow['lg_iso_2']), $charset) . ($acronymRow['lg_country_iso_2'] ? ('-' . $acronymRow['lg_country_iso_2']) : '')); if ($acronymRow['type'] == 1) { $acronymArray[] = $item; } else if ($acronymRow['type'] == 2) { @@ -186,10 +186,9 @@ } $this->acronymIndex = count($acronymArray); $this->abbreviationIndex = count($abbrArray); - return 'var acronyms = ' . json_encode($acronymArray) . ';' . 'var abbreviations = ' . json_encode($abbrArray) . ';'; + return json_encode(array('abbr' => $abbrArray, 'acronym' => $acronymArray)); } } - 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']); } Index: typo3/sysext/rtehtmlarea/extensions/Language/class.tx_rtehtmlarea_language.php =================================================================== --- typo3/sysext/rtehtmlarea/extensions/Language/class.tx_rtehtmlarea_language.php (révision 7270) +++ typo3/sysext/rtehtmlarea/extensions/Language/class.tx_rtehtmlarea_language.php (copie de travail) @@ -88,15 +88,14 @@ $languages = array_flip(array_merge($languages, $this->getLanguages())); $languagesJSArray = array(); foreach ($languages as $key => $value) { - $languagesJSArray[] = array($key, $value); + $languagesJSArray[] = array('text' => $key, 'value' => $value); } - $languagesJSArray = 'var options = ' . json_encode($languagesJSArray) . ';'; + $languagesJSArray = json_encode(array('options' => $languagesJSArray)); $registerRTEinJavascriptString .= ' RTEarea['.$RTEcounter.'].buttons.'. $button .'.dataUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('', $button . '_' . $this->htmlAreaRTE->contentLanguageUid, 'js', $languagesJSArray) . '";'; } return $registerRTEinJavascriptString; } - /** * Getting all languages into an array * where the key is the ISO alpha-2 code of the language @@ -159,9 +158,7 @@ } } } - if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/Language/class.tx_rtehtmlarea_language.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/Language/class.tx_rtehtmlarea_language.php']); } - ?> \ No newline at end of file Index: typo3/sysext/rtehtmlarea/extensions/SelectFont/class.tx_rtehtmlarea_selectfont.php =================================================================== --- typo3/sysext/rtehtmlarea/extensions/SelectFont/class.tx_rtehtmlarea_selectfont.php (révision 7270) +++ typo3/sysext/rtehtmlarea/extensions/SelectFont/class.tx_rtehtmlarea_selectfont.php (copie de travail) @@ -176,11 +176,10 @@ } // Setting the JS list of options $itemsJSArray = array(); - foreach ($items as $option) { - $itemsJSArray[] = $option; + foreach ($items as $name => $option) { + $itemsJSArray[] = array('text' => $option[0], 'value' => $option[1]); } - $itemsJSArray = 'var options = ' . json_encode($itemsJSArray) . ';'; - + $itemsJSArray = json_encode(array('options' => $itemsJSArray)); // Adding to button JS configuration if (!is_array( $this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$buttonId . '.'])) { $configureRTEInJavascriptString .= ' @@ -190,8 +189,7 @@ RTEarea['.$RTEcounter.'].buttons.'. $buttonId . '.dataUrl = \'' . $this->htmlAreaRTE->writeTemporaryFile('', $buttonId . '_'. $this->htmlAreaRTE->contentLanguageUid, 'js', $itemsJSArray) . '\';'; return $configureRTEInJavascriptString; } -} // end of class - +} if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/SelectFont/class.tx_rtehtmlarea_selectfont.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/SelectFont/class.tx_rtehtmlarea_selectfont.php']); } Index: typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail) @@ -37,7 +37,9 @@ if (typeof(HTMLArea) == 'undefined') { // Establish HTMLArea name space Ext.namespace('HTMLArea.util.TYPO3', 'HTMLArea.util.Tips', 'HTMLArea.util.Color', 'Ext.ux.form', 'Ext.ux.menu', 'Ext.ux.Toolbar'); - // Establish some constants +/*************************************************** + * CONSTANTS + ***************************************************/ Ext.apply(HTMLArea, { // Browser identification is_gecko : Ext.isGecko || Ext.isOpera || Ext.isWebKit, @@ -95,65 +97,6 @@ HTMLArea._appendToLog("[HTMLArea::init]: Editor content skin CSS set to: " + HTMLArea.editedContentCSS); }; /*************************************************** - * SCRIPT LOADING - ***************************************************/ -/* - * Get a script using asynchronous XMLHttpRequest - */ -HTMLArea.MSXML_XMLHTTP_PROGIDS = new Array('Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'); -HTMLArea.XMLHTTPResponseHandler = function (request, url) { - return (function() { - if (request.readyState == 4) { - if (request.status == 200) { - try { - eval(request.responseText); - } catch (e) { - HTMLArea._appendToLog('ERROR [HTMLArea::getScript]: Unable to get script ' + url + ': ' + e); - } - } else { - HTMLArea._appendToLog('ERROR [HTMLArea::getScript]: Unable to get ' + url + ' . Server reported ' + request.status); - } - } - }); -}; -HTMLArea._getScript = function (i,asynchronous,url) { - if (typeof(asynchronous) == 'undefined') { - var asynchronous = true; - } - if (window.XMLHttpRequest) { - var request = new XMLHttpRequest(); - } else if (window.ActiveXObject) { - var success = false; - for (var k = 0; k < HTMLArea.MSXML_XMLHTTP_PROGIDS.length && !success; k++) { - try { - var request = new ActiveXObject(HTMLArea.MSXML_XMLHTTP_PROGIDS[k]); - success = true; - } catch (e) { } - } - if (!success) { - return false; - } - } - if (request) { - HTMLArea._appendToLog('[HTMLArea::getScript]: Requesting script ' + url); - request.open('GET', url, asynchronous); - if (asynchronous) { - request.onreadystatechange = HTMLArea.XMLHTTPResponseHandler(request, url); - } - if (window.XMLHttpRequest) { - request.send(null); - } else if (window.ActiveXObject) { - request.send(); - } - if (!asynchronous) { - return (request.status == 200 ? request.responseText : ''); - } - return true; - } else { - return false; - } -}; -/*************************************************** * EDITOR CONFIGURATION ***************************************************/ HTMLArea.Config = function (editorId) { @@ -219,6 +162,7 @@ submitValue: false, forceSelection: true, mode: 'local', + storeRoot: 'options', storeFields: [ { name: 'text'}, { name: 'value'}], valueField: 'value', displayField: 'text', @@ -257,12 +201,24 @@ // Set some additional properties switch (config.xtype) { case 'htmlareacombo': - // Create combo store - config.store = new Ext.data.ArrayStore({ - autoDestroy: true, - fields: config.storeFields, - data: config.options - }); + if (config.options) { + // Create combo array store + config.store = new Ext.data.ArrayStore({ + autoDestroy: true, + fields: config.storeFields, + data: config.options + }); + } else if (config.storeUrl) { + config.mode = 'remote'; + // Create combo json store + config.store = new Ext.data.JsonStore({ + autoDestroy: true, + autoLoad: true, + root: config.storeRoot, + fields: config.storeFields, + url: config.storeUrl + }); + } config.hideLabel = Ext.isEmpty(config.fieldLabel); config.helpTitle = config.tooltip; break; @@ -3644,73 +3600,6 @@ } }); Ext.reg('colorpalettefield', Ext.ux.form.ColorPaletteField); -/* - * Use XML HTTPRequest to post some data back to the server and do something - * with the response (asyncronously or syncronously); this is used by such things as the spellchecker update personal dict function - */ -HTMLArea._postback = function(url, data, handler, addParams, charset, asynchronous) { - if (typeof(charset) == "undefined") var charset = "utf-8"; - if (typeof(asynchronous) == "undefined") { - var asynchronous = true; - } - var req = null; - if (window.XMLHttpRequest) req = new XMLHttpRequest(); - else if (window.ActiveXObject) { - var success = false; - for (var k = 0; k < HTMLArea.MSXML_XMLHTTP_PROGIDS.length && !success; k++) { - try { - req = new ActiveXObject(HTMLArea.MSXML_XMLHTTP_PROGIDS[k]); - success = true; - } catch (e) { } - } - } - - if(req) { - var content = ''; - for (var i in data) { - content += (content.length ? '&' : '') + i + '=' + encodeURIComponent(data[i]); - } - content += (content.length ? '&' : '') + 'charset=' + charset; - if (typeof(addParams) != "undefined") content += addParams; - - function callBack() { - if (req.readyState == 4) { - if (req.status == 200) { - if (typeof(handler) == "function") handler(req.responseText, req); - HTMLArea._appendToLog("[HTMLArea::_postback]: Server response: " + req.responseText); - } else { - HTMLArea._appendToLog("ERROR [HTMLArea::_postback]: Unable to post " + url + " . Server reported " + req.statusText); - } - } - } - if (asynchronous) { - req.onreadystatechange = callBack; - } - function sendRequest() { - HTMLArea._appendToLog("[HTMLArea::_postback]: Request: " + content); - req.send(content); - } - - req.open('POST', url, asynchronous); - req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); - if (!asynchronous) { - HTMLArea.pendingSynchronousXMLHttpRequest = true; - sendRequest(); - if (req.status == 200) { - if (typeof(handler) == "function") { - handler(req.responseText, req); - } - HTMLArea._appendToLog("[HTMLArea::_postback]: Server response: " + req.responseText); - } else { - HTMLArea._appendToLog("ERROR [HTMLArea::_postback]: Unable to post " + url + " . Server reported " + req.statusText); - } - HTMLArea.pendingSynchronousXMLHttpRequest = false; - } else { - window.setTimeout(sendRequest, 500); - } - } -}; - /** * Internet Explorer returns an item having the _name_ equal to the given id, even if it's not having any id. * This way it can return a different form field even if it's not a textarea. This works around the problem by @@ -3887,6 +3776,7 @@ constructor : function(editor, pluginName) { this.editor = editor; this.editorNumber = editor.editorId; + this.editorId = editor.editorId; this.editorConfiguration = editor.config; this.name = pluginName; try { @@ -4184,7 +4074,9 @@ */ onUpdateToolbar: Ext.emptyFn, /** - * Deprecated as of TYPO3 4.4 + *********************************************** + * THIS FUNCTION IS DEPRECATED AS OF TYPO3 4.4 * + *********************************************** * Register the key handler to the editor keyMap in onGenerate function * The keyPress event handler * This function may be defined by the plugin subclass. @@ -4219,12 +4111,15 @@ onGenerate: Ext.emptyFn, /** * Make function reference in order to avoid memory leakage in IE + *********************************************** + * THIS FUNCTION IS DEPRECATED AS OF TYPO3 4.4 * + *********************************************** * * @param string functionName: the name of the plugin function to be invoked * * @return function function definition invoking the specified function of the plugin */ - makeFunctionReference : function (functionName) { + makeFunctionReference: function (functionName) { var self = this; return (function(arg1, arg2, arg3) { return (self[functionName](arg1, arg2, arg3));}); @@ -4237,53 +4132,76 @@ * * @return string the localization of the label */ - localize : function (label) { + localize: function (label) { return this.I18N[label] || HTMLArea.I18N.dialogs[label] || HTMLArea.I18N.tooltips[label] || HTMLArea.I18N.msg[label]; }, - /** - * Load a Javascript file synchronously + * Load a Javascript file asynchronously * * @param string url: url of the file to load + * @param function callBack: the callBack function * - * @return boolean true on success + * @return boolean true on success of the request submission */ - getJavascriptFile : function (url, noEval) { - var script = HTMLArea._getScript(0, false, url); - if (script) { - if (noEval) { - return script; - } else { - try { - eval(script); - return true; - } catch(e) { - this.appendToLog("getJavascriptFile", "Error evaluating contents of Javascript file: " + url); - return false; - } - } - } else { - return false; - } + getJavascriptFile: function (url, callback) { + var success = false; + this.appendToLog('getJavascriptFile', 'Requesting script ' + url); + Ext.Ajax.request({ + method: 'GET', + url: url, + callback: callback, + success: function (response) { + success = true; + }, + failure: function (response) { + this.appendToLog('getJavascriptFile', 'Unable to get ' + url + ' . Server reported ' + response.status); + }, + scope: this + }); + return success; }, - /** * Post data to the server * * @param string url: url to post data to * @param object data: data to be posted - * @param function handler: function that will handle the response returned by the server - * @param boolean asynchronous: flag indicating if the request should processed asynchronously or not + * @param function callback: function that will handle the response returned by the server * * @return boolean true on success */ - postData : function (url, data, handler, asynchronous) { - if (typeof(asynchronous) == "undefined") { - var asynchronous = true; - } - HTMLArea._postback(url, data, handler, this.editorConfiguration.RTEtsConfigParams, (this.editorConfiguration.typo3ContentCharset ? this.editorConfiguration.typo3ContentCharset : "utf-8"), asynchronous); + postData: function (url, data, callback) { + var success = false; + data.charset = this.editorConfiguration.typo3ContentCharset ? this.editorConfiguration.typo3ContentCharset : 'utf-8'; + var params = ''; + Ext.iterate(data, function (parameter, value) { + params += (params.length ? '&' : '') + parameter + '=' + encodeURIComponent(value); + }); + params += this.editorConfiguration.RTEtsConfigParams; + this.appendToLog('postData', 'Posting to ' + url + '. Data: ' + params); + Ext.Ajax.request({ + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + url: url, + params: params, + callback: Ext.isFunction(callback) ? callback: function (options, success, response) { + if (success) { + this.appendToLog('postData', 'Post request to ' + url + ' successful. Server response: ' + response.responseText); + } else { + this.appendToLog('postData', 'Post request to ' + url + ' failed. Server reported ' + response.status); + } + }, + success: function (response) { + success = true; + }, + failure: function (response) { + this.appendToLog('postData', 'Unable to post ' + url + ' . Server reported ' + response.status); + }, + scope: this + }); + return success; }, - /** *********************************************** * THIS FUNCTION IS DEPRECATED AS OF TYPO3 4.4 * Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js (copie de travail) @@ -30,23 +30,14 @@ * TYPO3 SVN ID: $Id$ */ Acronym = HTMLArea.Plugin.extend({ - constructor : function(editor, pluginName) { + constructor: function(editor, pluginName) { this.base(editor, pluginName); }, /* * This function gets called by the class constructor */ - configurePlugin : function(editor) { + configurePlugin: function(editor) { this.pageTSConfiguration = this.editorConfiguration.buttons.acronym; - this.acronymUrl = this.pageTSConfiguration.acronymUrl; - this.data = this.getJavascriptFile(this.acronymUrl, 'noEval'); - if (this.data) { - eval(this.data); - }; - this.data = { - acronym: acronyms, - abbr: abbreviations - }; /* * Registering plugin "About" information */ @@ -253,10 +244,12 @@ itemId: 'termSelector', helpTitle: this.localize('Select_a_term'), tpl: '
{term}
', - store: new Ext.data.ArrayStore({ + store: new Ext.data.JsonStore({ autoDestroy: true, + autoLoad: true, + root: type, fields: [ { name: 'term'}, { name: 'abbr'}, { name: 'language'}], - data: this.data[type] + url: this.pageTSConfiguration.acronymUrl }), width: 350, listeners: { @@ -278,10 +271,12 @@ fieldLabel: this.localize('Abridged_term'), itemId: 'abbrSelector', helpTitle: this.localize('Select_an_' + type), - store: new Ext.data.ArrayStore({ + store: new Ext.data.JsonStore({ autoDestroy: true, + autoLoad: true, + root: type, fields: [ { name: 'term'}, { name: 'abbr'}, { name: 'language'}], - data: this.data[type] + url: this.pageTSConfiguration.acronymUrl }), width: 100, listeners: { @@ -297,19 +292,30 @@ }, this.configDefaults['combo'])); var languageObject = this.getPluginInstance('Language'); if (this.getButton('Language')) { - var languageStore = new Ext.data.ArrayStore({ + var selectedLanguage = !Ext.isEmpty(element) ? languageObject.getLanguageAttribute(element) : 'none'; + function initLanguageStore (store) { + if (selectedLanguage !== 'none') { + store.removeAt(0); + store.insert(0, new store.recordType({ + text: languageObject.localize('Remove language mark'), + value: 'none' + })); + } + this.getButton('Language').setValue('none'); + } + var languageStore = new Ext.data.JsonStore({ autoDestroy: true, + autoLoad: true, + root: 'options', fields: [ { name: 'text'}, { name: 'value'} ], - data: this.getDropDownConfiguration('Language').options + url: this.getDropDownConfiguration('Language').dataUrl, + listeners: { + load: { + fn: initLanguageStore, + scope: this + } + } }); - var selectedLanguage = !Ext.isEmpty(element) ? languageObject.getLanguageAttribute(element) : 'none'; - if (selectedLanguage !== 'none') { - languageStore.removeAt(0); - languageStore.insert(0, new languageStore.recordType({ - text: languageObject.localize('Remove language mark'), - value: 'none' - })); - } itemsConfig.push(Ext.apply({ xtype: 'combo', fieldLabel: this.localize('Language'), @@ -321,7 +327,17 @@ tpl: '
{text}
', store: languageStore, width: 200, - value: selectedLanguage + value: selectedLanguage, + listeners: { + render: { + fn: function (combo) { + // Load the language dropdown + combo.getStore().load({ + callback: function () { combo.setValue(selectedLanguage); } + }); + } + } + } }, this.configDefaults['combo'])); } return { Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockStyle/block-style.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockStyle/block-style.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockStyle/block-style.js (copie de travail) @@ -247,18 +247,31 @@ * This function gets called on plugin generation, on toolbar update and on change mode * Re-initiate the parsing of the style sheets, if not yet completed, and refresh our toolbar components */ - generate : function(editor, dropDownId) { - if (this.cssLoaded && this.getEditorMode() === "wysiwyg" && this.editor.isEditable()) { + generate: function(editor, dropDownId) { + if (this.cssLoaded && this.getEditorMode() === 'wysiwyg' && this.editor.isEditable()) { this.updateValue(dropDownId); } else { if (this.cssTimeout) { window.clearTimeout(this.cssTimeout); this.cssTimeout = null; } - if (this.classesUrl && (typeof(HTMLArea.classesLabels) === "undefined")) { - this.getJavascriptFile(this.classesUrl); + if (this.classesUrl && (typeof(HTMLArea.classesLabels) === 'undefined')) { + this.getJavascriptFile(this.classesUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesLabels) === 'undefined') { + eval(response.responseText); + this.appendToLog('generate', 'Javascript file successfully evaluated: ' + this.classesUrl); + } + } catch(e) { + this.appendToLog('generate', 'Error evaluating contents of Javascript file: ' + this.classesUrl); + } + } + this.buildCssArray(this.editor, dropDownId); + }); + } else { + this.buildCssArray(this.editor, dropDownId); } - this.buildCssArray(this.editor, dropDownId); } }, Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js (copie de travail) @@ -408,8 +408,7 @@ if (InstallTrigger.enabled()) { var mozillaXpi = new Object(); mozillaXpi["AllowClipboard Helper"] = this.buttonsConfiguration.paste.mozillaAllowClipboardURL; - var mozillaInstallCallback = this.makeFunctionReference("mozillaInstallCallback"); - InstallTrigger.install(mozillaXpi, mozillaInstallCallback); + InstallTrigger.install(mozillaXpi, this.mozillaInstallCallback); } else { alert(this.localize("Mozilla-Org-Install-Not-Enabled")); this.appendToLog("mozillaClipboardAccessException", "Mozilla install was not enabled."); Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js (copie de travail) @@ -102,28 +102,23 @@ */ var buttonId = 'Language'; if (this.buttonsConfiguration[buttonId.toLowerCase()] && this.buttonsConfiguration[buttonId.toLowerCase()].dataUrl) { - // Load the options var - var optionsData = this.getJavascriptFile(this.buttonsConfiguration[buttonId.toLowerCase()].dataUrl, "noEval"); - if (optionsData) { - eval(optionsData); + var dropDownConfiguration = { + id : buttonId, + tooltip : this.localize(buttonId + '-Tooltip'), + storeUrl : this.buttonsConfiguration[buttonId.toLowerCase()].dataUrl, + action : 'onChange' + }; + if (this.buttonsConfiguration.language) { + dropDownConfiguration.width = this.buttonsConfiguration.language.width ? parseInt(this.buttonsConfiguration.language.width, 10) : 200; + if (this.buttonsConfiguration.language.listWidth) { + dropDownConfiguration.listWidth = parseInt(this.buttonsConfiguration.language.listWidth, 10); + } + if (this.buttonsConfiguration.language.maxHeight) { + dropDownConfiguration.maxHeight = parseInt(this.buttonsConfiguration.language.maxHeight, 10); + } } + this.registerDropDown(dropDownConfiguration); } - var dropDownConfiguration = { - id : buttonId, - tooltip : this.localize(buttonId + '-Tooltip'), - options : options, - action : 'onChange' - }; - if (this.buttonsConfiguration.language) { - dropDownConfiguration.width = this.buttonsConfiguration.language.width ? parseInt(this.buttonsConfiguration.language.width, 10) : 200; - if (this.buttonsConfiguration.language.listWidth) { - dropDownConfiguration.listWidth = parseInt(this.buttonsConfiguration.language.listWidth, 10); - } - if (this.buttonsConfiguration.language.maxHeight) { - dropDownConfiguration.maxHeight = parseInt(this.buttonsConfiguration.language.maxHeight, 10); - } - } - this.registerDropDown(dropDownConfiguration); return true; }, /* @@ -137,7 +132,7 @@ /* * This function gets called when the editor is generated */ - onGenerate : function () { + onGenerate: function () { // Add rules to the stylesheet for language mark highlighting // Model: body.htmlarea-show-language-marks *[lang=en]:before { content: "en: "; } // Works in IE8, but not in earlier versions of IE @@ -160,8 +155,12 @@ return true; }); } + // Load the language dropdown + this.getButton('Language').getStore().load({ + callback: function () { this.getButton('Language').setValue('none'); }, + scope: this + }); }, - /* * This function gets called when a button was pressed. * Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js (copie de travail) @@ -30,19 +30,15 @@ * TYPO3 SVN ID: $Id$ */ SelectFont = HTMLArea.Plugin.extend({ - - constructor : function(editor, pluginName) { + constructor: function(editor, pluginName) { this.base(editor, pluginName); }, - /* * This function gets called by the class constructor */ - configurePlugin : function (editor) { - + configurePlugin: function (editor) { this.buttonsConfiguration = this.editorConfiguration.buttons; this.disablePCexamples = this.editorConfiguration.disablePCexamples; - // Font formating will use the style attribute if (this.getPluginInstance("TextStyle")) { this.getPluginInstance("TextStyle").addAllowedAttribute("style"); @@ -81,19 +77,11 @@ */ Ext.each(this.dropDownList, function (dropDown) { var buttonId = dropDown[0]; - // Load the options var - var options = []; - if (this.buttonsConfiguration[dropDown[2]] && this.buttonsConfiguration[dropDown[2]].dataUrl) { - var optionsData = this.getJavascriptFile(this.buttonsConfiguration[dropDown[2]].dataUrl, "noEval"); - if (optionsData) { - eval(optionsData); - } - } var dropDownConfiguration = { id: buttonId, tooltip: this.localize(buttonId.toLowerCase()), - options: options, - action: "onChange", + storeUrl: this.buttonsConfiguration[dropDown[2]].dataUrl, + action: 'onChange', tpl: this.disablePCexamples ? '' : '
{text}
' }; if (this.buttonsConfiguration[dropDown[2]]) { @@ -112,31 +100,40 @@ }, this); return true; }, - /* * The list of buttons added by this plugin */ - dropDownList : [ + dropDownList: [ ['FontName', null, 'fontstyle', 'font-family:{value};text-align:left;font-size:11px;'], ['FontSize', null, 'fontsize', 'text-align:left;font-size:{value};'] ], - /* * Conversion object: button name to corresponding style property name */ - styleProperty : { + styleProperty: { FontName : "fontFamily", FontSize : "fontSize" }, - /* * Conversion object: button name to corresponding css property name */ - cssProperty : { + cssProperty: { FontName : "font-family", FontSize : "font-size" }, /* + * This funcion is invoked by the editor when it is being generated + */ + onGenerate: function () { + // Load the dropdowns + Ext.each(this.dropDownList, function (dropDown) { + this.getButton(dropDown[0]).getStore().load({ + callback: function () { this.getButton(dropDown[0]).setValue('none'); }, + scope: this + }) + }, this); + }, + /* * This function gets called when some font style or font size was selected from the dropdown lists */ onChange: function (editor, combo, record, index) { @@ -194,7 +191,7 @@ * * @return void */ - setStyle : function (element, buttonId, value) { + setStyle: function (element, buttonId, value) { element.style[this.styleProperty[buttonId]] = (value && value !== 'none') ? value : ''; // In IE, we need to remove the empty attribute in order to unset it if (HTMLArea.is_ie && (!value || value == 'none')) { @@ -211,7 +208,6 @@ } } }, - /* * This function gets called when the toolbar is updated */ @@ -223,8 +219,8 @@ var value = parentElement.style[this.styleProperty[select.itemId]]; if (!value) { if (HTMLArea.is_gecko) { - if (editor._doc.defaultView.getComputedStyle(parentElement, null)) { - value = editor._doc.defaultView.getComputedStyle(parentElement, null).getPropertyValue(this.cssProperty[select.itemId]); + if (editor.document.defaultView.getComputedStyle(parentElement, null)) { + value = editor.document.defaultView.getComputedStyle(parentElement, null).getPropertyValue(this.cssProperty[select.itemId]); } } else { value = parentElement.currentStyle[this.styleProperty[select.itemId]]; @@ -241,7 +237,7 @@ } if (index != -1) { select.setValue(store.getAt(index).get('value')); - } else { + } else if (store.getCount()) { select.setValue('none'); } select.setDisabled(!endPointsInSameBlock || (selectionEmpty && /^body$/i.test(parentElement.nodeName))); Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-checker.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-checker.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-checker.js (copie de travail) @@ -430,7 +430,7 @@ data['to_r_list[' + index + '][0]'] = replacement[0]; data['to_r_list[' + index + '][1]'] = replacement[1]; }); - HTMLArea._postback(this.pageTSconfiguration.path, data); + this.postData(this.pageTSconfiguration.path, data); } this.close(); return false; Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js (copie de travail) @@ -1182,34 +1182,47 @@ * * @return void */ - reStyleTable : function (table) { + reStyleTable: function (table) { if (table) { - if (this.classesUrl && (typeof(HTMLArea.classesAlternating) === "undefined" || typeof(HTMLArea.classesCounting) === "undefined")) { - this.getJavascriptFile(this.classesUrl); - } - var classNames = table.className.trim().split(" "); - for (var i = classNames.length; --i >= 0;) { - var classConfiguration = HTMLArea.classesAlternating[classNames[i]]; - if (classConfiguration && classConfiguration.rows) { - if (classConfiguration.rows.oddClass && classConfiguration.rows.evenClass) { - this.alternateRows(table, classConfiguration); + if (this.classesUrl && (typeof(HTMLArea.classesAlternating) === 'undefined' || typeof(HTMLArea.classesCounting) === 'undefined')) { + this.getJavascriptFile(this.classesUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesAlternating) === 'undefined' || typeof(HTMLArea.classesCounting) === 'undefined') { + eval(response.responseText); + this.appendToLog('reStyleTable', 'Javascript file successfully evaluated: ' + this.classesUrl); + } + this.reStyleTable(table); + } catch(e) { + this.appendToLog('reStyleTable', 'Error evaluating contents of Javascript file: ' + this.classesUrl); + } } - } - if (classConfiguration && classConfiguration.columns) { - if (classConfiguration.columns.oddClass && classConfiguration.columns.evenClass) { - this.alternateColumns(table, classConfiguration); + }); + } else { + var classNames = table.className.trim().split(' '); + for (var i = classNames.length; --i >= 0;) { + var classConfiguration = HTMLArea.classesAlternating[classNames[i]]; + if (classConfiguration && classConfiguration.rows) { + if (classConfiguration.rows.oddClass && classConfiguration.rows.evenClass) { + this.alternateRows(table, classConfiguration); + } } - } - classConfiguration = HTMLArea.classesCounting[classNames[i]]; - if (classConfiguration && classConfiguration.rows) { - if (classConfiguration.rows.rowClass) { - this.countRows(table, classConfiguration); + if (classConfiguration && classConfiguration.columns) { + if (classConfiguration.columns.oddClass && classConfiguration.columns.evenClass) { + this.alternateColumns(table, classConfiguration); + } } - } - if (classConfiguration && classConfiguration.columns) { - if (classConfiguration.columns.columnClass) { - this.countColumns(table, classConfiguration); + classConfiguration = HTMLArea.classesCounting[classNames[i]]; + if (classConfiguration && classConfiguration.rows) { + if (classConfiguration.rows.rowClass) { + this.countRows(table, classConfiguration); + } } + if (classConfiguration && classConfiguration.columns) { + if (classConfiguration.columns.columnClass) { + this.countColumns(table, classConfiguration); + } + } } } } @@ -1222,19 +1235,32 @@ * * @return void */ - removeAlternatingClasses : function (table, removeClass) { + removeAlternatingClasses: function (table, removeClass) { if (table) { - if (this.classesUrl && typeof(HTMLArea.classesAlternating) === "undefined") { - this.getJavascriptFile(this.classesUrl); - } - var classConfiguration = HTMLArea.classesAlternating[removeClass]; - if (classConfiguration) { - if (classConfiguration.rows && classConfiguration.rows.oddClass && classConfiguration.rows.evenClass) { - this.alternateRows(table, classConfiguration, true); + if (this.classesUrl && typeof(HTMLArea.classesAlternating) === 'undefined') { + this.getJavascriptFile(this.classesUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesAlternating) === 'undefined') { + eval(response.responseText); + this.appendToLog('removeAlternatingClasses', 'Javascript file successfully evaluated: ' + this.classesUrl); + } + this.removeAlternatingClasses(table, removeClass); + } catch(e) { + this.appendToLog('removeAlternatingClasses', 'Error evaluating contents of Javascript file: ' + this.classesUrl); + } + } + }); + } else { + var classConfiguration = HTMLArea.classesAlternating[removeClass]; + if (classConfiguration) { + if (classConfiguration.rows && classConfiguration.rows.oddClass && classConfiguration.rows.evenClass) { + this.alternateRows(table, classConfiguration, true); + } + if (classConfiguration.columns && classConfiguration.columns.oddClass && classConfiguration.columns.evenClass) { + this.alternateColumns(table, classConfiguration, true); + } } - if (classConfiguration.columns && classConfiguration.columns.oddClass && classConfiguration.columns.evenClass) { - this.alternateColumns(table, classConfiguration, true); - } } } }, @@ -1321,7 +1347,7 @@ } } } - }, + }, /* * Removes from rows/cells the counting classes of an counting style scheme * @@ -1330,19 +1356,32 @@ * * @return void */ - removeCountingClasses : function (table, removeClass) { + removeCountingClasses: function (table, removeClass) { if (table) { - if (this.classesUrl && typeof(HTMLArea.classesCounting) === "undefined") { - this.getJavascriptFile(this.classesUrl); - } - var classConfiguration = HTMLArea.classesCounting[removeClass]; - if (classConfiguration) { - if (classConfiguration.rows && classConfiguration.rows.rowClass) { - this.countRows(table, classConfiguration, true); + if (this.classesUrl && typeof(HTMLArea.classesCounting) === 'undefined') { + this.getJavascriptFile(this.classesUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesCounting) === 'undefined') { + eval(response.responseText); + this.appendToLog('removeCountingClasses', 'Javascript file successfully evaluated: ' + this.classesUrl); + } + this.removeCountingClasses(table, removeClass); + } catch(e) { + this.appendToLog('removeCountingClasses', 'Error evaluating contents of Javascript file: ' + this.classesUrl); + } + } + }); + } else { + var classConfiguration = HTMLArea.classesCounting[removeClass]; + if (classConfiguration) { + if (classConfiguration.rows && classConfiguration.rows.rowClass) { + this.countRows(table, classConfiguration, true); + } + if (classConfiguration.columns && classConfiguration.columns.columnClass) { + this.countColumns(table, classConfiguration, true); + } } - if (classConfiguration.columns && classConfiguration.columns.columnClass) { - this.countColumns(table, classConfiguration, true); - } } } }, @@ -1897,19 +1936,26 @@ var itemsConfig = []; var languageObject = this.getPluginInstance('Language'); if (this.removedProperties.indexOf('language') == -1 && this.getButton('Language')) { - var languageStore = new Ext.data.ArrayStore({ + var selectedLanguage = !Ext.isEmpty(element) ? languageObject.getLanguageAttribute(element) : 'none'; + function initLanguageStore (store) { + if (selectedLanguage !== 'none') { + store.removeAt(0); + store.insert(0, new store.recordType({ + text: languageObject.localize('Remove language mark'), + value: 'none' + })); + } + } + var languageStore = new Ext.data.JsonStore({ autoDestroy: true, + autoLoad: true, + root: 'options', fields: [ { name: 'text'}, { name: 'value'} ], - data: this.getDropDownConfiguration('Language').options + url: this.getDropDownConfiguration('Language').dataUrl, + listeners: { + load: initLanguageStore + } }); - var selectedLanguage = !Ext.isEmpty(element) ? languageObject.getLanguageAttribute(element) : 'none'; - if (selectedLanguage !== 'none') { - languageStore.removeAt(0); - languageStore.insert(0, new languageStore.recordType({ - text: languageObject.localize('Remove language mark'), - value: 'none' - })); - } itemsConfig.push(Ext.apply({ xtype: 'combo', fieldLabel: this.localize('Language'), Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js (copie de travail) @@ -234,7 +234,7 @@ * This function gets called on plugin generation, on toolbar update and on change mode * Re-initiate the parsing of the style sheets, if not yet completed, and refresh our toolbar components */ - generate : function(editor, dropDownId) { + generate: function (editor, dropDownId) { if (this.cssLoaded) { this.updateToolbar(dropDownId); } else { @@ -242,10 +242,23 @@ window.clearTimeout(this.cssTimeout); this.cssTimeout = null; } - if (this.classesUrl && (typeof(HTMLArea.classesLabels) === "undefined")) { - this.getJavascriptFile(this.classesUrl); + if (this.classesUrl && (typeof(HTMLArea.classesLabels) === 'undefined')) { + this.getJavascriptFile(this.classesUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesLabels) === 'undefined') { + eval(response.responseText); + this.appendToLog('generate', 'Javascript file successfully evaluated: ' + this.classesUrl); + } + } catch(e) { + this.appendToLog('generate', 'Error evaluating contents of Javascript file: ' + this.classesUrl); + } + } + this.buildCssArray(this.editor, dropDownId); + }); + } else { + this.buildCssArray(this.editor, dropDownId); } - this.buildCssArray(editor, dropDownId); } }, Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (copie de travail) @@ -91,18 +91,23 @@ editor.cleanAppleStyleSpans(editor._doc.body); } var bookmark = editor.getBookmark(editor._createRange(editor._getSelection())); + var url = this.parseHtmlModulePath; var content = { - editorNo : this.editorNumber, + editorNo : this.editorId, content : editor.getInnerHTML() }; - // Server-based synchronous pasted content cleaning - this.postData( this.parseHtmlModulePath, + // Server-based cleaning of pasted content + this.postData( url, content, - function(response) { - editor.setHTML(response); - editor.selectRange(editor.moveToBookmark(bookmark)); - }, - false + function (options, success, response) { + if (success) { + editor.setHTML(response.responseText); + editor.selectRange(editor.moveToBookmark(bookmark)); + this.appendToLog('clean', 'Post request to ' + url + ' successful. Server response: ' + response.responseText); + } else { + this.appendToLog('clean', 'Post request to ' + url + ' failed. Server reported ' + response.status); + } + } ); }, /* Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js (révision 7270) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js (copie de travail) @@ -82,6 +82,26 @@ ['UnLink', 'a', false, false, 'unlink'] ], /* + * This function is invoked when the editor is being generated + */ + onGenerate: function () { + // Download the definition of special anchor classes if not yet done + if (this.classesAnchorUrl && (typeof(HTMLArea.classesAnchorSetup) === 'undefined')) { + this.getJavascriptFile(this.classesAnchorUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesAnchorSetup) === 'undefined') { + eval(response.responseText); + this.appendToLog('ongenerate', 'Javascript file successfully evaluated: ' + this.classesAnchorUrl); + } + } catch(e) { + this.appendToLog('ongenerate', 'Error evaluating contents of Javascript file: ' + this.classesAnchorUrl); + } + } + }); + } + }, + /* * This function gets called when the button was pressed * * @param object editor: the editor instance @@ -94,58 +114,68 @@ // Could be a button or its hotkey var buttonId = this.translateHotKey(id); buttonId = buttonId ? buttonId : id; - // Download the definition of special anchor classes if not yet done - if (this.classesAnchorUrl && (typeof(HTMLArea.classesAnchorSetup) === "undefined")) { - this.getJavascriptFile(this.classesAnchorUrl); - } - - if (buttonId === "UnLink") { - this.unLink(); - return false; - } - - var additionalParameter; - var node = this.editor.getParentElement(); - var el = HTMLArea.getElementObject(node, "a"); - if (el != null && /^a$/i.test(el.nodeName)) node = el; - if (node != null && /^a$/i.test(node.nodeName)) { - additionalParameter = "&curUrl[href]=" + encodeURIComponent(node.getAttribute("href")); - if (node.target) additionalParameter += "&curUrl[target]=" + encodeURIComponent(node.target); - if (node.className) additionalParameter += "&curUrl[class]=" + encodeURIComponent(node.className); - if (node.title) additionalParameter += "&curUrl[title]=" + encodeURIComponent(node.title); - if (this.pageTSConfiguration && this.pageTSConfiguration.additionalAttributes) { - var additionalAttributes = this.pageTSConfiguration.additionalAttributes.split(","); - for (var i = additionalAttributes.length; --i >= 0;) { - if (node.hasAttribute(additionalAttributes[i])) { - additionalParameter += "&curUrl[" + additionalAttributes[i] + "]=" + encodeURIComponent(node.getAttribute(additionalAttributes[i])); + if (this.classesAnchorUrl && (typeof(HTMLArea.classesAnchorSetup) === 'undefined')) { + this.getJavascriptFile(this.classesAnchorUrl, function (options, success, response) { + if (success) { + try { + if (typeof(HTMLArea.classesAnchorSetup) === 'undefined') { + eval(response.responseText); + this.appendToLog('onButtonPress', 'Javascript file successfully evaluated: ' + this.classesAnchorUrl); + } + this.onButtonPress(editor, id, target); + } catch(e) { + this.appendToLog('onButtonPress', 'Error evaluating contents of Javascript file: ' + this.classesAnchorUrl); } } + }); + } else { + if (buttonId === "UnLink") { + this.unLink(); + return false; } - } else if (this.editor.hasSelectedText()) { - var text = this.editor.getSelectedHTML(); - if (text && text != null) { - var offset = text.toLowerCase().indexOf(""); - ATagContent = ATagContent.substring(0,offset); - additionalParameter = "&curUrl[all]=" + encodeURIComponent(ATagContent); + var additionalParameter; + var node = this.editor.getParentElement(); + var el = HTMLArea.getElementObject(node, "a"); + if (el != null && /^a$/i.test(el.nodeName)) node = el; + if (node != null && /^a$/i.test(node.nodeName)) { + additionalParameter = "&curUrl[href]=" + encodeURIComponent(node.getAttribute("href")); + if (node.target) additionalParameter += "&curUrl[target]=" + encodeURIComponent(node.target); + if (node.className) additionalParameter += "&curUrl[class]=" + encodeURIComponent(node.className); + if (node.title) additionalParameter += "&curUrl[title]=" + encodeURIComponent(node.title); + if (this.pageTSConfiguration && this.pageTSConfiguration.additionalAttributes) { + var additionalAttributes = this.pageTSConfiguration.additionalAttributes.split(","); + for (var i = additionalAttributes.length; --i >= 0;) { + if (node.hasAttribute(additionalAttributes[i])) { + additionalParameter += "&curUrl[" + additionalAttributes[i] + "]=" + encodeURIComponent(node.getAttribute(additionalAttributes[i])); + } + } } + } else if (this.editor.hasSelectedText()) { + var text = this.editor.getSelectedHTML(); + if (text && text != null) { + var offset = text.toLowerCase().indexOf(""); + ATagContent = ATagContent.substring(0,offset); + additionalParameter = "&curUrl[all]=" + encodeURIComponent(ATagContent); + } + } } + this.openContainerWindow( + buttonId, + buttonId.toLowerCase(), + this.getWindowDimensions( + { + width: 550, + height: 350 + }, + buttonId + ), + this.makeUrlFromModulePath(this.modulePath, additionalParameter) + ); } - this.openContainerWindow( - buttonId, - buttonId.toLowerCase(), - this.getWindowDimensions( - { - width: 550, - height: 350 - }, - buttonId - ), - this.makeUrlFromModulePath(this.modulePath, additionalParameter) - ); return false; }, /* Index: typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php =================================================================== --- typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php (révision 7270) +++ typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php (copie de travail) @@ -486,10 +486,9 @@ if (classesImage) var styleSelector=\'\'; var floatSelector=\'\'; if (plugin.getButton("Language")) { - var languageOptions = plugin.getDropDownConfiguration("Language").options; var languageSelector = \'\'; }