5 [% USE AdditionalContents %]
6 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Your search history › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% BLOCK cssinclude %][% END %]
12 [% INCLUDE 'bodytag.inc' bodyid='opac-search-history' bodyclass='scrollto' %]
13 [% INCLUDE 'masthead.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
17 <ol class="breadcrumb">
18 <li class="breadcrumb-item">
19 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
21 [% IF ( loggedinusername ) %]
22 <li class="breadcrumb-item">
23 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
25 <li class="breadcrumb-item active">
26 <a href="#" aria-current="page">Your search history</a>
29 <li class="breadcrumb-item active">
30 <a href="#" aria-current="page">Search history</a>
34 </nav> <!-- /#breadcrumbs -->
36 <div class="container-fluid">
38 [% IF ( OpacNav||loggedinusername ) %]
39 <div class="col col-lg-2 order-2 order-lg-1">
41 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
44 <div class="col-md-12 col-lg-10 order-1">
46 <div class="col order-first order-md-first order-lg-2">
49 <div id="searchhistory" class="maincontent">
50 <h1>Search history</h1>
51 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
52 <div id="tabs" class="toptabs">
54 <li><a href="#biblio_tab">Catalog</a></li>
55 <li><a href="#authority_tab">Authority</a></li>
59 <div id="current_biblio">
60 [% IF ( current_biblio_searches ) %]
61 <h2>Current session</h2>
62 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
63 <legend class="sr-only">Toolbar control</legend>
65 [% INCLUDE 'toolbar_controls' %]
66 <input type="hidden" name="action" value="delete" />
67 <table class="historyt table table-bordered table-striped">
68 <caption class="sr-only">Current session</caption>
78 [% FOREACH s IN current_biblio_searches %]
80 <td class="selectcol">
81 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
83 <td data-order="[% s.time | html %]">
84 <label for="result[% s.id | html %]">
85 [% s.time |$KohaDates with_hours => 1 %]
89 <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">
90 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
92 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
94 <td>[% s.total | html %]</td>
99 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
101 [% END # IF ( current_biblio_searches ) %]
102 </div> <!-- / #current_biblio -->
104 <div id="previous_biblio">
105 [% IF ( previous_biblio_searches ) %]
106 <h2>Previous sessions</h2>
107 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
108 <legend class="sr-only">Toolbar control</legend>
109 [% INCLUDE 'toolbar_controls' %]
111 <input type="hidden" name="action" value="delete" />
112 <table class="historyt table table-bordered table-striped">
113 <caption class="sr-only">Previous sessions</caption>
123 [% FOREACH s IN previous_biblio_searches %]
125 <td class="selectcol">
126 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
128 <td data-order="[% s.time | html %]">
129 <label for="result[% s.id | html %]">
130 [% s.time |$KohaDates with_hours => 1 %]
134 <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">
135 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
137 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
138 [% s.query_desc | html %]
141 <td>[% s.total | html %]</td>
146 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
148 [% END # IF ( previous_biblio_searches ) %]
149 </div> <!-- / #previous_biblio -->
151 [% IF !current_biblio_searches && !previous_biblio_searches %]
152 <p>Your catalog search history is empty.</p>
154 </div> <!-- / #biblio_tab -->
156 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
157 <div id="authority_tab">
158 [% IF ( current_authority_searches ) %]
159 <h2>Current session</h2>
160 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
161 <legend class="sr-only">Toolbar control</legend>
162 [% INCLUDE 'toolbar_controls' %]
163 <input type="hidden" name="action" value="delete" />
164 <table class="historyt table table-bordered table-striped">
165 <caption class="sr-only">Current session</caption>
175 [% FOREACH s IN current_authority_searches %]
177 <td class="selectcol">
178 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
180 <td data-order="[% s.time | html %]">
181 <label for="result[% s.id | html %]">
182 [% s.time |$KohaDates with_hours => 1 %]
185 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
186 <td>[% s.total | html %]</td>
191 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
193 [% END # / IF ( current_authority_searches ) %]
195 [% IF ( previous_authority_searches ) %]
196 <h2>Previous sessions</h2>
197 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
198 <legend class="sr-only">Toolbar control</legend>
199 [% INCLUDE 'toolbar_controls' %]
200 <input type="hidden" name="action" value="delete" />
201 <table class="historyt table table-bordered table-striped">
202 <caption class="sr-only">Previous sessions</caption>
212 [% FOREACH s IN previous_authority_searches %]
214 <td class="selectcol">
215 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
217 <td data-order="[% s.time | html %]">
218 <label for="result[% s.id | html %]">
219 [% s.time |$KohaDates with_hours => 1 %]
222 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
223 <td>[% s.total | html %]</td>
228 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
230 [% END # / IF ( previous_authority_searches )%]
232 [% IF !current_authority_searches && !previous_authority_searches %]
233 <p>Your authority search history is empty.</p>
235 </div> <!-- / #authority_tab -->
236 [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
237 </div> <!-- / #tabs -->
238 </div> <!-- / #searchhistory -->
239 </div> <!-- / .col-lg-10/12 -->
240 </div> <!-- / .row -->
241 </div> <!-- / .container-fluid -->
242 </div> <!-- / #main -->
244 [% INCLUDE 'opac-bottom.inc' %]
246 [% BLOCK toolbar_controls %]
247 [% # Identical controls shown at the top of each table of search history %]
248 <div class="selections-toolbar toolbar">
249 <div class="check_control">
250 <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
251 <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
254 <span class="selections">Select searches to: </span>
255 <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
260 [% BLOCK jsinclude %]
261 [% INCLUDE 'datatables.inc' %]
264 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
265 $(document).ready(function() {
266 // We show table ordered by descending dates by default
267 // (so that the more recent query is shown first)
268 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
269 "order": [[ 1, "desc" ]],
270 "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
272 { "targets": [ 0 ], "sortable": false, "searchable": false }
276 "searchPlaceholder": _("Search")
280 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
282 $(".CheckNone").click(function(e){
284 var form = $(this).parents("form").get(0);
285 $(form).find("input:checkbox").prop("checked", false);
286 enableCheckboxActions(form);
288 $(".CheckAll").click(function(e){
290 var form = $(this).parents("form").get(0);
291 $(form).find("input:checkbox").prop("checked", true);
292 enableCheckboxActions(form);
295 $("input:checkbox").click(function(){
296 var form = $(this).parents("form").get(0);
297 enableCheckboxActions(form);
300 $(".removeitems,.remove-selected").click(function(e){
302 var form = $(this).parents("form").get(0);
303 var ids = $(form).find("input:checkbox:checked");
304 if ( $(ids).length < 1 ) {
307 if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
312 $(".remove-selected").addClass("disabled");
315 function enableCheckboxActions(form){
316 // Enable/disable controls if checkboxes are checked
317 var checkedBoxes = $(form).find("input:checkbox:checked");
318 if ($(checkedBoxes).size()) {
319 $(form).find(".selections").html(_("With selected searches: "));
320 $(form).find(".selections-toolbar .links a").removeClass("disabled");
321 $(form).find(".remove-selected").removeClass("disabled");
323 $(form).find(".selections").html(_("Select searches to: "));
324 $(form).find(".selections-toolbar .links a").addClass("disabled");
325 $(form).find(".remove-selected").addClass("disabled");