View | Details | Raw Unified | Return to bug 9580
Collapse All | Expand All

(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 86-91 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
86
('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'),
86
('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'),
87
('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'),
87
('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'),
88
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
88
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
89
('CoceHost', 0, NULL, 'Coce server URL', 'Free'),
90
('CoceProviders', 0, NULL, 'Coce providers, for example aws,gb', 'Free'),
89
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','YesNo'),
91
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','YesNo'),
90
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
92
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
91
('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'),
93
('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'),
(-)a/installer/data/mysql/updatedatabase.pl (+15 lines)
Lines 8891-8896 if ( CheckVersion($DBversion) ) { Link Here
8891
    SetVersion($DBversion);
8891
    SetVersion($DBversion);
8892
}
8892
}
8893
8893
8894
$DBversion = "3.17.00.XXX";
8895
if ( CheckVersion($DBversion) ) {
8896
    $dbh->do(q{
8897
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
8898
        VALUES('CoceHost', NULL, 'Coce server URL', NULL,'Free')
8899
    });
8900
    $dbh->do(q{
8901
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
8902
        VALUES('CoceProviders', NULL, 'Coce Providers, for example: aws,gb', NULL,'Free')
8903
    });
8904
    print "Upgrade to $DBversion done (Bug 9580 - Cover image from Coce, a remote image URL cache)\n";
8905
    SetVersion($DBversion);
8906
}
8907
8908
8894
=head1 FUNCTIONS
8909
=head1 FUNCTIONS
8895
8910
8896
=head2 TableExists($table)
8911
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+9 lines)
Lines 337-339 Enhanced Content: Link Here
337
            - "Show items from the OverDrive catalog of library #"
337
            - "Show items from the OverDrive catalog of library #"
338
            - pref: OverDriveLibraryID
338
            - pref: OverDriveLibraryID
339
            - .
339
            - .
340
    Coce Cover images cache:
341
        -
342
            - Coce server URL
343
            - pref: CoceHost
344
              class: url
345
        -
346
            - Providers
347
            - pref: CoceProviders
348
            - 'separated by comma, for example: aws,gb. Leave empty not to activate this service.'
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+9 lines)
Lines 166-171 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
166
        //]]>
166
        //]]>
167
    </script>
167
    </script>
168
[% END %]
168
[% END %]
169
[% IF Koha.Preference('CoceProviders') %]
170
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/coce.js"></script>
171
    <script type="text/javascript">
172
        //<![CDATA[
173
        var NO_COCE_JACKET = _("No cover image available");
174
        //]]>
175
    </script>
176
[% END %]
177
169
[% IF OpenLibraryCovers %]
178
[% IF OpenLibraryCovers %]
170
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/openlibrary.js"></script>
179
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/openlibrary.js"></script>
171
    <script type="text/javascript">
180
    <script type="text/javascript">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (+7 lines)
Lines 79-84 Link Here
79
                    [% IF ( GoogleJackets ) %]
79
                    [% IF ( GoogleJackets ) %]
80
                        <div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="gbs-thumbnail-preview"></div>
80
                        <div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="gbs-thumbnail-preview"></div>
81
                    [% END %]
81
                    [% END %]
82
                    [% IF Koha.Preference('CoceProviders') %]
83
                      <div style="block" title="[% biblionumber |url %]" class="[% IF ( normalized_ean ) %][% normalized_ean %][% ELSE %][% normalized_isbn %][% END %]" id="coce-thumbnail-preview"></div>
84
                    [% END %]
82
                    [% IF OpenLibraryCovers %]
85
                    [% IF OpenLibraryCovers %]
83
                        <div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="openlibrary-thumbnail-preview"></div>
86
                        <div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="openlibrary-thumbnail-preview"></div>
84
                    [% END %]
87
                    [% END %]
Lines 1430-1435 Link Here
1430
    [% IF ( GoogleJackets ) %]
1433
    [% IF ( GoogleJackets ) %]
1431
        KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1434
        KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1432
    [% END %]
1435
    [% END %]
1436
    [% IF Koha.Preference('CoceProviders') %]
1437
        KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
1438
    [% END %]
1439
1433
    [% IF OpenLibraryCovers %]
1440
    [% IF OpenLibraryCovers %]
1434
        KOHA.OpenLibrary.GetCoverFromIsbn();
1441
        KOHA.OpenLibrary.GetCoverFromIsbn();
1435
    [% END %]
1442
    [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+9 lines)
Lines 257-262 Link Here
257
                                                            [% END %]
257
                                                            [% END %]
258
                                                        [% END %]
258
                                                        [% END %]
259
259
260
                                                        [% IF Koha.Preference('CoceProviders') %]
261
                                                          [% IF ( SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn ) %]
262
                                                            <span style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% IF ( SEARCH_RESULT.normalized_ean ) %][% SEARCH_RESULT.normalized_ean %][% ELSE %][% SEARCH_RESULT.normalized_isbn %][% END %]" id="coce-thumbnail[% loop.count %]"></span>
263
                                                          [% ELSE %]
264
                                                            <span class="no-image">No cover image available</span>
265
                                                          [% END %]
266
                                                        [% END %]
267
260
                                                        [% IF OpenLibraryCovers %]
268
                                                        [% IF OpenLibraryCovers %]
261
                                                            [% IF SEARCH_RESULT.normalized_isbn %]
269
                                                            [% IF SEARCH_RESULT.normalized_isbn %]
262
                                                                <span style="block" title="[% SEARCH_RESULT.biblionumber %]" class="[% SEARCH_RESULT.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>
270
                                                                <span style="block" title="[% SEARCH_RESULT.biblionumber %]" class="[% SEARCH_RESULT.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>
Lines 908-913 $(document).ready(function(){ Link Here
908
[% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
916
[% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
909
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
917
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
910
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
918
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
919
[% IF Koha.Preference('CoceProviders') %]KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]');[% END %]
911
920
912
[% IF ( DidYouMean ) %]
921
[% IF ( DidYouMean ) %]
913
    $("#didyoumean").load("/cgi-bin/koha/svc/suggestion?render=stub&q=[% querystring |uri %]",
922
    $("#didyoumean").load("/cgi-bin/koha/svc/suggestion?render=stub&q=[% querystring |uri %]",
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/coce.js (-1 / +43 lines)
Line 0 Link Here
0
- 
1
if (KOHA === undefined || !KOHA) { var KOHA = {}; }
2
3
4
/**
5
 * A namespace for Coce cover images cache
6
 */
7
KOHA.coce = {
8
9
  /**
10
   * Search all:
11
   *    <div title="biblionumber" id="isbn" class="coce-thumbnail"></div>
12
   * or
13
   *    <div title="biblionumber" id="isbn" class="coce-thumbnail-preview"></div>
14
   * and run a search with all collected isbns to coce cover service.
15
   * The result is asynchronously returned, and used to append <img>.
16
   */
17
  getURL: function(host,provider,newWindow) {
18
    var ids = [];
19
    $("[id^=coce-thumbnail]").each(function(i) {
20
        var id = $(this).attr("class"); // id=isbn
21
        if ( id !== '' ) { ids.push(id); }
22
    });
23
    if (ids.length == 0) return;
24
    ids = ids.join(',');
25
    var coceURL = host + '/cover?id=' + ids + '&provider=' + provider;
26
    $.ajax({
27
      url: coceURL,
28
      dataType: 'jsonp',
29
      success: function(urlPerID){
30
        for (var id in urlPerID) {
31
          var url = urlPerID[id];
32
          $("[id^=coce-thumbnail]."+id).each(function() {
33
            var img = document.createElement("img");
34
            img.src = url;
35
            img.title = url; //FIXME: to delete
36
            $(this).append(img);
37
         });
38
        }
39
      }
40
    });
41
  }
42
43
};

Return to bug 9580