From a7ee741dc165e5fe4a9289b39ad2875c34c19ed6 Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 1 Mar 2013 13:22:33 +1100 Subject: [PATCH] Bug 9737 - Local Covers sometimes appear then disappear on OPAC Search Results/Lists Content-Type: text/plain; charset="utf-8" The current problem: When the verify_images() function runs from amazonimages.js, it loops through every img element and selects the elements that come from Amazon sources. However, if the height/width is 1 (i.e. Amazon passes off a blank image) or if the img element's complete property is null or non-existent, then it searches for the parent node and re-writes the HTML with the "No Cover Image Available" (NO_AMAZON_IMAGE) text, even though that parent node might contain other img elements that have images available (from Google, local images, etc)! Proposed fix: Wrap the Amazon image in a span tag (as we do with the Google and local covers), so that it re-writes the HTML within that parent span, rather than the parent anchor which contains all the other images. To test: 1) Turn on the OPACAmazonCoverImages, GoogleJackets, and OPACLocalCoverImages system preferences 2) Replace the ISBN in one of your records with 9780615352435 3) Now load a local cover image for that record 4) Search for that record (but make sure you're vague enough to have multiple search results) 5) For a split second, you may notice the local cover image appears before being replaced by a "No Cover Image Available". Now apply this patch 6) Refresh your search results page 7) You should now see your local cover image, PLUS the "No Cover Image Available" for the Amazon image, and whatever other graphics/"no cover image available" "graphics" for the Google Jackets. To be comprehensive, try the same set of steps using the OPAC Lists rather than the OPAC Search Results Signed-off-by: Owen Leonard --- koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt | 6 +++--- koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 04d02ba..224c750 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -663,15 +663,15 @@ $(document).ready(function(){ [% IF ( OPACLocalCoverImages ) %][% END %] - [% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %] [% IF ( SyndeticsCoverImages ) %] [% IF SEARCH_RESULT.normalized_isbn %] [% IF ( using_https ) %] - + [% ELSE %] - + [% END %] [% ELSE %] No cover image available diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index 3ad295d..66ff9bc 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -487,12 +487,12 @@ $(document).ready(function() { [% IF ( OPACLocalCoverImages ) %][% END %] - [% IF ( OPACAmazonCoverImages ) %][% IF ( itemsloo.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] + [% IF ( OPACAmazonCoverImages ) %][% IF ( itemsloo.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %] [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %] - + [% ELSE %] - [% END %][% END %][% END %] + [% END %][% END %][% END %] [% IF ( GoogleJackets ) %][% IF ( itemsloo.normalized_isbn ) %]
[% ELSE %]No cover image available[% END %][% END %] [% IF OpenLibraryCovers %][% IF itemsloo.normalized_isbn %][% ELSE %]No cover image available[% END %][% END %] -- 1.7.10.4