From 6f4994ff4dc588bab1b83173c414e6161b6d704e 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 (Note that the selector has been changed from %% to {} in a coming patch) 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 Signed-off-by: Hayley Mapley Signed-off-by: Hugo Agud Signed-off-by: Owen Leonard Signed-off-by: Michal Denar Signed-off-by: Kyle Hall Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- .../data/mysql/atomicupdate/bug_xxxxx.perl | 14 ++++++++++++++ installer/data/mysql/sysprefs.sql | 3 +++ .../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 75b04e2fd0..11aa53d1dc 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -128,6 +128,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'), @@ -361,6 +363,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), +('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 7d1cdfc45d..1315dd9c03 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.39.5