Bugzilla – Attachment 36627 Details for
Bug 11982
Show local cover images in the biblio details page in the intranet.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11982 - Images now display properly in the details
Bug-11982---Images-now-display-properly-in-the-det.patch (text/plain), 8.32 KB, created by
Maxime Beaulieu
on 2015-03-05 16:39:16 UTC
(
hide
)
Description:
Bug 11982 - Images now display properly in the details
Filename:
MIME Type:
Creator:
Maxime Beaulieu
Created:
2015-03-05 16:39:16 UTC
Size:
8.32 KB
patch
obsolete
>From 07bf5f2397827155ad9fcd768eb1605fa782a76a Mon Sep 17 00:00:00 2001 >From: mbeaulieu <mbeaulieu@inlibro.com> >Date: Fri, 8 Aug 2014 09:49:53 -0400 >Subject: [PATCH] Bug 11982 - Images now display properly in the details > section. > >If the a cover image exists, it will be displayed on the details page. >Nothing is displayed of there is no cover available. > modified: koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js > modified: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Works as described, passes tests and QA script. >Checked Amazon covers and local covers display correctly >in staff on results and detail pages. >--- > koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js | 5 +- > .../prog/en/modules/catalogue/detail.tt | 54 ++++++++++++-------- > .../prog/en/modules/catalogue/results.tt | 2 +- > 3 files changed, 35 insertions(+), 26 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js b/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js >index 253d7a6..ac1f885 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js >@@ -28,11 +28,10 @@ KOHA.LocalCover = { > var img = $("<img />").attr('src', > '/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class")) > .load(function () { >- if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { >+ if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth <= 1) { > //IE HACK > try { >- $(mydiv).append(img); >- $(mydiv).children('.no-image').remove(); >+ $(mydiv).remove(); > } > catch(err){ > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 48bc90b..a392e1a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -28,19 +28,22 @@ > //<![CDATA[ > // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html > function verify_images() { >- $("#bookcoverimg img").each(function(i){ >+ $("#bookcoverimg").each(function(i){ >+ $(this).find('img').each(function(i){ > if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { >- w = this.width; >- h = this.height; >- if ((w == 1) || (h == 1)) { >- $("#bookcoverimg").remove(); >- $(".yui-gb").attr("class","yui-g"); >- } else if ((this.complete != null) && (!this.complete)) { >- $("#bookcoverimg").remove(); >- $(".yui-gb").attr("class","yui-g"); >+ w = this.width; >+ h = this.height; >+ if ((w == 1) || (h == 1)) { >+ $("#amazon-bookcoverimg").remove(); >+ $(".yui-gb").attr("class","yui-g"); >+ } else if ((this.complete != null) && (!this.complete)) { >+ $("#amazon-bookcoverimg").remove(); >+ $(".yui-gb").attr("class","yui-g"); >+ } > } >- } > }); >+ if( $(this).find('img').length < 1 ) $(this).remove(); >+ }); > $("#editions img").each(function(i){ > if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { > w = this.width; >@@ -189,7 +192,7 @@ function verify_images() { > }); > }); > >- [% IF ( AmazonCoverImages ) %]$(window).load(function() { >+ [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() { > verify_images(); > });[% END %] > //]]> >@@ -376,17 +379,21 @@ function verify_images() { > <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC Preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber %]&viewas=html" title="MARC" class="previewMARC">Show</a></span> > [% IF ( holdcount ) %]<span class="results_summary"><span class="label">Holds:</span> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></span>[% ELSE %][% END %] > >- [% IF ( ( AmazonEnabled && AmazonCoverImages ) || LocalCoverImages ) %] >+ [% IF ( AmazonCoverImages || LocalCoverImages ) %] > </div><div class="yui-u" id="bookcoverimg"> >- [% IF ( LocalCoverImages ) %]<div title="[% biblionumber |url %]" class="[% biblionumber %]" id="local-thumbnail-preview"></div>[% END %] >- [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]<div id="bookcoverimg"> >- <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"> >+ [% IF ( LocalCoverImages ) %] >+ <div title="[% biblionumber |url %]" class="[% biblionumber %]" id="local-thumbnail-preview"></div> >+ [% END %] >+ [% IF ( AmazonCoverImages ) %] >+ <div id="amazon-bookcoverimg"> >+ <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"> > [% IF ( using_https ) %] >- <img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> >+ <img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> > [% ELSE %] >- <img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> >+ <img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> > [% END %] >- </a></div>[% END %][% END %] >+ </a></div> >+ [% END %] > [% END %] > [% ELSE %] > >@@ -450,10 +457,13 @@ function verify_images() { > </ul> > </div> > >- [% IF ( ( AmazonEnabled && AmazonCoverImages ) || LocalCoverImages ) %] >+ [% IF ( AmazonCoverImages || LocalCoverImages ) %] > <div class="yui-u" id="bookcoverimg"> >- [% IF ( LocalCoverImages ) %]<div title="[% biblionumber |url %]" class="[% biblionumber %]" id="local-thumbnail-preview"></div>[% END %] >- [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]<div id="bookcoverimg"> >+ [% IF ( LocalCoverImages ) %] >+ <div title="[% biblionumber |url %]" class="[% biblionumber %]" id="local-thumbnail-preview"></div> >+ [% END %] >+ [% IF ( AmazonCoverImages ) %] >+ <div id="amazon-bookcoverimg"> > <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"> > [% IF ( using_https ) %] > <img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /> >@@ -462,7 +472,7 @@ function verify_images() { > [% END %] > </a> > </div> >- [% END %][% END %] >+ [% END %] > </div> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index 933453c..785da66 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -16,7 +16,7 @@ var q_array = new Array(); // will hold search terms, if present > // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html > function verify_images() { > $("img").each(function(i){ >- if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0)) { >+ if ((this.src.indexOf('images-amazon.com') >= 0) || (this.src.indexOf('images.amazon.com') >=0)) { > w = this.width; > h = this.height; > if ((w == 1) || (h == 1)) { >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11982
:
26514
|
26515
|
30625
|
30626
|
30627
|
30689
|
30690
|
32636
|
32637
|
32638
|
32746
|
32747
|
32748
|
34813
|
34815
|
34816
|
36626
|
36627
|
36852
|
36853
|
36854
|
114729