Bugzilla – Attachment 35264 Details for
Bug 11358
Use Amazon's HTTPS URLs for covers when using HTTPS in Koha.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug: 11358 - Use HTTPS Amazon images when Koha is using HTTPS.
Bug-11358---Use-HTTPS-Amazon-images-when-Koha-is-u.patch (text/plain), 15.20 KB, created by
Justin Vos
on 2015-01-14 22:16:43 UTC
(
hide
)
Description:
Bug: 11358 - Use HTTPS Amazon images when Koha is using HTTPS.
Filename:
MIME Type:
Creator:
Justin Vos
Created:
2015-01-14 22:16:43 UTC
Size:
15.20 KB
patch
obsolete
>From 361a45d2662790f38bb30ebde429cf720edf5956 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= <frederick.capovilla@libeo.com> >Date: Mon, 9 Dec 2013 13:26:45 -0500 >Subject: [PATCH] Bug: 11358 - Use HTTPS Amazon images when Koha is using > HTTPS. > >We've tried to fix the conflicts, not entirely sure if correct, please test thoroughly. > >http://bugs.koha-community.org/show_bug.cgi?id=11358 >--- > .../intranet-tmpl/prog/en/css/staff-global.css | 11 ++++++ > .../prog/en/includes/doc-head-close.inc | 7 ++++ > koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js | 15 ++++++++ > .../prog/en/modules/catalogue/detail.tt | 38 ++++++++++++++++---- > .../prog/en/modules/catalogue/results.tt | 31 ++++++---------- > .../bootstrap/en/modules/opac-opensearch.tt | 11 +++++- > koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js | 13 +++---- > 7 files changed, 92 insertions(+), 34 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >index 9d5b7ea..841b178 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >@@ -2273,6 +2273,17 @@ div.authorizedheading { > display: inline; > } > >+span.no-image { >+ background-color : #FFF; >+ border: 1px solid #979797; >+ color : #AAA; >+ display:block; >+ font-size : 86%; >+ font-weight : bold; >+ text-align : center; >+ width : 75px; >+} >+ > #hierarchies a { > font-weight: normal; > text-decoration: underline; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index f6269de..e78c452 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -56,3 +56,10 @@ var NO_LOCAL_JACKET = _("No cover image available"); > //]]> > </script> > [% END %] >+[% IF ( AmazonCoverImages ) %] >+<script type="text/javascript" language="javascript">//<![CDATA[ >+ var NO_AMAZON_IMAGE = _("No cover image available"); >+//]]> >+</script> >+<script type="text/javascript" language="javascript" src="[% themelang %]/js/amazonimages.js"></script> >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js b/koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js >new file mode 100644 >index 0000000..2184b24 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js >@@ -0,0 +1,15 @@ >+// 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) >+ || (this.src.indexOf('syndetics.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com') >= 0)) { >+ w = this.width; >+ h = this.height; >+ if ((w == 1) || (h == 1)) { >+ $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); >+ } else if ((this.complete != null) && (!this.complete)) { >+ $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); >+ } >+ } >+ }); >+} >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 ee5915e..c88dcc2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -42,13 +42,14 @@ function verify_images() { > } > }); > $("#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'))) { >+ 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') >= 0)) { > w = this.width; > h = this.height; > if ((w == 1) || (h == 1)) { >- this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >+ $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); > } else if ((this.complete != null) && (!this.complete)) { >- this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >+ $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); > } > } > }); >@@ -349,7 +350,6 @@ function verify_images() { > > [% IF ( XSLTDetailsDisplay ) %] > [% XSLTBloc %] >- > [% IF ( GetShelves ) %] > <span class="results_summary"><span class="label">Lists that include this title: </span> > [% FOREACH GetShelve IN GetShelves %] >@@ -374,7 +374,13 @@ 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="https://images-na.ssl-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"> >+ [% IF ( using_https ) %] >+ <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="" /> >+ [% END %] >+ </a>[% END %] > [% ELSE %] > > <h3>[% title |html %]</h3> >@@ -438,7 +444,14 @@ 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="https://images-na.ssl-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"> >+ [% IF ( using_https ) %] >+ <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="" /> >+ [% END %] >+</a></div> >+[% END %] > > <div class="yui-u" style="margin-top: 1em;"> > <ul> >@@ -944,7 +957,18 @@ 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="https://images-na.ssl-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"> >+ [% IF ( using_https ) %] >+ <img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn %].01._AA75_PU_PU-5_.jpg" /></a> >+ [% ELSE %] >+ <img src="http://images.amazon.com/images/P/[% XISBN.normalized_isbn %].01._AA75_PU_PU-5_.jpg" /></a> >+ [% END %] >+ </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 %] ©[% XISBN.copyrightdate %] > [% IF ( XISBN.publishercode ) %] >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 9462fa1..bdda9e0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -13,21 +13,6 @@ var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); > var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold."); > var q_array = new Array(); // will hold search terms, if present > [% IF ( AmazonCoverImages ) %] >-// 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)) { >- w = this.width; >- h = this.height; >- if ((w == 1) || (h == 1)) { >- 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 = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >- } >- } >- }); >-} >- > $(window).load(function() { > verify_images(); > }); >@@ -449,11 +434,17 @@ var holdForPatron = function () { > [% IF ( LocalCoverImages ) %] > <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber %]" id="local-thumbnail[% loop.count %]"></span> > [% 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 ) %]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 %] >+ <a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]"> >+ [% IF ( SEARCH_RESULT.normalized_isbn ) %] >+ [% IF ( using_https ) %] >+ <img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" /> >+ [% ELSE %] >+ <img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" /> >+ [% END %] >+ [% ELSE %] >+ <span class="no-image">No cover image available</span> >+ [% END %] >+ </a> > </td> > [% END %] > <td> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt >index 34cfcc5..6903687 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt >@@ -37,7 +37,16 @@ > <dc:identifier>ISBN [% SEARCH_RESULT.isbn |html %]</dc:identifier> > <link>[% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %][% OPACBaseURL %]/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% ELSE %][% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %][% OPACBaseURL %]/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% ELSE %][% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% END %][% END %]</link> > <description><![CDATA[ >-[% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" />[% END %][% END %] >+[% IF ( OPACAmazonCoverImages ) %] >+ [% IF ( SEARCH_RESULT.normalized_isbn ) %] >+ [% IF ( using_https ) %] >+ <img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" /> >+ [% ELSE %] >+ <img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" /> >+ [% END %] >+ [% END %] >+[% END %] >+ > [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( SEARCH_RESULT.content_identifier_exists ) %]<img src="http://www.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn %]/SC.GIF&client=[% SEARCH_RESULT.SyndeticsClientCode %]&type=xw10[% IF ( SEARCH_RESULT.normalized_upc ) %]&upc=[% SEARCH_RESULT.normalized_upc %][% END %][% IF ( SEARCH_RESULT.normalized_oclc ) %]&oclc=[% SEARCH_RESULT.normalized_oclc %][% END %]" alt="" /> > [% ELSE %] > <img src="http://www.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn %]/SC.GIF&client=[% SyndeticsClientCode %]&type=xw10&upc=[% SEARCH_RESULT.normalized_upc %]&oclc=[% SEARCH_RESULT.normalized_oclc %]" alt="" /> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js b/koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js >index f7b4887..2184b24 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js >@@ -1,14 +1,15 @@ > // 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) || (this.src.indexOf('syndetics.com') >=0) ) { >+ $("img").each(function(i){ >+ if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) >+ || (this.src.indexOf('syndetics.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com') >= 0)) { > w = this.width; > h = this.height; > if ((w == 1) || (h == 1)) { >- $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); >+ $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); > } else if ((this.complete != null) && (!this.complete)) { >- $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); >+ $(this).parent().html("<span class=\"no-image\">"+NO_AMAZON_IMAGE+"</span>"); > } > } >- }); >- } >+ }); >+} >-- >1.7.10.4
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 11358
:
23361
|
35264
|
45182