[open-ils-commits] r1394 - conifer/branches/rel_2_0/web/opac/skin/uwin/xml/result (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Apr 19 13:23:27 EDT 2011
Author: dbs
Date: 2011-04-19 13:23:23 -0400 (Tue, 19 Apr 2011)
New Revision: 1394
Modified:
conifer/branches/rel_2_0/web/opac/skin/uwin/xml/result/result_table.xml
Log:
Get this_title_id inside the pertinent slot
BibTemplate (perhaps in combination with newer JavaScript engines) appears to
be rendering slots from the bottom up now, so curr_title_id was out of sync.
Grabbing the 901c from within the slot being rendered ensures that you've got
the right record ID.
Modified: conifer/branches/rel_2_0/web/opac/skin/uwin/xml/result/result_table.xml
===================================================================
--- conifer/branches/rel_2_0/web/opac/skin/uwin/xml/result/result_table.xml 2011-04-19 16:41:50 UTC (rev 1393)
+++ conifer/branches/rel_2_0/web/opac/skin/uwin/xml/result/result_table.xml 2011-04-19 17:23:23 UTC (rev 1394)
@@ -90,75 +90,72 @@
<tr name="local_callnumber_list" class="result_table_title_cell">
<td>
<!--
- we snag the record id from the 901 field, and then use it
- for lining up the resolver content
- -->
- <span
- type='opac/slot-data' query='datafield[tag="901"] subfield[code="c"]' class='hide_me'>
- <span class='hide_me' debug='true' type='opac/slot-format'><![CDATA[
- curr_title_id = dojo.trim(BT.textContent(item));
- ]]></span>
- </span>
- <!--
this is very close to the layout in rdetail, we need to find the
record id in order to place the resolver info in the right spot
-->
- <span
- type='opac/slot-data' query='datafield[tag="022"] subfield' class='hide_me'>
+ <span type='opac/slot-data' query='record' class='hide_me'>
<span class='hide_me' debug='true' type='opac/slot-format'><![CDATA[
- var this_title_id = curr_title_id;
- var issn = '';
- issn = BT.textContent(item) + '';
- issn = issn.replace(/^(\s|.)*?(\d{4}).(\d{3,4}[xX]?)(\s|.)*/, "$2-$3");
- if (issn.length > 0) {
- try {
- 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');
- 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;
+ var this_title_id;
+
+ dojo.query('datafield[tag="901"] subfield[code="c"]', item).forEach(function (item) {
+ this_title_id = dojo.trim(BT.textContent(item));
+ });
+
+ dojo.query('datafield[tag="022"] subfield', item).forEach(function(item) {
+ var issn = '';
+ issn = BT.textContent(item) + '';
+ issn = issn.replace(/^(\s|.)*?(\d{4}).(\d{3,4}[xX]?)(\s|.)*/, "$2-$3");
+ if (issn.length > 0) {
+ try {
+ 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');
+ 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;
}
- });
- 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);}
- }
+ });
+ };
+ req.send();
+ } catch (err) { alert(err.message);}
+ }
+ });
]]></span>
</span>
+
<!-- Prevent records with dozens of items attached from filling the screen -->
<span type='opac/slot-data+marcxml-full' query='volumes'>
<span class='hide_me' debug='true' type='opac/slot-format'><![CDATA[
@@ -224,7 +221,7 @@
</span>
<!-- Be lenient in what we accept; disabled until we figure out how to prevent both URIs and SFX -->
- <span type='opac/slot-data+marcxml-full' query='record'>
+ <span type='opac/slot-data+marcxml-uris' query='record'>
<span class='hide_me' type='opac/slot-format'><![CDATA[
var found_issn = false;
dojo.query('datafield[tag="022"]', item).forEach(function(issn) {
@@ -232,9 +229,14 @@
});
if (found_issn) { return; }
+ var this_title_id;
+
+ dojo.query('datafield[tag="901"] subfield[code="c"]', item).forEach(function (item) {
+ this_title_id = dojo.trim(BT.textContent(item));
+ });
+
var output = dojo.create('span');
dojo.query('volumes volume uris uri', item).forEach(function(xitem) {
- var this_title_id = curr_title_id;
if (resolved[this_title_id]) { return; }
var uri = new Object;
uri.href = xitem.getAttribute('href');
More information about the open-ils-commits
mailing list