4 [% USE AdditionalContents %]
5 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
6 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>RecordedBooks search for '[% q | html %]' › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% BLOCK cssinclude %]
13 [% INCLUDE 'bodytag.inc' bodyid='recordedbooks-results-page' bodyclass='scrollto' %]
14 [% INCLUDE 'masthead.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
18 <ol class="breadcrumb">
19 <li class="breadcrumb-item">
20 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
22 <li class="breadcrumb-item active">
23 <a href="#" aria-current="page">RecordedBooks search for '[% q | html %]'</a>
26 </nav> <!-- /#breadcrumbs -->
28 <div class="container-fluid">
30 <div class="col-lg-2">
31 [% IF ( OpacNav || OpacNavBottom ) %]
32 [% INCLUDE 'navigation.inc' %]
35 <div class="col-lg-10 order-first order-md-first order-lg-2">
36 <div id="recordedbooks-results-content" class="maincontent searchresults">
37 <h1>RecordedBooks search for '[% q | html %]'</h1>
38 [% UNLESS ( logged_in_user ) %]
39 <h2 class="rb_login">Sign in to view availability and checkout items or place holds</h2>
42 <div id="breadcrumbs">
47 <nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
51 <table id="recordedbooks-results-list" class="table table-striped">
56 <div id="bottom-pages">
57 <nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
61 </div> <!-- / #recordedbooks-results-content -->
62 </div> <!-- / .col-lg-10 -->
63 </div> <!-- / .row -->
64 </div> <!-- / .container-fluid -->
65 </div> <!-- / .main -->
67 [% INCLUDE 'recordedbooks-checkout.inc' %]
69 [% INCLUDE 'opac-bottom.inc' %]
71 [% Asset.js("js/recordedbooks.js") | $raw %]
73 var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
74 var results_per_page = [% OPACnumSearchResults || 20 | html %];
76 function search( page ) {
77 $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
79 KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
81 $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
86 $( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
90 $( '#recordedbooks-results-list tbody' ).empty();
92 $( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
94 for ( var i = 0; data.items[i]; i++ ) {
95 var prod = data.items[i];
97 results.push( '<tr>' );
99 results.push( '<td class="info"><span class="title">' );
100 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
101 results.push( prod.title );
102 if (prod.url) results.push( '</a>' );
103 results.push( '</span>' );
104 results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
105 if (prod.description) results.push( '<p>' + prod.description, '</p>' );
106 results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
108 results.push( '</td>' );
110 results.push( '<td>' );
111 if ( prod.images && prod.images.medium ) {
112 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
113 results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
114 if (prod.url) results.push( '</a>' );
116 results.push( '</td>' );
118 results.push( '</tr>' );
119 var $tr = $( results.join( '' ));
120 $( '#recordedbooks-results-list tbody' ).append( $tr );
122 $tr.find( '.info' ).each(function() {
123 KOHA.RecordedBooks.add_actions(this, prod.isbn);
127 $( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
131 var max_page = Math.floor( data.total / results_per_page );
132 if (data.total == page*results_per_page) max_page++;
135 pages.push( '<li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
138 for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
140 pages.push( ' <li class="page-item disabled"><a class="page-link" href="#">' + ( p + 1 ) + '</a></li>' );
142 pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
146 if ( page < max_page ) {
147 pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
150 if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul class="pagination">' + pages.join( '' ) + '</ul>');
152 if( KOHA.RecordedBooks.is_identified() == false ){
153 $("#breadcrumbs").before('<h3 class="rb_register"><a href="https://[% Koha.Preference('RecordedBooksDomain') | uri %]">To see availability you must register for RecordedBooks using your cardnumber and the email associated with your Koha account</a></h3>');
159 $( document ).ready( function() {
160 $( '#breadcrumbs p' )
162 .append( '<span id="recordedbooks-status"></span>' );
164 $( document ).on( 'click', 'a.od-nav', function() {
165 search( $( this ).data( 'page' ) );
169 [% IF ( logged_in_user ) %]
170 KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {