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>
84 [% FOREACH s IN current_biblio_searches %]
86 <td class="selectcol">
87 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
89 <td data-order="[% s.time | html %]">
90 <label for="result[% s.id | html %]">
91 [% s.time |$KohaDates with_hours => 1 %]
95 <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">
96 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
98 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
100 <td>[% s.total | html %]</td>
105 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
107 [% END # IF ( current_biblio_searches ) %]
108 </div> <!-- / #current_biblio -->
110 <div id="previous_biblio">
111 [% IF ( previous_biblio_searches ) %]
112 <h2>Previous sessions</h2>
113 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
114 <legend class="sr-only">Toolbar control</legend>
115 [% INCLUDE 'toolbar_controls' %]
117 <input type="hidden" name="action" value="delete" />
118 <table class="historyt table table-bordered table-striped">
119 <caption class="sr-only">Previous sessions</caption>
129 [% FOREACH s IN previous_biblio_searches %]
131 <td class="selectcol">
132 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
134 <td data-order="[% s.time | html %]">
135 <label for="result[% s.id | html %]">
136 [% s.time |$KohaDates with_hours => 1 %]
140 <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">
141 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
143 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
144 [% s.query_desc | html %]
147 <td>[% s.total | html %]</td>
152 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
154 [% END # IF ( previous_biblio_searches ) %]
155 </div> <!-- / #previous_biblio -->
157 [% IF !current_biblio_searches && !previous_biblio_searches %]
158 <p>Your catalog search history is empty.</p>
160 </div> <!-- / #biblio_tab -->
162 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
163 <div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
164 <div id="current_authority">
165 [% IF ( current_authority_searches ) %]
166 <h2>Current session</h2>
167 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
168 <legend class="sr-only">Toolbar control</legend>
169 [% INCLUDE 'toolbar_controls' %]
170 <input type="hidden" name="action" value="delete" />
171 <table class="historyt table table-bordered table-striped">
172 <caption class="sr-only">Current session</caption>
182 [% FOREACH s IN current_authority_searches %]
184 <td class="selectcol">
185 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
187 <td data-order="[% s.time | html %]">
188 <label for="result[% s.id | html %]">
189 [% s.time |$KohaDates with_hours => 1 %]
192 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
193 <td>[% s.total | html %]</td>
198 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
200 [% END # / IF ( current_authority_searches ) %]
201 </div> <!-- / #current_authority -->
203 <div id="previous_authority">
204 [% IF ( previous_authority_searches ) %]
205 <h2>Previous sessions</h2>
206 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
207 <legend class="sr-only">Toolbar control</legend>
208 [% INCLUDE 'toolbar_controls' %]
209 <input type="hidden" name="action" value="delete" />
210 <table class="historyt table table-bordered table-striped">
211 <caption class="sr-only">Previous sessions</caption>
221 [% FOREACH s IN previous_authority_searches %]
223 <td class="selectcol">
224 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
226 <td data-order="[% s.time | html %]">
227 <label for="result[% s.id | html %]">
228 [% s.time |$KohaDates with_hours => 1 %]
231 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
232 <td>[% s.total | html %]</td>
237 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
239 [% END # / IF ( previous_authority_searches )%]
242 [% IF !current_authority_searches && !previous_authority_searches %]
243 <p>Your authority search history is empty.</p>
245 </div> <!-- / #authority_tab -->
246 </div> <!-- /.tab-content -->
247 [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
248 </div> <!-- / #tabs -->
249 </div> <!-- / #searchhistory -->
250 </div> <!-- / .col-lg-10/12 -->
251 </div> <!-- / .row -->
252 </div> <!-- / .container-fluid -->
253 </div> <!-- / #main -->
255 [% INCLUDE 'opac-bottom.inc' %]
257 [% BLOCK toolbar_controls %]
258 [% # Identical controls shown at the top of each table of search history %]
259 <div class="selections-toolbar toolbar">
260 <div class="check_control">
261 <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
262 <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
265 <span class="selections">Select searches to: </span>
266 <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
271 [% BLOCK jsinclude %]
272 [% INCLUDE 'datatables.inc' %]
275 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
276 $(document).ready(function() {
277 // We show table ordered by descending dates by default
278 // (so that the more recent query is shown first)
279 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
280 "order": [[ 1, "desc" ]],
281 "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
283 { "targets": [ 0 ], "sortable": false, "searchable": false }
287 "searchPlaceholder": _("Search")
291 $(".CheckNone").click(function(e){
293 var form = $(this).parents("form").get(0);
294 $(form).find("input:checkbox").prop("checked", false);
295 enableCheckboxActions(form);
297 $(".CheckAll").click(function(e){
299 var form = $(this).parents("form").get(0);
300 $(form).find("input:checkbox").prop("checked", true);
301 enableCheckboxActions(form);
304 $("input:checkbox").click(function(){
305 var form = $(this).parents("form").get(0);
306 enableCheckboxActions(form);
309 $(".removeitems,.remove-selected").click(function(e){
311 var form = $(this).parents("form").get(0);
312 var ids = $(form).find("input:checkbox:checked");
313 if ( $(ids).length < 1 ) {
316 if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
321 $(".remove-selected").addClass("disabled");
324 function enableCheckboxActions(form){
325 // Enable/disable controls if checkboxes are checked
326 var checkedBoxes = $(form).find("input:checkbox:checked");
327 if ($(checkedBoxes).size()) {
328 $(form).find(".selections").html(_("With selected searches: "));
329 $(form).find(".selections-toolbar .links a").removeClass("disabled");
330 $(form).find(".remove-selected").removeClass("disabled");
332 $(form).find(".selections").html(_("Select searches to: "));
333 $(form).find(".selections-toolbar .links a").addClass("disabled");
334 $(form).find(".remove-selected").addClass("disabled");