[open-ils-commits] r9008 - in trunk/Open-ILS/web/opac: locale/en-US
skin/default/js skin/default/xml/result
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 14 09:34:09 EDT 2008
Author: miker
Date: 2008-03-14 09:00:32 -0400 (Fri, 14 Mar 2008)
New Revision: 9008
Modified:
trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
trunk/Open-ILS/web/opac/skin/default/js/result_common.js
trunk/Open-ILS/web/opac/skin/default/xml/result/result_table.xml
Log:
adding google books view to result pages
Modified: trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/opac.dtd 2008-03-14 01:49:04 UTC (rev 9007)
+++ trunk/Open-ILS/web/opac/locale/en-US/opac.dtd 2008-03-14 13:00:32 UTC (rev 9008)
@@ -554,6 +554,7 @@
<!ENTITY result.table.keyword "View titles for this record">
<!ENTITY result.table.author "Perform an Author Search">
+<!ENTITY result.googleBooks.browse "Browse in Google Books Search">
<!ENTITY common.call.number.label "Call Number:">
<!ENTITY common.isbn.label "ISBN:">
Modified: trunk/Open-ILS/web/opac/skin/default/js/result_common.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/result_common.js 2008-03-14 01:49:04 UTC (rev 9007)
+++ trunk/Open-ILS/web/opac/skin/default/js/result_common.js 2008-03-14 13:00:32 UTC (rev 9008)
@@ -2,6 +2,8 @@
var recordsHandled = 0;
var recordsCache = [];
var lowHitCount = 4;
+var isbnList = '';
+var googleBooks = false;
var resultFetchAllRecords = false;
var resultCompiledSearch = null;
@@ -394,6 +396,21 @@
);
}
+function unhideGoogleBooks (data) {
+ for ( var i in data ) {
+ if (data[i].preview == 'noview') continue;
+
+ var gbspan = $n('googleBooks-' + i);
+ var gba = $n("googleBooks-link",gbspan)
+
+ gba..setAttribute(
+ 'href',
+ data[i].info_url
+ );
+ removeCSSClass( gbspan, 'hide_me' );
+ }
+}
+
/* display the record info in the record display table 'pos' is the
zero based position the record should have in the display table */
function resultDisplayRecord(rec, pos, is_mr) {
@@ -403,8 +420,21 @@
recordsCache.push(rec);
var r = table.rows[pos + 1];
+ var currentISBN = cleanISBN(rec.isbn());
-
+ if (googleBooks) {
+ var gbspan = $n(r, "googleBooks");
+ if (currentISBN) {
+ gbspan.setAttribute(
+ 'name',
+ gbspan.getAttribute('name') + '-' + currentISBN
+ );
+
+ if (isbnList) isbnList += ', ';
+ isbnList += currentISBN;
+ }
+ }
+
try {
var rank = parseFloat(ranks[pos + getOffset()]);
rank = parseInt( rank * 100 );
@@ -414,7 +444,7 @@
} catch(e){ }
var pic = $n(r, config.names.result.item_jacket);
- pic.setAttribute("src", buildISBNSrc(cleanISBN(rec.isbn())));
+ pic.setAttribute("src", buildISBNSrc(currentISBN));
var title_link = $n(r, config.names.result.item_title);
var author_link = $n(r, config.names.result.item_author);
@@ -550,6 +580,18 @@
function resultPageIsDone(pos) {
+
+ if (isbnList && googleBooks) {
+ var scriptElement = document.createElement("script");
+ scriptElement.setAttribute("id", "jsonScript");
+ scriptElement.setAttribute("src",
+ "http://books.google.com/books?bibkeys=" +
+ escape(isbnList) + "&jscmd=viewapi&callback=unhideGoogleBooks");
+ scriptElement.setAttribute("type", "text/javascript");
+ // make the request to Google Book Search
+ document.documentElement.firstChild.appendChild(scriptElement);
+ }
+
return (recordsHandled == getDisplayCount()
|| recordsHandled + getOffset() == getHitCount());
}
Modified: trunk/Open-ILS/web/opac/skin/default/xml/result/result_table.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/result/result_table.xml 2008-03-14 01:49:04 UTC (rev 9007)
+++ trunk/Open-ILS/web/opac/skin/default/xml/result/result_table.xml 2008-03-14 13:00:32 UTC (rev 9008)
@@ -120,15 +120,21 @@
</span>
<span class='hide_me' name='place_hold_span'>
- <a style='padding-left: 8px; padding-right: 10px;' href='javascript:void(0);'
+ <a style='padding-left: 8px;' href='javascript:void(0);'
class='classic_link' name='place_hold_link'>&opac.holds.placeHold;</a>
</span>
<!-- Empty span used for creating unAPI links -->
- <abbr name="unapi" class="unapi-id">
+ <abbr style='padding-left: 8px;' name="unapi" class="unapi-id">
<!-- unAPI URI goes here -->
</abbr>
+ <!-- Empty span used for creating unAPI links -->
+ <span name="googleBooks" class="hide_me">
+ <a style='padding-left: 8px;' class='classic_link' name="googleBooks-link">&result.googleBooks.browse;</a>
+ </span>
+
+
</td>
</tr>
More information about the open-ils-commits
mailing list