forked from verdnatura/hedera-web
59 lines
1.1 KiB
JavaScript
59 lines
1.1 KiB
JavaScript
|
|
module.exports = new Class
|
|
({
|
|
Extends: Vn.Component
|
|
|
|
,activate: function ()
|
|
{
|
|
this.renderReport ();
|
|
}
|
|
|
|
,open: function (hash, body)
|
|
{
|
|
this.hash = hash;
|
|
this.body = body;
|
|
this.reportWindow = body.ownerDocument.defaultView;
|
|
this.activate (hash, body);
|
|
}
|
|
|
|
,openIframe: function (hash)
|
|
{
|
|
this.hash = hash;
|
|
|
|
var iframe = this.iframe = this.createElement ('iframe');
|
|
iframe.src = 'js/hedera/report.html';
|
|
iframe.style.display = 'none';
|
|
this.doc.body.appendChild (iframe);
|
|
|
|
this.reportWindow = iframe.contentWindow;
|
|
this.reportWindow.addEventListener ('load',
|
|
this._onWindowLoad.bind (this));
|
|
|
|
return true;
|
|
}
|
|
|
|
,_onWindowLoad: function ()
|
|
{
|
|
this.body = this.reportWindow.document.body;
|
|
this.renderReport ();
|
|
}
|
|
|
|
,print: function ()
|
|
{
|
|
this.reportWindow.print ();
|
|
}
|
|
|
|
,renderReport: function ()
|
|
{
|
|
var builder = new Vn.Builder ();
|
|
builder.compileFile ('reports/'+ this.info.path +'/ui.xml');
|
|
|
|
var extraObjects = {
|
|
conn: this.conn,
|
|
hash: this.hash
|
|
};
|
|
this.loadScope (builder, null, extraObjects);
|
|
this.body.appendChild (this.$.report);
|
|
}
|
|
});
|