|
Timeplot.DefaultEventSource.prototype.loadXML = function(inxml, url, xsl_url) { |
|
var xhttp=new XMLHttpRequest(); |
|
xhttp.open("GET", xsl_url,false); |
|
xhttp.send(null); |
|
var xsl = xhttp.responseXML; |
|
|
|
xsltProcessor=new XSLTProcessor(); |
|
xsltProcessor.importStylesheet(xsl); |
|
xml = xsltProcessor.transformToDocument(inxml); |
|
|
|
var base = this._getBaseURL(url); |
|
|
|
var wikiURL = xml.documentElement.getAttribute("wiki-url"); |
|
var wikiSection = xml.documentElement.getAttribute("wiki-section"); |
|
|
|
var dateTimeFormat = xml.documentElement.getAttribute("date-time-format"); |
|
var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); |
|
|
|
var node = xml.documentElement.firstChild; |
|
var added = false; |
|
while (node != null) { |
|
if (node.nodeType == 1) { |
|
var description = ""; |
|
if (node.firstChild != null && node.firstChild.nodeType == 3) { |
|
description = node.firstChild.nodeValue; |
|
} |
|
// instant event: default is true. Or use values from isDuration or durationEvent |
|
var instant = (node.getAttribute("isDuration") === null && |
|
node.getAttribute("durationEvent") === null) || |
|
node.getAttribute("isDuration") == "false" || |
|
node.getAttribute("durationEvent") == "false"; |
|
|
|
var evt = new Timeline.DefaultEventSource.Event( { |
|
id: node.getAttribute("id"), |
|
start: parseDateTimeFunction(node.getAttribute("start")), |
|
end: parseDateTimeFunction(node.getAttribute("end")), |
|
latestStart: parseDateTimeFunction(node.getAttribute("latestStart")), |
|
earliestEnd: parseDateTimeFunction(node.getAttribute("earliestEnd")), |
|
instant: instant, |
|
text: node.getAttribute("title"), |
|
description: description, |
|
image: this._resolveRelativeURL(node.getAttribute("image"), base), |
|
link: this._resolveRelativeURL(node.getAttribute("link") , base), |
|
icon: this._resolveRelativeURL(node.getAttribute("icon") , base), |
|
color: node.getAttribute("color"), |
|
textColor: node.getAttribute("textColor"), |
|
hoverText: node.getAttribute("hoverText"), |
|
classname: node.getAttribute("classname"), |
|
tapeImage: node.getAttribute("tapeImage"), |
|
tapeRepeat: node.getAttribute("tapeRepeat"), |
|
caption: node.getAttribute("caption"), |
|
eventID: node.getAttribute("eventID"), |
|
trackNum: node.getAttribute("trackNum") |
|
}); |
|
|
|
evt._node = node; |
|
evt.getProperty = function(name) { |
|
return this._node.getAttribute(name); |
|
}; |
|
evt.setWikiInfo(wikiURL, wikiSection); |
|
|
|
this._events.add(evt); |
|
|
|
added = true; |
|
} |
|
node = node.nextSibling; |
|
} |
|
|
|
|
|
if (added) { |
|
this._fire("onAddMany", []); |
|
} |
|
} |