Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt
Owen 8473254ec3 Bug 24224: Convert OpacNavBottom system preference to additional content
This patch builds on Bug 22318 to move the OpacNavBottom system
preference into the "Additional contents" system, making it possible to
have language- and library-specific content.

To test you should have some content in the OpacNavBottom system
preference. To make testing easier it's also a good idea to have content
in the OpacNav preference.

- Apply the patch and run the database update process.
- In the staff client, go to Tools -> HTML customizations and verify
  that the content from OpacNavBottom is now stored there. When you
  edit the entry you should see content from the OpacNavBottom system
  preference under the "default" tab.
  - The publication date for the entry should be today's date.
  - Confirm that the previous contents of OpacNavBottom were added
    correctly.
- Go to Administration -> System preferences -> OPAC and verify that
  the OpacNavBottom preference has been removed.
- Update and reinstall active translations (for instance fr-FR):
  - cd misc/translator/
  - perl translate update fr-FR
  - perl translate install fr-FR
- View the OPAC and confirm that the contents of the OpacNavBottom
  system preference displays in the left-hand sidebar.
- Test as many pages as possible to confirm that wherever the
  OpacNavBottom content is displayed, OpacNavBottom is also displayed.
- Test also using the updated translation.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-08 11:41:48 +01:00

178 lines
8.3 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE AdditionalContents %]
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>RecordedBooks search for '[% q | html %]' &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</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">
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
</li>
<li class="breadcrumb-item active">
<a href="#" aria-current="page">RecordedBooks search for '[% q | html %]'</a>
</li>
</ol>
</nav> <!-- /#breadcrumbs -->
<div class="container-fluid">
<div class="row">
<div class="col-lg-2">
[% IF ( OpacNav || OpacNavBottom ) %]
[% INCLUDE 'navigation.inc' %]
[% END %]
</div>
<div class="col-lg-10 order-first order-md-first order-lg-2">
<div id="recordedbooks-results-content" class="maincontent searchresults">
<h1>RecordedBooks search for '[% q | html %]'</h1>
[% UNLESS ( logged_in_user ) %]
<h2 class="rb_login">Sign in to view availability and checkout items or place holds</h2>
[% END %]
<div id="breadcrumbs">
<p></p>
</div>
<div id="top-pages">
<nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
</nav>
</div>
<table id="recordedbooks-results-list" class="table table-striped">
<tbody>
</tbody>
</table>
<div id="bottom-pages">
<nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
</nav>
</div>
</div> <!-- / #recordedbooks-results-content -->
</div> <!-- / .col-lg-10 -->
</div> <!-- / .row -->
</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 class="page-item"><a class="page-link 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="page-item disabled"><a class="page-link" href="#">' + ( p + 1 ) + '</a></li>' );
} else {
pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
}
}
if ( page < max_page ) {
pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' &raquo;</a></li>' );
}
if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul class="pagination">' + 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 %]