3 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Catalog › Search history</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/datatables.css") %]
11 <body id="catalogue_search-history" class="catalogue">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Search history
20 <div id="doc3" class="yui-t2">
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 %]" /></td>
59 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
60 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
61 <td>[% s.total %]</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 %]" /></td>
96 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
97 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
98 <td>[% s.total %]</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 %]" /></td>
139 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
140 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
141 <td>[% s.total %]</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 %]" /></td>
176 <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
177 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
178 <td>[% s.total %]</td>
186 [% IF !current_authority_searches && !previous_authority_searches %]
187 <p>Your authority search history is empty.</p>
195 [% MACRO jsinclude BLOCK %]
196 [% INCLUDE 'datatables.inc' %]
197 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
198 <script type="text/javascript">
200 $(document).ready(function() {
201 // We show table ordered by descending dates by default
202 // (so that the more recent query is shown first)
203 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
204 "aaSorting": [[ 1, "desc" ]],
206 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
207 { "aTargets": [ 1 ], "sType": "title-string" },
209 "sPaginationType": "full_numbers"
214 // DataTables removes hidden rows from the DOM, so we can't expect a
215 // "regular" submit to work and we need to build another form containing
216 // all form elements, and then submit this form.
217 $('#tabs form').submit(function(e) {
221 var table = form.find('table').dataTable();
223 var new_form = $('<form>')
224 .attr('action', form.attr('action'))
225 .attr('method', form.attr('method'));
226 form.find('input[type="hidden"]')
227 .add(table.$('input:checkbox:checked'))
229 var input = $('<input type="hidden">')
230 .attr('name', $(this).attr('name'))
231 .attr('value', $(this).attr('value'));
232 new_form.append(input);
234 $(document.body).append(new_form);
238 $(".CheckNone").click(function(e){
240 var form = $(this).parents("form").first();
241 form.find('table input[type="checkbox"]').prop('checked', false);
242 enableCheckboxActions(form);
244 $(".CheckAll").click(function(e){
246 var form = $(this).parents("form").first();
247 form.find('table input[type="checkbox"]').prop('checked', true);
248 enableCheckboxActions(form);
251 $('#tabs table').on('click', 'input:checkbox', function() {
252 var form = $(this).parents("form").first();
253 enableCheckboxActions(form);
256 $(".action_delete").click(function(e){
258 var form = $(this).parents("form").first();
259 var table = form.find('table').dataTable();
260 var ids = table.$("input:checkbox:checked");
261 if ( $(ids).length < 1 ) {
266 if (ids.length == 1) {
267 msg = _("Are you sure you want to delete the selected search history entry?");
269 msg = _("Are you sure you want to delete the %s selected search history entries?").format(ids.length);
272 if ( confirm(msg) ) {
278 $('#tabs form').each(function() {
279 enableCheckboxActions($(this));
283 function enableCheckboxActions(form){
284 // Enable/disable controls if checkboxes are checked
285 var table = form.find('table').dataTable();
286 var checked_count = table.$("input:checkbox:checked").length;
288 if (checked_count == 1) {
289 form.find(".selections").html(_("With selected search: "));
291 form.find(".selections").html(_("With %s selected searches: ").format(checked_count));
293 form.find(".selections-toolbar .links a").removeClass("disabled");
295 form.find(".selections").html(_("Select searches to: "));
296 form.find(".selections-toolbar .links a").addClass("disabled");
303 [% INCLUDE 'intranet-bottom.inc' %]