From a487f64f4c712437d12ac38d6665f7b7e7358def Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 30 May 2011 12:53:41 -0400 Subject: [PATCH] Add resolver support to search results Again, we use the SFX_TARGET variable as our placeholder for the to-be-written automatic skin deployment script. Signed-off-by: Dan Scott --- .../skin/default/xml/rdetail/rdetail_summary.xml | 7 +- .../opac/skin/default/xml/result/result_table.xml | 248 +++++++++++++++------ 2 files changed, 186 insertions(+), 69 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml index 8523487fec..0a3afa5245 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml @@ -71,7 +71,12 @@ } var ses = new OpenSRF.ClientSession('open-ils.resolver'); - var req = ses.request('open-ils.resolver.resolve_holdings.raw', 'issn', issn); + var req = ses.request( + 'open-ils.resolver.resolve_holdings.raw', + 'issn', + issn, + SFX_TARGET + ); req.oncomplete = function(r) { var msg; dojo.forEach(r.recv().content(), function(entry) { diff --git a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml index 5ff3ba86fd..8498151351 100644 --- a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml +++ b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml @@ -67,6 +67,186 @@ + + + + + + + + + 0 && SFX_TARGET) { + try { + var ses = new OpenSRF.ClientSession('open-ils.resolver'); + var req = ses.request( + 'open-ils.resolver.resolve_holdings.raw', + 'issn', + issn, + SFX_TARGET + ); + req.oncomplete = function(r) { + var resolverInfo = ""; + dojo.forEach(r.recv().content(), function(entry) { + resolverInfo = entry.public_name + "_" + entry.target_coverage; + if (title_list.indexOf(this_title_id) == -1) { + url_list = ""; + } + if (url_list.indexOf(resolverInfo) == -1) { + var resolverNode = null; + dojo.query('.recid').forEach(function(recinfo) { + if (parseFloat(dojo.trim(BT.textContent(recinfo))) == parseFloat(this_title_id)) { + resolverNode = recinfo; + } + }); + url_list += resolverInfo; + var output = null; + if (resolverNode != null) { + var parent = resolverNode.parentNode; + if (parent) { + parent = parent.parentNode; + } + if (parent) { + dojo.removeClass(parent,'hide_me'); + } + output = dojo.create('div',{"style":"background-color:#EEFFEE;"},resolverNode,"last"); + dojo.addClass(output,"result_table_sfx_cell"); + title_list += this_title_id; + var link = dojo.create('a', {"style": "margin-left: 1em;", "class":"search_link", "href": entry.target_url}); + var link_text = dojo.doc.createTextNode( entry.public_name); + link.appendChild(link_text); + output.appendChild(link); + var coverage_text = dojo.doc.createTextNode(' - ' + entry.target_coverage + + (entry.target_embargo ? (' / ' + entry.target_embargo) : '')); + output.appendChild(coverage_text); + resolved[this_title_id] = true; + } + } + }); + }; + req.send(); + } catch (err) { alert(err.message);} + } + ]]> + + + = max_items) { + return output.innerHTML; + } + dojo.query('copy', vol).forEach(function (cp) { + if (item_cnt >= max_items) { + return; + } + if (cp.getAttribute('deleted') == 't') { + return; + } + if (cp.getAttribute('opac_visible') == 'f') { + return; + } + var cp_entry = dojo.create('div'); + var loc_visible; + var vol_appended = false; + dojo.query('location', cp).forEach(function (location) { + loc_visible = location.getAttribute('opac_visible'); + if (loc_visible == 't') { + if (!vol_appended) { + var cn = dojo.create('span', { style: "font-weight: bold;" }, cp_entry); + var cn_txt = dojo.doc.createTextNode(vol.getAttribute('label')); + cn.appendChild(cn_txt); + vol_appended = true; + } + var loc = dojo.create('span', { "style": "font-weight: bold;"}, cp_entry); + var loc_txt = dojo.doc.createTextNode(' - ' + BT.textContent(location)); + loc.appendChild(loc_txt); + } + }); + if (loc_visible != 't') { + return; + } + dojo.query('circ_lib', cp).forEach(function (circ_lib) { + var cp_lib = dojo.create('span', { "style": "font-weight: bold;" }, cp_entry, "first"); + var cp_lib_txt = dojo.doc.createTextNode(circ_lib.getAttribute('name') + ' - '); + cp_lib.appendChild(cp_lib_txt); + }); + dojo.query('status', cp).forEach(function (status) { + var cp_status = dojo.create('span', { "style": "font-weight: bold;" }, cp_entry); + var cp_status_txt = dojo.doc.createTextNode(' (' + BT.textContent(status) + ')'); + cp_status.appendChild(cp_status_txt); + }); + + item_cnt++; + if (item_cnt >= max_items) { + dojo.create('br', null, cp_entry); + cp_entry.appendChild(dojo.doc.createTextNode(opac_strings.MORE_COPIES_FULL_RECORD)); + } + output.appendChild(cp_entry); + }); + }); + + return output.innerHTML; + ]]> + + + + + + + + @@ -136,74 +316,6 @@ - - - - = max_items) { - return output.innerHTML; - } - dojo.query('copy', vol).forEach(function (cp) { - if (item_cnt >= max_items) { - return; - } - if (cp.getAttribute('deleted') == 't') { - return; - } - if (cp.getAttribute('opac_visible') == 'f') { - return; - } - var cp_entry = dojo.create('div'); - var loc_visible; - var vol_appended = false; - dojo.query('location', cp).forEach(function (location) { - loc_visible = location.getAttribute('opac_visible'); - if (loc_visible == 't') { - if (!vol_appended) { - var cn = dojo.create('span', { style: "font-weight: bold;" }, cp_entry); - var cn_txt = dojo.doc.createTextNode(vol.getAttribute('label')); - cn.appendChild(cn_txt); - vol_appended = true; - } - var loc = dojo.create('span', { "style": "font-weight: bold;"}, cp_entry); - var loc_txt = dojo.doc.createTextNode(' - ' + BT.textContent(location)); - loc.appendChild(loc_txt); - } - }); - if (loc_visible != 't') { - return; - } - dojo.query('circ_lib', cp).forEach(function (circ_lib) { - var cp_lib = dojo.create('span', { "style": "font-weight: bold;" }, cp_entry, "first"); - var cp_lib_txt = dojo.doc.createTextNode(circ_lib.getAttribute('name') + ' - '); - cp_lib.appendChild(cp_lib_txt); - }); - dojo.query('status', cp).forEach(function (status) { - var cp_status = dojo.create('span', { "style": "font-weight: bold;" }, cp_entry); - var cp_status_txt = dojo.doc.createTextNode(' (' + BT.textContent(status) + ')'); - cp_status.appendChild(cp_status_txt); - }); - - item_cnt++; - if (item_cnt >= max_items) { - dojo.create('br', null, cp_entry); - cp_entry.appendChild(dojo.doc.createTextNode(opac_strings.MORE_COPIES_FULL_RECORD)); - } - output.appendChild(cp_entry); - }); - }); - - return output.innerHTML; - ]]> - - - -- 2.11.0