Bug 11982 - Fixed the amazon no image icon.

A no image icon will only be displayed if both the amazon and local images are missing.
Added hyperlink to details on the local image in the search result page.
    modified:   koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js
    modified:   koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
    modified:   koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
mbeaulieu 2014-08-08 08:38:20 -04:00 committed by Tomas Cohen Arazi
parent bbb6cf94de
commit 2668cbdc41
3 changed files with 52 additions and 8 deletions

View file

@ -46,7 +46,44 @@ KOHA.LocalCover = {
} }
$(mydiv).children('.no-image').remove(); $(mydiv).children('.no-image').remove();
} }
}) });
});
},
LoadResultsCovers: function(){
$("div [id^=local-thumbnail]").each(function(i) {
var mydiv = this;
var message = document.createElement("span");
$(message).attr("class","no-image thumbnail");
$(message).html(NO_LOCAL_JACKET);
$(mydiv).append(message);
var img = $("<img />");
img.attr('src','/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class"));
img.load(function () {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth <= 1) {
//IE HACK
try {
var otherCovers = $(mydiv).closest('td').find('img');
var nbCovers = otherCovers.length;
if(nbCovers > 0){
var badCovers = 0;
otherCovers.each(function(){
if(this.naturalWidth <= 1){
$(this).parent().remove();
badCovers++;
}
});
if(badCovers < nbCovers){
$(mydiv).parent().remove();
}
}
}
catch(err){
}
} else {
$(mydiv).append(img);
$(mydiv).children('.no-image').remove();
}
});
}); });
} }
}; };

View file

@ -174,6 +174,9 @@ function verify_images() {
[%# inject no images message %] [%# inject no images message %]
[% IF ( LocalCoverImages && ! localimages.0 ) %] [% IF ( LocalCoverImages && ! localimages.0 ) %]
showNoImageMessage(); showNoImageMessage();
[% END %]
[% IF LocalCoverImages %]
KOHA.LocalCover.GetCoverFromBibnumber(true);
[% END %] [% END %]
$("body").on("click",".previewMARC", function(e){ $("body").on("click",".previewMARC", function(e){
e.preventDefault(); e.preventDefault();
@ -184,9 +187,6 @@ function verify_images() {
$("#marcPreview").on("hidden", function(){ $("#marcPreview").on("hidden", function(){
$("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
}); });
[% IF LocalCoverImages %]
KOHA.LocalCover.GetCoverFromBibnumber(true);
[% END %]
}); });
[% IF ( AmazonCoverImages ) %]$(window).load(function() { [% IF ( AmazonCoverImages ) %]$(window).load(function() {

View file

@ -151,7 +151,7 @@ $('#sort_by').change(function() {
[% END %] [% END %]
[% END %] [% END %]
[% IF LocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %] [% IF LocalCoverImages %]KOHA.LocalCover.LoadResultsCovers();[% END %]
}); });
@ -446,12 +446,19 @@ var holdForPatron = function () {
[% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %] [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
[% IF ( AmazonCoverImages || LocalCoverImages ) %] [% IF ( AmazonCoverImages || LocalCoverImages ) %]
<td> <td>
[% IF ( LocalCoverImages ) %] [% IF ( LocalCoverImages) %]
<a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
<span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber %]" id="local-thumbnail[% loop.count %]"></span> <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber %]" id="local-thumbnail[% loop.count %]"></span>
</a>
[% END %] [% END %]
[% IF ( AmazonCoverImages ) %] [% IF ( AmazonCoverImages ) %]
<a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]"> [% IF ( SEARCH_RESULT.normalized_isbn ) %]
<img src="[% IF ( SEARCH_RESULT.normalized_isbn ) %]https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg[% ELSE %]https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif[% END %]" alt="" class="thumbnail" /> <a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
<img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />
[% ELSIF ( !LocalCoverImages ) %]
<a class="p1 no-amazon-cover" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
<img src="https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif" alt="" class="thumbnail" />
[% END %]
</a> </a>
[% END %] [% END %]
</td> </td>