[open-ils-commits] r9427 - branches/rel_1_2/Open-ILS/web/reports
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Apr 22 14:39:43 EDT 2008
Author: erickson
Date: 2008-04-22 14:00:31 -0400 (Tue, 22 Apr 2008)
New Revision: 9427
Modified:
branches/rel_1_2/Open-ILS/web/reports/oils_rpt_editor.xhtml
branches/rel_1_2/Open-ILS/web/reports/oils_rpt_report_editor.js
Log:
added support for defining pivot data and label columns
Modified: branches/rel_1_2/Open-ILS/web/reports/oils_rpt_editor.xhtml
===================================================================
--- branches/rel_1_2/Open-ILS/web/reports/oils_rpt_editor.xhtml 2008-04-22 16:21:16 UTC (rev 9426)
+++ branches/rel_1_2/Open-ILS/web/reports/oils_rpt_editor.xhtml 2008-04-22 18:00:31 UTC (rev 9427)
@@ -34,8 +34,24 @@
</tr>
<tr>
<th>Report Columns:</th>
- <td><b id='oils_rpt_report_editor_cols'/></td>
+ <td nowrap='nowrap'><b id='oils_rpt_report_editor_cols'/></td>
</tr>
+ <tr class='hide_me' id='oils_rpt_editor_pivot_label_row'>
+ <th>Pivot Label Column:</th>
+ <td>
+ <select id='oils_rpt_editor_pivot_label'>
+ <option selected='selected' value=''> -- Select One (optional) -- </option>
+ </select>
+ </td>
+ </tr>
+ <tr class='hide_me' id='oils_rpt_editor_pivot_data_row'>
+ <th>Pivot Data Column:</th>
+ <td>
+ <select id='oils_rpt_editor_pivot_data'>
+ </select>
+ </td>
+ </tr>
+
<!--
<tr><td colspan='2'><hr/></td></tr>
-->
Modified: branches/rel_1_2/Open-ILS/web/reports/oils_rpt_report_editor.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/reports/oils_rpt_report_editor.js 2008-04-22 16:21:16 UTC (rev 9426)
+++ branches/rel_1_2/Open-ILS/web/reports/oils_rpt_report_editor.js 2008-04-22 18:00:31 UTC (rev 9427)
@@ -21,6 +21,43 @@
}
);
+/*
+oils_rpt_editor_pivot_label
+oils_rpt_editor_pivot_data
+*/
+
+ var hasAgg = false;
+ iterate(rptObject.def.select,
+ function(i) {
+ if(OILS_RPT_TRANSFORMS[i.column.transform].aggregate)
+ hasAgg = true;
+ }
+ );
+
+ while(DOM.oils_rpt_editor_pivot_label.getElementsByTagName('option').length > 1)
+ DOM.oils_rpt_editor_pivot_label.removeChild(DOM.oils_rpt_editor_pivot_label.lastChild);
+
+ while(DOM.oils_rpt_editor_pivot_data.lastChild)
+ DOM.oils_rpt_editor_pivot_data.removeChild(DOM.oils_rpt_editor_pivot_data.lastChild);
+
+ if(hasAgg) {
+ unHideMe(DOM.oils_rpt_editor_pivot_label_row);
+ unHideMe(DOM.oils_rpt_editor_pivot_data_row);
+
+ for(var i in rptObject.def.select) {
+ var col = rptObject.def.select[i];
+ if(OILS_RPT_TRANSFORMS[col.column.transform].aggregate)
+ insertSelectorVal(DOM.oils_rpt_editor_pivot_data, -1, col.alias, parseInt(i)+1);
+ else
+ insertSelectorVal(DOM.oils_rpt_editor_pivot_label, -1, col.alias, parseInt(i)+1);
+ }
+
+ } else {
+ hideMe(DOM.oils_rpt_editor_pivot_label_row);
+ hideMe(DOM.oils_rpt_editor_pivot_data_row);
+ }
+
+
if( rpt ) {
DOM.oils_rpt_report_editor_name.value = rpt.name();
DOM.oils_rpt_report_editor_description.value = rpt.description();
@@ -102,6 +139,12 @@
data[par.key] = val;
}
+ if(getSelectorVal(DOM.oils_rpt_editor_pivot_data)) {
+ data.__pivot_label = getSelectorVal(DOM.oils_rpt_editor_pivot_label);
+ data.__pivot_data = getSelectorVal(DOM.oils_rpt_editor_pivot_data);
+ }
+
+
data = js2JSON(data);
_debug("complete report data = "+data);
report.data(data);
More information about the open-ils-commits
mailing list