From 4277ed47acd32381ba26e2b296a2e4b0f03ad9b4 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Sat, 9 Jun 2012 06:50:16 -0400 Subject: [PATCH] Bug 5292 - Google Preview Option for OPAC Adds option to insert link for Google Books preview into opac for items with available preview. Patch based on original work by Darrel Ulm. --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../admin/preferences/enhanced_content.pref | 7 +++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 9 +++++++++ opac/opac-detail.pl | 5 ++++- 5 files changed, 28 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2ffe2df..2928016 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -365,3 +365,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',NULL,'Integer'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('GoogleBooksPreview','1','Display the ability to place multiple holds or not','','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index dbbdee3..66b08e6 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5308,6 +5308,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.09.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('GoogleBooksPreview','1','Display the ability to place multiple holds or not','','YesNo')"); + print "Upgrade to $DBversion done (Add GooglePreview syspref)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref index bb3bc2d..c867139 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -166,6 +166,13 @@ Enhanced Content: yes: Add no: "Don't add" - cover images from Open Library to search results and item detail pages on the OPAC. + Google Books Preview: + - + - pref: GoogleBooksPreview + choices: + yes: Add + no: "Don't add" + - a Google Books preview link to the OPAC item details page when a matching ISBN is found. Library Thing: # Awkward syntax below, due to quoting conflicts - diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 3c45aff..18911d2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -295,6 +295,15 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
+ + [% IF ( GoogleBooksPreview ) %] + [% IF ( normalized_isbn ) %] + + +
+ [% END %] + [% END %] + [% IF ( OPACLocalCoverImages ) %]
[% END %] [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( OPACurlOpenInNewWindow ) %]Cover image[% ELSE %]Cover image[% END %][% END %][% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 0014c27..03770dc 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -75,7 +75,10 @@ if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; } -$template->param( biblionumber => $biblionumber ); +$template->param( + biblionumber => $biblionumber, + GoogleBooksPreview => C4::Context->preference('GoogleBooksPreview'), +); # get biblionumbers stored in the cart my @cart_list; -- 1.7.2.5