From c7a2ef261e4d905c3c4d61f088e1d72681305db3 Mon Sep 17 00:00:00 2001 From: Srdjan Date: Tue, 8 Dec 2015 19:07:41 +1300 Subject: [PATCH] bug_16034 Add overdrive info to the users page in the public interface Signed-off-by: Jesse Weaver Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- .../en/includes/overdrive-checkout.inc | 19 + .../en/modules/opac-overdrive-search.tt | 17 +- .../bootstrap/en/modules/opac-user.tt | 23 ++ koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js | 377 ++++++++++++++++++ opac/opac-overdrive-search.pl | 1 + opac/opac-user.pl | 6 + opac/svc/overdrive | 150 +++++++ 7 files changed, 591 insertions(+), 2 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/overdrive-checkout.inc create mode 100755 opac/svc/overdrive diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/overdrive-checkout.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/overdrive-checkout.inc new file mode 100644 index 0000000000..a8d60bb311 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/overdrive-checkout.inc @@ -0,0 +1,19 @@ + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-overdrive-search.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-overdrive-search.tt index 5f5a83646a..f5a26af5cb 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-overdrive-search.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-overdrive-search.tt @@ -55,6 +55,8 @@ +[% INCLUDE 'overdrive-checkout.inc' %] + [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] @@ -80,7 +82,9 @@ function fetch_availability( prod, $tr ) { $availability_summary.find( '.available' ).append( ', ' + _("waiting holds:") + ' ' + data.numberOfHolds + '' ); } - $tr.find( '.info' ).append( '' ); + $tr.find( '.info' ).each(function() { + KOHA.OverDriveCirculation.add_actions(this, data.id, data.copiesAvailable); + }); } ); } @@ -179,7 +183,16 @@ $( document ).ready( function() { return false; }); - search( 0 ); + [% IF ( overdrive_error ) %] + KOHA.OverDriveCirculation.display_error("#breadcrumbs", "[% overdrive_error.dquote %]"); + [% END %] + [% IF ( loggedinusername ) %] + KOHA.OverDriveCirculation.with_account_details("#breadcrumbs", function() { + search( 0 ); + }); + [% ELSE %] + search( 0 ); + [% END %] } ); [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index ef24771eb7..c862a14e36 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -135,8 +135,13 @@ Using this account is not recommended because some parts of Koha will not functi [% END %] [% IF ( RESERVES.count ) %]
  • Holds ([% RESERVES.count %])
  • [% END %] [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current %]
  • Article requests ([% borrower.article_requests_current.count %])
  • [% END %] + [% IF ( OverDriveCirculation ) %] +
  • OverDrive Account
  • + [% END %] +
    +
    [% IF ( issues_count ) %]
    @@ -824,6 +829,10 @@ Using this account is not recommended because some parts of Koha will not functi
    +[% IF ( OverDriveCirculation ) %] +[% INCLUDE 'overdrive-checkout.inc' %] +[% END %] + [% INCLUDE 'opac-bottom.inc' %] @@ -887,4 +896,18 @@ Using this account is not recommended because some parts of Koha will not functi }); //]]> + + [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js index 1bc8c5d4d3..24717f503e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js @@ -59,3 +59,380 @@ KOHA.OverDrive = ( function() { } }; } )(); + +KOHA.OverDriveCirculation = new function() { + var svc_url = '/cgi-bin/koha/svc/overdrive'; + + var error_div = $('
    '); + function display_error ( error ) { + error_div.text(error); + } + + var login_link = $('') + .click(function(e) { + e.preventDefault(); + login(window.open()); + }) + .text(_("Login to OverDrive account")); + var login_div = $('