From: artunit Date: Sun, 26 Sep 2010 21:07:49 +0000 (+0000) Subject: reversing url checking logic, have to expose non-proxied urls X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3edccaf85de034ab40d68551b16bc44eb1f6ba35;p=contrib%2FConifer.git reversing url checking logic, have to expose non-proxied urls git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_1@1008 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/web/opac/skin/uwin/js/rdetail.js b/web/opac/skin/uwin/js/rdetail.js index 72b5214512..ceefcd8d6a 100644 --- a/web/opac/skin/uwin/js/rdetail.js +++ b/web/opac/skin/uwin/js/rdetail.js @@ -17,7 +17,7 @@ var rdetailRefWorksHost = 'http://refworks.scholarsportal.info'; var enableHoldsOnAvailable = false; var urlCheck = true; //whether to use a url check to mask legacy urls -var urlExpr = "/ezproxy|laws/i"; //regular expression +var urlExpr = /webvoy|janus|resolver/i; //regular expression /* threshold for paging */ var rdetailBreakUpLargeSets = true; //flag for paging support @@ -379,7 +379,11 @@ function _rdetailDraw(r) { var href = links[i]; // avoid matching "HTTP: The Complete Reference" //if( href.match(/https?:\/|ftps?:\/|mailto:|http?:/i) && href.match(/ezproxy|law/i )) { - if( href.match(/https?:\/|ftps?:\/|mailto:|http?:/i) && urlCheck?href.match(urlExpr):true) { + var test = null; + if (urlCheck) + test = href.match(urlExpr); + + if( href.match(/https?:\/|ftps?:\/|mailto:|http?:/i) && test == null) { unHideMe($('rdetail_online_row')); // MODS can contain a display label (used for the text of the link) // as well as a note about the URL; many legacy systems conflate the diff --git a/web/opac/skin/uwin/xml/result/result_table.xml b/web/opac/skin/uwin/xml/result/result_table.xml index 5f2336dc0f..1da9debf20 100644 --- a/web/opac/skin/uwin/xml/result/result_table.xml +++ b/web/opac/skin/uwin/xml/result/result_table.xml @@ -115,11 +115,15 @@ var ses = new OpenSRF.ClientSession('open-ils.resolver'); var req = ses.request('open-ils.resolver.resolve_holdings.raw', 'issn', issn, 'http://sfx.scholarsportal.info/windsor'); + if (url_list[this_title_id] == undefined) + url_list[this_title_id] = ""; req.oncomplete = function(r) { var resolverInfo = ""; dojo.forEach(r.recv().content(), function(entry) { resolverInfo = entry.public_name + "_" + entry.target_coverage; - if (url_list.indexOf(resolverInfo) == -1) { + var testDup = url_list[this_title_id] + ""; + + if (testDup.indexOf(resolverInfo) == -1) { var resolverNode = null; dojo.query('.recid').forEach(function(recinfo) { if (parseFloat(dojo.trim(dojox.data.dom.textContent(recinfo))) == @@ -128,7 +132,7 @@ resolverNode = recinfo; } }); - url_list += resolverInfo; + url_list[this_title_id] += resolverInfo; var output = null; if (resolverNode != null) { var parent = resolverNode.parentNode; @@ -168,7 +172,6 @@ var item_cnt = 0; var max_items = 4; - dojo.query('volume', item).forEach(function(vol) { if (item_cnt >= max_items) { return output.innerHTML; @@ -180,44 +183,44 @@ var loc_id; var vol_appended = false; dojo.query('location', cp).forEach(function (location) { - loc_id = parseInt(location.getAttribute('ident')); - if (loc_id != 8 && loc_id != 20) { - if (!vol_appended) { - dojo.create('span',{ className: 'live_location_cell', - innerHTML: vol.getAttribute('label')}, + loc_id = parseInt(location.getAttribute('ident')); + if (loc_id != 8 && loc_id != 20) { + if (!vol_appended) { + dojo.create('span',{ className: 'live_location_cell', + innerHTML: vol.getAttribute('label')}, + output); + vol_appended = true; + } + dojo.create('span', { className: 'live_separator_cell', + "innerHTML": ' - '}, + output); + dojo.create('span', { className: 'live_location_cell', + "innerHTML": dojox.xml.parser.textContent(location)}, output); - vol_appended = true; } - dojo.create('span', { className: 'live_separator_cell', - "innerHTML": ' - '}, - output); - dojo.create('span', { className: 'live_location_cell', - "innerHTML": dojox.xml.parser.textContent(location)}, - output); + }); + if (loc_id == 8 || loc_id == 20) { + return; } - }); - if (loc_id == 8 || loc_id == 20) { - return; - } - dojo.query('status', cp).forEach(function (status) { - var pfx = dojo.doc.createTextNode(' ('); - output.appendChild(pfx); - dojo.create('span', { className: 'live_status_cell', - "innerHTML": dojox.xml.parser.textContent(status) }, output); - var sfx = dojo.doc.createTextNode(')'); - output.appendChild(sfx); - }); - dojo.create('br', null, output); - - item_cnt++; - if (item_cnt >= max_items) { - output.appendChild(dojo.doc.createTextNode('... more print items listed in full record')); + dojo.query('status', cp).forEach(function (status) { + var pfx = dojo.doc.createTextNode(' ('); + output.appendChild(pfx); + dojo.create('span', { className: 'live_status_cell', + "innerHTML": dojox.xml.parser.textContent(status) }, output); + var qfx = dojo.doc.createTextNode(')'); + output.appendChild(qfx); + }); dojo.create('br', null, output); - } + + item_cnt++; + if (item_cnt >= max_items) { + output.appendChild(dojo.doc.createTextNode('... more print items listed in full record')); + dojo.create('br', null, output); + } + }); }); - }); - return output.innerHTML; + return output.innerHTML; ]]> @@ -227,6 +230,12 @@ var output = dojo.create('span'); var uri = new Object; uri.href = item.getAttribute('href'); + /* url check for legacy (and mostly broken) urls */ + var test = null; + if (urlCheck) + test = href.match(urlExpr); + if (test != null) + return ""; uri.label = item.getAttribute('label'); uri.use = item.getAttribute('use_restriction'); if (uri.href == uri.label) { @@ -387,9 +396,14 @@ config.names.result.format_cell = 'result_table_format_cell'; config.names.result.format_link = 'resource_link' config.names.result.format_pic = 'format_pic' - var url_list = ""; + var url_list = new Array(); var title_list = ""; var curr_title_id = ""; + /* whether to use a url check to mask legacy urls */ + var urlCheck = true; + /* regular expression */ + var urlExpr = /webvoy|janus|resolver/i; + var test = "";