4 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Catalog › Search history</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% Asset.css("css/datatables.css") | $raw %]
12 <body id="catalogue_search-history" class="catalogue">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
17 <div id="breadcrumbs">
18 <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Search history
21 <div class="container-fluid">
23 <div class="col-sm-12 col-md-8 col-md-offset-2">
25 <h1>Search history</h1>
26 <div id="tabs" class="toptabs">
28 <li><a href="#biblio_tab">Catalog</a></li>
29 <li><a href="#authority_tab">Authority</a></li>
32 [% IF ( current_biblio_searches ) %]
33 <h2>Current session</h2>
34 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
35 <div class="selections-toolbar">
36 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
37 <span class="sep">|</span>
38 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
39 <span class="sep">|</span>
41 <span class="selections">Select searches to: </span>
42 <a href="#" class="action_delete disabled">Delete</a>
45 <input type="hidden" name="action" value="delete" />
46 <table class="historyt">
56 [% FOREACH s IN current_biblio_searches %]
58 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
59 <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
60 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
61 <td>[% s.total | html %]</td>
69 [% IF ( previous_biblio_searches ) %]
70 <h2>Previous sessions</h2>
71 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
72 <div class="selections-toolbar">
73 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
74 <span class="sep">|</span>
75 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
76 <span class="sep">|</span>
78 <span class="selections">Select searches to: </span>
79 <a href="#" class="action_delete disabled">Delete</a>
82 <input type="hidden" name="action" value="delete" />
83 <table class="historyt">
93 [% FOREACH s IN previous_biblio_searches %]
95 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
96 <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
97 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
98 <td>[% s.total | html %]</td>
106 [% IF !current_biblio_searches && !previous_biblio_searches %]
107 <p>Your catalog search history is empty.</p>
111 <div id="authority_tab">
112 [% IF ( current_authority_searches ) %]
113 <h2>Current session</h2>
114 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
115 <div class="selections-toolbar">
116 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
117 <span class="sep">|</span>
118 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
119 <span class="sep">|</span>
121 <span class="selections">Select searches to: </span>
122 <a href="#" class="action_delete disabled">Delete</a>
125 <input type="hidden" name="action" value="delete" />
126 <table class="historyt">
136 [% FOREACH s IN current_authority_searches %]
138 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
139 <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
140 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
141 <td>[% s.total | html %]</td>
149 [% IF ( previous_authority_searches ) %]
150 <h2>Previous sessions</h2>
151 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
152 <div class="selections-toolbar">
153 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
154 <span class="sep">|</span>
155 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
156 <span class="sep">|</span>
158 <span class="selections">Select searches to: </span>
159 <a href="#" class="action_delete disabled">Delete</a>
162 <input type="hidden" name="action" value="delete" />
163 <table class="historyt">
173 [% FOREACH s IN previous_authority_searches %]
175 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
176 <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
177 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
178 <td>[% s.total | html %]</td>
186 [% IF !current_authority_searches && !previous_authority_searches %]
187 <p>Your authority search history is empty.</p>
189 </div> [% # /authority_tab %]
191 </div> [% # /div.col-md-8 %]
192 </div> [% # /div.row %]
194 [% MACRO jsinclude BLOCK %]
195 [% INCLUDE 'datatables.inc' %]
196 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
197 <script type="text/javascript">
199 $(document).ready(function() {
200 // We show table ordered by descending dates by default
201 // (so that the more recent query is shown first)
202 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
203 "aaSorting": [[ 1, "desc" ]],
205 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
206 { "aTargets": [ 1 ], "sType": "title-string" },
208 "sPaginationType": "full_numbers"
213 // DataTables removes hidden rows from the DOM, so we can't expect a
214 // "regular" submit to work and we need to build another form containing
215 // all form elements, and then submit this form.
216 $('#tabs form').submit(function(e) {
220 var table = form.find('table').dataTable();
222 var new_form = $('<form>')
223 .attr('action', form.attr('action'))
224 .attr('method', form.attr('method'));
225 form.find('input[type="hidden"]')
226 .add(table.$('input:checkbox:checked'))
228 var input = $('<input type="hidden">')
229 .attr('name', $(this).attr('name'))
230 .attr('value', $(this).attr('value'));
231 new_form.append(input);
233 $(document.body).append(new_form);
237 $(".CheckNone").click(function(e){
239 var form = $(this).parents("form").first();
240 form.find('table input[type="checkbox"]').prop('checked', false);
241 enableCheckboxActions(form);
243 $(".CheckAll").click(function(e){
245 var form = $(this).parents("form").first();
246 form.find('table input[type="checkbox"]').prop('checked', true);
247 enableCheckboxActions(form);
250 $('#tabs table').on('click', 'input:checkbox', function() {
251 var form = $(this).parents("form").first();
252 enableCheckboxActions(form);
255 $(".action_delete").click(function(e){
257 var form = $(this).parents("form").first();
258 var table = form.find('table').dataTable();
259 var ids = table.$("input:checkbox:checked");
260 if ( $(ids).length < 1 ) {
265 if (ids.length == 1) {
266 msg = _("Are you sure you want to delete the selected search history entry?");
268 msg = _("Are you sure you want to delete the %s selected search history entries?").format(ids.length);
271 if ( confirm(msg) ) {
277 $('#tabs form').each(function() {
278 enableCheckboxActions($(this));
282 function enableCheckboxActions(form){
283 // Enable/disable controls if checkboxes are checked
284 var table = form.find('table').dataTable();
285 var checked_count = table.$("input:checkbox:checked").length;
287 if (checked_count == 1) {
288 form.find(".selections").html(_("With selected search: "));
290 form.find(".selections").html(_("With %s selected searches: ").format(checked_count));
292 form.find(".selections-toolbar .links a").removeClass("disabled");
294 form.find(".selections").html(_("Select searches to: "));
295 form.find(".selections-toolbar .links a").addClass("disabled");
302 [% INCLUDE 'intranet-bottom.inc' %]