From 1af04b4e1bdc701f1284cc897b5ed4a07b1baf51 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Tue, 24 Jan 2012 16:04:06 -0500 Subject: [PATCH] Enable "map" field support in reporter In the IDL the "map" lets you logically skip a table, but previously blocked the reporter from accessing the link. This enables use of those links in the reporting module. Signed-off-by: Thomas Berezansky --- Open-ILS/web/reports/xul/source-browse.js | 52 ++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/reports/xul/source-browse.js b/Open-ILS/web/reports/xul/source-browse.js index 4075dd1f71..e823241129 100644 --- a/Open-ILS/web/reports/xul/source-browse.js +++ b/Open-ILS/web/reports/xul/source-browse.js @@ -41,8 +41,24 @@ function sourceTreeHandler (ev, dbl) { var link = link_fields[i].getAttribute('field'); var key = link_fields[i].getAttribute('key'); var reltype = link_fields[i].getAttribute('reltype'); - - if (map) continue; + var via = null; + var via_field = null; + + if (map) { + via = idlclass; + via_link = link; + via_field = field.getAttribute('name'); + var temp_class = getIDLClass(via); + var temp_links = temp_class.getElementsByTagName('link'); + for ( var j = 0; j < temp_links.length; j++ ) { + if (temp_links[j].getAttribute('field') == map) { + idlclass = temp_links[j].getAttribute('class'); + link = temp_links[j].getAttribute('field'); + field = getIDLField( temp_class, link ); + if (!field) continue; + } + } + } var pathList = []; findAncestorStack( item, 'treeitem', pathList ); @@ -52,7 +68,15 @@ function sourceTreeHandler (ev, dbl) { for (var j in pathList.reverse()) { var n = pathList[j].getAttribute('idlclass'); var f = pathList[j].getAttribute('field'); + var v = pathList[j].getAttribute('via'); + var vf = pathList[j].getAttribute('via_field'); var j = pathList[j].getAttribute('join'); + if (v) { + if (vf) fullpath += "-" + vf; + if (vf && j != 'undefined') fullpath += '>' + j; + if (fullpath) fullpath += "."; + fullpath += v; + } if (f) fullpath += "-" + f; if (f && j != 'undefined') fullpath += '>' + j; @@ -62,6 +86,10 @@ function sourceTreeHandler (ev, dbl) { } + if(via) { + fullpath += "-" + via_field + "." + via; + } + fullpath += "-" + link; subtreeList.push( @@ -73,7 +101,9 @@ function sourceTreeHandler (ev, dbl) { field : field.getAttribute('name'), reltype : reltype, link : link, - fullpath : fullpath + fullpath : fullpath, + via : via, + via_field : via_field } ); @@ -89,7 +119,9 @@ function sourceTreeHandler (ev, dbl) { field : field.getAttribute('name'), reltype : reltype, link : link, - fullpath : fullpath + '>right' + fullpath : fullpath + '>right', + via : via, + via_field : via_field } ); @@ -103,7 +135,9 @@ function sourceTreeHandler (ev, dbl) { field : field.getAttribute('name'), reltype : reltype, link : link, - fullpath : fullpath + '>inner' + fullpath : fullpath + '>inner', + via : via, + via_field : via_field } ); @@ -118,7 +152,9 @@ function sourceTreeHandler (ev, dbl) { field : field.getAttribute('name'), reltype : reltype, link : link, - fullpath : fullpath + '>left' + fullpath : fullpath + '>left', + via : via, + via_field : via_field } ); @@ -132,7 +168,9 @@ function sourceTreeHandler (ev, dbl) { field : field.getAttribute('name'), reltype : reltype, link : link, - fullpath : fullpath + '>inner' + fullpath : fullpath + '>inner', + via : via, + via_field : via_field } ); -- 2.11.0