forked from verdnatura/hedera-web
58 lines
1.1 KiB
JavaScript
58 lines
1.1 KiB
JavaScript
|
|
module.exports = new Class
|
|
({
|
|
Extends: Htk.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.signalData = this;
|
|
builder.add ('hash', this.hash);
|
|
builder.add ('conn', this.conn);
|
|
builder.loadXml ('reports/'+ this.info.path +'/ui.xml');
|
|
|
|
var res = this.builderResultInit (builder);
|
|
this.body.appendChild (res.$('report'));
|
|
}
|
|
});
|