0
1
Fork 0
hedera-web-mindshore/js/hedera/report.js

58 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
2017-04-05 14:06:07 +00:00
,activate: function ()
{
this.renderReport ();
}
2017-04-08 11:42:27 +00:00
,open: function (hash, body)
{
2017-04-08 11:42:27 +00:00
this.hash = hash;
2017-03-23 16:20:51 +00:00
this.body = body;
2017-03-30 11:44:53 +00:00
this.reportWindow = body.ownerDocument.defaultView;
2017-04-08 11:42:27 +00:00
this.activate (hash, body);
}
2017-03-30 11:44:53 +00:00
2017-04-08 11:42:27 +00:00
,openIframe: function (hash)
2015-08-17 18:02:14 +00:00
{
2017-04-08 11:42:27 +00:00
this.hash = hash;
2017-03-30 11:44:53 +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';
2017-03-30 11:44:53 +00:00
this.doc.body.appendChild (iframe);
2017-03-23 16:20:51 +00:00
2017-03-30 11:44:53 +00:00
this.reportWindow = iframe.contentWindow;
this.reportWindow.addEventListener ('load',
this._onWindowLoad.bind (this));
2017-03-23 16:20:51 +00:00
2015-11-19 13:57:23 +00:00
return true;
}
,_onWindowLoad: function ()
{
2017-03-30 11:44:53 +00:00
this.body = this.reportWindow.document.body;
this.renderReport ();
}
,print: function ()
{
this.reportWindow.print ();
2015-11-19 13:57:23 +00:00
}
2017-03-30 11:44:53 +00:00
,renderReport: function ()
2015-11-19 13:57:23 +00:00
{
var builder = new Vn.Builder ();
builder.signalData = this;
2017-04-08 11:42:27 +00:00
builder.add ('hash', this.hash);
2015-11-19 13:57:23 +00:00
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
}
});