From 3c0cdedfb00528e64dc35c98523258d641e312e4 Mon Sep 17 00:00:00 2001 From: Charles Farmer Date: Fri, 30 Mar 2018 11:58:55 -0400 Subject: [PATCH] Bug 18421: Add Coce to the staff intranet TEST PLAN: 1) Apply the patch with git-bz 2) Run updatedatabase.pl 2.1) Console output should confirm database modification 3) Visit the 'Enhanced Content' tab of admin/syspref 3.1) ressource is /cgi-bin/koha/admin/preferences.pl?tab=enhanced_content 3.2) You should see that the previous preference, Coce, is now CoceOPAC, and that a new preference was added, CoceIntranet 4) Activate CoceIntranet 5) Do a search for a book for which you have a Coce cover 5.1) The cover image url should now point to a provider you defined in Coce 5.2) Your Coce log should show a query 6) Click on the book's name to visit the detail.pl page 6.1) The book's cover should also be provided by Coce on that page Signed-off-by: Owen Leonard Signed-off-by: Alex Buckley Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- .../bug_18421_add_coce_intranet.perl | 24 +++++++++++ installer/data/mysql/sysprefs.sql | 3 +- .../admin/preferences/enhanced_content.pref | 10 ++++- .../prog/en/modules/catalogue/detail.tt | 25 ++++++++++- .../prog/en/modules/catalogue/results.tt | 25 ++++++++++- koha-tmpl/intranet-tmpl/prog/js/coce.js | 43 +++++++++++++++++++ .../bootstrap/en/includes/opac-bottom.inc | 2 +- .../bootstrap/en/includes/shelfbrowser.inc | 2 +- .../bootstrap/en/modules/opac-detail.tt | 10 ++--- .../bootstrap/en/modules/opac-results.tt | 6 +-- 10 files changed, 133 insertions(+), 17 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl create mode 100644 koha-tmpl/intranet-tmpl/prog/js/coce.js diff --git a/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl b/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl new file mode 100755 index 0000000000..af27757b60 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl @@ -0,0 +1,24 @@ +#! /usr/bin/perl + +use Modern::Perl; +use C4::Context; + +my $dbh=C4::Context->dbh; + +################ +# IntranetCoce # +################ + +# validate systempreferences.Coce and save the config for OpacCoce +my $current_coce_pref = C4::Context->preference('Coce') || 0; + +# add two new systempreferences in order to have distinct behavior between intranet and OPAC +$dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES + ('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'), + ('OpacCoce','$current_coce_pref', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo') + ;") or die "Error applying Bug 18421: error inserting new values into database: ". $dbh->errstr . "\n"; + +$dbh->do("DELETE IGNORE FROM systempreferences WHERE variable = 'Coce';") + or die "Error applying Bug 18421: error deleting the old syspref 'Coce': ". $dbh->errstr . "\n"; + +print "Upgrade to XX.XX done (Bug 18421: Add Coce image cache to the Intranet)\n"; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index bb3c8098d8..cb172ffaa0 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -121,7 +121,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'), ('CircSidebar','0',NULL,'Activate or deactivate the navigation sidebar on all Circulation pages','YesNo'), ('ClaimsBccCopy','0','','Bcc the ClaimAcquisition and ClaimIssues alerts','YesNo'), -('Coce','0', NULL, 'If on, enables cover retrieval from the configured Coce server', 'YesNo'), ('CoceHost', '', NULL, 'Coce server URL', 'Free'), ('CoceProviders', '', 'aws,gb,ol', 'Coce providers', 'multiple'), ('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','YesNo'), @@ -248,6 +247,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'), ('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'), ('IntranetCirculationHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the reports home page', 'Free'), +('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'), ('intranetcolorstylesheet','','50','Define the color stylesheet to use in the Staff Client','free'), ('IntranetFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','free'), ('IntranetmainUserblock','','70|10','Add a block of HTML that will display on the intranet home page','Textarea'), @@ -361,6 +361,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'), ('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'), ('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'), +('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'), ('OpacCustomSearch','','70|10','Replace the search box on the OPAC with the provided HTML','Textarea'), ('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'), ('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), 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 f6e01e2ea2..9f90d15f0a 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 @@ -412,11 +412,17 @@ Enhanced Content: - pref: RecordedBooksDomain Coce Cover images cache: - - - pref: Coce + - pref: OpacCoce choices: yes: Enable no: "Don't enable" - - a Coce image cache service. + - a Coce image cache service in the OPAC. + - + - pref: IntranetCoce + choices: + yes: Enable + no: "Don't enable" + - a Coce image cache service in the staff intranet. - - Coce server URL - pref: CoceHost diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 05f6ba3dcc..c1dabf218e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -63,13 +63,19 @@
The record you requested does not exist ([% biblionumber | html %]).
[% ELSE %] +[% + IntranetCoce = Koha.Preference('IntranetCoce') + CoceProviders = Koha.Preference('CoceProviders') + CoceHost = Koha.Preference('CoceHost') +%] + [% INCLUDE 'cat-toolbar.inc' %] [% IF ( ocoins ) %] [% END %] - [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled ) %] + [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce ) %]
[% ELSE %]
@@ -121,7 +127,7 @@ [% END %] - [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled ) %] + [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce ) %]
[% IF ( LocalCoverImages ) %]
@@ -135,6 +141,16 @@
[% END %] + [% IF ( IntranetCoce && CoceProviders ) %] + [% coce_id = normalized_ean || normalized_isbn %] + + [% IF ( coce_id ) %] + + [% ELSE %] + No cover image available + [% END %] + + [% END %] [% END %]
@@ -754,6 +770,7 @@ [% INCLUDE 'catalog-strings.inc' %] [% Asset.js("js/catalog.js") | $raw %] [% INCLUDE 'greybox.inc' %] + [% END %] -[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %] +[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] [% Asset.js("js/coce.js") | $raw %]