From 1223d89dacb710c32a251826ccc889d374498f46 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 12 Mar 2013 21:40:46 +1300 Subject: [PATCH] Bug 9817 Add Goodreads reviews to OPAC To test 1/ Go to systempreferences and turn on goodreads reviews 2/ Search for a book in your opac, that is likely to be in Goodreads, and that has an isbn 3/ Look in the opac detail page for a good reads review tab Should work in both prog and ccsr --- C4/Auth.pm | 2 + installer/data/mysql/sysprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 11 +++++ .../admin/preferences/enhanced_content.pref | 12 ++++++ .../prog/en/includes/goodreadsreviews.inc | 44 ++++++++++++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 9 ++++ 6 files changed, 80 insertions(+) create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/goodreadsreviews.inc diff --git a/C4/Auth.pm b/C4/Auth.pm index efe1200..c370de2 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -336,6 +336,8 @@ sub get_template_and_user { noItemTypeImages => C4::Context->preference("noItemTypeImages"), marcflavour => C4::Context->preference("marcflavour"), persona => C4::Context->preference("persona"), + GoodReadsReviews => C4::Context->preference("GoodReadsReviews"), + GoodReadsKey => C4::Context->preference("GoodReadsKey"), ); if ( $in->{'type'} eq "intranet" ) { $template->param( diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index cad409c..1cd5dea 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -418,3 +418,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacItemLocation','callnum','Show the shelving location of items in the opac','callnum|ccode|location','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('TrackClicks','0','Track links clicked',NULL,'Integer'); +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('GoodReadsReviews','0','Show Goodreads Reviews','','YesNo'); + diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 82654d8..7f89f1d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6486,6 +6486,17 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do( + qq{ +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('GoodReadsReviews','0','Show Goodreads Reviews','','YesNo'); + } + ); + print +"Upgrade to $DBversion done (Bug 9207: Add new index batch_id_record_type to import_records)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS 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 74e6553..b9f0553 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 @@ -319,3 +319,15 @@ Enhanced Content: - pref: HTML5MediaExtensions class: multi - (separated with |). + Good Reads: + - + - Good reads API key + - pref: GoodReadsKey + class: password + - you can get a key from http://www.goodreads.com/api/keys + - + - pref: GoodReadsReviews + choices: + yes: "Show" + no: "Don't show" + - a tab in the holdings section in the OPAC for Goodreads reviews diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/goodreadsreviews.inc b/koha-tmpl/opac-tmpl/prog/en/includes/goodreadsreviews.inc new file mode 100644 index 0000000..2e747ff --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/includes/goodreadsreviews.inc @@ -0,0 +1,44 @@ + +
+
+

Goodreads reviews for [% title |html %]

+ + +
+
+ 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 6321efd..ad1c0d3 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -976,6 +976,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( IDreamBooksReviews ) %] [% END %] + +[% IF GoodReadsReviews %] +
  • Goodreads Reviews
  • +[% END %] + [% IF ( serialcollection ) %] @@ -1324,6 +1329,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] +[% IF GoodReadsReviews %] + [% INCLUDE 'goodreadsreviews.inc' %] +[% END %] + [% IF ( OPACLocalCoverImages && localimages.size ) %]

    Click on an image to view it in the image viewer

    -- 1.7.10.4