hedera-web/web/js/hedera/report.js

86 lines
1.6 KiB
JavaScript
Executable File

Vn.Report = new Class
({
Extends: Vn.Object
,initialize: function (props)
{
this.parent (props);
this.open ();
}
,showWindow: function ()
{
var reportWindow = window.open ('js/hedera/report.html', reportPath,
'resizable=yes,height=600,width=750,scrollbars=yes,menubar=no');
//report.print ();
Vn.includeCss ('reports/'+ reportPath +'/style.css');
window.document.body.appendChild (this.node);
var report = new Vn.Report (reportWindow.document.body);
return reportWindow;
}
/**
* Gets an object from the builder associated to this report.
*
* @param {string} objectId The object identifier
* @return {Object} The object, or %null if not found
**/
,$: function (objectId)
{
if (this.builder)
return this.builder.get (objectId);
return null;
}
/**
* Called when the form is opened.
**/
,open: function ()
{
this.builder = new Vn.Builder ();
this.builder.signalData = this;
this.builder.loadXml (Vn.getXml ('reports/'+ this.reportPath +'/report.xml'));
this.node = this.builder.get ('form');
var models = this.builder.getObjects ('db-model');
for (var i = 0; i < models.length; i++)
models[i].conn = this.conn;
var queries = this.builder.getObjects ('db-query');
for (var i = 0; i < queries.length; i++)
queries[i].conn = this.conn;
}
/**
* Called when the form is activated.
**/
,activate: function () {}
/**
* Called when the form is deactivated.
**/
,deactivate: function () {}
/**
* Called when the form is closed.
**/
,close: function ()
{
this.builder.unref ();
this.builder = null;
}
,_destroy: function ()
{
this.close ();
this.parent ();
}
});