1 function oilsInitReports() {
4 /* tell FF to capture mouse movements */
5 document.captureEvents(Event.MOUSEMOVE);
6 document.onmousemove = setMousePos;
11 fetchUser(cgi.param('ses'));
12 DOM.oils_rpt_user.appendChild(text(USER.usrname()));
14 fetchHighestPermOrgs(SESSION, USER.id(), ['RUN_REPORTS']);
15 if( PERMS['RUN_REPORTS'] == -1 ) {
16 unHideMe(DOM.oils_rpt_permission_denied);
17 hideMe(DOM.oils_rpt_tree_loading);
21 oilsRptCookie = new HTTP.Cookies();
22 oilsRptCurrentOrg = USER.ws_ou();
23 cookieManager.write(COOKIE_SES, SESSION, -1, '/');
24 cookieManager.write('ws_ou', USER.ws_ou(), -1, '/');
30 hideMe(DOM.oils_rpt_tree_loading);
31 unHideMe(DOM.oils_rpt_folder_table);
39 function oilsRtpInitFolders() {
40 oilsRptCurrentFolderManager =
41 new oilsRptFolderManager(DOM.oils_rpt_folder_tree_div);
42 oilsRptCurrentFolderManager.draw(SESSION);
45 function oilsCleanupReports() {
46 try {oilsRptDebugWindow.close();} catch(e) {}
48 oilsRptObjectCache = null;
49 oilsRptObject.objectCache = null;
55 /* ---------------------------------------------------------------------
56 Define the report object
57 --------------------------------------------------------------------- */
58 function oilsReport(templateObj, reportObj) {
69 this.templateObject = templateObj;
70 this.reportObject = reportObj;
73 this.def = JSON2js(templateObj.data());
74 this.name = templateObj.name();
78 this.params = JSON2js(reportObj.data());
79 if(!this.params) this.params = {};
82 oilsReport.prototype.toString = function() {
83 return formatJSON(js2JSON(this));
86 oilsReport.prototype.toHTMLString = function() {
87 return formatJSONHTML(js2JSON(this));
90 oilsReport.prototype.gatherParams = function() {
91 //if(oilsRptObjectKeys(this.params).length == 0) return;
92 _debug("we have params: " + js2JSON(this.params));
95 this._gatherParams(params, this.def.where, 'where', 'condition');
96 this._gatherParams(params, this.def.having, 'having', 'condition');
100 oilsReport.prototype._gatherParams = function(params, arr, type, field) {
102 for( var i = 0; i < arr.length; i++ ) {
109 /* add select transform support */
111 if( typeof node == 'string' ) {
112 key = node.match(/::.*/);
114 op = oilsRptObjectKeys(node)[0];
115 key = (node[op] +'').match(/::.*/);
119 key = key[0].replace(/::/,'');
120 _debug("key = "+key+", param = " + this.params[key]);
125 value : this.params[key],
129 relation : obj.relation,