Bug 11978 - Fix URLs displayed in OverDrive search
authorJesse Weaver <pianohacker@gmail.com>
Thu, 20 Mar 2014 17:20:40 +0000 (11:20 -0600)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 8 Apr 2014 23:36:11 +0000 (23:36 +0000)
OverDrive has recently changed its APIs to include "http://" in the URLs
it returns. This patch removes the "http://" on the Koha end so they
aren't doubled.

Test plan:
  1. Run an OverDrive search on the OPAC.
  2. Check the links, they should start with "http://http://"
  3. Apply this patch.
  4. Rerun the search, the links should now be correct.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I can reproduce the problem and confirm that this patch fixes it.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch removes hardcoded http:// from URLs in the Overdrive code.
Trusting Jesse and Owen to have tested this with Overdrive,
code review reveals no additional changes or possible problems.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-overdrive-search.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-overdrive-search.tt

index 9aeff2d..1d3924f 100644 (file)
@@ -79,7 +79,7 @@ function fetch_availability( prod, $tr ) {
                 $availability_summary.find( '.available' ).append( ', ' + _("waiting holds:") + ' <strong>' + data.numberOfHolds + '</strong>' );
             }
 
-            $tr.find( '.info' ).append( '<div class="actions-menu"><span class="actions"><a href="http://' + prod.contentDetails[0].href + '" ' + ( data.copiesAvailable ? ( ' class="addtocart">' + _("Check out") ) : ( ' class="hold">' + _("Place hold") ) ) + '</a></span></div>' );
+            $tr.find( '.info' ).append( '<div class="actions-menu"><span class="actions"><a href="' + prod.contentDetails[0].href + '" ' + ( data.copiesAvailable ? ( ' class="addtocart">' + _("Check out") ) : ( ' class="hold">' + _("Place hold") ) ) + '</a></span></div>' );
         }
     );
 }
@@ -108,7 +108,7 @@ function search( offset ) {
 
             results.push( '<tr>' );
 
-            results.push( '<td class="info"><a class="title" href="http://', prod.contentDetails[0].href, '">' );
+            results.push( '<td class="info"><a class="title" href="', prod.contentDetails[0].href, '">' );
             results.push( prod.title );
             if ( prod.subtitle ) results.push( ', ', prod.subtitle );
             results.push( '</a>' );
@@ -127,7 +127,7 @@ function search( offset ) {
 
             results.push( '<td>' );
             if ( prod.images.thumbnail ) {
-                results.push( '<a href="http://', prod.contentDetails[0].href, '">' );
+                results.push( '<a href="', prod.contentDetails[0].href, '">' );
                 results.push( '<img class="thumbnail" src="', prod.images.thumbnail.href, '" />' );
                 results.push( '</a>' );
             }
index 2114c2a..f80e46a 100644 (file)
@@ -25,7 +25,7 @@ function fetch_availability( prod, $tr ) {
                 $availability_summary.find( '.available' ).append( ', ' + _("waiting holds:") + ' <strong>' + data.numberOfHolds + '</strong>' );
             }
 
-            $tr.find( '.info' ).append( '<span class="results_summary actions"><span class="label">' + _("Actions:") + ' </span><a href="http://' + prod.contentDetails[0].href + '" ' + ( data.copiesAvailable ? ( ' class="addtocart">' + _("Check out") ) : ( ' class="hold">' + _("Place hold") ) ) + '</a></span>' );
+            $tr.find( '.info' ).append( '<span class="results_summary actions"><span class="label">' + _("Actions:") + ' </span><a href="' + prod.contentDetails[0].href + '" ' + ( data.copiesAvailable ? ( ' class="addtocart">' + _("Check out") ) : ( ' class="hold">' + _("Place hold") ) ) + '</a></span>' );
         }
     );
 }
@@ -54,7 +54,7 @@ function search( offset ) {
 
             results.push( '<tr>' );
 
-            results.push( '<td class="info"><a class="title" href="http://', prod.contentDetails[0].href, '">' );
+            results.push( '<td class="info"><a class="title" href="', prod.contentDetails[0].href, '">' );
             results.push( prod.title );
             if ( prod.subtitle ) results.push( ', ', prod.subtitle );
             results.push( '</a>' );
@@ -71,7 +71,7 @@ function search( offset ) {
 
             results.push( '<td>' );
             if ( prod.images.thumbnail ) {
-                results.push( '<a href="http://', prod.contentDetails[0].href, '">' );
+                results.push( '<a href="', prod.contentDetails[0].href, '">' );
                 results.push( '<img class="thumbnail" src="', prod.images.thumbnail.href, '" />' );
                 results.push( '</a>' );
             }