5 [% USE AdditionalContents %]
6 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Your search history › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% BLOCK cssinclude %][% END %]
13 [% INCLUDE 'bodytag.inc' bodyid='opac-search-history' bodyclass='scrollto' %]
14 [% INCLUDE 'masthead.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
18 <ol class="breadcrumb">
19 <li class="breadcrumb-item">
20 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
22 [% IF ( loggedinusername ) %]
23 <li class="breadcrumb-item">
24 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
26 <li class="breadcrumb-item active">
27 <a href="#" aria-current="page">Your search history</a>
30 <li class="breadcrumb-item active">
31 <a href="#" aria-current="page">Search history</a>
35 </nav> <!-- /#breadcrumbs -->
37 <div class="container-fluid">
39 [% IF ( OpacNav||loggedinusername ) %]
40 <div class="col col-lg-2 order-2 order-lg-1">
42 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
45 <div class="col-md-12 col-lg-10 order-1">
47 <div class="col order-first order-md-first order-lg-2">
50 <div id="searchhistory" class="maincontent">
51 <h1>Search history</h1>
52 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
53 <div id="tabs" class="toptabs">
54 <ul class="nav nav-tabs" role="tablist">
55 <li class="nav-item" role="presentation">
56 <a class="nav-link active" id="biblio-tab-link" href="#biblio_tab" aria-controls="biblio_tab" role="tab" data-toggle="tab" aria-selected="true">Catalog</a>
58 <li class="nav-item" role="presentation">
59 <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>
62 <div class="tab-content">
64 <div id="biblio_tab" role="tabpanel" class="tab-pane active" aria-labelledby="biblio-tab-link">
65 <div id="current_biblio">
66 [% IF ( current_biblio_searches ) %]
67 <h2>Current session</h2>
68 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
69 <legend class="sr-only">Toolbar control</legend>
71 [% INCLUDE 'toolbar_controls' %]
72 <input type="hidden" name="action" value="delete" />
73 <table class="historyt table table-bordered table-striped">
74 <caption class="sr-only">Current session</caption>
85 [% FOREACH s IN current_biblio_searches %]
87 <td class="selectcol">
88 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
90 <td data-order="[% s.time | html %]">
91 <label for="result[% s.id | html %]">
92 [% s.time |$KohaDates with_hours => 1 %]
96 <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">
97 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
99 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
101 <td>[% s.total | html %]</td>
107 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
109 [% END # IF ( current_biblio_searches ) %]
110 </div> <!-- / #current_biblio -->
112 <div id="previous_biblio">
113 [% IF ( previous_biblio_searches ) %]
114 <h2>Previous sessions</h2>
115 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
116 <legend class="sr-only">Toolbar control</legend>
117 [% INCLUDE 'toolbar_controls' %]
119 <input type="hidden" name="action" value="delete" />
120 <table class="historyt table table-bordered table-striped">
121 <caption class="sr-only">Previous sessions</caption>
132 [% FOREACH s IN previous_biblio_searches %]
134 <td class="selectcol">
135 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
137 <td data-order="[% s.time | html %]">
138 <label for="result[% s.id | html %]">
139 [% s.time |$KohaDates with_hours => 1 %]
143 <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">
144 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
146 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
147 [% s.query_desc | html %]
150 <td>[% s.total | html %]</td>
156 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
158 [% END # IF ( previous_biblio_searches ) %]
159 </div> <!-- / #previous_biblio -->
161 [% IF !current_biblio_searches && !previous_biblio_searches %]
162 <p>Your catalog search history is empty.</p>
164 </div> <!-- / #biblio_tab -->
166 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
167 <div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
168 <div id="current_authority">
169 [% IF ( current_authority_searches ) %]
170 <h2>Current session</h2>
171 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
172 <legend class="sr-only">Toolbar control</legend>
173 [% INCLUDE 'toolbar_controls' %]
174 <input type="hidden" name="action" value="delete" />
175 <table class="historyt table table-bordered table-striped">
176 <caption class="sr-only">Current session</caption>
187 [% FOREACH s IN current_authority_searches %]
189 <td class="selectcol">
190 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
192 <td data-order="[% s.time | html %]">
193 <label for="result[% s.id | html %]">
194 [% s.time |$KohaDates with_hours => 1 %]
197 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
198 <td>[% s.total | html %]</td>
204 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
206 [% END # / IF ( current_authority_searches ) %]
207 </div> <!-- / #current_authority -->
209 <div id="previous_authority">
210 [% IF ( previous_authority_searches ) %]
211 <h2>Previous sessions</h2>
212 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
213 <legend class="sr-only">Toolbar control</legend>
214 [% INCLUDE 'toolbar_controls' %]
215 <input type="hidden" name="action" value="delete" />
216 <table class="historyt table table-bordered table-striped">
217 <caption class="sr-only">Previous sessions</caption>
228 [% FOREACH s IN previous_authority_searches %]
230 <td class="selectcol">
231 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
233 <td data-order="[% s.time | html %]">
234 <label for="result[% s.id | html %]">
235 [% s.time |$KohaDates with_hours => 1 %]
238 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
239 <td>[% s.total | html %]</td>
245 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
247 [% END # / IF ( previous_authority_searches )%]
250 [% IF !current_authority_searches && !previous_authority_searches %]
251 <p>Your authority search history is empty.</p>
253 </div> <!-- / #authority_tab -->
254 </div> <!-- /.tab-content -->
255 [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
256 </div> <!-- / #tabs -->
257 </div> <!-- / #searchhistory -->
258 </div> <!-- / .col-lg-10/12 -->
259 </div> <!-- / .row -->
260 </div> <!-- / .container-fluid -->
261 </div> <!-- / #main -->
263 [% INCLUDE 'opac-bottom.inc' %]
265 [% BLOCK toolbar_controls %]
266 [% # Identical controls shown at the top of each table of search history %]
267 <div class="selections-toolbar toolbar">
268 <div class="check_control">
269 <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
270 <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
273 <span class="selections">Select searches to: </span>
274 <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
279 [% BLOCK jsinclude %]
280 [% INCLUDE 'datatables.inc' %]
283 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
284 $(document).ready(function() {
285 // We show table ordered by descending dates by default
286 // (so that the more recent query is shown first)
287 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
288 "order": [[ 1, "desc" ]],
289 "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
291 { "targets": [ 0 ], "sortable": false, "searchable": false },
292 {"className": 'dtr-control',"orderable": false,"targets": -1}
296 "searchPlaceholder": _("Search")
307 $(".CheckNone").click(function(e){
309 var form = $(this).parents("form").get(0);
310 $(form).find("input:checkbox").prop("checked", false);
311 enableCheckboxActions(form);
313 $(".CheckAll").click(function(e){
315 var form = $(this).parents("form").get(0);
316 $(form).find("input:checkbox").prop("checked", true);
317 enableCheckboxActions(form);
320 $("input:checkbox").click(function(){
321 var form = $(this).parents("form").get(0);
322 enableCheckboxActions(form);
325 $(".removeitems,.remove-selected").click(function(e){
327 var form = $(this).parents("form").get(0);
328 var ids = $(form).find("input:checkbox:checked");
329 if ( $(ids).length < 1 ) {
332 if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
337 $(".remove-selected").addClass("disabled");
340 function enableCheckboxActions(form){
341 // Enable/disable controls if checkboxes are checked
342 var checkedBoxes = $(form).find("input:checkbox:checked");
343 if ($(checkedBoxes).size()) {
344 $(form).find(".selections").html(_("With selected searches: "));
345 $(form).find(".selections-toolbar .links a").removeClass("disabled");
346 $(form).find(".remove-selected").removeClass("disabled");
348 $(form).find(".selections").html(_("Select searches to: "));
349 $(form).find(".selections-toolbar .links a").addClass("disabled");
350 $(form).find(".remove-selected").addClass("disabled");