From b016806699c96d149950e655cb874da51cc45503 Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Thu, 1 Jun 2023 13:33:38 +0000 Subject: [PATCH] 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> --- .../en/modules/opac-search-history.tt | 381 +++++++++--------- 1 file changed, 195 insertions(+), 186 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt index 7bfb0e11ee..10fe6208cd 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt @@ -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,199 +60,207 @@ <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"> - [% 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> - </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 %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&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> - </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> - </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 %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&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> - </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 --> + <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 --> - [% 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> - </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> - </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> - </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> - </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 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> <!-- / #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> + </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 %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&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> + </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> + </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 %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&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> + </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> + </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> + </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> + </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> + </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 %] -- 2.30.2