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

(-)a/C4/ShelfBrowser.pm (+2 lines)
Lines 73-78 to take into account. Link Here
73
  	  print $_->{browser_normalized_upc};
73
  	  print $_->{browser_normalized_upc};
74
  	  print $_->{browser_normalized_oclc};
74
  	  print $_->{browser_normalized_oclc};
75
  	  print $_->{browser_normalized_isbn};
75
  	  print $_->{browser_normalized_isbn};
76
      print $_->{browser_normalized_ean};
76
  }
77
  }
77
78
78
  # This is the information required to scroll the browser to the next left
79
  # This is the information required to scroll the browser to the next left
Lines 228-233 sub GetShelfInfo { Link Here
228
        $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour);
229
        $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour);
229
        $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
230
        $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
230
        $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
231
        $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
232
        $item->{'browser_normalized_ean'} = GetNormalizedEAN($this_record,$marcflavour);
231
        push @valid_items, $item;
233
        push @valid_items, $item;
232
    }
234
    }
233
    return @valid_items;
235
    return @valid_items;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 87-92 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
87
('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'),
87
('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'),
88
('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
('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'),
89
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
89
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
90
('CoceHost', NULL, NULL, 'Coce server URL', 'Free'),
91
('CoceProviders', NULL, NULL, 'Coce providers, for example aws,gb', 'Free'),
90
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','YesNo'),
92
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','YesNo'),
91
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
93
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
92
('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'),
94
('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 9608-9613 if ( CheckVersion($DBversion) ) { Link Here
9608
    SetVersion ($DBversion);
9608
    SetVersion ($DBversion);
9609
}
9609
}
9610
9610
9611
$DBversion = "3.19.00.XXX";
9612
if ( CheckVersion($DBversion) ) {
9613
    $dbh->do(q{
9614
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
9615
        VALUES('CoceHost', NULL, 'Coce server URL', NULL,'Free')
9616
    });
9617
    $dbh->do(q{
9618
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
9619
        VALUES('CoceProviders', NULL, 'Coce Providers, for example: aws,gb', NULL,'Free')
9620
    });
9621
    print "Upgrade to $DBversion done (Bug 9580 - Cover image from Coce, a remote image URL cache)\n";
9622
    SetVersion($DBversion);
9623
}
9624
9625
9611
=head1 FUNCTIONS
9626
=head1 FUNCTIONS
9612
9627
9613
=head2 TableExists($table)
9628
=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 165-170 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
165
        //]]>
165
        //]]>
166
    </script>
166
    </script>
167
[% END %]
167
[% END %]
168
[% IF Koha.Preference('CoceProviders') %]
169
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/coce.js"></script>
170
    <script type="text/javascript">
171
        //<![CDATA[
172
        var NO_COCE_JACKET = _("No cover image available");
173
        //]]>
174
    </script>
175
[% END %]
176
168
[% IF OpenLibraryCovers %]
177
[% IF OpenLibraryCovers %]
169
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/openlibrary.js"></script>
178
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/openlibrary.js"></script>
170
    <script type="text/javascript">
179
    <script type="text/javascript">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc (-1 / +5 lines)
Lines 53-58 Link Here
53
                                        <span class="no-image">No cover image available</span>
53
                                        <span class="no-image">No cover image available</span>
54
                                    [% END %]
54
                                    [% END %]
55
                                [% END %]
55
                                [% END %]
56
                                [% IF ( Koha.Preference('CoceProviders') ) %]
57
                                  [% coce_id = item.browser_normalized_ean || item.browser_normalized_isbn %]
58
                                  <div title="[% item.biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail-preview-[% coce_id %]"></div>
59
                                [% END %]
56
                                [% IF ( BakerTaylorEnabled ) %]
60
                                [% IF ( BakerTaylorEnabled ) %]
57
                                    [% IF ( item.browser_normalized_isbn ) %]
61
                                    [% IF ( item.browser_normalized_isbn ) %]
58
                                        <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% item.browser_normalized_isbn %]" />
62
                                        <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% item.browser_normalized_isbn %]" />
Lines 83-86 Link Here
83
            </table>
87
            </table>
84
        </div>
88
        </div>
85
    [% END # /IF OpenOPACShelfBrowser %]
89
    [% END # /IF OpenOPACShelfBrowser %]
86
[% END # end of shelfbrowser block %]
90
[% END # end of shelfbrowser block %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (+14 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
                      [% coce_id = normalized_ean || normalized_isbn %]
84
                      <div style="block" title="[% biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail-preview"></div>
85
                    [% END %]
82
                    [% IF OpenLibraryCovers %]
86
                    [% IF OpenLibraryCovers %]
83
                        <div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="openlibrary-thumbnail-preview"></div>
87
                        <div title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="openlibrary-thumbnail-preview"></div>
84
                    [% END %]
88
                    [% END %]
Lines 1440-1445 Link Here
1440
    [% IF ( GoogleJackets ) %]
1444
    [% IF ( GoogleJackets ) %]
1441
        KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1445
        KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1442
    [% END %]
1446
    [% END %]
1447
    [% IF ( Koha.Preference('CoceProviders') ) %]
1448
        KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
1449
    [% END %]
1450
1443
    [% IF OpenLibraryCovers %]
1451
    [% IF OpenLibraryCovers %]
1444
        KOHA.OpenLibrary.GetCoverFromIsbn();
1452
        KOHA.OpenLibrary.GetCoverFromIsbn();
1445
    [% END %]
1453
    [% END %]
Lines 1497-1502 Link Here
1497
                    [% IF ( GoogleJackets ) %]
1505
                    [% IF ( GoogleJackets ) %]
1498
                      KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1506
                      KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1499
                    [% END %]
1507
                    [% END %]
1508
                    [% IF ( Koha.Preference('CoceProviders') ) %]
1509
                      KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
1510
                    [% END %]
1500
                    [% IF OpenLibraryCovers %]
1511
                    [% IF OpenLibraryCovers %]
1501
                      KOHA.OpenLibrary.GetCoverFromIsbn();
1512
                      KOHA.OpenLibrary.GetCoverFromIsbn();
1502
                    [% END %]
1513
                    [% END %]
Lines 1520-1525 Link Here
1520
                    [% IF ( GoogleJackets ) %]
1531
                    [% IF ( GoogleJackets ) %]
1521
                      KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1532
                      KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);
1522
                    [% END %]
1533
                    [% END %]
1534
                    [% IF ( Koha.Preference('CoceProviders') ) %]
1535
                      KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]',[% covernewwindow %]);
1536
                    [% END %]
1523
                    [% IF OpenLibraryCovers %]
1537
                    [% IF OpenLibraryCovers %]
1524
                      KOHA.OpenLibrary.GetCoverFromIsbn();
1538
                      KOHA.OpenLibrary.GetCoverFromIsbn();
1525
                    [% END %]
1539
                    [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+10 lines)
Lines 257-262 Link Here
257
                                                            [% END %]
257
                                                            [% END %]
258
                                                        [% END %]
258
                                                        [% END %]
259
259
260
                                                        [% IF ( Koha.Preference('CoceProviders') ) %]
261
                                                          [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
262
                                                          [% IF ( coce_id ) %]
263
                                                            <span style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail[% loop.count %]"></span>
264
                                                          [% ELSE %]
265
                                                            <span class="no-image">No cover image available</span>
266
                                                          [% END %]
267
                                                        [% END %]
268
260
                                                        [% IF OpenLibraryCovers %]
269
                                                        [% IF OpenLibraryCovers %]
261
                                                            [% IF SEARCH_RESULT.normalized_isbn %]
270
                                                            [% IF SEARCH_RESULT.normalized_isbn %]
262
                                                                <span style="block" title="[% SEARCH_RESULT.biblionumber %]" class="[% SEARCH_RESULT.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>
271
                                                                <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 %]
917
[% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
909
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
918
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
910
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
919
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
920
[% IF ( Koha.Preference('CoceProviders') ) %]KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]');[% END %]
911
921
912
[% IF ( DidYouMean ) %]
922
[% IF ( DidYouMean ) %]
913
    $("#didyoumean").load("/cgi-bin/koha/svc/suggestion?render=stub&q=[% querystring |uri %]",
923
    $("#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).html(img);
37
         });
38
        }
39
      }
40
    });
41
  }
42
43
};

Return to bug 9580