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()));
12 fetchHighestPermOrgs(SESSION, USER.id(), ['RUN_REPORTS']);
13 if( PERMS['RUN_REPORTS'] == -1 ) {
14 unHideMe(DOM.oils_rpt_permission_denied);
15 hideMe(DOM.oils_rpt_tree_loading);
19 oilsRptCookie = new HTTP.Cookies();
20 oilsRptCurrentOrg = USER.ws_ou();
21 cookieManager.write(COOKIE_SES, SESSION, -1, '/');
22 cookieManager.write('ws_ou', USER.ws_ou(), -1, '/');
28 hideMe(DOM.oils_rpt_tree_loading);
29 unHideMe(DOM.oils_rpt_folder_table);
37 function oilsRtpInitFolders() {
38 oilsRptCurrentFolderManager =
39 new oilsRptFolderManager(DOM.oils_rpt_folder_tree_div);
40 oilsRptCurrentFolderManager.draw(SESSION);
43 function oilsCleanupReports() {
44 try {oilsRptDebugWindow.close();} catch(e) {}
46 oilsRptObjectCache = null;
47 oilsRptObject.objectCache = null;
53 /* ---------------------------------------------------------------------
54 Define the report object
55 --------------------------------------------------------------------- */
56 function oilsReport(templateObj, reportObj) {
67 this.templateObject = templateObj;
68 this.reportObject = reportObj;
71 this.def = JSON2js(templateObj.data());
72 this.name = templateObj.name();
76 this.params = JSON2js(reportObj.data());
77 if(!this.params) this.params = {};
80 oilsReport.prototype.toString = function() {
81 return formatJSON(js2JSON(this));
84 oilsReport.prototype.toHTMLString = function() {
85 return formatJSONHTML(js2JSON(this));
88 oilsReport.prototype.gatherParams = function() {
89 //if(oilsRptObjectKeys(this.params).length == 0) return;
90 _debug("we have params: " + js2JSON(this.params));
93 this._gatherParams(params, this.def.where, 'where', 'condition');
94 this._gatherParams(params, this.def.having, 'having', 'condition');
98 oilsReport.prototype._gatherParams = function(params, arr, type, field) {
100 for( var i = 0; i < arr.length; i++ ) {
107 /* add select transform support */
109 if( typeof node == 'string' ) {
110 key = node.match(/::.*/);
112 op = oilsRptObjectKeys(node)[0];
113 key = (node[op] +'').match(/::.*/);
117 key = key[0].replace(/::/,'');
118 _debug("key = "+key+", param = " + this.params[key]);
123 value : this.params[key],
126 relation : obj.relation,