From fd3a378f9a8f43f9ac2b4fae73d881f36cc5f9bf Mon Sep 17 00:00:00 2001 From: Martin Persson Date: Mon, 5 Oct 2015 11:13:15 +0200 Subject: [PATCH] Bug 8630: Adlibris covers (syspref files) This patch adds a system preference for cover images from Swedish book retailer Adlibris. Images are retrieved via http or https from an external web server. This might leak OPAC and Staff interface data to third parties and should thus be used with caution. Sponsored-By: Halland County Library Test plan: Test 1: Test upgrade procedure for clean installation. Start by removing existing sysprefs, if present: $ mysql -u kohaadmin -p -D koha > DELETE FROM `systempreferences` WHERE `variable` LIKE 'Adlibris%'; * Apply this patch which will add a pref file, update the 'syspref' structure and add an atomic upgrade file. * Install the update: Koha$ perl installer/data/mysql/updatedatabase.pl * Once upgraded and logged in, Select 'More', 'Administration', 'Global Preferences' and finally 'Enhanced content'. There should be a new option called 'Adlibris'. The first option should default to "Don't show", if not the patch is broken. The second options should show the default URL: http://www.adlibris.com/se/organisationer/showimagesafe.aspx If not, the patch is broken. Test 2: Changing sysprefs * In the control panel, change the first value from "Don't show" to "Show" and save the changes. Use MySQL client to inspect changes: $ mysql -u kohaadmin -p -D koha > SELECT * FROM `systempreferences` WHERE `variable` LIKE 'Adlibris%'; The column 'value' should now have the value '1', if not the patch is broken. Test 3: Apply update to existing data * Re-execute the installer now that the database has the data already: Koha$ perl installer/data/mysql/updatedatabase.pl If any errors occur the patch is broken. Examine the database contents: $ mysql -u kohaadmin -p -D koha > SELECT * FROM `systempreferences` WHERE `variable` LIKE 'Adlibris%'; If the values were overwritten by the installer the patch is broken. Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- ...bug_8630-add_adlibris_cover_image_syspref.sql | 3 +++ installer/data/mysql/sysprefs.sql | 2 ++ .../admin/preferences/enhanced_content.pref | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_8630-add_adlibris_cover_image_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_8630-add_adlibris_cover_image_syspref.sql b/installer/data/mysql/atomicupdate/bug_8630-add_adlibris_cover_image_syspref.sql new file mode 100644 index 0000000000..36107cd52a --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_8630-add_adlibris_cover_image_syspref.sql @@ -0,0 +1,3 @@ +INSERT IGNORE INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES +('AdlibrisCoversEnabled', '0', NULL, 'Display cover images in OPAC results and detail listing from Swedish retailer Adlibris.','YesNo'), +('AdlibrisCoversURL', 'http://www.adlibris.com/se/organisationer/showimagesafe.aspx', NULL, 'Base URL for Adlibris cover image web service.', 'Free'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ed85d2b0fd..2317a3853d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -8,6 +8,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), ('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'), ('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'), +('AdlibrisCoversEnabled','0',NULL,'Display cover images in OPAC results and detail listing from Swedish retailer Adlibris.','YesNo'), +('AdlibrisCoversURL','http://www.adlibris.com/se/organisationer/showimagesafe.aspx',NULL,'Base URL for Adlibris cover image web service.','Free'), ('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'), ('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option. Example: eng|fre|ita','Textarea'), ('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','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 03fb7fc482..67db1fbb01 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 @@ -1,4 +1,20 @@ Enhanced Content: + Adlibris: + - + - NOTE: Using resources such as external images might leak sensitive data to third parties. + - + - pref: AdlibrisCoversEnabled + default: 0 + choices: + no: "Don't show" + yes: "Show" + - cover images in OPAC results and detail listing from Swedish retailer Adlibris. + - + - Use base URL: + - pref: AdlibrisCoversURL + class: url + default: "http://www.adlibris.com/se/organisationer/showimagesafe.aspx" + - for the Adlibris cover service. All: - - NOTE: you can only choose one source of cover images from below, otherwise Koha will show the images from all sources selected. -- 2.39.5