Bug 33894: Restructuring: Use BLOCKs for biblio and authority sections

In order to make the conversion to the tab wrapper markup easier I'm
putting the biblio search history and authority search history sections
into blocks. This will make it easier to include or not include the
sections using template logic.

To test, apply the patch and, if necessary, perform some searches for
bibliographic and authority records. The OPAC search history page should
be unchanged, with the correct information showing under each tab and in
each section for current and previous searches.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-06-01 13:33:38 +00:00 committed by Tomas Cohen Arazi
parent 44759b4be3
commit f3def0d264
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -49,6 +49,7 @@
<div id="searchhistory" class="maincontent">
<h1>Search history</h1>
[% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
<div id="tabs" class="toptabs">
<ul class="nav nav-tabs" role="tablist">
@ -59,207 +60,215 @@
<a class="nav-link" id="authority-tab-link" href="#authority_tab" aria-controls="authority_tab" role="tab" data-toggle="tab" aria-selected="false">Authority</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-content">
<div id="biblio_tab" role="tabpanel" class="tab-pane active" aria-labelledby="biblio-tab-link">
[% PROCESS catalog_search_history %]
</div> <!-- / #biblio_tab -->
<div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
[% PROCESS authority_search_history %]
</div> <!-- / #authority_tab -->
</div> <!-- /.tab-content -->
</div> <!-- / #tabs -->
[% ELSE %]
[% PROCESS catalog_search_history %]
[% END %]
<div id="biblio_tab" role="tabpanel" class="tab-pane active" aria-labelledby="biblio-tab-link">
<div id="current_biblio">
[% IF ( current_biblio_searches ) %]
<h2>Current session</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Current session</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN current_biblio_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td>
<a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;[% s.query_cgi | $raw %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" aria-label="Subscribe to this search" class="rsssearchlink">
<i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
</a>
<a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
</td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # IF ( current_biblio_searches ) %]
</div> <!-- / #current_biblio -->
<hr />
<div id="previous_biblio">
[% IF ( previous_biblio_searches ) %]
<h2>Previous sessions</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Previous sessions</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN previous_biblio_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td>
<a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;[% s.query_cgi | $raw %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" aria-label="Subscribe to this search" class="rsssearchlink">
<i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
</a>
<a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
[% s.query_desc | html %]
</a>
</td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # IF ( previous_biblio_searches ) %]
</div> <!-- / #previous_biblio -->
[% IF !current_biblio_searches && !previous_biblio_searches %]
<p>Your catalog search history is empty.</p>
[% END %]
</div> <!-- / #biblio_tab -->
[% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
<div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
<div id="current_authority">
[% IF ( current_authority_searches ) %]
<h2>Current session</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Current session</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN current_authority_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # / IF ( current_authority_searches ) %]
</div> <!-- / #current_authority -->
<hr />
<div id="previous_authority">
[% IF ( previous_authority_searches ) %]
<h2>Previous sessions</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Previous sessions</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN previous_authority_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # / IF ( previous_authority_searches )%]
</div>
[% IF !current_authority_searches && !previous_authority_searches %]
<p>Your authority search history is empty.</p>
[% END %]
</div> <!-- / #authority_tab -->
</div> <!-- /.tab-content -->
[% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
</div> <!-- / #tabs -->
</div> <!-- / #searchhistory -->
</div> <!-- / .col-lg-10/12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
</div> <!-- / #main -->
[% BLOCK catalog_search_history %]
<div id="current_biblio">
[% IF ( current_biblio_searches ) %]
<h2>Current session</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Current session</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN current_biblio_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td>
<a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;[% s.query_cgi | $raw %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" aria-label="Subscribe to this search" class="rsssearchlink">
<i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
</a>
<a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
</td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # IF ( current_biblio_searches ) %]
</div> <!-- / #current_biblio -->
<hr />
<div id="previous_biblio">
[% IF ( previous_biblio_searches ) %]
<h2>Previous sessions</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Previous sessions</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN previous_biblio_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td>
<a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;[% s.query_cgi | $raw %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" aria-label="Subscribe to this search" class="rsssearchlink">
<i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
</a>
<a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
[% s.query_desc | html %]
</a>
</td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # IF ( previous_biblio_searches ) %]
</div> <!-- / #previous_biblio -->
[% IF !current_biblio_searches && !previous_biblio_searches %]
<p>Your catalog search history is empty.</p>
[% END %]
[% END %]
[% BLOCK authority_search_history %]
<div id="current_authority">
[% IF ( current_authority_searches ) %]
<h2>Current session</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Current session</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN current_authority_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # / IF ( current_authority_searches ) %]
</div> <!-- / #current_authority -->
<hr />
<div id="previous_authority">
[% IF ( previous_authority_searches ) %]
<h2>Previous sessions</h2>
<form action="/cgi-bin/koha/opac-search-history.pl" method="post">
<legend class="sr-only">Toolbar control</legend>
[% INCLUDE 'toolbar_controls' %]
<input type="hidden" name="action" value="delete" />
<table class="historyt table table-bordered table-striped">
<caption class="sr-only">Previous sessions</caption>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH s IN previous_authority_searches %]
<tr>
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
<input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
</form>
[% END # / IF ( previous_authority_searches )%]
</div>
[% IF !current_authority_searches && !previous_authority_searches %]
<p>Your authority search history is empty.</p>
[% END %]
[% END %]
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK toolbar_controls %]