Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
Owen Leonard 693bbc76e7 Bug 11969: Show patrons star rating on their reading history
This patch adds display of a user's ratings to their reading history in
the OPAC.

Also changed: Removed obsolete "border" attribute from the template, and
removed obsolete JavaScript include from opac-results.tt

To test, apply the patch and rebuild the OPAC CSS. OpacStarRatings
should be set to all (results and details).

 - Log in to the OPAC as a user with a reading history and titles in
   that history which have ratings.
 - Under the "your reading history" tab, your ratings should show under
   rated titles with the date of the rating.
 - Test also with OpacStarRatings set to a value other than "all."

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Star ratings are displayed in Reading History with OpacStarRatings
enabled, and are not displayed when OpacStarRatings is disabled, as
expected.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-17 12:25:25 +00:00

240 lines
16 KiB
Text

[% USE raw %]
[% USE Koha %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your checkout history</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
<style>ul.ui-tabs-nav li a, ul.ui-tabs-nav li span.a { padding:0.6em 1em; }</style>
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %]
[% INCLUDE 'masthead.inc' %]
[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
<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="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Your checkout history</a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="span10">
<div id="userreadingrecord">
<h3>Checkout history</h3>
[% IF READING_RECORD.size == 0 %]
You have never borrowed anything from this library.
[% ELSE %]
<div id="opac-user-readingrec">
<div class="resultscontrol resort">
<form id="sortform" action="/cgi-bin/koha/opac-readingrecord.pl" method="get">
[% UNLESS ( limit ) %]<input type="hidden" name="limit" value="full" />[% END %]
<select name="order" id="order">
[% IF ( orderbydate ) %]<option value="" selected="selected">Order by date</option>[% ELSE %]<option value="">Order by date</option>[% END %]
[% IF ( orderbytitle ) %]<option value="title" selected="selected">Order by title</option>[% ELSE %]<option value="title">Order by title</option>[% END %]
[% IF ( orderbyauthor ) %]<option value="author" selected="selected">Order by author</option>[% ELSE %]<option value="author">Order by author</option>[% END %]
</select>
<input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
</form>
</div>
[% IF limit %]
<p>
Showing last 50 items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a>
</p>
[% ELSE %]
<p>
Showing all items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show last 50 items</a>
</p>
[% END %]
[% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %]
<div id="tabs" class="toptabs">
<ul>
<li><a href="#tabs-container" id="tab_all">All</a></li>
<li><a href="#tabs-container" id="tab_checkout">Checkouts</a></li>
<li><a href="#tabs-container" id="tab_onsite_checkout">On-site checkouts</a></li>
</ul>
[% END %]
<div id="tabs-container" style="overflow:hidden">
<table id="readingrec" class="table table-bordered table-striped">
<thead>
<tr>
<th style="display:none;">Type</th>
<th class="nosort"></th>
<th class="anti-the">Title</th>
<th>Item type</th>
<th>Call no.</th>
<th class="title-string">Date</th>
[% IF ( OPACMySummaryHTML ) %]
<th>Links</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH issue IN READING_RECORD %]
<tr>
<td style="display:none;">
[% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %]
[% ELSE %][% issuetype = 'standard_checkout' %]
[% END %]
[% issuetype | html %]
</td>
<td>
[% IF ( AdlibrisEnabled && issue.normalized_isbn ) %]
[% IF issue.BiblioDefaultViewmarc %]
<a href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">
[% ELSIF issue.BiblioDefaultViewisbd %]
<a href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% issue.biblionumber |url %]">
[% ELSE %]
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">
[% END %]
<img src="[% AdlibrisURL | html %]?isbn=[% issue.normalized_isbn | html %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
[% END %]
[% IF OPACAmazonCoverImages %]
[% IF issue.normalized_isbn %]
<a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% issue.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF GoogleJackets %]
[% IF issue.normalized_isbn %]
<div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF BakerTaylorEnabled %]
[% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %]
[% IF ( bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF SyndeticsEnabled && SyndeticsCoverImages %]
<img src="https://secure.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% issue.normalized_upc | html %]&amp;oclc=[% issue.normalized_oclc | html %]" alt="" class="item-thumbnail" />
[% END %]
</td>
<td>
[% IF issue.BiblioDefaultViewmarc %]
<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title | html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield | html %][% END %][% END %]</a>
[% ELSIF issue.BiblioDefaultViewisbd %]
<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title | html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield | html %][% END %][% END %]</a>
[% ELSE %]
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title | html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield | html %][% END %][% END %]</a>
[% END %]
<p class="results-summary item-details">[% issue.author | html %]</p>
[% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' && issue.my_rating ) %]
<div class="results_summary ratings">
<div class="br-wrapper br-theme-fontawesome-stars">
<div class="br-widget br-readonly">
[% FOREACH i IN [ 1 2 3 4 5 ] %]
[% IF issue.my_rating.rating_value == i %]
<a href="#" class="br-selected br-current"></a>
[% ELSIF issue.my_rating.rating_value > i %]
<a href="#" class="br-selected"></a>
[% ELSE %]
<a href="#"></a>
[% END %]
[% END %]
</div>
</div>
Rated on [% issue.my_rating.timestamp | $KohaDates %]
</div> <!-- / .results_summary -->
[% END # / IF OpacStarRatings %]
</td>
<td>
[% UNLESS ( noItemTypeImages ) %]
[% IF ( issue.imageurl ) %]
<img src="[% issue.imageurl | html %]" alt="" />
[% END %]
[% END %]
<span class="tdlabel">Item type:</span>
[% issue.translated_description | html %]</td>
<td>
<span class="tdlabel">Call number:</span>
[% issue.itemcallnumber | html %]
</td>
<td>
[% IF issue.returndate %]
<span class="tdlabel">Check-in date:</span>
<span title="[% issue.returndate | html %]">[% issue.returndate | $KohaDates %]</span>
[% ELSE %]
<span title="Checked out"><em>(Checked out)</em></span>
[% END %]
</td>
[% IF OPACMySummaryHTML %]
<td>[% issue.MySummaryHTML | $raw %]</td>
[% END %]
</tr>
[% END # / FOREACH issue %]
</tbody>
</table>
</div> <!-- / .tabs-container -->
[% IF ( Koha.Preference( 'OnSiteCheckouts' ) == 1 ) %]
</div> <!-- /#tabs -->
[% END %]
</div> <!-- / .opac-user-readingrec -->
[% END # / IF READING_RECORD.size %]
</div> <!-- / .userreadingrecord -->
</div> <!-- / .span10 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function(){
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
$('#sortsubmit').hide();
$('#order').change(function() {
$('#sortform').submit();
});
var table = $("#readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button",
"columnDefs": [
{ "targets": [ "nosort" ],"sortable": false,"searchable": false },
{ "type": "anti-the", "targets" : [ "anti-the" ] },
{ "type": "title-string", "targets" : [ "title-string" ] }
]
}));
var tabs = $("#tabs").tabs({
select: function(e, ui) {
var id = $(ui.tab).attr("id");
if ( id == "tab_checkout" ) {
table.fnFilter("standard_checkout", 0);
} else if ( id == "tab_onsite_checkout" ) {
table.fnFilter("onsite_checkout", 0);
} else { // all
table.fnFilter('', 0);
}
}
});
});
</script>
[% END %]