hedera-web/js/hedera/report.js

60 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-10-21 23:34:35 +00:00
2016-09-26 09:28:47 +00:00
module.exports = new Class
2015-10-21 23:34:35 +00:00
({
2017-03-23 16:20:51 +00:00
Extends: Htk.Component
2015-10-21 23:34:35 +00:00
,initialize: function (moduleInfo, gui)
{
this.info = moduleInfo;
this.gui = gui;
this.conn = gui.conn;
this.parent (null);
}
2017-03-23 16:20:51 +00:00
,open: function (batch, body)
{
this.batch = batch;
2017-03-23 16:20:51 +00:00
this.body = body;
2015-11-19 13:57:23 +00:00
this.createWindow ();
}
2015-10-21 23:34:35 +00:00
,print: function ()
{
this.window.print ();
}
2015-11-19 13:57:23 +00:00
,createWindow: function ()
2015-08-17 18:02:14 +00:00
{
2017-03-23 16:20:51 +00:00
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;
2015-11-19 13:57:23 +00:00
reportWindow.addEventListener ('load',
this._onWindowLoad.bind (this));
2015-10-21 23:42:52 +00:00
this.window = reportWindow;
2017-03-23 16:20:51 +00:00
2015-11-19 13:57:23 +00:00
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');
2017-03-23 16:20:51 +00:00
var res = this.builderResultInit (builder);
this.body.appendChild (res.$('report'));
2015-10-21 23:34:35 +00:00
}
});