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>
53 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
54 <div id="tabs" class="toptabs">
55 <ul class="nav nav-tabs" role="tablist">
56 <li class="nav-item" role="presentation">
57 <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>
59 <li class="nav-item" role="presentation">
60 <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>
63 <div class="tab-content">
64 <div id="biblio_tab" role="tabpanel" class="tab-pane active" aria-labelledby="biblio-tab-link">
65 [% PROCESS catalog_search_history %]
66 </div> <!-- / #biblio_tab -->
68 <div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
69 [% PROCESS authority_search_history %]
70 </div> <!-- / #authority_tab -->
71 </div> <!-- /.tab-content -->
72 </div> <!-- / #tabs -->
74 [% PROCESS catalog_search_history %]
76 </div> <!-- / #searchhistory -->
77 </div> <!-- / .col-lg-10/12 -->
78 </div> <!-- / .row -->
79 </div> <!-- / .container-fluid -->
80 </div> <!-- / #main -->
82 [% BLOCK catalog_search_history %]
83 <div id="current_biblio">
84 [% IF ( current_biblio_searches ) %]
85 <h2>Current session</h2>
86 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
87 <legend class="sr-only">Toolbar control</legend>
89 [% INCLUDE 'toolbar_controls' %]
90 <input type="hidden" name="action" value="delete" />
91 <table class="historyt table table-bordered table-striped">
92 <caption class="sr-only">Current session</caption>
103 [% FOREACH s IN current_biblio_searches %]
105 <td class="selectcol">
106 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
108 <td data-order="[% s.time | html %]">
109 <label for="result[% s.id | html %]">
110 [% s.time |$KohaDates with_hours => 1 %]
114 <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">
115 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
117 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
119 <td>[% s.total | html %]</td>
125 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
127 [% END # IF ( current_biblio_searches ) %]
128 </div> <!-- / #current_biblio -->
130 <div id="previous_biblio">
131 [% IF ( previous_biblio_searches ) %]
132 <h2>Previous sessions</h2>
133 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
134 <legend class="sr-only">Toolbar control</legend>
135 [% INCLUDE 'toolbar_controls' %]
137 <input type="hidden" name="action" value="delete" />
138 <table class="historyt table table-bordered table-striped">
139 <caption class="sr-only">Previous sessions</caption>
150 [% FOREACH s IN previous_biblio_searches %]
152 <td class="selectcol">
153 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
155 <td data-order="[% s.time | html %]">
156 <label for="result[% s.id | html %]">
157 [% s.time |$KohaDates with_hours => 1 %]
161 <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">
162 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
164 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
165 [% s.query_desc | html %]
168 <td>[% s.total | html %]</td>
174 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
176 [% END # IF ( previous_biblio_searches ) %]
177 </div> <!-- / #previous_biblio -->
179 [% IF !current_biblio_searches && !previous_biblio_searches %]
180 <p>Your catalog search history is empty.</p>
184 [% BLOCK authority_search_history %]
185 <div id="current_authority">
186 [% IF ( current_authority_searches ) %]
187 <h2>Current session</h2>
188 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
189 <legend class="sr-only">Toolbar control</legend>
190 [% INCLUDE 'toolbar_controls' %]
191 <input type="hidden" name="action" value="delete" />
192 <table class="historyt table table-bordered table-striped">
193 <caption class="sr-only">Current session</caption>
204 [% FOREACH s IN current_authority_searches %]
206 <td class="selectcol">
207 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
209 <td data-order="[% s.time | html %]">
210 <label for="result[% s.id | html %]">
211 [% s.time |$KohaDates with_hours => 1 %]
214 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
215 <td>[% s.total | html %]</td>
221 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
223 [% END # / IF ( current_authority_searches ) %]
224 </div> <!-- / #current_authority -->
226 <div id="previous_authority">
227 [% IF ( previous_authority_searches ) %]
228 <h2>Previous sessions</h2>
229 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
230 <legend class="sr-only">Toolbar control</legend>
231 [% INCLUDE 'toolbar_controls' %]
232 <input type="hidden" name="action" value="delete" />
233 <table class="historyt table table-bordered table-striped">
234 <caption class="sr-only">Previous sessions</caption>
245 [% FOREACH s IN previous_authority_searches %]
247 <td class="selectcol">
248 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
250 <td data-order="[% s.time | html %]">
251 <label for="result[% s.id | html %]">
252 [% s.time |$KohaDates with_hours => 1 %]
255 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
256 <td>[% s.total | html %]</td>
262 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
264 [% END # / IF ( previous_authority_searches )%]
267 [% IF !current_authority_searches && !previous_authority_searches %]
268 <p>Your authority search history is empty.</p>
272 [% INCLUDE 'opac-bottom.inc' %]
274 [% BLOCK toolbar_controls %]
275 [% # Identical controls shown at the top of each table of search history %]
276 <div class="selections-toolbar toolbar">
277 <div class="check_control">
278 <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
279 <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
282 <span class="selections">Select searches to: </span>
283 <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</a>
288 [% BLOCK jsinclude %]
289 [% INCLUDE 'datatables.inc' %]
292 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
293 $(document).ready(function() {
294 // We show table ordered by descending dates by default
295 // (so that the more recent query is shown first)
296 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
297 "order": [[ 1, "desc" ]],
298 "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
300 { "targets": [ 0 ], "sortable": false, "searchable": false },
301 { "className": 'dtr-control', "orderable": false, "targets": -1 }
305 "searchPlaceholder": _("Search")
309 "details": { "type": 'column',"target": -1 }
313 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
314 $(".historyt").DataTable().responsive.recalc();
316 $(".CheckNone").click(function(e){
318 var form = $(this).parents("form").get(0);
319 $(form).find("input:checkbox").prop("checked", false);
320 enableCheckboxActions(form);
322 $(".CheckAll").click(function(e){
324 var form = $(this).parents("form").get(0);
325 $(form).find("input:checkbox").prop("checked", true);
326 enableCheckboxActions(form);
329 $("input:checkbox").click(function(){
330 var form = $(this).parents("form").get(0);
331 enableCheckboxActions(form);
334 $(".removeitems,.remove-selected").click(function(e){
336 var form = $(this).parents("form").get(0);
337 var ids = $(form).find("input:checkbox:checked");
338 if ( $(ids).length < 1 ) {
341 if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
346 $(".remove-selected").addClass("disabled");
349 function enableCheckboxActions(form){
350 // Enable/disable controls if checkboxes are checked
351 var checkedBoxes = $(form).find("input:checkbox:checked");
352 if ($(checkedBoxes).size()) {
353 $(form).find(".selections").html(_("With selected searches: "));
354 $(form).find(".selections-toolbar .links a").removeClass("disabled");
355 $(form).find(".remove-selected").removeClass("disabled");
357 $(form).find(".selections").html(_("Select searches to: "));
358 $(form).find(".selections-toolbar .links a").addClass("disabled");
359 $(form).find(".remove-selected").addClass("disabled");