From ff50da4f3844e24b4fdaa5a73a916b461cee889f 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 --- .../bootstrap/en/includes/overdrive-checkout.inc | 19 ++ .../bootstrap/en/modules/opac-overdrive-search.tt | 17 +- .../opac-tmpl/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 0000000..a8d60bb --- /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 5f5a836..f5a26af 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 ef24771..c862a14 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 1bc8c5d..ba0ef39 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 = $('