2017-03-23 16:20:51 +00:00
|
|
|
|
|
|
|
Hedera.Preview = new Class
|
|
|
|
({
|
|
|
|
Extends: Hedera.Form
|
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
2017-04-05 14:06:07 +00:00
|
|
|
var reportName = this.hash.get ('report');
|
2017-03-23 16:20:51 +00:00
|
|
|
|
|
|
|
if (!reportName)
|
|
|
|
{
|
|
|
|
Htk.Toast.showError (_('Report name not set'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.gui.loaderPush ();
|
|
|
|
|
|
|
|
var module = new Hedera.Module ('reports', reportName);
|
2017-03-30 11:44:53 +00:00
|
|
|
this.reportModule = module;
|
2017-03-23 16:20:51 +00:00
|
|
|
module.load (this._onReportLoad.bind (this));
|
|
|
|
}
|
2017-03-30 11:44:53 +00:00
|
|
|
|
|
|
|
,deactivate: function ()
|
|
|
|
{
|
|
|
|
this.reportModule.unload ();
|
|
|
|
}
|
2017-03-23 16:20:51 +00:00
|
|
|
|
|
|
|
,_onReportLoad: function (module)
|
|
|
|
{
|
|
|
|
this.gui.loaderPop ();
|
|
|
|
|
|
|
|
if (module.error)
|
|
|
|
{
|
|
|
|
Htk.Toast.showError (_('Error loading report'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-30 11:44:53 +00:00
|
|
|
this.report = new module.klass ({
|
|
|
|
info: module,
|
|
|
|
conn: this.conn
|
|
|
|
});
|
2017-04-05 14:06:07 +00:00
|
|
|
this.report.open (this.hash, this.node);
|
2017-03-23 16:20:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,onPrintClick: function ()
|
|
|
|
{
|
2017-03-30 11:44:53 +00:00
|
|
|
this.report.print ();
|
2017-03-23 16:20:51 +00:00
|
|
|
}
|
|
|
|
});
|