WidgetBaseXSL.js
Summary
No overview generated for 'WidgetBaseXSL.js'
mapbuilder.loadScript(baseDir+"/widget/WidgetBase.js");
function WidgetBaseXSL(widgetNode,model) {
WidgetBase.apply(this, new Array(widgetNode, model));
if ( !this.stylesheet ) {
this.stylesheet = new XslProcessor(this.getProperty("mb:stylesheet", baseDir+"/widget/"+widgetNode.nodeName+".xsl", model.namespace));
}
this.parseHTMLNodes = Mapbuilder.parseBoolean(this.getProperty("mb:parseHTMLNodes", false));
if (config.widgetText) {
var textNodeXpath = "/mb:WidgetText/mb:widgets/mb:" + widgetNode.nodeName;
var textParams = config.widgetText.selectNodes(textNodeXpath+"/*");
for (var j=0;j<textParams.length;j++) {
this.stylesheet.setParameter(textParams[j].nodeName,getNodeValue(textParams[j]));
}
}
for (var j=0;j<widgetNode.childNodes.length;j++) {
if (widgetNode.childNodes[j].firstChild)
{
this.stylesheet.setParameter(
widgetNode.childNodes[j].nodeName, widgetNode.childNodes[j].firstChild.nodeValue);
}
}
this.stylesheet.setParameter("modelId", this.model.id );
this.stylesheet.setParameter("modelTitle", this.model.title );
this.stylesheet.setParameter("widgetId", this.id );
this.stylesheet.setParameter("skinDir", config.skinDir );
this.stylesheet.setParameter("lang", config.lang );
this.paint = function(objRef, refreshId) {
if (refreshId && (refreshId!=objRef.id)) return;
if (objRef.model.doc && objRef.getNode()) {
objRef.stylesheet.setParameter("modelUrl", objRef.model.url);
objRef.stylesheet.setParameter("targetModelId", objRef.targetModel.id );
objRef.resultDoc = objRef.model.doc; // resultDoc sometimes modified by prePaint()
objRef.model.setParam("prePaint", objRef);
objRef.prePaint(objRef);
if (objRef.debug) mbDebugMessage(objRef, "prepaint:"+(new XMLSerializer()).serializeToString(objRef.resultDoc));
if (objRef.debug) mbDebugMessage(objRef, "stylesheet:"+(new XMLSerializer()).serializeToString(objRef.stylesheet.xslDom));
var outputNode = document.getElementById( objRef.outputNodeId );
var tempNode = document.createElement("DIV");
var s = objRef.stylesheet.transformNodeToString(objRef.resultDoc);
if (config.serializeUrl && objRef.debug) postLoad(config.serializeUrl, s);
if (objRef.debug) mbDebugMessage(objRef, "painting:"+objRef.id+":"+s);
tempNode.innerHTML = objRef.parseHTMLNodes ? Sarissa.unescape(s) : s;
if( tempNode.firstChild != null ) { //Could be null!
tempNode.firstChild.setAttribute("id", objRef.outputNodeId);
if (outputNode) {
objRef.getNode().replaceChild(tempNode.firstChild,outputNode);
} else {
objRef.getNode().appendChild(tempNode.firstChild);
}
}
objRef.postPaint(objRef);
objRef.model.setParam("postPaint", objRef);
}
}
this.model.addListener("refresh",this.paint, this);
}
Documentation generated by
JSDoc on Sun Apr 27 20:30:54 2008