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

134 lines
3.1 KiB
JavaScript
Executable File

Vn.Report = new Class
({
Extends: Vn.Object
<<<<<<< HEAD
,open: function () {}
=======
,initialize: function (moduleInfo, gui)
{
this.info = moduleInfo;
this.gui = gui;
this.conn = gui.conn;
this.parent (null);
}
/**
* 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.builderResult)
return this.builderResult.getById (objectId);
return null;
}
,open: function (batch)
{
this.batch = batch;
this.createWindow ();
}
>>>>>>> 5f64002b1d4eebc7fcfd7ff1916d7658fbaf57fb
,print: function ()
{
this.window.print ();
}
,includeCss: function (path)
{
var basePath = location.protocol +'//'+ location.host;
basePath += location.port ? ':'+ location.port : '';
basePath += location.pathname.substring (0,
location.pathname.lastIndexOf ('/'));
var link = this.doc.createElement ('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = basePath +'/'+ path + Vn.getVersion ();
var head = this.doc.getElementsByTagName ('head')[0];
head.appendChild (link);
}
<<<<<<< HEAD
,createWindow: function (reportPath)
{
var reportWindow = window.open (''/*'js/hedera/report.html'*/, '_blank'/*reportPath*/,
'resizable=yes,height=900,width=900,scrollbars=yes,menubar=true');
=======
,createWindow: function ()
{
var reportWindow = window.open (
'js/hedera/report.html', '_blank',
'height=650, width=950, resizable=yes, fullscreen=no,'+
'titlebar=no, menubar=no, toolbar=no, location=no, scrollbars=yes'
);
>>>>>>> 5f64002b1d4eebc7fcfd7ff1916d7658fbaf57fb
if (!reportWindow)
{
Htk.Toast.showError (
_('Please unlock popups and try again'));
<<<<<<< HEAD
return null;
}
this.window = reportWindow;
this.doc = reportWindow.document
this.includeCss ('js/hedera/report.css');
this.includeCss ('reports/'+ reportPath +'/style.css');
var printButton = this.doc.createElement ('button');
printButton.className = 'print-button';
printButton.appendChild (this.doc.createTextNode (_('Print')));
printButton.addEventListener ('click', this.print.bind (this));
this.doc.body.appendChild (printButton);
return reportWindow;
=======
return false;
}
reportWindow.addEventListener ('load',
this._onWindowLoad.bind (this));
this.window = reportWindow;
return true;
}
,_onWindowLoad: function ()
{
this.doc = this.window.document
this.includeCss ('reports/'+ this.info.path +'/style.css');
var printButton = this.doc.getElementById ('print');
printButton.addEventListener ('click', this.print.bind (this));
Vn.Node.setText (printButton, _('Print'));
this.onWindowCreate ();
}
,onWindowCreate: function ()
{
var builder = new Vn.Builder ();
builder.signalData = this;
builder.add ('batch', this.batch);
builder.add ('conn', this.conn);
builder.loadXml ('reports/'+ this.info.path +'/ui.xml');
var res = this.builderResult = builder.load ();
res.link ();
this.doc.body.appendChild (res.$('report'));
>>>>>>> 5f64002b1d4eebc7fcfd7ff1916d7658fbaf57fb
}
});