From 6356d81d204bf7a22195b24f3dcc40bbb40fd5f7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 1 Mar 2019 08:00:02 -0300 Subject: [PATCH] Bug 22445: Add new prefs *CustomCoverImages* This patch set adds a new method to display cover images for bibliographic records. The idea is to provide a flexible way allowing several use cases: - local path - remote url - webservice which would follow a given pattern. So far only the following patterns are available: - %isbn% will be replaced byt the isbn of the record - %issn% - using MARC subfields: %024$a% to replace with the value in 024$a For example - /your/local/images/%isbn%.png - https://covers.openlibrary.org/b/isbn/%isbn%-M.jpb - etc. There are 3 new sysprefs: CustomCoverImagesURL => Define the path/url CustomCoverImages => Turn on/off the display of the custom cover image in the staff client OPACCustomCoverImages => Turn on/off the display of the custom cover image at the OPAC Sponsored-by: Orex Digital --- installer/data/mysql/atomicupdate/bug_xxxxx.perl | 14 ++++++++++++++ installer/data/mysql/sysprefs.sql | 3 +++ .../en/modules/admin/preferences/enhanced_content.pref | 17 ++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_xxxxx.perl diff --git a/installer/data/mysql/atomicupdate/bug_xxxxx.perl b/installer/data/mysql/atomicupdate/bug_xxxxx.perl new file mode 100644 index 0000000000..4cf30e86cc --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_xxxxx.perl @@ -0,0 +1,14 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences + ( variable, value, options, explanation, type ) + VALUES + ('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff client. CustomCoverImagesURL must be defined.','YesNo'), + ('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'), + ('CustomCoverImagesURL','',NULL,'Define an URL serving book cover images, using the following patterns: %issn%, %isbn%, FIXME ADD MORE (use it with CustomCoverImages and/or OPACCustomCoverImages)','free') + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - Add new pref *CustomCoverImages*)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d142b14a0e..4e4c098e0c 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -125,6 +125,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'), ('CumulativeRestrictionPeriods',0,NULL,'Cumulate the restriction periods instead of keeping the highest','YesNo'), ('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'), +('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff client. CustomCoverImagesURL must be defined.','YesNo'), +('CustomCoverImagesURL','',NULL,'Define an URL serving book cover images, using the following patterns: %issn%, %isbn%, FIXME ADD MORE (use it with CustomCoverImages and/or OPACCustomCoverImages)','free'), ('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'), ('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'), ('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'), @@ -344,6 +346,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'), +('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','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..e06ae65b3b 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 @@ -313,7 +313,7 @@ Enhanced Content: - pref: TagsExternalDictionary class: file - on the server to be approved without moderation. - Local Cover Images: + Local or remote cover images: - - pref: LocalCoverImages choices: @@ -332,6 +332,21 @@ Enhanced Content: yes: Allow no: "Don't allow" - multiple images to be attached to each bibliographic record. + - + - pref: CustomCoverImages + choices: + yes: Display + no: "Don't display" + - "custom remote url images in the staff client.
" + - pref: OPACCustomCoverImages + choices: + yes: Display + no: "Don't display" + - "custom remote url images at the OPAC.
" + - "Using the following URL:" + - pref: CustomCoverImagesURL + class: url + - "You can defined it using the following patterns: %isbn%, %issn%." HTML5 Media: - - Show a tab with a HTML5 media player for files catalogued in field 856 -- 2.11.0