Bug 14318: iDreamBooks doesn't work when Koha is using https
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 4 Jun 2015 11:13:01 +0000 (07:13 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Sun, 7 Jun 2015 21:39:48 +0000 (18:39 -0300)
If a Koha server is configured to run over SSL, all iDreamBooks content
is blocked due to the fact that a secure page is requesting an insecure
endpoint. This is due to the fact that the urls for iDreamBooks use http
and not https. A simple fix would be to switch them to https since
browsers have to qualms about loading a secure data endpoint from an
insecure one.

Test Plan:
1) Enable iDreamBooks
2) Set up your OPAC to use https
3) Verify iDreamBooks content continues to work

Note: tested Chrome and IE, so that the IE change would be validated.
      Discovered isbn semi-colon issue that is beyond scope of this bug.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt

index 3002546..1e68153 100644 (file)
@@ -147,19 +147,19 @@ Enhanced Content:
               choices:
                   yes: Add
                   no: "Don't add"
-            - a tab on the OPAC details with book reviews from critics aggregated by <a href='http://idreambooks.com/'>IDreamBooks.com</a>.
+            - a tab on the OPAC details with book reviews from critics aggregated by <a href='https://idreambooks.com/'>IDreamBooks.com</a>.
         -
             - pref: IDreamBooksReadometer
               choices:
                   yes: Add
                   no: "Don't add"
-            - a "Readometer" that summarizes the reviews gathered by <a href='http://idreambooks.com/'>IDreamBooks.com</a> to the OPAC details page.
+            - a "Readometer" that summarizes the reviews gathered by <a href='https://idreambooks.com/'>IDreamBooks.com</a> to the OPAC details page.
         -
             - pref: IDreamBooksResults
               choices:
                   yes: Add
                   no: "Don't add"
-            - the rating from <a href='http://idreambooks.com/'>IDreamBooks.com</a> to OPAC search results.
+            - the rating from <a href='https://idreambooks.com/'>IDreamBooks.com</a> to OPAC search results.
     OCLC:
         -
             - pref: XISBN
index 21b2871..840f6ec 100644 (file)
         if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
         // Use Microsoft XDR for IE version 8 or above
             var xdr = new XDomainRequest();
-            xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
+            xdr.open("get", "https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
             xdr.onload = function() {
                 json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
                 eval(json); // json is now a regular JSON object
             }
             xdr.send();
         } else {
-            $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
+            $.getJSON("https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
                 parseIDBJSON(json);
             });
         }
                 isbn = isbn.replace(/-/, '');
 
                 [% IF ( IDreamBooksReadometer ) %]
-                    $(".title").append('<a href="'+json.book.detail_link+'" id="idreambooksreadometer"><img src="http://idreambooks.com/remotereadometer/'+isbn+'.jpg" alt="'+json.book.title+' by '+json.book.author+'" title="Rating based on reviews of '+json.book.title+'"></a>');
+                    $(".title").append('<a href="'+json.book.detail_link+'" id="idreambooksreadometer"><img src="https://idreambooks.com/remotereadometer/'+isbn+'.jpg" alt="'+json.book.title+' by '+json.book.author+'" title="Rating based on reviews of '+json.book.title+'"></a>');
                 [% END %]
 
                 [% IF ( IDreamBooksReviews ) %]
index 27c5a10..d905f13 100644 (file)
@@ -711,7 +711,7 @@ $(document).ready(function(){
             if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
             // Use Microsoft XDR for IE version 8 or above
                 var xdr = new XDomainRequest();
-                xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
+                xdr.open("get", "https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
                 xdr.onload = function() {
                     json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
                     eval(json); // json is now a regular JSON object
@@ -724,7 +724,7 @@ $(document).ready(function(){
                 }
                 xdr.send();
             } else {
-                $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
+                $.getJSON("https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
                     if(json.total_results > 0 && json.book.rating > 0){
                         $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+" by "+json.book.author+"' title='Rating based on reviews of "+json.book.title+"'>"+json.book.rating+"%");
                         $(element).show();