From 976321b7af3b9967df38f8adef617fce9eca9ff2 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 2 Jun 2011 14:40:57 -0400 Subject: [PATCH] Teach result_common.js to OpenLibrary requests Now that the proxied OpenLibrary requests are working, teach result_common.js to use them and get an advantage from being an access-rights-authenticated IP address (if applicable). Signed-off-by: Dan Scott Signed-off-by: Bill Erickson --- .../lib/OpenILS/WWW/AddedContent/OpenLibrary.pm | 2 ++ Open-ILS/web/opac/skin/default/js/result_common.js | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/OpenLibrary.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/OpenLibrary.pm index 32a035015d..a157389943 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/OpenLibrary.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/OpenLibrary.pm @@ -247,6 +247,8 @@ sub proxy_json { my( $self, $key ) = @_; my $url = $read_api . $key; + $logger->debug("proxy_json with key '$key', url $url"); + $self->send_json($AC->get_url($url)->content()); } diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 00194f1b52..3988e1e45f 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -698,12 +698,14 @@ function fetchOpenLibraryLinks() { isbns += 'isbn:' + isbn + '|'; }); isbns = isbns.replace(/.$/, ''); - dojo.require('dojo.io.script'); - dojo.io.script.get({ - "url":"http://openlibrary.org/api/volumes/brief/json/" + isbns + '?callback=renderOpenLibraryLinks', - "callback": "renderOpenLibraryLinks" - }); } + + dojo.xhrGet({ + "url": "/opac/extras/ac/proxy/json/" + isbns, + "handleAs": "json", + "load": function (data) { renderOpenLibraryLinks(data); } + }); + } function renderOpenLibraryLinks(response) { -- 2.43.2