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

(-)a/koha-tmpl/intranet-tmpl/js/coce.js (-1 / +2 lines)
Lines 39-45 KOHA.coce = { Link Here
39
                                $(this).closest(".coce-coverimg").remove();
39
                                $(this).closest(".coce-coverimg").remove();
40
                            }
40
                            }
41
                        };
41
                        };
42
                        $(this).html(img);
42
                        $(this).attr('href', url);
43
                        $(this).append(img);
43
                    });
44
                    });
44
                }
45
                }
45
            },
46
            },
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-17 / +39 lines)
Lines 40-45 Link Here
40
  [% END %]
40
  [% END %]
41
</title>
41
</title>
42
[% INCLUDE 'doc-head-close.inc' %]
42
[% INCLUDE 'doc-head-close.inc' %]
43
[% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %]
43
</head>
44
</head>
44
45
45
<body id="catalog_detail" class="catalog">
46
<body id="catalog_detail" class="catalog">
Lines 193-200 Link Here
193
                        [% IF localimages.count %]
194
                        [% IF localimages.count %]
194
                            [% FOREACH image IN localimages %]
195
                            [% FOREACH image IN localimages %]
195
                                <div class="cover-image local-coverimg">
196
                                <div class="cover-image local-coverimg">
196
                                    <a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
197
                                    <a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
197
                                        <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" />
198
                                        <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
198
                                    </a>
199
                                    </a>
199
                                    <div class="hint">Local cover image</div>
200
                                    <div class="hint">Local cover image</div>
200
                                </div>
201
                                </div>
Lines 204-211 Link Here
204
205
205
                    [% IF ( AdlibrisEnabled && normalized_isbn ) %]
206
                    [% IF ( AdlibrisEnabled && normalized_isbn ) %]
206
                        <div class="cover-image" id="adlibris-coverimg">
207
                        <div class="cover-image" id="adlibris-coverimg">
207
                            <a href="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]">
208
                            <a href="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" title="Addlibris cover image">
208
                                <img src="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" class="adlibris-cover-big" alt="Adlibris cover image" />
209
                                <img src="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" class="adlibris-cover-big" alt="Adlibris cover image" data-link="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" />
209
                            </a>
210
                            </a>
210
                            <div class="hint">Image from Adlibris</div>
211
                            <div class="hint">Image from Adlibris</div>
211
                        </div>
212
                        </div>
Lines 213-220 Link Here
213
214
214
                    [% IF ( AmazonCoverImages && normalized_isbn) %]
215
                    [% IF ( AmazonCoverImages && normalized_isbn) %]
215
                        <div class="cover-image" id="amazon-bookcoverimg">
216
                        <div class="cover-image" id="amazon-bookcoverimg">
216
                            <a href="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link">
217
                            <a href="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.LZZZZZZZ.jpg" title="Amazon cover image">
217
                                <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | html %].01.MZZZZZZZ.jpg" alt="Amazon cover image" />
218
                                <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.MZZZZZZZ.jpg" alt="Amazon cover image" data-link="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"/>
218
                            </a>
219
                            </a>
219
                            <div class="hint">Image from Amazon.com</div>
220
                            <div class="hint">Image from Amazon.com</div>
220
                        </div>
221
                        </div>
Lines 224-230 Link Here
224
                        [% coce_id = normalized_ean || normalized_isbn %]
225
                        [% coce_id = normalized_ean || normalized_isbn %]
225
                        <div class="cover-image" id="coce-coverimg">
226
                        <div class="cover-image" id="coce-coverimg">
226
                            [% IF ( coce_id ) %]
227
                            [% IF ( coce_id ) %]
227
                                <span title="[% biblionumber | url %]" class="[% coce_id | html %]" id="coce-thumbnail-preview"></span>
228
                                <a title="Image from Coce" class="[% coce_id | html %]" id="coce-thumbnail-preview"></a>
228
                            [% ELSE %]
229
                            [% ELSE %]
229
                                <span class="no-image">No cover image available</span>
230
                                <span class="no-image">No cover image available</span>
230
                            [% END %]
231
                            [% END %]
Lines 236-242 Link Here
236
                        [% SET custom_cover_image_url = biblio.custom_cover_image_url %]
237
                        [% SET custom_cover_image_url = biblio.custom_cover_image_url %]
237
                        [% IF custom_cover_image_url %]
238
                        [% IF custom_cover_image_url %]
238
                            <div class="cover-image" id="custom-coverimg">
239
                            <div class="cover-image" id="custom-coverimg">
239
                                <a class="custom_cover_image" href="[% custom_cover_image_url | url %]">
240
                                <a class="custom_cover_image" href="[% custom_cover_image_url | url %]" title="Custom cover image">
240
                                    <img id="custom-img" alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
241
                                    <img id="custom-img" alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
241
                                </a>
242
                                </a>
242
                                <div class="hint">Custom cover image</div>
243
                                <div class="hint">Custom cover image</div>
Lines 350-356 Link Here
350
                                <div class="cover-slider">
351
                                <div class="cover-slider">
351
                                    [% FOREACH image IN item.cover_images %]
352
                                    [% FOREACH image IN item.cover_images %]
352
                                        <div class="cover-image local-coverimg">
353
                                        <div class="cover-image local-coverimg">
353
                                            <a href="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
354
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
354
                                                <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" />
355
                                                <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" />
355
                                            </a>
356
                                            </a>
356
                                        </div>
357
                                        </div>
Lines 1011-1016 Note that permanent location is a code, and location may be an authval. Link Here
1011
    [% INCLUDE 'catalog-strings.inc' %]
1012
    [% INCLUDE 'catalog-strings.inc' %]
1012
    [% Asset.js("js/catalog.js") | $raw %]
1013
    [% Asset.js("js/catalog.js") | $raw %]
1013
    [% Asset.js("js/coce.js") | $raw %]
1014
    [% Asset.js("js/coce.js") | $raw %]
1015
    [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1014
    <script>
1016
    <script>
1015
        var interface = "[% interface | html %]";
1017
        var interface = "[% interface | html %]";
1016
        var theme = "[% theme | html %]";
1018
        var theme = "[% theme | html %]";
Lines 1018-1028 Note that permanent location is a code, and location may be an authval. Link Here
1018
        function verify_images() {
1020
        function verify_images() {
1019
            // Loop over each container in the template which contains covers
1021
            // Loop over each container in the template which contains covers
1020
            $(".cover-slider").each(function(){
1022
            $(".cover-slider").each(function(){
1023
                var lightbox_descriptions = [];
1021
                $(this).find(".cover-image").each( function( index ){
1024
                $(this).find(".cover-image").each( function( index ){
1022
                    var div = $(this);
1025
                    var div = $(this);
1023
                    // Find the image in the container
1026
                    // Find the image in the container
1024
                    var img = div.find("img")[0];
1027
                    var img = div.find("img")[0];
1025
                    if( $(img).length > 0 ){
1028
                    if( $(img).length > 0 ){
1029
                        var description = "";
1026
                        if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
1030
                        if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
1027
                            // No image loaded in the container. Remove the slide
1031
                            // No image loaded in the container. Remove the slide
1028
                            div.remove();
1032
                            div.remove();
Lines 1039-1066 Note that permanent location is a code, and location may be an authval. Link Here
1039
                                    // Amazon returned single-pixel placeholder
1043
                                    // Amazon returned single-pixel placeholder
1040
                                    // Remove the container
1044
                                    // Remove the container
1041
                                    div.remove();
1045
                                    div.remove();
1046
                                } else {
1047
                                    lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1042
                                }
1048
                                }
1043
                            }
1049
                            } else if( div.attr("id") == "custom-coverimg" ){
1044
                            if( div.attr("id") == "custom-img" ){
1045
                                if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1050
                                if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1046
                                    // No image was loaded via the CustomCoverImages system preference
1051
                                    // No image was loaded via the CustomCoverImages system preference
1047
                                    // Remove the container
1052
                                    // Remove the container
1048
                                    div.remove();
1053
                                    div.remove();
1054
                                } else {
1055
                                    lightbox_descriptions.push("Custom cover image");
1049
                                }
1056
                                }
1050
                            }
1057
                            } else if( div.attr("id") == "coce-coverimg" ){
1051
                            if( div.attr("id") == "coce-coverimg" ){
1052
                                // Identify which service's image is being loaded by Coce
1058
                                // Identify which service's image is being loaded by Coce
1059
                                var coce_description;
1053
                                if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1060
                                if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1054
                                    div.find(".hint").html(_("Coce image from Amazon.com"));
1061
                                    coce_description = ("Coce image from Amazon.com");
1055
                                } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1062
                                } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1056
                                    div.find(".hint").html(_("Coce image from Google Books"));
1063
                                    coce_description = _("Coce image from Google Books");
1057
                                } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1064
                                } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1058
                                    div.find(".hint").html(_("Coce image from Open Library"));
1065
                                    coce_description = _("Coce image from Open Library");
1059
                                }
1066
                                }
1067
                                div.find(".hint").html(coce_description);
1068
                                lightbox_descriptions.push(coce_description);
1069
                            } else if ( div.attr("id") == "adlibris-coverimg" ){
1070
                                lightbox_descriptions.push(_("Image from Adlibris (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1071
                            } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1072
                                lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1073
                            } else {
1074
                                console.log("Source of the image cannot be guessed.")
1060
                            }
1075
                            }
1061
                        }
1076
                        }
1062
                    }
1077
                    }
1063
                });
1078
                });
1079
1080
                // Lightbox for cover images
1081
                Chocolat(this.querySelectorAll('.cover-image a'), {
1082
                    description: function(){
1083
                        return lightbox_descriptions[this.settings.currentImageIndex];
1084
                    }
1085
                });
1086
1064
            });
1087
            });
1065
1088
1066
            $(".cover-slider").each(function(){
1089
            $(".cover-slider").each(function(){
1067
- 

Return to bug 28179