From 361a45d2662790f38bb30ebde429cf720edf5956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= 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"); //]]> [% END %] +[% IF ( AmazonCoverImages ) %] + + +[% 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(""+NO_AMAZON_IMAGE+""); + } else if ((this.complete != null) && (!this.complete)) { + $(this).parent().html(""+NO_AMAZON_IMAGE+""); + } + } + }); +} 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(""+NO_AMAZON_IMAGE+""); } 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(""+NO_AMAZON_IMAGE+""); } } }); @@ -349,7 +350,6 @@ function verify_images() { [% IF ( XSLTDetailsDisplay ) %] [% XSLTBloc %] - [% IF ( GetShelves ) %] Lists that include this title: [% FOREACH GetShelve IN GetShelves %] @@ -374,7 +374,13 @@ function verify_images() { [% IF ( holdcount ) %]Holds: [% holdcount %][% ELSE %][% END %] [% IF ( AmazonCoverImages ) %]
- [% END %] + + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + [% END %] [% ELSE %]

[% title |html %]

@@ -438,7 +444,14 @@ function verify_images() {
[% IF ( AmazonCoverImages ) %]
-
[% END %] + + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + +[% END %]
    @@ -944,7 +957,18 @@ function verify_images() { [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]

    Editions

    -[% FOREACH XISBN IN XISBNS %][% IF ( AmazonCoverImages ) %][% END %] +[% FOREACH XISBN IN XISBNS %] + + [% IF ( AmazonCoverImages ) %] + + [% END %] [% UNLESS ( item_level_itypes ) %][% END %] [% END %]
    + + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + [% IF ( noItemTypeImages ) %][% XISBN.description %][% ELSE %][% XISBN.description %][% END %][% XISBN.title |html %] 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 ) %] [% END %] - [% IF ( AmazonCoverImages ) %] - - - - [% END %] + + [% IF ( SEARCH_RESULT.normalized_isbn ) %] + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + No cover image available + [% END %] + 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 @@ ISBN [% SEARCH_RESULT.isbn |html %] [% 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 %] [% END %][% END %] +[% IF ( OPACAmazonCoverImages ) %] + [% IF ( SEARCH_RESULT.normalized_isbn ) %] + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + [% END %] +[% END %] + [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( SEARCH_RESULT.content_identifier_exists ) %] [% ELSE %] 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(""+NO_AMAZON_IMAGE+""); + $(this).parent().html(""+NO_AMAZON_IMAGE+""); } else if ((this.complete != null) && (!this.complete)) { - $(this).parent().html(""+NO_AMAZON_IMAGE+""); + $(this).parent().html(""+NO_AMAZON_IMAGE+""); } } - }); - } + }); +} -- 1.7.10.4