Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt
Martin Renvoize 42d40e372e
Bug 23261: (RM follow-up) Add missing uri filter
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 10:49:52 +00:00

169 lines
6.8 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; RecordedBooks search for '[% q | html %]'</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='recordedbooks-results-page' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">RecordedBooks search for '[% q | html %]'</a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
[% IF ( OpacNav || OpacNavBottom ) %]
[% INCLUDE 'navigation.inc' %]
[% END %]
</div>
<div class="span10">
<div id="recordedbooks-results-content" class="maincontent searchresults">
<h1>RecordedBooks search for '[% q | html %]'</h1>
[% UNLESS ( logged_in_user ) %]
<h3 class="rb_login">Sign in to view availability and checkout items or place holds</h3>
[% END %]
<div id="breadcrumbs">
<p></p>
</div>
<div id="top-pages">
<div class="pagination pagination-small">
</div>
</div>
<table id="recordedbooks-results-list" class="table table-striped">
<tbody>
</tbody>
</table>
<div id="bottom-pages">
<div class="pagination pagination-small">
</div>
</div>
</div> <!-- / #recordedbooks-results-content -->
</div> <!-- / .span10 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'recordedbooks-checkout.inc' %]
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% Asset.js("js/recordedbooks.js") | $raw %]
<script>
var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
var results_per_page = [% OPACnumSearchResults || 20 | html %];
function search( page ) {
$( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
if ( data.error ) {
$( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
return;
}
if ( !data.total ) {
$( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
return;
}
$( '#recordedbooks-results-list tbody' ).empty();
$( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
for ( var i = 0; data.items[i]; i++ ) {
var prod = data.items[i];
var results = [];
results.push( '<tr>' );
results.push( '<td class="info"><span class="title">' );
if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
results.push( prod.title );
if (prod.url) results.push( '</a>' );
results.push( '</span>' );
results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
if (prod.description) results.push( '<p>' + prod.description, '</p>' );
results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
results.push( '</td>' );
results.push( '<td>' );
if ( prod.images && prod.images.medium ) {
if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
if (prod.url) results.push( '</a>' );
}
results.push( '</td>' );
results.push( '</tr>' );
var $tr = $( results.join( '' ));
$( '#recordedbooks-results-list tbody' ).append( $tr );
$tr.find( '.info' ).each(function() {
KOHA.RecordedBooks.add_actions(this, prod.isbn);
});
}
$( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
var pages = [];
var max_page = Math.floor( data.total / results_per_page );
if (data.total == page*results_per_page) max_page++;
if ( page != 1 ) {
pages.push( '<li><a class="od-nav" href="#" data-page="' + (page - 1) + '">&laquo; ' + MSG_PREVIOUS + '</a></li>' );
}
for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
if ( p == page ) {
pages.push( ' <li class="active"><a href="#">' + ( p + 1 ) + '</a></li>' );
} else {
pages.push( ' <li><a class="od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
}
}
if ( page < max_page ) {
pages.push( ' <li><a class="od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' &raquo;</a></li>' );
}
if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul>' + pages.join( '' ) + '</ul>');
if( KOHA.RecordedBooks.is_identified() == false ){
$("#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>');
}
} );
}
$( document ).ready( function() {
$( '#breadcrumbs p' )
.append( ' ' )
.append( '<span id="recordedbooks-status"></span>' );
$( document ).on( 'click', 'a.od-nav', function() {
search( $( this ).data( 'page' ) );
return false;
});
[% IF ( logged_in_user ) %]
KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {
search( 1 );
});
[% ELSE %]
search( 1 );
[% END %]
} );
</script>
[% END %]