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

Return to bug 28179