2 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Catalog › Search history</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
10 <body id="catalogue_search-history" class="catalogue">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
15 <div id="breadcrumbs">
16 <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Search history
19 <div id="doc3" class="yui-t2">
24 <h1>Search history</h1>
25 <div id="tabs" class="toptabs">
27 <li><a href="#biblio_tab">Catalog</a></li>
28 <li><a href="#authority_tab">Authority</a></li>
31 [% IF ( current_biblio_searches ) %]
32 <h2>Current session</h2>
33 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
34 <div class="selections-toolbar">
35 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
36 <span class="sep">|</span>
37 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
38 <span class="sep">|</span>
40 <span class="selections">Select searches to: </span>
41 <a href="#" class="action_delete disabled">Delete</a>
44 <input type="hidden" name="action" value="delete" />
45 <table class="historyt">
55 [% FOREACH s IN current_biblio_searches %]
57 <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
58 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
59 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
60 <td>[% s.total %]</td>
68 [% IF ( previous_biblio_searches ) %]
69 <h2>Previous sessions</h2>
70 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
71 <div class="selections-toolbar">
72 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
73 <span class="sep">|</span>
74 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
75 <span class="sep">|</span>
77 <span class="selections">Select searches to: </span>
78 <a href="#" class="action_delete disabled">Delete</a>
81 <input type="hidden" name="action" value="delete" />
82 <table class="historyt">
92 [% FOREACH s IN previous_biblio_searches %]
94 <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
95 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
96 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
97 <td>[% s.total %]</td>
105 [% IF !current_biblio_searches && !previous_biblio_searches %]
106 <p>Your catalog search history is empty.</p>
110 <div id="authority_tab">
111 [% IF ( current_authority_searches ) %]
112 <h2>Current session</h2>
113 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
114 <div class="selections-toolbar">
115 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
116 <span class="sep">|</span>
117 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
118 <span class="sep">|</span>
120 <span class="selections">Select searches to: </span>
121 <a href="#" class="action_delete disabled">Delete</a>
124 <input type="hidden" name="action" value="delete" />
125 <table class="historyt">
135 [% FOREACH s IN current_authority_searches %]
137 <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
138 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
139 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
140 <td>[% s.total %]</td>
148 [% IF ( previous_authority_searches ) %]
149 <h2>Previous sessions</h2>
150 <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
151 <div class="selections-toolbar">
152 <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
153 <span class="sep">|</span>
154 <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
155 <span class="sep">|</span>
157 <span class="selections">Select searches to: </span>
158 <a href="#" class="action_delete disabled">Delete</a>
161 <input type="hidden" name="action" value="delete" />
162 <table class="historyt">
172 [% FOREACH s IN previous_authority_searches %]
174 <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
175 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
176 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
177 <td>[% s.total %]</td>
185 [% IF !current_authority_searches && !previous_authority_searches %]
186 <p>Your authority search history is empty.</p>
194 [% MACRO jsinclude BLOCK %]
195 [% INCLUDE 'datatables.inc' %]
196 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
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' %]