4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>RecordedBooks search for '[% q | html %]' › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
6 [% INCLUDE 'doc-head-close.inc' %]
10 [% INCLUDE 'bodytag.inc' bodyid='recordedbooks-results-page' bodyclass='scrollto' %]
11 [% INCLUDE 'masthead.inc' %]
14 <nav aria-label="breadcrumb">
15 <ul class="breadcrumb">
16 <li class="breadcrumb-item">
17 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
19 <li class="breadcrumb-item active" aria-current="page">
20 <a href="#">RecordedBooks search for '[% q | html %]'</a>
25 <div class="container-fluid">
27 <div class="col-lg-2">
28 [% IF ( OpacNav || OpacNavBottom ) %]
29 [% INCLUDE 'navigation.inc' %]
32 <div class="col-lg-10 order-first order-md-first order-lg-2">
33 <div id="recordedbooks-results-content" class="maincontent searchresults">
34 <h1>RecordedBooks search for '[% q | html %]'</h1>
35 [% UNLESS ( logged_in_user ) %]
36 <h3 class="rb_login">Sign in to view availability and checkout items or place holds</h3>
39 <div id="breadcrumbs">
44 <nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
48 <table id="recordedbooks-results-list" class="table table-striped">
53 <div id="bottom-pages">
54 <nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
58 </div> <!-- / #recordedbooks-results-content -->
59 </div> <!-- / .col-lg-10 -->
60 </div> <!-- / .row -->
61 </div> <!-- / .container-fluid -->
62 </div> <!-- / .main -->
64 [% INCLUDE 'recordedbooks-checkout.inc' %]
66 [% INCLUDE 'opac-bottom.inc' %]
68 [% Asset.js("js/recordedbooks.js") | $raw %]
70 var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
71 var results_per_page = [% OPACnumSearchResults || 20 | html %];
73 function search( page ) {
74 $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
76 KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
78 $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
83 $( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
87 $( '#recordedbooks-results-list tbody' ).empty();
89 $( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
91 for ( var i = 0; data.items[i]; i++ ) {
92 var prod = data.items[i];
94 results.push( '<tr>' );
96 results.push( '<td class="info"><span class="title">' );
97 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
98 results.push( prod.title );
99 if (prod.url) results.push( '</a>' );
100 results.push( '</span>' );
101 results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
102 if (prod.description) results.push( '<p>' + prod.description, '</p>' );
103 results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
105 results.push( '</td>' );
107 results.push( '<td>' );
108 if ( prod.images && prod.images.medium ) {
109 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
110 results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
111 if (prod.url) results.push( '</a>' );
113 results.push( '</td>' );
115 results.push( '</tr>' );
116 var $tr = $( results.join( '' ));
117 $( '#recordedbooks-results-list tbody' ).append( $tr );
119 $tr.find( '.info' ).each(function() {
120 KOHA.RecordedBooks.add_actions(this, prod.isbn);
124 $( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
128 var max_page = Math.floor( data.total / results_per_page );
129 if (data.total == page*results_per_page) max_page++;
132 pages.push( '<li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
135 for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
137 pages.push( ' <li class="page-item disabled"><a class="page-link" href="#">' + ( p + 1 ) + '</a></li>' );
139 pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
143 if ( page < max_page ) {
144 pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
147 if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul class="pagination">' + pages.join( '' ) + '</ul>');
149 if( KOHA.RecordedBooks.is_identified() == false ){
150 $("#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>');
156 $( document ).ready( function() {
157 $( '#breadcrumbs p' )
159 .append( '<span id="recordedbooks-status"></span>' );
161 $( document ).on( 'click', 'a.od-nav', function() {
162 search( $( this ).data( 'page' ) );
166 [% IF ( logged_in_user ) %]
167 KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {