4 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Search history › Catalog › Koha</title>
8 [% INCLUDE 'doc-head-close.inc' %]
11 <body id="catalogue_search-history" class="catalogue">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22 <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
25 <a href="#" aria-current="page">
32 <div class="container-fluid">
34 <div class="col-sm-12 col-md-8 col-md-offset-2">
36 <h1>Search history</h1>
37 <div id="tabs" class="toptabs">
38 <ul class="nav nav-tabs" role="tablist">
39 <li role="presentation" class="active"><a href="#biblio_tab" aria-controls="biblio_tab" role="tab" data-toggle="tab">Catalog</a></li>
40 <li role="presentation"><a href="#authority_tab" aria-controls="authority_tab" role="tab" data-toggle="tab">Authority</a></li>
42 <div class="tab-content">
43 <div role="tabpanel" class="tab-pane active" id="biblio_tab">
44 [% IF ( current_biblio_searches ) %]
45 <h2>Current session</h2>
46 <form id="current_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
47 <p class="selections-toolbar">
48 <a class="CheckAll" data-form="current_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
49 <span class="sep">|</span>
50 <a class="CheckNone" data-form="current_cat" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
51 <span class="sep">|</span>
53 <span class="selections">Select searches to: </span>
54 <a href="#" class="action_delete disabled">Delete</a>
57 <input type="hidden" name="action" value="delete" />
58 <table class="historyt">
68 [% FOREACH s IN current_biblio_searches %]
70 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
71 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
72 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
73 <td>[% s.total | html %]</td>
81 [% IF ( current_biblio_searches && previous_biblio_searches) %]
85 [% IF ( previous_biblio_searches ) %]
86 <h2>Previous sessions</h2>
87 <form id="previous_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
88 <p class="selections-toolbar">
89 <a class="CheckAll" data-form="previous_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
90 <span class="sep">|</span>
91 <a class="CheckNone" data-form="previous_cat" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
92 <span class="sep">|</span>
94 <span class="selections">Select searches to: </span>
95 <a href="#" class="action_delete disabled">Delete</a>
98 <input type="hidden" name="action" value="delete" />
99 <table class="historyt">
109 [% FOREACH s IN previous_biblio_searches %]
111 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
112 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
113 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
114 <td>[% s.total | html %]</td>
122 [% IF !current_biblio_searches && !previous_biblio_searches %]
123 <p>Your catalog search history is empty.</p>
125 </div> <!-- /#biblio_tab -->
127 <div id="authority_tab" role="tabpanel" class="tab-pane">
128 [% IF ( current_authority_searches ) %]
129 <h2>Current session</h2>
130 <form id="current_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
131 <p class="selections-toolbar">
132 <a class="CheckAll" data-form="current_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
133 <span class="sep">|</span>
134 <a class="CheckNone" data-form="current_auth" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
135 <span class="sep">|</span>
137 <span class="selections">Select searches to: </span>
138 <a href="#" class="action_delete disabled">Delete</a>
141 <input type="hidden" name="action" value="delete" />
142 <table class="historyt">
152 [% FOREACH s IN current_authority_searches %]
154 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
155 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
156 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
157 <td>[% s.total | html %]</td>
165 [% IF ( current_authority_searches && previous_authority_searches) %]
169 [% IF ( previous_authority_searches ) %]
170 <h2>Previous sessions</h2>
171 <form id="previous_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
172 <p class="selections-toolbar">
173 <a class="CheckAll" data-form="previous_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
174 <span class="sep">|</span>
175 <a class="CheckNone" data-form="previous_auth" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
176 <span class="sep">|</span>
178 <span class="selections">Select searches to: </span>
179 <a href="#" class="action_delete disabled">Delete</a>
182 <input type="hidden" name="action" value="delete" />
183 <table class="historyt">
193 [% FOREACH s IN previous_authority_searches %]
195 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
196 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
197 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
198 <td>[% s.total | html %]</td>
206 [% IF !current_authority_searches && !previous_authority_searches %]
207 <p>Your authority search history is empty.</p>
209 </div> [% # /authority_tab %]
210 </div> <!-- /.tab-content -->
212 </div> [% # /div.col-md-8 %]
213 </div> [% # /div.row %]
215 [% MACRO jsinclude BLOCK %]
216 [% INCLUDE 'datatables.inc' %]
218 $(document).ready(function() {
219 // We show table ordered by descending dates by default
220 // (so that the more recent query is shown first)
221 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
222 "aaSorting": [[ 1, "desc" ]],
224 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
226 "sPaginationType": "full_numbers"
229 // DataTables removes hidden rows from the DOM, so we can't expect a
230 // "regular" submit to work and we need to build another form containing
231 // all form elements, and then submit this form.
232 $('#tabs form').submit(function(e) {
236 var table = form.find('table').dataTable();
238 var new_form = $('<form>')
239 .attr('action', form.attr('action'))
240 .attr('method', form.attr('method'));
241 form.find('input[type="hidden"]')
242 .add(table.$('input:checkbox:checked'))
244 var input = $('<input type="hidden">')
245 .attr('name', $(this).attr('name'))
246 .attr('value', $(this).attr('value'));
247 new_form.append(input);
249 $(document.body).append(new_form);
253 $(".CheckNone").click(function(e){
255 var form = $(this).data("form");
256 $("#" + form ).find('table input[type="checkbox"]').prop('checked', false);
257 enableCheckboxActions($("#" + form ));
259 $(".CheckAll").click(function(e){
261 var form = $(this).data("form");
262 $("#" + form ).find('table input[type="checkbox"]').prop('checked', true);
263 enableCheckboxActions($("#" + form ));
266 $('#tabs table').on('click', 'input:checkbox', function() {
267 var form = $(this).parents("form").first();
268 enableCheckboxActions(form);
271 $(".action_delete").click(function(e){
273 var form = $(this).parents("form").first();
274 var table = form.find('table').dataTable();
275 var ids = table.$("input:checkbox:checked");
276 if ( $(ids).length < 1 ) {
281 if (ids.length == 1) {
282 msg = _("Are you sure you want to delete the selected search history entry?");
284 msg = _("Are you sure you want to delete the %s selected search history entries?").format(ids.length);
287 if ( confirm(msg) ) {
293 $('#tabs form').each(function() {
294 enableCheckboxActions($(this));
298 function enableCheckboxActions(form){
299 // Enable/disable controls if checkboxes are checked
300 var table = form.find('table').dataTable();
301 var checked_count = table.$("input:checkbox:checked").length;
303 if (checked_count == 1) {
304 form.find(".selections").html(_("With selected search: "));
306 form.find(".selections").html(_("With %s selected searches: ").format(checked_count));
308 form.find(".selections-toolbar .links a").removeClass("disabled");
310 form.find(".selections").html(_("Select searches to: "));
311 form.find(".selections-toolbar .links a").addClass("disabled");
318 [% INCLUDE 'intranet-bottom.inc' %]