[open-ils-commits] r1008 - in conifer/branches/rel_1_6_1/web/opac/skin/uwin: js xml/result (artunit)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Sep 26 17:07:55 EDT 2010


Author: artunit
Date: 2010-09-26 17:07:49 -0400 (Sun, 26 Sep 2010)
New Revision: 1008

Modified:
   conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js
   conifer/branches/rel_1_6_1/web/opac/skin/uwin/xml/result/result_table.xml
Log:
reversing url checking logic, have to expose non-proxied urls

Modified: conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js
===================================================================
--- conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js	2010-09-26 03:40:19 UTC (rev 1007)
+++ conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js	2010-09-26 21:07:49 UTC (rev 1008)
@@ -17,7 +17,7 @@
 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 @@
 		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

Modified: conifer/branches/rel_1_6_1/web/opac/skin/uwin/xml/result/result_table.xml
===================================================================
--- conifer/branches/rel_1_6_1/web/opac/skin/uwin/xml/result/result_table.xml	2010-09-26 03:40:19 UTC (rev 1007)
+++ conifer/branches/rel_1_6_1/web/opac/skin/uwin/xml/result/result_table.xml	2010-09-26 21:07:49 UTC (rev 1008)
@@ -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);
-													vol_appended = true;
+													dojo.create('span', { className: 'live_location_cell',
+														"innerHTML": dojox.xml.parser.textContent(location)}, 
+														output);
 												}
-												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;
 											}
+											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);
+											}
 										});
-										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.create('br', null, output);
-										}
 									});
-								});
 
-								return output.innerHTML;
+									return output.innerHTML;
 								]]></span>
 								</span>
 
@@ -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 = "";
 
 	</script>
 



More information about the open-ils-commits mailing list