From d32e88b31af9484ae37c1b43504b2070159fe089 Mon Sep 17 00:00:00 2001 From: miker Date: Sat, 30 Sep 2006 00:19:13 +0000 Subject: [PATCH] tranform and ui updates git-svn-id: svn://svn.open-ils.org/ILS/trunk@6276 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/reports/oils_rpt_builder.js | 123 ++++++++++++++++++++++++++-- Open-ILS/web/reports/oils_rpt_builder.xhtml | 5 ++ Open-ILS/web/reports/oils_rpt_tforms.xhtml | 34 ++++++-- Open-ILS/web/reports/oils_rpt_vars.js | 6 ++ 4 files changed, 155 insertions(+), 13 deletions(-) diff --git a/Open-ILS/web/reports/oils_rpt_builder.js b/Open-ILS/web/reports/oils_rpt_builder.js index 9cffb3183e..b5a32bf989 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.js +++ b/Open-ILS/web/reports/oils_rpt_builder.js @@ -21,8 +21,10 @@ function oilsReportBuilderReset() { oilsRpt.name = n; oilsRptDisplaySelector = DOM.oils_rpt_display_selector; oilsRptFilterSelector = DOM.oils_rpt_filter_selector; + oilsRptAggFilterSelector= DOM.oils_rpt_agg_filter_selector; removeChildren(oilsRptDisplaySelector); removeChildren(oilsRptFilterSelector); + removeChildren(oilsRptAggFilterSelector); oilsRptDebug(); oilsRptResetParams(); } @@ -174,11 +176,15 @@ function oilsDelSelectedDisplayItems() { } else { for( var j = 0; j < list.length; j++ ) - /* if there are no items left in the "select" clause for the given - relation, trim this relation from the "from" clause */ - if(!grep(oilsRpt.def.select, - function(i){ return (i.relation == oilsRptPathRel(list[j])); })) - oilsRptPruneFromClause(oilsRptPathRel(list[j])); + /* if there are no items left in the "select", "where", or "having" clauses + for the given relation, trim this relation from the "from" clause */ + if( !grep(oilsRpt.def.select, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + && !grep(oilsRpt.def.where, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + && !grep(oilsRpt.def.having, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + ) oilsRptPruneFromClause(oilsRptPathRel(list[j])); } oilsRptDebug(); @@ -229,7 +235,112 @@ function oilsDelFilterItem(val) { /* removes selected items from the display window */ function oilsDelSelectedFilterItems() { - oilsDelSelectedItems(oilsRptFilterSelector); + var list = oilsDelSelectedItems(oilsRptFilterSelector); + + /* remove the de-selected columns from the report output */ + oilsRpt.def.where = grep( oilsRpt.def.where, + function(i) { + for( var j = 0; j < list.length; j++ ) { + var d = list[j]; + var col = i.column; + + /* if this columsn has a transform, + it will be an object { tform => column } */ + if( typeof col != 'string' ) + for( var c in col ) col = col[c]; + + /* if this transform requires params, the column + will be the first item in the param set array */ + if( typeof col != 'string' ) col = col[0]; + + if( oilsRptPathRel(d) == i.relation && oilsRptPathCol(d) == col ) { + var param = (i.alias) ? i.alias.match(/::PARAM\d*/) : null; + if( param ) delete oilsRpt.params[param]; + return false; + } + } + return true; + } + ); + + if(!oilsRpt.def.where) { + oilsRpt.def.where = []; + oilsReportBuilderReset(); + + } else { + for( var j = 0; j < list.length; j++ ) + /* if there are no items left in the "select", "where", or "having" clauses + for the given relation, trim this relation from the "from" clause */ + if( !grep(oilsRpt.def.select, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + && !grep(oilsRpt.def.where, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + && !grep(oilsRpt.def.having, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + ) oilsRptPruneFromClause(oilsRptPathRel(list[j])); + } + + oilsRptDebug(); +} + +/* adds an item to the display window */ +function oilsAddRptAggFilterItem(val) { + oilsAddSelectorItem(oilsRptAggFilterSelector, val); +} + +/* removes a specific item from the display window */ +function oilsDelAggFilterItem(val) { + oilsDelSelectorItem(oilsRptAggFilterSelector, val); +} + +/* removes selected items from the display window */ +function oilsDelSelectedAggFilterItems() { + var list = oilsDelSelectedItems(oilsRptAggFilterSelector); + + /* remove the de-selected columns from the report output */ + oilsRpt.def.having = grep( oilsRpt.def.having, + function(i) { + for( var j = 0; j < list.length; j++ ) { + var d = list[j]; + var col = i.column; + + /* if this columsn has a transform, + it will be an object { tform => column } */ + if( typeof col != 'string' ) + for( var c in col ) col = col[c]; + + /* if this transform requires params, the column + will be the first item in the param set array */ + if( typeof col != 'string' ) col = col[0]; + + if( oilsRptPathRel(d) == i.relation && oilsRptPathCol(d) == col ) { + var param = (i.alias) ? i.alias.match(/::PARAM\d*/) : null; + if( param ) delete oilsRpt.params[param]; + return false; + } + } + return true; + } + ); + + if(!oilsRpt.def.having) { + oilsRpt.def.having = []; + oilsReportBuilderReset(); + + } else { + for( var j = 0; j < list.length; j++ ) + /* if there are no items left in the "select", "where", or "having" clauses + for the given relation, trim this relation from the "from" clause */ + if( !grep(oilsRpt.def.select, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + && !grep(oilsRpt.def.where, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + && !grep(oilsRpt.def.having, + function(i){ return (i.relation == oilsRptPathRel(list[j])); }) + ) oilsRptPruneFromClause(oilsRptPathRel(list[j])); + } + + oilsRptDebug(); } diff --git a/Open-ILS/web/reports/oils_rpt_builder.xhtml b/Open-ILS/web/reports/oils_rpt_builder.xhtml index ae3c4ec09c..d3ca310472 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.xhtml +++ b/Open-ILS/web/reports/oils_rpt_builder.xhtml @@ -54,6 +54,11 @@ + + diff --git a/Open-ILS/web/reports/oils_rpt_tforms.xhtml b/Open-ILS/web/reports/oils_rpt_tforms.xhtml index 1febaf7c04..615ddf5d5a 100644 --- a/Open-ILS/web/reports/oils_rpt_tforms.xhtml +++ b/Open-ILS/web/reports/oils_rpt_tforms.xhtml @@ -7,17 +7,23 @@ - - - - + + + + + + + + + + @@ -30,9 +36,23 @@ - - - + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/web/reports/oils_rpt_vars.js b/Open-ILS/web/reports/oils_rpt_vars.js index c6f14f7d55..6cdb090684 100644 --- a/Open-ILS/web/reports/oils_rpt_vars.js +++ b/Open-ILS/web/reports/oils_rpt_vars.js @@ -29,6 +29,10 @@ var oilsRptDisplaySelector; var oilsRptFilterSelector; +var oilsRptAggFilterSelector; + +var oilsRptOrderBySelector; + /* display the currently building report object in an external window */ var oilsRptDebugWindow; @@ -48,9 +52,11 @@ var oilsRptCurrentTform; /* the current transform manager for the builder filter window */ var oilsRptCurrentFilterTform; +var oilsRptCurrentAggFilterTform; /* the current operation manager for the filter window */ var oilsRptCurrentFilterOpManager; +var oilsRptCurrentAggFilterOpManager; var OILS_RPT_FETCH_FOLDERS = 'open-ils.reporter:open-ils.reporter.folder.visible.retrieve'; var OILS_RPT_FETCH_FOLDER_DATA = 'open-ils.reporter:open-ils.reporter.folder_data.retrieve'; -- 2.11.0