From 0007c3d75d106a51b204ce6292f4bd908fc07ca5 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 | 359 +++++++++++++++++++++ opac/opac-overdrive-search.pl | 1 + opac/opac-user.pl | 6 + opac/svc/overdrive | 139 ++++++++ 7 files changed, 562 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 9aa4cc3..8f8c600 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -147,8 +147,13 @@ Using this account is not recommended because some parts of Koha will not functi [% IF ( BORROWER_INFO.amountlessthanzero ) %]
  • Credits ([% BORROWER_INFO.amountoutstanding | $Price %])
  • [% END %] [% END %] [% IF ( RESERVES.count ) %]
  • Holds ([% RESERVES.count %])
  • [% END %] + [% IF ( OverDriveCirculation ) %] +
  • OverDrive Account
  • + [% END %] +
    +
    [% IF ( issues_count ) %]
    @@ -735,6 +740,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' %] @@ -798,4 +807,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..e985d61 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js @@ -59,3 +59,362 @@ 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(); + }) + .text(_("Login to OverDrive account")); + var login_div = $('