Project

General

Profile

Feature #17763 » rtehtmlarea_feature_6668.patch

Administrator Admin, 2007-11-07 16:24

View differences:

typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (working copy)
};
HTMLArea.loadTimer;
HTMLArea._scripts = [];
HTMLArea._scriptLoaded = [];
HTMLArea._request = [];
HTMLArea.scriptLoaded = [];
HTMLArea.ajaxRequest = [];
HTMLArea.loadScript = function(url, plugin) {
if (plugin) url = _editor_url + "/plugins/" + plugin + '/' + url;
if (HTMLArea.is_opera) url = _typo3_host_url + url;
......
if(HTMLArea.is_ie) HTMLArea.loadScript(RTEarea[0]["htmlarea-ie"] ? RTEarea[0]["htmlarea-ie"] : _editor_url + "htmlarea-ie.js");
/*
* Get a script using asynchronous XMLHttpRequest
* Get a script using an asynchronous request
*/
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 (i) {
return (function() {
HTMLArea._getScript = function (i, asynchronous, url) {
if (typeof(url) === "undefined") {
var url = HTMLArea._scripts[i];
if (HTMLArea._request[i].readyState != 4) return;
if (HTMLArea._request[i].status == 200) {
try {
eval(HTMLArea._request[i].responseText);
HTMLArea._scriptLoaded[i] = true;
i = null;
} 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 " + HTMLArea._request[i].status);
}
if (typeof(asynchronous) === "undefined") {
var asynchronous = true;
}
HTMLArea.ajaxRequest[i] = new Ajax.Request(url, {
asynchronous : asynchronous,
method : "get",
onSuccess : function(transport) {
HTMLArea.scriptLoaded[i] = true;
return true;
},
onFailure : function(transport) {
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get " + url + " . Server reported " + HTMLArea.ajaxRequest[i].status);
return false;
}
});
};
HTMLArea._getScript = function (i,asynchronous,url) {
if (typeof(url) == "undefined") var url = HTMLArea._scripts[i];
if (typeof(asynchronous) == "undefined") var asynchronous = true;
if (window.XMLHttpRequest) HTMLArea._request[i] = new XMLHttpRequest();
else if (window.ActiveXObject) {
var success = false;
for (var k = 0; k < HTMLArea.MSXML_XMLHTTP_PROGIDS.length && !success; k++) {
try {
HTMLArea._request[i] = new ActiveXObject(HTMLArea.MSXML_XMLHTTP_PROGIDS[k]);
success = true;
} catch (e) { }
}
if (!success) return false;
}
var request = HTMLArea._request[i];
if (request) {
request.open("GET", url, asynchronous);
if (asynchronous) request.onreadystatechange = HTMLArea.XMLHTTPResponseHandler(i);
if (window.XMLHttpRequest) request.send(null);
else if (window.ActiveXObject) request.send();
if (!asynchronous) {
if (request.status == 200) return request.responseText;
else return '';
}
return true;
} else {
return false;
}
};
/*
* Wait for the loading process to complete
......
HTMLArea.checkInitialLoad = function() {
var scriptsLoaded = true;
for (var i = HTMLArea._scripts.length; --i >= 0;) {
scriptsLoaded = scriptsLoaded && HTMLArea._scriptLoaded[i];
scriptsLoaded = scriptsLoaded && HTMLArea.scriptLoaded[i];
}
if(HTMLArea.loadTimer) window.clearTimeout(HTMLArea.loadTimer);
if (scriptsLoaded) {
......
HTMLArea._appendToLog("[HTMLArea::init]: Editor url set to: " + _editor_url);
HTMLArea._appendToLog("[HTMLArea::init]: Editor skin CSS set to: " + _editor_CSS);
HTMLArea._appendToLog("[HTMLArea::init]: Editor content skin CSS set to: " + _editor_edited_content_CSS);
if (window.ActiveXObject) {
for (var i = HTMLArea._scripts.length; --i >= 0;) {
HTMLArea._request[i].onreadystatechange = new Function();
HTMLArea._request[i] = null;
}
}
} else {
HTMLArea.loadTimer = window.setTimeout("HTMLArea.checkInitialLoad();", 200);
return false;
......
HTMLArea.init = function() {
HTMLArea._eventCache = HTMLArea._eventCacheConstructor();
if (window.XMLHttpRequest || window.ActiveXObject) {
try {
var success = true;
for (var i = HTMLArea._scripts.length; --i >= 0 && success;) success = success && HTMLArea._getScript(i);
} catch (e) {
HTMLArea._appendToLog("ERROR [HTMLArea::init]: Unable to use XMLHttpRequest: "+ e);
for (var i = HTMLArea._scripts.length; --i >= 0;) {
HTMLArea._getScript(i);
}
if (success) {
HTMLArea.checkInitialLoad();
} else {
if (HTMLArea.is_ie) window.setTimeout('if (window.document.getElementById("pleasewait1")) { window.document.getElementById("pleasewait1").innerHTML = HTMLArea.I18N.msg["ActiveX-required"]; } else { alert(HTMLArea.I18N.msg["ActiveX-required"]); };', 200);
}
HTMLArea.checkInitialLoad();
} else {
if (HTMLArea.is_ie) alert(HTMLArea.I18N.msg["ActiveX-required"]);
if (HTMLArea.is_ie) {
HTMLArea._appendToLog("ERROR [HTMLArea::init]: " + HTMLArea.I18N.msg["ActiveX-required"]);
alert(HTMLArea.I18N.msg["ActiveX-required"]);
}
}
};
......
return (function(editor, buttonId) {
self[functionName](editor, buttonId);});
},
/**
* Localize a string
*
......
},
/**
* Load a Javascript file synchronously
*
* @param string url: url of the file to load
*
* @return boolean true on success
*/
getJavascriptFile : function (url) {
return HTMLArea._getScript(0, false, url);
},
/**
* Append an entry at the end of the troubleshooting log
*
* @param string functionName: the name of the plugin function writing to the log
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineCSS/inlinecss.js (working copy)
generate : function(editor) {
var obj = editor.config.customSelects["InlineCSS-class"];
var classesUrl = obj["classesUrl"];
if (classesUrl && typeof(HTMLArea.classesLabels) == "undefined") {
var classesData = HTMLArea._getScript(0, false, classesUrl);
if (classesData) {
eval(classesData);
}
if (classesUrl && typeof(HTMLArea.classesLabels) === "undefined") {
this.getJavascriptFile(classesUrl);
}
// Let us load the style sheets
if (obj.loaded) {
(1-1/2)