5 [% USE AdditionalContents %]
6 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
7 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, 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">
55 <li><a href="#biblio_tab">Catalog</a></li>
56 <li><a href="#authority_tab">Authority</a></li>
60 <div id="current_biblio">
61 [% IF ( current_biblio_searches ) %]
62 <h2>Current session</h2>
63 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
64 <legend class="sr-only">Toolbar control</legend>
66 [% INCLUDE 'toolbar_controls' %]
67 <input type="hidden" name="action" value="delete" />
68 <table class="historyt table table-bordered table-striped">
69 <caption class="sr-only">Current session</caption>
79 [% FOREACH s IN current_biblio_searches %]
81 <td class="selectcol">
82 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
84 <td data-order="[% s.time | html %]">
85 <label for="result[% s.id | html %]">
86 [% s.time |$KohaDates with_hours => 1 %]
90 <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">
91 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
93 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
95 <td>[% s.total | html %]</td>
100 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
102 [% END # IF ( current_biblio_searches ) %]
103 </div> <!-- / #current_biblio -->
105 <div id="previous_biblio">
106 [% IF ( previous_biblio_searches ) %]
107 <h2>Previous sessions</h2>
108 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
109 <legend class="sr-only">Toolbar control</legend>
110 [% INCLUDE 'toolbar_controls' %]
112 <input type="hidden" name="action" value="delete" />
113 <table class="historyt table table-bordered table-striped">
114 <caption class="sr-only">Previous sessions</caption>
124 [% FOREACH s IN previous_biblio_searches %]
126 <td class="selectcol">
127 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
129 <td data-order="[% s.time | html %]">
130 <label for="result[% s.id | html %]">
131 [% s.time |$KohaDates with_hours => 1 %]
135 <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">
136 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
138 <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
139 [% s.query_desc | html %]
142 <td>[% s.total | html %]</td>
147 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
149 [% END # IF ( previous_biblio_searches ) %]
150 </div> <!-- / #previous_biblio -->
152 [% IF !current_biblio_searches && !previous_biblio_searches %]
153 <p>Your catalog search history is empty.</p>
155 </div> <!-- / #biblio_tab -->
157 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
158 <div id="authority_tab">
159 [% IF ( current_authority_searches ) %]
160 <h2>Current session</h2>
161 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
162 <legend class="sr-only">Toolbar control</legend>
163 [% INCLUDE 'toolbar_controls' %]
164 <input type="hidden" name="action" value="delete" />
165 <table class="historyt table table-bordered table-striped">
166 <caption class="sr-only">Current session</caption>
176 [% FOREACH s IN current_authority_searches %]
178 <td class="selectcol">
179 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
181 <td data-order="[% s.time | html %]">
182 <label for="result[% s.id | html %]">
183 [% s.time |$KohaDates with_hours => 1 %]
186 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
187 <td>[% s.total | html %]</td>
192 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
194 [% END # / IF ( current_authority_searches ) %]
196 [% IF ( previous_authority_searches ) %]
197 <h2>Previous sessions</h2>
198 <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
199 <legend class="sr-only">Toolbar control</legend>
200 [% INCLUDE 'toolbar_controls' %]
201 <input type="hidden" name="action" value="delete" />
202 <table class="historyt table table-bordered table-striped">
203 <caption class="sr-only">Previous sessions</caption>
213 [% FOREACH s IN previous_authority_searches %]
215 <td class="selectcol">
216 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
218 <td data-order="[% s.time | html %]">
219 <label for="result[% s.id | html %]">
220 [% s.time |$KohaDates with_hours => 1 %]
223 <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
224 <td>[% s.total | html %]</td>
229 <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
231 [% END # / IF ( previous_authority_searches )%]
233 [% IF !current_authority_searches && !previous_authority_searches %]
234 <p>Your authority search history is empty.</p>
236 </div> <!-- / #authority_tab -->
237 [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
238 </div> <!-- / #tabs -->
239 </div> <!-- / #searchhistory -->
240 </div> <!-- / .col-lg-10/12 -->
241 </div> <!-- / .row -->
242 </div> <!-- / .container-fluid -->
243 </div> <!-- / #main -->
245 [% INCLUDE 'opac-bottom.inc' %]
247 [% BLOCK toolbar_controls %]
248 [% # Identical controls shown at the top of each table of search history %]
249 <div class="selections-toolbar toolbar">
250 <div class="check_control">
251 <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
252 <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
255 <span class="selections">Select searches to: </span>
256 <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
261 [% BLOCK jsinclude %]
262 [% INCLUDE 'datatables.inc' %]
265 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
266 $(document).ready(function() {
267 // We show table ordered by descending dates by default
268 // (so that the more recent query is shown first)
269 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
270 "order": [[ 1, "desc" ]],
271 "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
273 { "targets": [ 0 ], "sortable": false, "searchable": false }
277 "searchPlaceholder": _("Search")
281 [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
283 $(".CheckNone").click(function(e){
285 var form = $(this).parents("form").get(0);
286 $(form).find("input:checkbox").prop("checked", false);
287 enableCheckboxActions(form);
289 $(".CheckAll").click(function(e){
291 var form = $(this).parents("form").get(0);
292 $(form).find("input:checkbox").prop("checked", true);
293 enableCheckboxActions(form);
296 $("input:checkbox").click(function(){
297 var form = $(this).parents("form").get(0);
298 enableCheckboxActions(form);
301 $(".removeitems,.remove-selected").click(function(e){
303 var form = $(this).parents("form").get(0);
304 var ids = $(form).find("input:checkbox:checked");
305 if ( $(ids).length < 1 ) {
308 if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
313 $(".remove-selected").addClass("disabled");
316 function enableCheckboxActions(form){
317 // Enable/disable controls if checkboxes are checked
318 var checkedBoxes = $(form).find("input:checkbox:checked");
319 if ($(checkedBoxes).size()) {
320 $(form).find(".selections").html(_("With selected searches: "));
321 $(form).find(".selections-toolbar .links a").removeClass("disabled");
322 $(form).find(".remove-selected").removeClass("disabled");
324 $(form).find(".selections").html(_("Select searches to: "));
325 $(form).find(".selections-toolbar .links a").addClass("disabled");
326 $(form).find(".remove-selected").addClass("disabled");