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 [% WRAPPER 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
17 [% WRAPPER 'sub-header.inc' %]
18 [% WRAPPER breadcrumbs %]
19 [% WRAPPER breadcrumb_item %]
20 <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
22 [% WRAPPER breadcrumb_item bc_active= 1 %]
23 <span>Search history</span>
25 [% END #/ WRAPPER breadcrumbs %]
26 [% END #/ WRAPPER sub-header.inc %]
28 <div class="container-fluid">
30 <div class="col-sm-12 col-md-8 col-md-offset-2">
32 <h1>Search history</h1>
34 [% WRAPPER tabs id= "tabs" %]
35 [% WRAPPER tabs_nav %]
36 [% WRAPPER tab_item tabname= "biblio_tab" bt_active= 1 %] <span>Catalog</span> [% END %]
37 [% WRAPPER tab_item tabname= "authority_tab" %] <span>Authority</span> [% END %]
38 [% END # /WRAPPER tabs_nav %]
40 [% WRAPPER tab_panels %]
41 [% WRAPPER tab_panel tabname="biblio_tab" bt_active= 1 %]
42 [% IF ( current_biblio_searches ) %]
43 <h2>Current session</h2>
44 <form id="current_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
45 <p class="selections-toolbar">
46 <a class="CheckAll" data-form="current_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
47 <span class="sep">|</span>
48 <a class="CheckNone" data-form="current_cat" href="#"><i class="fa fa-times"></i> Clear selection on visible rows</a>
49 <span class="sep">|</span>
51 <span class="selections">Select searches to: </span>
52 <a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</a>
55 <input type="hidden" name="action" value="delete" />
56 <table class="historyt">
66 [% FOREACH s IN current_biblio_searches %]
68 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
69 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
70 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
71 <td>[% s.total | html %]</td>
79 [% IF ( current_biblio_searches && previous_biblio_searches) %]
83 [% IF ( previous_biblio_searches ) %]
84 <h2>Previous sessions</h2>
85 <form id="previous_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
86 <p class="selections-toolbar">
87 <a class="CheckAll" data-form="previous_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
88 <span class="sep">|</span>
89 <a class="CheckNone" data-form="previous_cat" href="#"><i class="fa fa-times"></i> Clear selection on visible rows</a>
90 <span class="sep">|</span>
92 <span class="selections">Select searches to: </span>
93 <a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</a>
96 <input type="hidden" name="action" value="delete" />
97 <table class="historyt">
107 [% FOREACH s IN previous_biblio_searches %]
109 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
110 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
111 <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
112 <td>[% s.total | html %]</td>
120 [% IF !current_biblio_searches && !previous_biblio_searches %]
121 <p>Your catalog search history is empty.</p>
123 [% END # /tab_panel#biblio_tab %]
125 [% WRAPPER tab_panel tabname="authority_tab" %]
126 [% IF ( current_authority_searches ) %]
127 <h2>Current session</h2>
128 <form id="current_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
129 <p class="selections-toolbar">
130 <a class="CheckAll" data-form="current_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
131 <span class="sep">|</span>
132 <a class="CheckNone" data-form="current_auth" href="#"><i class="fa fa-times"></i> Clear selection on visible rows</a>
133 <span class="sep">|</span>
135 <span class="selections">Select searches to: </span>
136 <a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</a>
139 <input type="hidden" name="action" value="delete" />
140 <table class="historyt">
150 [% FOREACH s IN current_authority_searches %]
152 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
153 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
154 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
155 <td>[% s.total | html %]</td>
163 [% IF ( current_authority_searches && previous_authority_searches) %]
167 [% IF ( previous_authority_searches ) %]
168 <h2>Previous sessions</h2>
169 <form id="previous_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
170 <p class="selections-toolbar">
171 <a class="CheckAll" data-form="previous_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
172 <span class="sep">|</span>
173 <a class="CheckNone" data-form="previous_auth" href="#"><i class="fa fa-times"></i> Clear selection on visible rows</a>
174 <span class="sep">|</span>
176 <span class="selections">Select searches to: </span>
177 <a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</a>
180 <input type="hidden" name="action" value="delete" />
181 <table class="historyt">
191 [% FOREACH s IN previous_authority_searches %]
193 <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
194 <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
195 <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
196 <td>[% s.total | html %]</td>
204 [% IF !current_authority_searches && !previous_authority_searches %]
205 <p>Your authority search history is empty.</p>
207 [% END # /tab_panel#authority_tab %]
208 [% END # /WRAPPER tab_panels %]
209 [% END # /WRAPPER tabs %]
211 </div> [% # /div.col-md-8 %]
212 </div> [% # /div.row %]
214 [% MACRO jsinclude BLOCK %]
215 [% INCLUDE 'datatables.inc' %]
217 $(document).ready(function() {
218 // We show table ordered by descending dates by default
219 // (so that the more recent query is shown first)
220 $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
221 "aaSorting": [[ 1, "desc" ]],
223 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
225 "sPaginationType": "full_numbers"
228 // DataTables removes hidden rows from the DOM, so we can't expect a
229 // "regular" submit to work and we need to build another form containing
230 // all form elements, and then submit this form.
231 $('#tabs form').submit(function(e) {
235 var table = form.find('table').dataTable();
237 var new_form = $('<form>')
238 .attr('action', form.attr('action'))
239 .attr('method', form.attr('method'));
240 form.find('input[type="hidden"]')
241 .add(table.$('input:checkbox:checked'))
243 var input = $('<input type="hidden">')
244 .attr('name', $(this).attr('name'))
245 .attr('value', $(this).attr('value'));
246 new_form.append(input);
248 $(document.body).append(new_form);
252 $(".CheckNone").click(function(e){
254 var form = $(this).data("form");
255 $("#" + form ).find('table input[type="checkbox"]').prop('checked', false);
256 enableCheckboxActions($("#" + form ));
258 $(".CheckAll").click(function(e){
260 var form = $(this).data("form");
261 $("#" + form ).find('table input[type="checkbox"]').prop('checked', true);
262 enableCheckboxActions($("#" + form ));
265 $('#tabs table').on('click', 'input:checkbox', function() {
266 var form = $(this).parents("form").first();
267 enableCheckboxActions(form);
270 $(".action_delete").click(function(e){
272 var form = $(this).parents("form").first();
273 var table = form.find('table').dataTable();
274 var ids = table.$("input:checkbox:checked");
275 if ( $(ids).length < 1 ) {
280 if (ids.length == 1) {
281 msg = _("Are you sure you want to delete the selected search history entry?");
283 msg = _("Are you sure you want to delete the %s selected search history entries?").format(ids.length);
286 if ( confirm(msg) ) {
292 $('#tabs form').each(function() {
293 enableCheckboxActions($(this));
297 function enableCheckboxActions(form){
298 // Enable/disable controls if checkboxes are checked
299 var table = form.find('table').dataTable();
300 var checked_count = table.$("input:checkbox:checked").length;
302 if (checked_count == 1) {
303 form.find(".selections").html(_("With selected search: "));
305 form.find(".selections").html(_("With %s selected searches: ").format(checked_count));
307 form.find(".selections-toolbar .links a").removeClass("disabled");
309 form.find(".selections").html(_("Select searches to: "));
310 form.find(".selections-toolbar .links a").addClass("disabled");
317 [% INCLUDE 'intranet-bottom.inc' %]