mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged 3.1 to HEAD
13275: updated web-client to use tinymce v3 13276: overlay display fix for when field has large content git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13585 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
126
source/web/scripts/tiny_mce/classes/xml/Parser.js
vendored
Executable file
126
source/web/scripts/tiny_mce/classes/xml/Parser.js
vendored
Executable file
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
* $Id: Parser.js 834 2008-05-05 12:47:42Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
/**
|
||||
* XML Parser class. This class is only available for the dev version of TinyMCE.
|
||||
*/
|
||||
tinymce.create('tinymce.xml.Parser', {
|
||||
/**
|
||||
* Constucts a new XML parser instance.
|
||||
*
|
||||
* @param {Object} Optional settings object.
|
||||
*/
|
||||
Parser : function(s) {
|
||||
this.settings = tinymce.extend({
|
||||
async : true
|
||||
}, s);
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses the specified document and executed the callback ones it's parsed.
|
||||
*
|
||||
* @param {String} u URL to XML file to parse.
|
||||
* @param {function} cb Optional callback to execute ones the XML file is loaded.
|
||||
* @param {Object} s Optional scope for the callback execution.
|
||||
*/
|
||||
load : function(u, cb, s) {
|
||||
var doc, t, w = window, c = 0;
|
||||
|
||||
s = s || this;
|
||||
|
||||
// Explorer, use XMLDOM since it can be used on local fs
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject("Microsoft.XMLDOM");
|
||||
doc.async = this.settings.async;
|
||||
|
||||
// Wait for response
|
||||
if (doc.async) {
|
||||
function check() {
|
||||
if (doc.readyState == 4 || c++ > 10000)
|
||||
return cb.call(s, doc);
|
||||
|
||||
w.setTimeout(check, 10);
|
||||
};
|
||||
|
||||
t = w.setTimeout(check, 10);
|
||||
}
|
||||
|
||||
doc.load(u);
|
||||
|
||||
if (!doc.async)
|
||||
cb.call(s, doc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// W3C using XMLHttpRequest
|
||||
if (window.XMLHttpRequest) {
|
||||
try {
|
||||
doc = new window.XMLHttpRequest();
|
||||
doc.open('GET', u, this.settings.async);
|
||||
doc.async = this.settings.async;
|
||||
|
||||
doc.onload = function() {
|
||||
cb.call(s, doc.responseXML);
|
||||
};
|
||||
|
||||
doc.send('');
|
||||
} catch (ex) {
|
||||
cb.call(s, null, ex);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses the specified XML string.
|
||||
*
|
||||
* @param {String} xml XML String to parse.
|
||||
* @return {Document} XML Document instance.
|
||||
*/
|
||||
loadXML : function(xml) {
|
||||
var doc;
|
||||
|
||||
// W3C
|
||||
if (window.DOMParser)
|
||||
return new DOMParser().parseFromString(xml, "text/xml");
|
||||
|
||||
// Explorer
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject("Microsoft.XMLDOM");
|
||||
doc.async = "false";
|
||||
doc.loadXML(xml);
|
||||
|
||||
return doc;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all string contents of a element concated together.
|
||||
*
|
||||
* @param {XMLNode} el XML element to retrive text from.
|
||||
* @return {string} XML element text contents.
|
||||
*/
|
||||
getText : function(el) {
|
||||
var o = '';
|
||||
|
||||
if (!el)
|
||||
return '';
|
||||
|
||||
if (el.hasChildNodes()) {
|
||||
el = el.firstChild;
|
||||
|
||||
do {
|
||||
if (el.nodeType == 3 || el.nodeType == 4)
|
||||
o += el.nodeValue;
|
||||
} while(el = el.nextSibling);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
});
|
||||
})();
|
Reference in New Issue
Block a user