4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › RecordedBooks search for '[% q | html %]'</title>
6 [% INCLUDE 'doc-head-close.inc' %]
10 [% INCLUDE 'bodytag.inc' bodyid='recordedbooks-results-page' bodyclass='scrollto' %]
11 [% INCLUDE 'masthead.inc' %]
14 <ul class="breadcrumb">
15 <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li>
16 <li><a href="#">RecordedBooks search for '[% q | html %]'</a></li>
19 <div class="container-fluid">
20 <div class="row-fluid">
22 [% IF ( OpacNav || OpacNavBottom ) %]
23 [% INCLUDE 'navigation.inc' %]
27 <div id="recordedbooks-results-content" class="maincontent searchresults">
28 <h1>RecordedBooks search for '[% q | html %]'</h1>
29 <div id="breadcrumbs">
34 <div class="pagination pagination-small">
38 <table id="recordedbooks-results-list" class="table table-striped">
43 <div id="bottom-pages">
44 <div class="pagination pagination-small">
48 </div> <!-- / #recordedbooks-results-content -->
49 </div> <!-- / .span10 -->
50 </div> <!-- / .row-fluid -->
51 </div> <!-- / .container-fluid -->
52 </div> <!-- / .main -->
54 [% INCLUDE 'recordedbooks-checkout.inc' %]
56 [% INCLUDE 'opac-bottom.inc' %]
58 [% Asset.js("js/recordedbooks.js") | $raw %]
60 var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
61 var results_per_page = [% OPACnumSearchResults || 20 | html %];
63 function search( page ) {
64 $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
66 KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
68 $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
73 $( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
77 $( '#recordedbooks-results-list tbody' ).empty();
79 $( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
81 for ( var i = 0; data.items[i]; i++ ) {
82 var prod = data.items[i];
85 results.push( '<tr>' );
87 results.push( '<td class="info"><span class="title">' );
88 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
89 results.push( prod.title );
90 if (prod.url) results.push( '</a>' );
91 results.push( '</span>' );
92 results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
93 if (prod.description) results.push( '<p>' + prod.description, '</p>' );
94 results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
96 results.push( '</td>' );
98 results.push( '<td>' );
99 if ( prod.images && prod.images.medium ) {
100 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
101 results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
102 if (prod.url) results.push( '</a>' );
104 results.push( '</td>' );
106 results.push( '</tr>' );
107 var $tr = $( results.join( '' ));
108 $( '#recordedbooks-results-list tbody' ).append( $tr );
110 $tr.find( '.info' ).each(function() {
111 KOHA.RecordedBooks.add_actions(this, prod.isbn);
115 $( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
119 var max_page = Math.floor( data.total / results_per_page );
120 if (data.total == page*results_per_page) max_page++;
123 pages.push( '<li><a class="od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
126 for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
128 pages.push( ' <li class="active"><a href="#">' + ( p + 1 ) + '</a></li>' );
130 pages.push( ' <li><a class="od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
134 if ( page < max_page ) {
135 pages.push( ' <li><a class="od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
138 if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul>' + pages.join( '' ) + '</ul>');
143 $( document ).ready( function() {
144 $( '#breadcrumbs p' )
146 .append( '<span id="recordedbooks-status"></span>' );
148 $( document ).on( 'click', 'a.od-nav', function() {
149 search( $( this ).data( 'page' ) );
153 [% IF ( loggedinusername ) %]
154 KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {