1 function oilsInitReports() {
4 /* tell FF to capture mouse movements */
5 document.captureEvents(Event.MOUSEMOVE);
6 document.onmousemove = setMousePos;
9 fetchUser(cgi.param('ses'));
10 DOM.oils_rpt_user.appendChild(text(USER.usrname()));
11 oilsRptDebugEnabled = cgi.param('dbg');
14 function oilsRtpInitFolders() {
15 oilsRptCurrentFolderManager =
16 new oilsRptFolderManager(DOM.oils_rpt_folder_tree_div);
17 oilsRptCurrentFolderManager.draw(SESSION);
20 function oilsCleanupReports() {
21 try {oilsRptDebugWindow.close();} catch(e) {}
28 /* ---------------------------------------------------------------------
29 Define the report object
30 --------------------------------------------------------------------- */
31 function oilsReport(templateObj, reportObj) {
42 this.templateObject = templateObj;
43 this.reportObject = reportObj;
46 this.def = JSON2js(templateObj.data());
47 this.name = templateObj.name();
51 this.params = JSON2js(reportObj.data());
54 oilsReport.prototype.toString = function() {
55 return formatJSON(js2JSON(this));
58 oilsReport.prototype.toHTMLString = function() {
59 return formatJSONHTML(js2JSON(this));
62 oilsReport.prototype.gatherParams = function() {
63 if(oilsRptObjectKeys(this.params).length == 0) return;
65 _debug("we have params: " + js2JSON(this.params));
68 this._gatherParams(params, this.def.select, 'select', 'alias');
69 this._gatherParams(params, this.def.where, 'where', 'condition');
70 this._gatherParams(params, this.def.having, 'having', 'condition');
74 oilsReport.prototype._gatherParams = function(params, arr, type, field) {
76 for( var i = 0; i < arr.length; i++ ) {
83 if( typeof node == 'string' ) {
84 key = node.match(/::.*/);
86 op = oilsRptObjectKeys(node)[0];
87 key = (node[op] +'').match(/::.*/);
91 key = key[0].replace(/::/,'');
92 _debug("key = "+key+", param = " + this.params[key]);
97 value : this.params[key],
100 relation : obj.relation