5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Your search history › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% BLOCK cssinclude %][% END %]
10 [% INCLUDE 'bodytag.inc' bodyid='opac-search-history' bodyclass='scrollto' %]
11 [% INCLUDE 'masthead.inc' %]
14 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
15 <ol class="breadcrumb">
16 <li class="breadcrumb-item">
17 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
19 [% IF ( loggedinusername ) %]
20 <li class="breadcrumb-item">
21 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
23 <li class="breadcrumb-item active">
24 <a href="#" aria-current="page">Your search history</a>
27 <li class="breadcrumb-item active">
28 <a href="#" aria-current="page">Search history</a>
32 </nav> <!-- /#breadcrumbs -->
34 <div class="container-fluid">
36 [% IF ( OpacNav||loggedinusername ) %]
37 <div class="col col-lg-2 order-2 order-lg-1">
39 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
42 <div class="col-md-12 col-lg-10 order-1">
44 <div class="col order-first order-md-first order-lg-2">
47 <div id="searchhistory" class="maincontent">
48 <h1>Search history</h1>
49 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
50 <div id="tabs" class="toptabs">
52 <li><a href="#biblio_tab">Catalog</a></li>
53 <li><a href="#authority_tab">Authority</a></li>
57 <div id="current_biblio">
58 [% IF ( current_biblio_searches ) %]
59 <h2>Current session</h2>
60 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
61 <legend class="sr-only">Toolbar control</legend>
63 [% INCLUDE 'toolbar_controls' %]
64 <input type="hidden" name="action" value="delete" />
65 <table class="historyt table table-bordered table-striped">
66 <caption class="sr-only">Current session</caption>
76 [% FOREACH s IN current_biblio_searches %]
78 <td class="selectcol">
79 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
81 <td data-order="[% s.time | html %]">
82 <label for="result[% s.id | html %]">
83 [% s.time |$KohaDates with_hours => 1 %]
87 <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">
88 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
90 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
92 <td>[% s.total | html %]</td>
97 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
99 [% END # IF ( current_biblio_searches ) %]
100 </div> <!-- / #current_biblio -->
102 <div id="previous_biblio">
103 [% IF ( previous_biblio_searches ) %]
104 <h2>Previous sessions</h2>
105 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
106 <legend class="sr-only">Toolbar control</legend>
107 [% INCLUDE 'toolbar_controls' %]
109 <input type="hidden" name="action" value="delete" />
110 <table class="historyt table table-bordered table-striped">
111 <caption class="sr-only">Previous sessions</caption>
121 [% FOREACH s IN previous_biblio_searches %]
123 <td class="selectcol">
124 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
126 <td data-order="[% s.time | html %]">
127 <label for="result[% s.id | html %]">
128 [% s.time |$KohaDates with_hours => 1 %]
132 <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">
133 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
135 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
136 [% s.query_desc | html %]
139 <td>[% s.total | html %]</td>
144 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
146 [% END # IF ( previous_biblio_searches ) %]
147 </div> <!-- / #previous_biblio -->
149 [% IF !current_biblio_searches && !previous_biblio_searches %]
150 <p>Your catalog search history is empty.</p>
152 </div> <!-- / #biblio_tab -->
154 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
155 <div id="authority_tab">
156 [% IF ( current_authority_searches ) %]
157 <h2>Current session</h2>
158 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
159 <legend class="sr-only">Toolbar control</legend>
160 [% INCLUDE 'toolbar_controls' %]
161 <input type="hidden" name="action" value="delete" />
162 <table class="historyt table table-bordered table-striped">
163 <caption class="sr-only">Current session</caption>
173 [% FOREACH s IN current_authority_searches %]
175 <td class="selectcol">
176 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
178 <td data-order="[% s.time | html %]">
179 <label for="result[% s.id | html %]">
180 [% s.time |$KohaDates with_hours => 1 %]
183 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
184 <td>[% s.total | html %]</td>
189 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
191 [% END # / IF ( current_authority_searches ) %]
193 [% IF ( previous_authority_searches ) %]
194 <h2>Previous sessions</h2>
195 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
196 <legend class="sr-only">Toolbar control</legend>
197 [% INCLUDE 'toolbar_controls' %]
198 <input type="hidden" name="action" value="delete" />
199 <table class="historyt table table-bordered table-striped">
200 <caption class="sr-only">Previous sessions</caption>
210 [% FOREACH s IN previous_authority_searches %]
212 <td class="selectcol">
213 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
215 <td data-order="[% s.time | html %]">
216 <label for="result[% s.id | html %]">
217 [% s.time |$KohaDates with_hours => 1 %]
220 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
221 <td>[% s.total | html %]</td>
226 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
228 [% END # / IF ( previous_authority_searches )%]
230 [% IF !current_authority_searches && !previous_authority_searches %]
231 <p>Your authority search history is empty.</p>
233 </div> <!-- / #authority_tab -->
234 [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
235 </div> <!-- / #tabs -->
236 </div> <!-- / #searchhistory -->
237 </div> <!-- / .col-lg-10/12 -->
238 </div> <!-- / .row -->
239 </div> <!-- / .container-fluid -->
240 </div> <!-- / #main -->
242 [% INCLUDE 'opac-bottom.inc' %]
244 [% BLOCK toolbar_controls %]
245 [% # Identical controls shown at the top of each table of search history %]
246 <div class="selections-toolbar toolbar">
247 <div class="check_control">
248 <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
249 <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
252 <span class="selections">Select searches to: </span>
253 <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
258 [% BLOCK jsinclude %]
259 [% INCLUDE 'datatables.inc' %]
262 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
263 $(document).ready(function() {
264 // We show table ordered by descending dates by default
265 // (so that the more recent query is shown first)
266 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
267 "order": [[ 1, "desc" ]],
268 "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
270 { "targets": [ 0 ], "sortable": false, "searchable": false }
274 "searchPlaceholder": _("Search")
278 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
280 $(".CheckNone").click(function(e){
282 var form = $(this).parents("form").get(0);
283 $(form).find("input:checkbox").prop("checked", false);
284 enableCheckboxActions(form);
286 $(".CheckAll").click(function(e){
288 var form = $(this).parents("form").get(0);
289 $(form).find("input:checkbox").prop("checked", true);
290 enableCheckboxActions(form);
293 $("input:checkbox").click(function(){
294 var form = $(this).parents("form").get(0);
295 enableCheckboxActions(form);
298 $(".removeitems,.remove-selected").click(function(e){
300 var form = $(this).parents("form").get(0);
301 var ids = $(form).find("input:checkbox:checked");
302 if ( $(ids).length < 1 ) {
305 if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
310 $(".remove-selected").addClass("disabled");
313 function enableCheckboxActions(form){
314 // Enable/disable controls if checkboxes are checked
315 var checkedBoxes = $(form).find("input:checkbox:checked");
316 if ($(checkedBoxes).size()) {
317 $(form).find(".selections").html(_("With selected searches: "));
318 $(form).find(".selections-toolbar .links a").removeClass("disabled");
319 $(form).find(".remove-selected").removeClass("disabled");
321 $(form).find(".selections").html(_("Select searches to: "));
322 $(form).find(".selections-toolbar .links a").addClass("disabled");
323 $(form).find(".remove-selected").addClass("disabled");