4 [% USE AdditionalContents %]
5 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>RecordedBooks search for '[% q | html %]' › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
8 [% INCLUDE 'doc-head-close.inc' %]
12 [% INCLUDE 'bodytag.inc' bodyid='recordedbooks-results-page' bodyclass='scrollto' %]
13 [% INCLUDE 'masthead.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
17 <ol class="breadcrumb">
18 <li class="breadcrumb-item">
19 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
21 <li class="breadcrumb-item active">
22 <a href="#" aria-current="page">RecordedBooks search for '[% q | html %]'</a>
25 </nav> <!-- /#breadcrumbs -->
27 <div class="container-fluid">
29 <div class="col-lg-2">
30 [% IF ( OpacNav || OpacNavBottom ) %]
31 [% INCLUDE 'navigation.inc' %]
34 <div class="col-lg-10 order-first order-md-first order-lg-2">
35 <div id="recordedbooks-results-content" class="maincontent searchresults">
36 <h1>RecordedBooks search for '[% q | html %]'</h1>
37 [% UNLESS ( logged_in_user ) %]
38 <h2 class="rb_login">Sign in to view availability and checkout items or place holds</h2>
41 <div id="breadcrumbs">
46 <nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
50 <table id="recordedbooks-results-list" class="table table-striped">
55 <div id="bottom-pages">
56 <nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
60 </div> <!-- / #recordedbooks-results-content -->
61 </div> <!-- / .col-lg-10 -->
62 </div> <!-- / .row -->
63 </div> <!-- / .container-fluid -->
64 </div> <!-- / .main -->
66 [% INCLUDE 'recordedbooks-checkout.inc' %]
68 [% INCLUDE 'opac-bottom.inc' %]
70 [% Asset.js("js/recordedbooks.js") | $raw %]
72 var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
73 var results_per_page = [% OPACnumSearchResults || 20 | html %];
75 function search( page ) {
76 $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
78 KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
80 $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
85 $( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
89 $( '#recordedbooks-results-list tbody' ).empty();
91 $( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
93 for ( var i = 0; data.items[i]; i++ ) {
94 var prod = data.items[i];
96 results.push( '<tr>' );
98 results.push( '<td class="info"><span class="title">' );
99 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
100 results.push( prod.title );
101 if (prod.url) results.push( '</a>' );
102 results.push( '</span>' );
103 results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
104 if (prod.description) results.push( '<p>' + prod.description, '</p>' );
105 results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
107 results.push( '</td>' );
109 results.push( '<td>' );
110 if ( prod.images && prod.images.medium ) {
111 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
112 results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
113 if (prod.url) results.push( '</a>' );
115 results.push( '</td>' );
117 results.push( '</tr>' );
118 var $tr = $( results.join( '' ));
119 $( '#recordedbooks-results-list tbody' ).append( $tr );
121 $tr.find( '.info' ).each(function() {
122 KOHA.RecordedBooks.add_actions(this, prod.isbn);
126 $( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
130 var max_page = Math.floor( data.total / results_per_page );
131 if (data.total == page*results_per_page) max_page++;
134 pages.push( '<li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
137 for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
139 pages.push( ' <li class="page-item disabled"><a class="page-link" href="#">' + ( p + 1 ) + '</a></li>' );
141 pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
145 if ( page < max_page ) {
146 pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
149 if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul class="pagination">' + pages.join( '' ) + '</ul>');
151 if( KOHA.RecordedBooks.is_identified() == false ){
152 $("#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>');
158 $( document ).ready( function() {
159 $( '#breadcrumbs p' )
161 .append( '<span id="recordedbooks-status"></span>' );
163 $( document ).on( 'click', 'a.od-nav', function() {
164 search( $( this ).data( 'page' ) );
168 [% IF ( logged_in_user ) %]
169 KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {