44 lines
744 B
JavaScript
44 lines
744 B
JavaScript
|
|
Hedera.Preview = new Class
|
|
({
|
|
Extends: Hedera.Form
|
|
|
|
,activate: function ()
|
|
{
|
|
var reportName = Vn.Hash.get ('report');
|
|
|
|
if (!reportName)
|
|
{
|
|
Htk.Toast.showError (_('Report name not set'));
|
|
return;
|
|
}
|
|
|
|
this.gui.loaderPush ();
|
|
|
|
var module = new Hedera.Module ('reports', reportName);
|
|
module.load (this._onReportLoad.bind (this));
|
|
}
|
|
|
|
,_onReportLoad: function (module)
|
|
{
|
|
this.gui.loaderPop ();
|
|
|
|
if (module.error)
|
|
{
|
|
Htk.Toast.showError (_('Error loading report'));
|
|
return;
|
|
}
|
|
|
|
var batch = new Sql.Batch ();
|
|
batch.addValues (Vn.Hash._hashMap);
|
|
|
|
var report = new module.klass (module, this.gui);
|
|
report.open (batch, this.node);
|
|
}
|
|
|
|
,onPrintClick: function ()
|
|
{
|
|
this.doc.defaultView.print ();
|
|
}
|
|
});
|