From 56b7511975277c8921cc19bdf421caac4e04b932 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 20 Sep 2006 22:09:41 +0000 Subject: [PATCH] more grunt work git-svn-id: svn://svn.open-ils.org/ILS/trunk@6170 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/reports/oils_rpt.css | 16 ++++++++++++- Open-ILS/web/reports/oils_rpt.js | 25 +++++++------------- Open-ILS/web/reports/oils_rpt_builder.js | 36 ++++++++++++++++++++++++----- Open-ILS/web/reports/oils_rpt_builder.xhtml | 13 +++++++---- Open-ILS/web/reports/oils_rpt_tree.js | 10 ++++---- Open-ILS/web/reports/oils_rpt_utils.js | 5 ++++ Open-ILS/web/reports/oils_rpt_vars.js | 3 +++ 7 files changed, 75 insertions(+), 33 deletions(-) diff --git a/Open-ILS/web/reports/oils_rpt.css b/Open-ILS/web/reports/oils_rpt.css index 84e87c9822..e202ea980d 100644 --- a/Open-ILS/web/reports/oils_rpt.css +++ b/Open-ILS/web/reports/oils_rpt.css @@ -2,6 +2,19 @@ body { font-size: 9pt; } .hide_me { display: none; visibility: hidden; } .welcome_box { position:absolute; top: 5px; right: 5px; } + +.oils_rpt_main_link { + padding: 5px; + font-size: 10pt; +} + +#oils_rpt_name_div { + vertical-align: middle; + padding: 5px; + background: #E0F0F0; + margin-bottom: 20px; +} + #oils_rpt_table { width: 100%; border-top: 2px solid #E0E0E0; @@ -36,7 +49,8 @@ body { font-size: 9pt; } .oils_rpt_info_selector { border: 1px solid blue; - background: #E0F0E0; + /*background: #E0F0E0;*/ + background: #E0F0F0; min-height: 130px; max-height: 240px; overflow: scroll; diff --git a/Open-ILS/web/reports/oils_rpt.js b/Open-ILS/web/reports/oils_rpt.js index 5c6b692fbb..bdce9bf4a5 100644 --- a/Open-ILS/web/reports/oils_rpt.js +++ b/Open-ILS/web/reports/oils_rpt.js @@ -1,9 +1,5 @@ function oilsInitReports() { - oilsRpt = new oilsReport(); - oilsRptDisplaySelector = $('oils_rpt_display_selector'); - oilsRptFilterSelector = $('oils_rpt_filter_selector'); - /* tell FF to capture mouse movements */ document.captureEvents(Event.MOUSEMOVE); document.onmousemove = setMousePos; @@ -12,18 +8,10 @@ function oilsInitReports() { fetchUser(cgi.param('ses')); $('oils_rpt_user').appendChild(text(USER.usrname())); oilsRptDebugEnabled = cgi.param('dbg'); - - oilsDrawRptTree( - function() { - hideMe($('oils_rpt_tree_loading')); - unHideMe($('oils_rpt_table')); - } - ); - } function oilsCleanupReports() { - if(oilsRptDebugWindow) oilsRptDebugWindow.close(); + try {oilsRptDebugWindow.close();} catch(e) {} } @@ -31,10 +19,13 @@ function oilsCleanupReports() { Define the report object --------------------------------------------------------------------- */ function oilsReport() { - this.select = []; - this.from = {}; - this.where = []; - this.params = {}; + this.def = { + select : [], + from : {}, + where : [] + }; + this.params = {}; + this.name = "" } oilsReport.prototype.toString = function() { diff --git a/Open-ILS/web/reports/oils_rpt_builder.js b/Open-ILS/web/reports/oils_rpt_builder.js index d6942cb422..3ce92b4f80 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.js +++ b/Open-ILS/web/reports/oils_rpt_builder.js @@ -1,3 +1,18 @@ +function oilsInitReportBuilder() { + oilsInitReports(); + oilsRpt = new oilsReport(); + oilsRptDisplaySelector = $('oils_rpt_display_selector'); + oilsRptFilterSelector = $('oils_rpt_filter_selector'); + oilsDrawRptTree( + function() { + hideMe($('oils_rpt_tree_loading')); + unHideMe($('oils_rpt_table')); + } + ); +} + + + function oilsRptSplitPath(path) { var parts = path.split(/-/); var column = parts.pop(); @@ -30,7 +45,9 @@ function oilsAddRptDisplayItem(val, name) { /* add the selected columns to the report output */ var splitp = oilsRptSplitPath(val); name = (name) ? name : splitp[1]; - oilsRpt.select.push( {relation:splitp[0], column:splitp[1], alias:name} ); + var param = oilsRptNextParam(); + oilsRpt.def.select.push( {relation:splitp[0], column:splitp[1], alias:param} ); + oilsRpt.params[param] = name; oilsRptDebug(); } @@ -44,18 +61,21 @@ function oilsDelSelectedDisplayItems() { var list = oilsDelSelectedItems(oilsRptDisplaySelector); /* remove the de-selected columns from the report output */ - oilsRpt.select = grep( oilsRpt.select, + oilsRpt.def.select = grep( oilsRpt.def.select, function(i) { for( var j = 0; j < list.length; j++ ) { var d = list[j]; var arr = oilsRptSplitPath(d); - _debug(arr); - if( arr[0] == i.relation && arr[1] == i.column ) return false; + if( arr[0] == i.relation && arr[1] == i.column ) { + var param = (i.alias) ? i.alias.match(/::PARAM\d*/) : null; + if( param ) delete oilsRpt.params[param]; + return false; + } } return true; } ); - if(!oilsRpt.select) oilsRpt.select = []; + if(!oilsRpt.def.select) oilsRpt.def.select = []; oilsRptDebug(); } @@ -118,6 +138,10 @@ function oilsRptHideEditorDivs() { } +/** + This draws the 3-tabbed window containing the transform, + filter, and aggregate filter picker window + */ function oilsRptDrawDataWindow(path) { var parts = path.split(/-/); @@ -140,7 +164,6 @@ function oilsRptDrawDataWindow(path) { /* focus after all the shifting to make sure the div is at least visible */ $('oils_rpt_tform_label_input').focus(); - /* give the tab links behavior */ $('oils_rpt_tform_tab').onclick = function(){oilsRptHideEditorDivs();unHideMe($('oils_rpt_tform_div'))}; @@ -151,6 +174,7 @@ function oilsRptDrawDataWindow(path) { } +/* draws the transform window */ function oilsRptDrawTransformWindow(path, col, cls, field) { appendClear($('oils_rpt_tform_label'), text(oilsRptMakeLabel(path))); $('oils_rpt_tform_label_input').value = oilsRptMakeLabel(path); diff --git a/Open-ILS/web/reports/oils_rpt_builder.xhtml b/Open-ILS/web/reports/oils_rpt_builder.xhtml index 74da54e7fd..afd2af8e0e 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.xhtml +++ b/Open-ILS/web/reports/oils_rpt_builder.xhtml @@ -42,7 +42,7 @@ - +
You are logged in as @@ -56,6 +56,10 @@ +
+ Report Name: + +
@@ -63,12 +67,12 @@
Report Display Items
- +
@@ -86,7 +90,8 @@
-     + +

diff --git a/Open-ILS/web/reports/oils_rpt_tree.js b/Open-ILS/web/reports/oils_rpt_tree.js index bd6c0835d5..b913ceeb8e 100644 --- a/Open-ILS/web/reports/oils_rpt_tree.js +++ b/Open-ILS/web/reports/oils_rpt_tree.js @@ -29,10 +29,10 @@ function oilsParseRptTree(IDL, callback) { var obj = { fields : oilsRptParseFields(node), - table : node.getAttribute('oils_persist:tablename'), name : node.getAttribute('id'), - core : node.getAttribute('reporter:core'), - label : node.getAttribute('reporter:label') + table : node.getAttributeNS(oilsIDLPersistNS, 'tablename'), + core : node.getAttributeNS(oilsIDLReportsNS, 'core'), + label : node.getAttributeNS(oilsIDLReportsNS, 'label') }; if( obj.core == 'true' ) obj.core = true; @@ -65,7 +65,7 @@ function oilsRptParseFields( node ) { var obj = { field : fields[i], name : name, - label : field.getAttribute('reporter:label'), + label : field.getAttributeNS(oilsIDLReportsNS,'label'), type : 'field' } @@ -83,7 +83,7 @@ function oilsRptParseFields( node ) { obj.key = link.getAttribute('key'); obj['class'] = link.getAttribute('class'); } else { - if( fields[i].getAttribute('oils_persist:virtual') == 'true' ) + if( fields[i].getAttributeNS(oilsIDLPersistNS, 'virtual') == 'true' ) continue; } diff --git a/Open-ILS/web/reports/oils_rpt_utils.js b/Open-ILS/web/reports/oils_rpt_utils.js index 9322536324..d5bcb31b90 100644 --- a/Open-ILS/web/reports/oils_rpt_utils.js +++ b/Open-ILS/web/reports/oils_rpt_utils.js @@ -1,8 +1,13 @@ var oilsRptID = 0; +var oilsRptID2 = 0; function oilsNextId() { return 'oils_'+ (oilsRptID++); } +function oilsRptNextParam() { + return '::PARAM'+ (oilsRptID2++); +} + function nodeText(id) { if($(id)) return $(id).innerHTML; diff --git a/Open-ILS/web/reports/oils_rpt_vars.js b/Open-ILS/web/reports/oils_rpt_vars.js index 7e58594417..f4e497988f 100644 --- a/Open-ILS/web/reports/oils_rpt_vars.js +++ b/Open-ILS/web/reports/oils_rpt_vars.js @@ -27,3 +27,6 @@ var oilsMouseX; var oilsMouseY; var oilsPageXMid; var oilsPageYMid; + +var oilsIDLReportsNS = 'http://open-ils.org/spec/opensrf/IDL/reporter/v1'; +var oilsIDLPersistNS = 'http://open-ils.org/spec/opensrf/IDL/persistance/v1'; -- 2.11.0