Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt
Owen Leonard 9cb89b4639 Bug 20168: Update of the OPAC bootstrap template to bootstrap v4
This patch updates the version of Bootstrap in the OPAC from 2.3.1 to
4.5.0. The Bootstrap JavaScript files have been replaced with custom
builds of the 4.5.0 JavaScript source files. The Bootstrap CSS is now
built into the OPAC CSS by loading the required Bootstrap 4.5.0 SCSS
files in node_modules.

OPAC SCSS now starts with Bootstrap customizations:

/* Bootstrap variable customizations */
$headings-color: #727272;
...

Followed by loading the necessary Bootstrap SCSS files:

/* Bootstrap imports */
@import "../../../../../node_modules/bootstrap/scss/functions";
@import "../../../../../node_modules/bootstrap/scss/variables";
...

Followed by our CSS. The build process for generating compiled CSS now
creates a file which bundles Bootstrap CSS and ours. Removed from the
Koha source: Bootstrap CSS files, Bootstrap "glyphicons" images.

The upgrade to Bootstrap 4 involved a lot of markup changes to conform
with new Bootstrap classes, especially in classes related to the grid.
Besides duplicating the grid we used before, this upgrade adds some new
features made possible by Bootstrap 4.5's use of flexbox as a layout
tool. This includes custom ordering of columns based on class names:
https://getbootstrap.com/docs/4.5/layout/grid/#order-classes.

Other areas where the most changes have been made: Navigation menus,
breadcrumb menus, buttons, dropdowns.

Bootstrap's JavaScript file is now "bootstrap.bundle.min.js" to reflect
the fact that a required JavaScript asset is now distributed separately
in Bootstrap 4. The "bundle" version includes Popper.js.

Unrelated changes: Indentation corrections, removal of invalid
"//<![CDATA[" markers, removal of invalid script type attributes.

To test, apply the patch and run 'yarn install' to install Bootstrap as
an npm module. Run 'yarn build --view opac' to regenerate the OPAC CSS.

Test as many aspect of the OPAC as possible, viewing pages at various
browser widths to confirm that everything adjusts well. Test with
various OPAC interface system preferences enabled and disabled.

Test self checkout and self checkin.

Known issues: RTL support has not been updated.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-09 14:13:03 +02:00

374 lines
28 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
[% IF ( searchdesc ) %]
Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]
[% ELSE %]
You did not specify any search criteria.
[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
<link rel="alternate" type="application/rss+xml" title="Koha - RSS" href="/cgi-bin/koha/opac-rss.pl?[% query_cgi | $raw %][% limit_cgi | url %]" />
</head>
[% INCLUDE 'bodytag.inc' bodyid='results-grouped' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
[% IF ( searchdesc ) %]
<a href="#">Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]</a>
[% ELSE %]
<a href="#">You did not specify any search criteria.</a>
[% END %]
</li>
</ul>
</nav>
[% IF ( query_error ) %]
<div class="container-fluid">
<div class="row">
<div class="col order-first order-md-first order-lg-2">
<div class="alert alert-warning">
<h4>Error:</h4>
<p>[% query_error | html %]</p>
</div>
</div> <!-- / .span12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
[% END %]
<div class="container-fluid">
<div class="row">
[% IF ( opacfacets && total ) %]
<div class="col-lg-2">
<div id="facetcontainer">
<!-- FACETS START -->
[% INCLUDE 'opac-facets.inc' %]
<!-- FACETS END -->
</div>
</div>
<div class="col-10 order-first order-md-first order-lg-2">
[% ELSE %]
<div class="col order-first order-md-first order-lg-2">
[% END %]
<div id="grouped-results" class="maincontent">
<!-- Search Results Table -->
[% IF ( total ) %]
[% IF ( scan ) %]
<h1>Scan index:</h1>
<form action="/cgi-bin/koha/opac-search.pl" method="get">
<table>
<tbody>
<tr>
<td>
Scan index for: <input type="text" name="q" id="scan-index" size="35" value="" />
</td>
</tr>
<tr>
<td>
<label for="scan-index">Indexed in:</label>
<select name="idx" id="scan-index">
<option value="">Any word</option>
<option value="kw,phr:">Any phrase</option>
<option value="ti:">Title</option>
<option value="ti,phr:">Title phrase</option>
<option value="au,phr:">Author</option>
<option value="su:">Subject</option>
<option value="su,phr:">Subject phrase</option>
<option value="se:">Series</option>
<option value="pb:">Publisher</option>
<option value="nt:">Notes</option>
<option value="se:">Series Title</option>
<option value="sn:">ISBN</option>
<option value="ss:">ISSN</option>
</select>
<input type="hidden" name="scan" value="1" />
</td>
</tr>
</tbody>
</table>
</form>
<form action="/cgi-bin/koha/opac-search.pl" method="get">
<table>
<thead>
<tr>
<th>Term/Phrase</th>
<th>Count</th>
</tr>
</thead>
<tbody>
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
<tr>
<td>
<a href="/cgi-bin/koha/opac-search.pl?q=[% SEARCH_RESULT.scan_use |url %]&quot;[% SEARCH_RESULT.title |url %]&quot;"><span class="biblio-title">[% SEARCH_RESULT.title | html %]</span></a>
</td>
<td>
[% FOREACH subtitl IN SEARCH_RESULT.subtitle.split(' | ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %]
<span class="subtitle">[% subtitl | html %]</span>
[% END %]
<span class="part-number">[% SEARCH_RESULT.part_number | html %]</span> <span class="part-name">[% SEARCH_RESULT.part_name | html %]</span>
</td>
</tr>
[% END %]
</thead>
</table>
</form>
[% ELSE %]
<div class="searchresults">
<form action="/cgi-bin/koha/opac-search.pl" method="get" name="bookbag_form" id="bookbag_form">
[% IF ( searchdesc ) %]
[% FOREACH QUERY_INPUT IN QUERY_INPUTS %]
<input type="hidden" name="[% QUERY_INPUT.input_name | html %]" value="[% QUERY_INPUT.input_value | html %]"/>
[% END %]
[% FOREACH LIMIT_INPUT IN LIMIT_INPUTS %]
<input type="hidden" name="[% LIMIT_INPUT.input_name | html %]" value="[% LIMIT_INPUT.input_value | html %]"/>
[% END %]
[% END %]
<!-- TABLE RESULTS START -->
<table class="table table-striped">
<tr>
<td colspan="3" class="resultscontrol">
<div class="resort">
<select id="sort_by" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select>
<input type="submit" class="submit clearfix" id="sortsubmit" value="Go" />
</div>
[% IF ( ( Koha.Preference( 'opacbookbag' ) == 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
<div class="cartlist"><span class="checkall"></span>
<span class="clearall"></span>
<a href="#" class="highlight_toggle" id="highlight_toggle_off">Unhighlight</a>
<a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
<span class="addto"></span></div>
[% END %]
</td>
</tr>
<!-- Actual Search Results -->
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
<tr class="grouplabel"><td colspan="3">[% SEARCH_RESULT.group_label | html %]</td></tr>
[% FOREACH GROUP_RESULT IN SEARCH_RESULT.GROUP_RESULTS %]
[% IF ( GROUP_RESULT.even ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td>
[% IF ( AdlibrisEnabled && GROUP_RESULT.normalized_isbn ) %]
<img src="[% AdlibrisURL | html %]?isbn=[% GROUP_RESULT.normalized_isbn | html %]" class="adlibris-cover" alt="Adlibris cover image" />
[% END %]
[% IF ( OPACAmazonCoverImages ) %]
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% GROUP_RESULT.biblionumber |url %]">[% IF ( GROUP_RESULT.isbn ) %]<img src="https://images-na.ssl-images-amazon.com/images/P/[% GROUP_RESULT.isbn | html %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />[% ELSE %]<img src="http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif" alt="" class="thumbnail" />[% END %]
</a>
[% ELSE %]
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
[% IF ( GROUP_RESULT.imageurl ) %]
<img src="[% GROUP_RESULT.imageurl | html %]" title="[% GROUP_RESULT.description | html %]" />
[% END %]
[% END %]
[% GROUP_RESULT.description | html %]
[% END %]
</td>
<td>
[% GROUP_RESULT.result_number | html %].
[% IF ( GROUP_RESULT.BiblioDefaultViewmarc ) %]
<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% GROUP_RESULT.biblionumber |url %]" title="View details for this title">[% GROUP_RESULT.title | html %]
[% ELSE %]
[% IF ( GROUP_RESULT.BiblioDefaultViewisbd ) %]
<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% GROUP_RESULT.biblionumber |url %]" title="View details for this title">[% GROUP_RESULT.title | html %]
[% ELSE %]
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% GROUP_RESULT.biblionumber |url %]" title="View details for this title">[% GROUP_RESULT.title | html %]
[% END %]
[% FOREACH subtitl IN GROUP_RESULT.subtitle %]
[% subtitl | html %]
[% END %]
</a>
[% END # / IF GROUP_RESULT.BiblioDefaultViewmarc %]
[% IF ( GROUP_RESULT.author ) %]
by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% GROUP_RESULT.author |url %]" title="Search for works by this author">[% GROUP_RESULT.author | html %]</a>
[% ELSE %]
&nbsp;
[% END %]
<p>
[% IF ( GROUP_RESULT.publicationyear ) %] - [% GROUP_RESULT.publicationyear | html %][% END %]
[% IF ( GROUP_RESULT.publishercode ) %]- [% GROUP_RESULT.publishercode | html %][% END %]
[% IF ( GROUP_RESULT.place ) %] ; [% GROUP_RESULT.place | html %][% END %]
[% IF ( GROUP_RESULT.pages ) %] - [% GROUP_RESULT.pages | html %][% END %]
[% IF ( GROUP_RESULT.notes ) %] : [% GROUP_RESULT.notes | html %][% END %]
[% IF ( GROUP_RESULT.size ) %] ; [% GROUP_RESULT.size | html %][% END %]
[% IF ( GROUP_RESULT.timestamp ) %] <em>(modified on [% GROUP_RESULT.timestamp | html %])</em>[% END %]
</p>
[% IF ( GROUP_RESULT.searchhighlightblob ) %]
<p class="searchhighlightblob">[% GROUP_RESULT.searchhighlightblob | html %]</p>
[% END %]
<p class="availability">
[% IF ( GROUP_RESULT.available_items_loop ) %]
<span class="available"><strong>Items available at:</strong>
[% FOREACH available_items_loo IN GROUP_RESULT.available_items_loop %]
[% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname | html %][% END %]
[% IF ( OPACItemsResultsDisplay ) %]
[% IF ( available_items_loo.location ) %]<span class="shelvingloc">[% available_items_loo.location | html %]</span>[% END %]
[% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber | html %]</a>][% END %]
[% END %]
([% available_items_loo.count | html %]),
[% END # / FOREACH available_items_loo %]
</span>
[% ELSE %]
<span class="unavailable">No items available:</span>
[% END # / IF GROUP_RESULT.available_items_loop %]
<span class="unavailable">
[% IF ( GROUP_RESULT.onloancount ) %] Checked out ([% GROUP_RESULT.onloancount | html %]), [% END %]
[% IF ( GROUP_RESULT.withdrawncount ) %] Withdrawn ([% GROUP_RESULT.withdrawncount | html %]), [% END %]
[% IF ( GROUP_RESULT.itemlostcount ) %] Lost ([% GROUP_RESULT.itemlostcount | html %]),[% END %]
[% IF ( GROUP_RESULT.damagedcount ) %] Damaged ([% GROUP_RESULT.damagedcount | html %]),[% END %]
[% IF ( GROUP_RESULT.orderedcount ) %] On order ([% GROUP_RESULT.orderedcount | html %]),[% END %]
[% IF ( GROUP_RESULT.intransitcount ) %] In transit ([% GROUP_RESULT.intransitcount | html %]),[% END %]
</span>
</p>
<p>
[% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
[% UNLESS ( GROUP_RESULT.norequests ) %]
[% IF Koha.Preference( 'opacuserlogin' ) == 1 && GROUP_RESULT.holdable %]
<a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% GROUP_RESULT.biblionumber | html %]">Place hold</a><!-- add back when available 0 holds in queue-->
[% END %]
[% END %]
[% END %]
[% IF ( ( Koha.Preference( 'opacbookbag' ) == 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
<input type="checkbox" name="biblionumber" value="[% GROUP_RESULT.biblionumber | html %]" title="Click to add to cart" /> <label for="bib[% GROUP_RESULT.biblionumber | html %]">
[% END %]
<img src="[% themelang | html %]/images/[% GROUP_RESULT.itemtype | html %].gif" alt="[% GROUP_RESULT.ccode | html %]" title="[% GROUP_RESULT.ccode | html %]" />
[% IF ( ( Koha.Preference( 'opacbookbag' ) = 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]</label>[% END %]
[% IF ( GROUP_RESULT.classification ) %]
<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% GROUP_RESULT.classification |url %]"> [% GROUP_RESULT.classification | html %] </a>
[% END %]
</p>
</td>
</tr>
[% END # / FOREACH GROUP_RESULT %]
[% END # / FOREACH SEARCH_RESULTS %]
</table>
</form>
</div> <!-- / .searchresults -->
[% END # / IF scan %]
[% INCLUDE 'page-numbers.inc' %]
[% END # / IF total %]
[% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername || Koha.Preference( 'ILLModule' ) == 1 ) %]
<div class="suggestion">
Not finding what you're looking for?
<ul>
[% IF Koha.Preference( 'AnonSuggestions' ) == 1 %]
<li>Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></li>
[% ELSE %]
[% IF ( loggedinusername ) %]
<li>Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></li>
[% END %]
[% END %]
[% IF Koha.Preference( 'ILLModule' ) == 1 && loggedinusername %]
<li>Make an <a href="/cgi-bin/koha/opac-illrequests.pl?op=create">Interlibrary loan request</a></li>
[% END %]
</ul>
</div>
[% END %]
</div> <!-- / #grouped-results -->
</div> <!-- /.col-10/12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
</div><!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
<script>
var q_array = new Array(); // will hold the search terms, if possible
$(document).ready(function(){
[% IF ( OpacHighlightedWords ) %]
$('a.title').each(function() {
$(this).attr("href", $(this).attr("href") + "&query_desc=[% query_desc | uri %]");
});
[% END %]
$('#sort_by').change(function() {
$('#bookbag_form').submit();
});
$("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">" + _("Clear all") + "</a>");
$("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">" + _("Select all") + "</a>");
$("span.addto").html("<label for=\"addto\">" + _("Add to: ") + "</label><select name=\"addto\" id=\"addto\"><option value=\"\"></option>[% IF Koha.Preference( 'opacbookbag' ) == 1 %]<option value=\"addtocart\">" + _("Cart") + "</option>[% END %][% IF Koha.Preference( 'virtualshelves' ) == 1 %][% IF ( loggedinusername ) %]<optgroup label=\"" + _("Lists:") + "\">[% IF ( barshelves ) %][% FOREACH barshelvesloo IN barshelvesloop %][% IF ( category == 1 ) %]<option id=\"s[% barshelvesloo.shelfnumber | html %]\" value=\"addtolist\">[% barshelvesloo.shelfname | html %]</option>[% END %][% END %][% END %]<option value=\"newlist\">" + _("[ New list ]") + "</option></optgroup>[% ELSE %]<option value=\"newlist\">" + _("List") + "</option>[% END %][% END %]</select> <input type=\"submit\" class=\"submit\" value=\"" + _("Save") + "\" />");
$("#addto").change(function(){
cartList();
});
$(".addto").find("input:submit").click(function(){
cartList();
return false;
});
function cartList(){
if($("#addto").find("option:selected").attr("value") == "addtolist"){
var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
[% IF ( loggedinusername ) %]if (vShelfAdd()) {
Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?selectedshelf='+shelfnumber+'&' + vShelfAdd());
}[% ELSE %] alert(_("You must be logged in to create or add to Lists")); [% END %]
return false;
} else if($("#addto").find("option:selected").attr("value") == "newlist"){
[% IF ( loggedinusername ) %]if (vShelfAdd()) {
Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?newshelf=1&' + vShelfAdd());
}[% ELSE %] alert(_("You must be logged in to create or add to Lists")); [% END %]
return false;
}
if($("#addto").find("option:selected").attr("value") == "addtocart"){
addMultiple();
return false;
}
}
$("#CheckAll").click(function(){
$("#bookbag_form").checkCheckboxes();
return false;
});
$("#CheckNone").click(function(){
$("#bookbag_form").unCheckCheckboxes();
return false;
});
[% IF ( query_desc ) %]
var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
q_array = query_desc.split(" ");
// ensure that we don't have "" at the end of the array, which can
// break the highlighter
while (q_array.length > 0 && q_array[q_array.length-1] == "") {
q_array = q_array.splice(0,-1);
}
highlightOn();
$("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
$("#highlight_toggle_off").show().click(function() {highlightOff();});
[% END %]
});
function highlightOff() {
$("td").removeHighlight();
$(".highlight_toggle").toggle();
}
function highlightOn() {
var x;
for (x in q_array) {
q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
q_array[x] = q_array[x].toLowerCase();
var myStopwords = "[% Koha.Preference('NotHighlightedWords') | html %]".toLowerCase().split('|');
if ( (q_array[x].length > 0) && ($.inArray(q_array[x], myStopwords) == -1) ) {
$("td").highlight(q_array[x]);
}
}
$(".highlight_toggle").toggle();
}
</script>
[% END %]