Bug 9580: (QA followup) add a Coce syspref and fix options for Providers

This proposed followup adds a 'Coce' syspref so it is consistent with
the rest of the enhanced content providers sysprefs (also, there's no
point making the user delete its configuration if disabling his Coce
integration for testing purposes, for example).

It also changes the CoceProviders syspref so it is a 'multiple' type
syspref. It puts some sensible descriptions to the options too.

Feel free to discuss this followup, it is just an idea!

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

  - OK for the 'Coce' syspref: it's sensible to distinct configuration
    from enabling/disbaling the service.
  - OK also for the multichoices systempreference. If a new service
    popup, it won't be difficult to amend the .pref file.
This commit is contained in:
Tomas Cohen Arazi 2015-03-31 13:58:37 -03:00
parent 9570439c50
commit 4ad600ffed
7 changed files with 29 additions and 13 deletions

View File

@ -86,8 +86,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'),
('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'),
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
('Coce','0', NULL, 'If on, enables cover retrieval from the configured Coce server', 'YesNo'),
('CoceHost', NULL, NULL, 'Coce server URL', 'Free'),
('CoceProviders', NULL, NULL, 'Coce providers, for example aws,gb', 'Free'),
('CoceProviders', NULL, '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'),
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'),

View File

@ -9955,15 +9955,19 @@ if ( CheckVersion($DBversion) ) {
$DBversion = "3.19.00.XXX";
if ( CheckVersion($DBversion) ) {
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
VALUES('Coce','0', 'If on, enables cover retrieval from the configured Coce server', NULL, 'YesNo')
});
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
VALUES('CoceHost', NULL, 'Coce server URL', NULL,'Free')
});
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
VALUES('CoceProviders', NULL, 'Coce Providers, for example: aws,gb', NULL,'Free')
VALUES('CoceProviders', NULL, 'Coce providers', 'aws,gb,ol', 'multiple')
});
print "Upgrade to $DBversion done (Bug 9580 - Cover image from Coce, a remote image URL cache)\n";
print "Upgrade to $DBversion done (Bug 9580: Cover image from Coce, a remote image URL cache)\n";
SetVersion($DBversion);
}

View File

@ -338,11 +338,20 @@ Enhanced Content:
- pref: OverDriveLibraryID
- .
Coce Cover images cache:
-
- pref: Coce
choices:
yes: Enable
no: "Don't enable"
- a Coce image cache service.
-
- Coce server URL
- pref: CoceHost
class: url
-
- Providers
- Use the following providers to fetch the covers
- pref: CoceProviders
- 'separated by comma, for example: aws,gb. Leave empty not to activate this service.'
multiple:
aws: Amazon Web Services
gb: Google Books
ol: Open Library

View File

@ -165,7 +165,7 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
//]]>
</script>
[% END %]
[% IF Koha.Preference('CoceProviders') %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
<script type="text/javascript" src="[% interface %]/[% theme %]/js/coce.js"></script>
<script type="text/javascript">
//<![CDATA[

View File

@ -53,7 +53,7 @@
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
[% coce_id = item.browser_normalized_ean || item.browser_normalized_isbn %]
<div title="[% item.biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail-preview-[% coce_id %]"></div>
[% END %]

View File

@ -79,7 +79,7 @@
[% IF ( GoogleJackets ) %]
<div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="gbs-thumbnail-preview"></div>
[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
[% coce_id = normalized_ean || normalized_isbn %]
<div style="block" title="[% biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail-preview"></div>
[% END %]
@ -1445,7 +1445,7 @@
[% IF ( GoogleJackets ) %]
KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
[% END %]
@ -1506,7 +1506,7 @@
[% IF ( GoogleJackets ) %]
KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
[% END %]
[% IF OpenLibraryCovers %]
@ -1532,7 +1532,7 @@
[% IF ( GoogleJackets ) %]
KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
[% END %]
[% IF OpenLibraryCovers %]

View File

@ -257,7 +257,7 @@
[% END %]
[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
[% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
[% IF ( coce_id ) %]
<span style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail[% loop.count %]"></span>
@ -913,7 +913,9 @@ $(document).ready(function(){
[% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
[% IF ( Koha.Preference('CoceProviders') ) %]KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]');[% END %]
[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]');
[% END %]
[% IF ( DidYouMean ) %]
$("#didyoumean").load("/cgi-bin/koha/svc/suggestion?render=stub&q=[% querystring |uri %]",