Enhance i18n support for Google Book Preview - addresses #50.
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 24 Mar 2009 03:53:36 +0000 (03:53 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 24 Mar 2009 03:53:36 +0000 (03:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12650 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml

index 42664be..fdaf656 100644 (file)
@@ -535,6 +535,9 @@ We recommend that you remove this title from any bookbags it may have been added
 <!ENTITY rdetail.extras.marc "MARC Record">
 <!ENTITY rdetail.extras.call.null "There are no call numbers for this item at this location.">
 <!ENTITY rdetail.extras.call.local "Local Call Numbers:">
+<!ENTITY rdetail.extras.preview.fulltext "Full text">
+<!ENTITY rdetail.extras.preview.title "See the full text of this book.">
+<!ENTITY rdetail.extras.preview.badge "Show a preview of this book from Google Book Search">
 <!ENTITY rdetail.loading "Loading copy infomation...">
 <!ENTITY rdetail.noneAvailable " * There are no copies in this location">
 <!ENTITY rdetail.summary.online "Online Resources">
index b973267..04ce435 100644 (file)
@@ -800,17 +800,11 @@ function _rdetailSortStatuses(a, b) {
 }
 
 /**
- * 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()) );
-
 }
 
 /**
@@ -850,7 +844,6 @@ function searchForGBPreview( isbn ) {
  * @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;
 
@@ -864,22 +857,23 @@ function GBPreviewCallback(GBPBookInfo) {
 
        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;
        }
 }
 
@@ -890,6 +884,7 @@ function GBPreviewCallback(GBPBookInfo) {
  * 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" ) {
@@ -899,6 +894,7 @@ function rdetailDisplayGBPreview() {
 }
 
 function rdetailGBPViewerLoadCallback() {
+       hideMe($('rdetail_extras_loading'));
        var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div'));
        GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) );
 
index 7b38f9a..96a8fdc 100644 (file)
                <!--#include virtual="rdetail_cn_details.xml"-->
 
        </div>
+       <!-- Text for dynamic JavaScript -->
+       <div id='rdetail_preview_full_text' class='hide_me'>&rdetail.extras.preview.fulltext;</div>
+       <div id='rdetail_preview_title' class='hide_me'>&rdetail.extras.preview.title;</div>
+       <div id='rdetail_preview_badge' class='hide_me'>&rdetail.extras.preview.badge;</div>
 </div>