Bug 10944: fix mixed content warnings for covers on staff client

This switches the URLs used to access Amazon's cover images to the
SSL image server, preventing warnings when using this on a secure
 site.

To test:
* Enable Amazon images in the sysprefs, all other cover images off.
* Do a search in the staff client. Using firebug or similar, inspect the
  images that indicate both "no image found" and the covers.
* Are they all https, and showing correctly?

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Robin Sheat 2013-10-04 16:13:20 +13:00 committed by Galen Charlton
parent 3f2300e132
commit 54ada7d069
2 changed files with 10 additions and 10 deletions

View file

@ -30,7 +30,7 @@
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_images() {
$("#bookcoverimg 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('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)) {
@ -43,13 +43,13 @@ function verify_images() {
}
});
$("#editions 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('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)) {
this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
} else if ((this.complete != null) && (!this.complete)) {
this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
}
}
});
@ -347,7 +347,7 @@ function verify_images() {
[% 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 ( AmazonCoverImages ) %]</div><div class="yui-u" id="bookcoverimg">
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /></a>[% END %]
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /></a>[% END %]
[% ELSE %]
<h3>[% title |html %]</h3>
@ -411,7 +411,7 @@ function verify_images() {
</div>
[% IF ( AmazonCoverImages ) %]<div class="yui-u" id="bookcoverimg">
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /></a></div>[% END %]
<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /></a></div>[% END %]
<div class="yui-u" style="margin-top: 1em;">
<ul>
@ -900,7 +900,7 @@ function verify_images() {
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
<div id="editions"><h4>Editions</h4>
<table>
[% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img src="http://images.amazon.com/images/P/[% XISBN.normalized_isbn %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %]
[% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %]
[% UNLESS ( item_level_itypes ) %]<td>[% IF ( noItemTypeImages ) %][% XISBN.description %][% ELSE %]<img src="[% XISBN.imageurl %]" alt="[% XISBN.description %]" title="[% XISBN.description %]">[% END %]</td>[% END %]
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% XISBN.biblionumber %]">[% XISBN.title |html %]</a> by [% XISBN.author %] &copy;[% XISBN.copyrightdate %]
[% IF ( XISBN.publishercode ) %]

View file

@ -19,9 +19,9 @@ function verify_images() {
w = this.width;
h = this.height;
if ((w == 1) || (h == 1)) {
this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
} else if ((this.complete != null) && (!this.complete)) {
this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
}
}
});
@ -447,7 +447,7 @@ var holdForPatron = function () {
[% END %]
[% IF ( AmazonCoverImages ) %]
<a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
<img src="[% IF ( SEARCH_RESULT.normalized_isbn ) %]http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg[% ELSE %]http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif[% END %]" alt="" class="thumbnail" />
<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>
[% END %]
</td>