forked from verdnatura/hedera-web
60 lines
1.1 KiB
JavaScript
60 lines
1.1 KiB
JavaScript
|
|
module.exports = new Class
|
|
({
|
|
Extends: Htk.Component
|
|
|
|
,initialize: function (moduleInfo, gui)
|
|
{
|
|
this.info = moduleInfo;
|
|
this.gui = gui;
|
|
this.conn = gui.conn;
|
|
this.parent (null);
|
|
}
|
|
|
|
,open: function (batch, body)
|
|
{
|
|
this.batch = batch;
|
|
this.body = body;
|
|
this.createWindow ();
|
|
}
|
|
|
|
,print: function ()
|
|
{
|
|
this.window.print ();
|
|
}
|
|
|
|
,createWindow: function ()
|
|
{
|
|
var iframe = this.iframe = this.createElement ('iframe');
|
|
iframe.src = 'js/hedera/report.html';
|
|
iframe.style.display = 'none';
|
|
document.body.appendChild (iframe);
|
|
|
|
var reportWindow = iframe.contentWindow;
|
|
|
|
reportWindow.addEventListener ('load',
|
|
this._onWindowLoad.bind (this));
|
|
this.window = reportWindow;
|
|
|
|
return true;
|
|
}
|
|
|
|
,_onWindowLoad: function ()
|
|
{
|
|
this.doc = this.window.document
|
|
this.onWindowCreate ();
|
|
}
|
|
|
|
,onWindowCreate: function ()
|
|
{
|
|
var builder = new Vn.Builder ();
|
|
builder.signalData = this;
|
|
builder.add ('batch', this.batch);
|
|
builder.add ('conn', this.conn);
|
|
builder.loadXml ('reports/'+ this.info.path +'/ui.xml');
|
|
|
|
var res = this.builderResultInit (builder);
|
|
this.body.appendChild (res.$('report'));
|
|
}
|
|
});
|