.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;
.oils_rpt_info_selector {
border: 1px solid blue;
- background: #E0F0E0;
+ /*background: #E0F0E0;*/
+ background: #E0F0F0;
min-height: 130px;
max-height: 240px;
overflow: scroll;
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;
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) {}
}
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() {
+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();
/* 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();
}
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();
}
}
+/**
+ This draws the 3-tabbed window containing the transform,
+ filter, and aggregate filter picker window
+ */
function oilsRptDrawDataWindow(path) {
var parts = path.split(/-/);
/* 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'))};
}
+/* 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);
</head>
- <body onload='oilsInitReports();' onunload='oilsCleanupReports();'>
+ <body onload='oilsInitReportBuilder();' onunload='oilsCleanupReports();'>
<div class='welcome_box'>
<span>You are logged in as </span><b><span id='oils_rpt_user'/></b>
<tbody>
<tr>
<td id='oils_rpt_table_left_td' align='left'>
+ <div id='oils_rpt_name_div'>
+ <span style='padding-right: 10px;'>Report Name: </span>
+ <input size='32' onchange="oilsRpt.name=this.value"/>
+ </div>
<div id='oils_rpt_tree_div'>
</div>
</td>
<div class='oils_rpt_info_div'>
<div class='oils_rpt_info_item oils_rpt_info_title'>Report Display Items</div>
<select id='oils_rpt_display_selector' class='oils_rpt_info_item oils_rpt_info_selector' multiple='multiple'/>
- <button onclick='oilsDelSelectedDisplayItems();'><u>X</u> Remove Selected Values</button>
+ <button onclick='oilsDelSelectedDisplayItems();'><u>X</u> Remove Selected</button>
</div>
<div class='oils_rpt_info_div'>
<div class='oils_rpt_info_item oils_rpt_info_title'>Report Filters</div>
<select id='oils_rpt_filter_selector' class='oils_rpt_info_item oils_rpt_info_selector' multiple='multiple'/>
- <button onclick='oilsDelSelectedFilterItems();'><u>X</u> Remove Selected Filters</button>
+ <button onclick='oilsDelSelectedFilterItems();'><u>X</u> Remove Selected</button>
</div>
</td>
</tr>
</tr></tbody></table>
<div id='oils_rpt_tform_div'>
- <b style='padding-right: 10px;' id='oils_rpt_tform_label'/> <input id='oils_rpt_tform_label_input'/>
+ <b style='padding-right: 15px;' id='oils_rpt_tform_label'/>
+ <input size='28' id='oils_rpt_tform_label_input'/>
<br/><br/>
<button id='oils_rpt_tform_submit'>Add Item</button>
</div>
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;
var obj = {
field : fields[i],
name : name,
- label : field.getAttribute('reporter:label'),
+ label : field.getAttributeNS(oilsIDLReportsNS,'label'),
type : 'field'
}
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;
}
var oilsRptID = 0;
+var oilsRptID2 = 0;
function oilsNextId() {
return 'oils_'+ (oilsRptID++);
}
+function oilsRptNextParam() {
+ return '::PARAM'+ (oilsRptID2++);
+}
+
function nodeText(id) {
if($(id))
return $(id).innerHTML;
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';