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 [% UNLESS ( logged_in_user ) %]
30 <h3 class="rb_login">Sign in to view availability and checkout items or place holds</h3>
33 <div id="breadcrumbs">
38 <div class="pagination pagination-small">
42 <table id="recordedbooks-results-list" class="table table-striped">
47 <div id="bottom-pages">
48 <div class="pagination pagination-small">
52 </div> <!-- / #recordedbooks-results-content -->
53 </div> <!-- / .span10 -->
54 </div> <!-- / .row-fluid -->
55 </div> <!-- / .container-fluid -->
56 </div> <!-- / .main -->
58 [% INCLUDE 'recordedbooks-checkout.inc' %]
60 [% INCLUDE 'opac-bottom.inc' %]
62 [% Asset.js("js/recordedbooks.js") | $raw %]
64 var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
65 var results_per_page = [% OPACnumSearchResults || 20 | html %];
67 function search( page ) {
68 $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
70 KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
72 $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
77 $( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
81 $( '#recordedbooks-results-list tbody' ).empty();
83 $( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
85 for ( var i = 0; data.items[i]; i++ ) {
86 var prod = data.items[i];
88 results.push( '<tr>' );
90 results.push( '<td class="info"><span class="title">' );
91 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
92 results.push( prod.title );
93 if (prod.url) results.push( '</a>' );
94 results.push( '</span>' );
95 results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
96 if (prod.description) results.push( '<p>' + prod.description, '</p>' );
97 results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
99 results.push( '</td>' );
101 results.push( '<td>' );
102 if ( prod.images && prod.images.medium ) {
103 if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
104 results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
105 if (prod.url) results.push( '</a>' );
107 results.push( '</td>' );
109 results.push( '</tr>' );
110 var $tr = $( results.join( '' ));
111 $( '#recordedbooks-results-list tbody' ).append( $tr );
113 $tr.find( '.info' ).each(function() {
114 KOHA.RecordedBooks.add_actions(this, prod.isbn);
118 $( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
122 var max_page = Math.floor( data.total / results_per_page );
123 if (data.total == page*results_per_page) max_page++;
126 pages.push( '<li><a class="od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
129 for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
131 pages.push( ' <li class="active"><a href="#">' + ( p + 1 ) + '</a></li>' );
133 pages.push( ' <li><a class="od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
137 if ( page < max_page ) {
138 pages.push( ' <li><a class="od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
141 if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul>' + pages.join( '' ) + '</ul>');
143 if( KOHA.RecordedBooks.is_identified() == false ){
144 $("#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>');
150 $( document ).ready( function() {
151 $( '#breadcrumbs p' )
153 .append( '<span id="recordedbooks-status"></span>' );
155 $( document ).on( 'click', 'a.od-nav', function() {
156 search( $( this ).data( 'page' ) );
160 [% IF ( logged_in_user ) %]
161 KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {