hedera-web/forms/preview/preview.js

50 lines
793 B
JavaScript

Hedera.Preview = new Class
({
Extends: Hedera.Form
,activate: function ()
{
var reportName = this.hash.get ('report');
if (!reportName)
{
Htk.Toast.showError (_('Report name not set'));
return;
}
this.gui.loaderPush ();
var module = new Hedera.Module ('reports', reportName);
this.reportModule = module;
module.load (this._onReportLoad.bind (this));
}
,deactivate: function ()
{
this.reportModule.unload ();
}
,_onReportLoad: function (module)
{
this.gui.loaderPop ();
if (module.error)
{
Htk.Toast.showError (_('Error loading report'));
return;
}
this.report = new module.klass ({
info: module,
conn: this.conn
});
this.report.open (this.hash, this.node);
}
,onPrintClick: function ()
{
this.report.print ();
}
});