[open-ils-commits] r322 - conifer/trunk/web/opac/skin/default/js (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 12 16:16:38 EDT 2009
Author: dbs
Date: 2009-04-12 16:16:34 -0400 (Sun, 12 Apr 2009)
New Revision: 322
Modified:
conifer/trunk/web/opac/skin/default/js/rdetail.js
Log:
Add a basic option for avoiding holds on available items
Also bring Google Book Previews into sync with trunk
Modified: conifer/trunk/web/opac/skin/default/js/rdetail.js
===================================================================
--- conifer/trunk/web/opac/skin/default/js/rdetail.js 2009-04-12 19:11:11 UTC (rev 321)
+++ conifer/trunk/web/opac/skin/default/js/rdetail.js 2009-04-12 20:16:34 UTC (rev 322)
@@ -26,6 +26,7 @@
var rdetailShowLocal = true;
var rdetailShowCopyLocation = true;
var googleBookPreview = true;
+var enableHoldsOnAvailable = false;
var nextContainerIndex;
@@ -197,6 +198,13 @@
}
G.ui.rdetail.abstr.appendChild(text(record.synopsis()));
+ if (enableHoldsOnAvailable) {
+ unHideMe($('rdetail_place_hold'));
+ } else {
+ hideMe($('rdetail_place_hold'));
+ rdetailCheckAvailable();
+ }
+
try{
if(record.isbn()) {
if(ENABLE_ADDED_CONTENT_ATTRIB_LINKS) {
@@ -281,7 +289,21 @@
}
+function rdetailCheckAvailable() {
+ var loc = getLocation();
+ var rid = getRid();
+ var req = new Request( 'open-ils.search:open-ils.search.biblio.record.copy_count', loc, rid );
+ req.callback(rdetailEnableHold);
+ req.send();
+}
+function rdetailEnableHold(r) {
+ var ccDepths = r.getResultObject();
+ if ((ccDepths[(ccDepths.length - 1)].available) > 0) {
+ unHideMe($('rdetail_place_hold'));
+ }
+}
+
function rdetailCheckDeleted(r) {
var br = r.getResultObject()[0];
if( isTrue(br.deleted()) ) {
@@ -819,17 +841,11 @@
}
/**
- * XXX Need to adopt a more typical approach to showing loading status
+ * Check for a Google Book preview
*/
function rdetailCheckForGBPreview() {
-
if (!googleBookPreview) return;
- var GBPp = document.createElement('p');
- GBPp.appendChild( document.createTextNode('Loading... ' ) );
- GBPp.id = 'loading';
- $('rdetail_preview_div').appendChild(GBPp);
searchForGBPreview( cleanISBN(record.isbn()) );
-
}
/**
@@ -869,7 +885,6 @@
* @param {JSON} booksInfo is the JSON object pulled from the Google books service.
*/
function GBPreviewCallback(GBPBookInfo) {
- // Clear any old data to prepare to display the Loading... message.
var GBPreviewDiv = document.getElementById("rdetail_preview_div");
var GBPBook;
@@ -883,22 +898,23 @@
if ( GBPBook.preview != "noview" ) {
if ( GBPBook.preview == 'full' ) {
- setText( $('rdetail_preview_link'), 'Full Text' );
- $('rdetail_preview_link_a').title = 'See the full text of this book.';
+ setText( $('rdetail_preview_link'), $('rdetail_preview_full_text').innerHTML );
+ $('rdetail_preview_link_a').title = $('rdetail_preview_title').innerHTML;
}
// Add a button below the book cover image to load the preview.
GBPBadge = document.createElement( 'img' );
GBPBadge.src = 'http://books.google.com/intl/en/googlebooks/images/gbs_preview_button1.gif';
- GBPBadge.title = 'Show a preview of this book from Google Book Search';
+ GBPBadge.title = $('rdetail_preview_badge').innerHTML;
GBPBadge.style.border = 0;
GBPBadgelink = document.createElement( 'a' );
GBPBadgelink.href = 'javascript:rdetailShowExtra("preview");';
GBPBadgelink.appendChild( GBPBadge );
$('rdetail_image_cell').appendChild( GBPBadgelink );
+ $('rdetail_preview_div').style.height = 600;
+ /* Display the "Preview" tab in the Extras section */
unHideMe( $('rdetail_preview_link' ) );
- $('rdetail_preview_div').style.height = 600;
}
}
@@ -909,6 +925,7 @@
* XXX I18N of Google Book Preview language attribute needed
*/
function rdetailDisplayGBPreview() {
+ unHideMe($('rdetail_extras_loading'));
GBPreviewPane = $('rdetail_preview_div');
if ( GBPreviewPane.getAttribute('loaded') == null ||
GBPreviewPane.getAttribute('loaded') == "false" ) {
@@ -918,6 +935,7 @@
}
function rdetailGBPViewerLoadCallback() {
+ hideMe($('rdetail_extras_loading'));
var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div'));
GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) );
More information about the open-ils-commits
mailing list