Project

General

Profile

Bug #21024 » rtehtmlarea_bugfix_11915_trunk.patch

Administrator Admin, 2009-09-15 00:49

View differences:

typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail)
return null;
};
/** Use XML HTTPRequest to post some data back to the server and do something
* with the response (asyncronously!), this is used by such things as the spellchecker update personal dict function
/*
* 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) {
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) {
......
}
function callBack() {
if(req.readyState == 4) {
if (req.readyState == 4) {
if (req.status == 200) {
if (typeof(handler) == 'function') handler(req.responseText, req);
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 " + postUrl + " . Server reported " + req.statusText);
}
}
}
req.onreadystatechange = callBack;
if (asynchronous) {
req.onreadystatechange = callBack;
}
function sendRequest() {
HTMLArea._appendToLog("[HTMLArea::_postback]: Request: " + content);
req.send(content);
}
req.open('POST', postUrl, true);
req.open('POST', postUrl, asynchronous);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
window.setTimeout(sendRequest, 500);
if (!asynchronous) {
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 " + postUrl + " . Server reported " + req.statusText);
}
} else {
window.setTimeout(sendRequest, 500);
}
}
};
......
* @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
*
* @return boolean true on success
*/
postData : function (url, data, handler) {
HTMLArea._postback(url, data, handler, this.editorConfiguration.RTEtsConfigParams, (this.editorConfiguration.typo3ContentCharset ? this.editorConfiguration.typo3ContentCharset : "utf-8"));
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);
},
/**
typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js (copie de travail)
// If we are handling a button, not a hotkey
this.applyBrowserCommand(buttonId);
}
// In FF3, the paste operation will indeed trigger the onPaste even; not in FF2; nor in Opera
if (HTMLArea.is_opera || (HTMLArea.is_gecko && navigator.productSub < 2008020514)) {
// In FF3, the paste operation will indeed trigger the onPaste event not in FF2; nor in Opera
// Safari does not support the paste operation
if (HTMLArea.is_opera || (HTMLArea.is_gecko && navigator.productSub < 20080514)) {
var cleanLaterFunctRef = this.getPluginInstance("DefaultClean") ? this.getPluginInstance("DefaultClean").cleanLaterFunctRef : (this.getPluginInstance("TYPO3HtmlParser") ? this.getPluginInstance("TYPO3HtmlParser").cleanLaterFunctRef : null);
if (cleanLaterFunctRef) {
window.setTimeout(cleanLaterFunctRef, 50);
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (copie de travail)
editorNo : this.editorNumber,
content : this.getPluginInstance("EditorMode").getInnerHTML()
};
// Server-based synchronous pasted content cleaning
this.postData( this.parseHtmlModulePath,
content,
function(response) {
editor.getPluginInstance("EditorMode").setHTML(response);
editor.selectRange(editor.moveToBookmark(bookmark));
}
},
false
);
}
});
(1-1/2)