reversing url checking logic, have to expose non-proxied urls
authorartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 26 Sep 2010 21:07:49 +0000 (21:07 +0000)
committerartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 26 Sep 2010 21:07:49 +0000 (21:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_1@1008 6d9bc8c9-1ec2-4278-b937-99fde70a366f

web/opac/skin/uwin/js/rdetail.js
web/opac/skin/uwin/xml/result/result_table.xml

index 72b5214..ceefcd8 100644 (file)
@@ -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
index 5f2336d..1da9deb 100644 (file)
                                                                                        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))) == 
                                                                                                                        resolverNode = recinfo;
                                                                                                                }
                                                                                                        });
-                                                                                                       url_list += resolverInfo;
+                                                                                                       url_list[this_title_id] += resolverInfo;
                                                                                                        var output = null;
                                                                                                        if (resolverNode != null) {
                                                                                                                var parent = resolverNode.parentNode;
                                                                        var item_cnt = 0;
                                                                        var max_items = 4;
 
-
                                                                        dojo.query('volume', item).forEach(function(vol) {
                                                                                if (item_cnt >= max_items) {
                                                                                        return output.innerHTML;
                                                                                        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;
                                                                ]]></span>
                                                                </span>
 
                                                                        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) {
                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 = "";
 
        </script>