Bug 32341: (Fix) Changing the placement of the button
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-search-history.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AdditionalContents %]
6 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Your search history &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% BLOCK cssinclude %][% END %]
12 </head>
13 [% INCLUDE 'bodytag.inc' bodyid='opac-search-history' bodyclass='scrollto' %]
14 [% INCLUDE 'masthead.inc' %]
15
16 <div class="main">
17     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
18         <ol class="breadcrumb">
19             <li class="breadcrumb-item">
20                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
21             </li>
22             [% IF ( loggedinusername ) %]
23                 <li class="breadcrumb-item">
24                     <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
25                 </li>
26                 <li class="breadcrumb-item active">
27                     <a href="#" aria-current="page">Your search history</a>
28                 </li>
29             [% ELSE %]
30                 <li class="breadcrumb-item active">
31                     <a href="#" aria-current="page">Search history</a>
32                 </li>
33             [% END %]
34         </ol>
35     </nav> <!-- /#breadcrumbs -->
36
37     <div class="container-fluid">
38         <div class="row">
39             [% IF ( OpacNav||loggedinusername ) %]
40                 <div class="col col-lg-2 order-2 order-lg-1">
41                     <div id="navigation">
42                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
43                     </div>
44                 </div>
45                 <div class="col-md-12 col-lg-10 order-1">
46             [% ELSE %]
47                 <div class="col order-first order-md-first order-lg-2">
48             [% END %]
49
50                 <div id="searchhistory" class="maincontent">
51                     <h1>Search history</h1>
52                     [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
53                         <div id="tabs" class="toptabs">
54                             <ul class="nav nav-tabs" role="tablist">
55                                 <li class="nav-item" role="presentation">
56                                     <a class="nav-link active" id="biblio-tab-link" href="#biblio_tab" aria-controls="biblio_tab" role="tab" data-toggle="tab" aria-selected="true">Catalog</a>
57                                 </li>
58                                 <li class="nav-item" role="presentation">
59                                     <a class="nav-link" id="authority-tab-link" href="#authority_tab" aria-controls="authority_tab" role="tab" data-toggle="tab" aria-selected="false">Authority</a>
60                                 </li>
61                             </ul>
62                         <div class="tab-content">
63                     [% END %]
64                         <div id="biblio_tab" role="tabpanel" class="tab-pane active" aria-labelledby="biblio-tab-link">
65                             <div id="current_biblio">
66                                 [% IF ( current_biblio_searches ) %]
67                                     <h2>Current session</h2>
68                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
69                                         <legend class="sr-only">Toolbar control</legend>
70
71                                         [% INCLUDE 'toolbar_controls' %]
72                                         <input type="hidden" name="action" value="delete" />
73                                         <table class="historyt table table-bordered table-striped">
74                                             <caption class="sr-only">Current session</caption>
75                                             <thead>
76                                                 <tr>
77                                                     <th></th>
78                                                     <th>Date</th>
79                                                     <th>Search</th>
80                                                     <th>Results</th>
81                                                     <th></th>
82                                                 </tr>
83                                             </thead>
84                                             <tbody>
85                                                 [% FOREACH s IN current_biblio_searches %]
86                                                     <tr>
87                                                         <td class="selectcol">
88                                                             <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
89                                                         </td>
90                                                         <td data-order="[% s.time | html %]">
91                                                             <label for="result[% s.id | html %]">
92                                                                 [% s.time |$KohaDates  with_hours => 1 %]
93                                                             </label>
94                                                         </td>
95                                                         <td>
96                                                             <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;[% s.query_cgi | $raw %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" aria-label="Subscribe to this search" class="rsssearchlink">
97                                                                 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
98                                                             </a>
99                                                             <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
100                                                         </td>
101                                                         <td>[% s.total | html %]</td>
102                                                         <td></td>
103                                                     </tr>
104                                                 [% END %]
105                                             </tbody>
106                                         </table>
107                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
108                                     </form>
109                                 [% END # IF ( current_biblio_searches ) %]
110                             </div> <!-- / #current_biblio -->
111                             <hr />
112                             <div id="previous_biblio">
113                                 [% IF ( previous_biblio_searches ) %]
114                                     <h2>Previous sessions</h2>
115                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
116                                         <legend class="sr-only">Toolbar control</legend>
117                                         [% INCLUDE 'toolbar_controls' %]
118
119                                         <input type="hidden" name="action" value="delete" />
120                                         <table class="historyt table table-bordered table-striped">
121                                             <caption class="sr-only">Previous sessions</caption>
122                                             <thead>
123                                                 <tr>
124                                                     <th></th>
125                                                     <th>Date</th>
126                                                     <th>Search</th>
127                                                     <th>Results</th>
128                                                     <th></th>
129                                                 </tr>
130                                             </thead>
131                                             <tbody>
132                                             [% FOREACH s IN previous_biblio_searches %]
133                                                 <tr>
134                                                     <td class="selectcol">
135                                                         <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
136                                                     </td>
137                                                     <td data-order="[% s.time | html %]">
138                                                         <label for="result[% s.id | html %]">
139                                                             [% s.time |$KohaDates  with_hours => 1 %]
140                                                         </label>
141                                                     </td>
142                                                     <td>
143                                                         <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;[% s.query_cgi | $raw %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" aria-label="Subscribe to this search" class="rsssearchlink">
144                                                             <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
145                                                         </a>
146                                                         <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
147                                                             [% s.query_desc | html %]
148                                                         </a>
149                                                     </td>
150                                                     <td>[% s.total | html %]</td>
151                                                     <td></td>
152                                                 </tr>
153                                             [% END %]
154                                             </tbody>
155                                         </table>
156                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
157                                     </form>
158                                 [% END # IF ( previous_biblio_searches ) %]
159                             </div> <!-- / #previous_biblio -->
160
161                             [% IF !current_biblio_searches && !previous_biblio_searches %]
162                                 <p>Your catalog search history is empty.</p>
163                             [% END %]
164                         </div> <!-- / #biblio_tab -->
165
166                         [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
167                             <div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
168                                 <div id="current_authority">
169                                     [% IF ( current_authority_searches ) %]
170                                         <h2>Current session</h2>
171                                         <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
172                                             <legend class="sr-only">Toolbar control</legend>
173                                             [% INCLUDE 'toolbar_controls' %]
174                                             <input type="hidden" name="action" value="delete" />
175                                             <table class="historyt table table-bordered table-striped">
176                                                 <caption class="sr-only">Current session</caption>
177                                                 <thead>
178                                                     <tr>
179                                                         <th></th>
180                                                         <th>Date</th>
181                                                         <th>Search</th>
182                                                         <th>Results</th>
183                                                         <th></th>
184                                                     </tr>
185                                                 </thead>
186                                                 <tbody>
187                                                     [% FOREACH s IN current_authority_searches %]
188                                                         <tr>
189                                                             <td class="selectcol">
190                                                                 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
191                                                             </td>
192                                                             <td data-order="[% s.time | html %]">
193                                                                 <label for="result[% s.id | html %]">
194                                                                     [% s.time |$KohaDates  with_hours => 1 %]
195                                                                 </label>
196                                                             </td>
197                                                             <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
198                                                             <td>[% s.total | html %]</td>
199                                                             <td></td>
200                                                         </tr>
201                                                     [% END %]
202                                                 </tbody>
203                                             </table>
204                                             <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
205                                         </form>
206                                     [% END # / IF ( current_authority_searches ) %]
207                                 </div> <!-- / #current_authority -->
208                                 <hr />
209                                 <div id="previous_authority">
210                                     [% IF ( previous_authority_searches ) %]
211                                         <h2>Previous sessions</h2>
212                                         <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
213                                             <legend class="sr-only">Toolbar control</legend>
214                                             [% INCLUDE 'toolbar_controls' %]
215                                             <input type="hidden" name="action" value="delete" />
216                                             <table class="historyt table table-bordered table-striped">
217                                                 <caption class="sr-only">Previous sessions</caption>
218                                                 <thead>
219                                                     <tr>
220                                                         <th></th>
221                                                         <th>Date</th>
222                                                         <th>Search</th>
223                                                         <th>Results</th>
224                                                         <th></th>
225                                                     </tr>
226                                                 </thead>
227                                                 <tbody>
228                                                     [% FOREACH s IN previous_authority_searches %]
229                                                         <tr>
230                                                             <td class="selectcol">
231                                                                 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
232                                                             </td>
233                                                             <td data-order="[% s.time | html %]">
234                                                                 <label for="result[% s.id | html %]">
235                                                                     [% s.time |$KohaDates  with_hours => 1 %]
236                                                                 </label>
237                                                             </td>
238                                                             <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
239                                                             <td>[% s.total | html %]</td>
240                                                             <td></td>
241                                                         </tr>
242                                                     [% END %]
243                                                 </tbody>
244                                             </table>
245                                             <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
246                                         </form>
247                                     [% END # / IF ( previous_authority_searches )%]
248                                 </div>
249
250                                 [% IF !current_authority_searches && !previous_authority_searches %]
251                                     <p>Your authority search history is empty.</p>
252                                 [% END %]
253                             </div> <!-- / #authority_tab -->
254                         </div> <!-- /.tab-content -->
255                         [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
256                     </div> <!-- / #tabs -->
257                 </div> <!-- / #searchhistory -->
258             </div> <!-- / .col-lg-10/12 -->
259         </div> <!-- / .row -->
260     </div> <!-- / .container-fluid -->
261 </div> <!-- / #main -->
262
263 [% INCLUDE 'opac-bottom.inc' %]
264
265 [% BLOCK toolbar_controls %]
266     [% # Identical controls shown at the top of each table of search history %]
267     <div class="selections-toolbar toolbar">
268         <div class="check_control">
269             <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
270             <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
271         </div>
272         <div class="links">
273             <span class="selections">Select searches to: </span>
274             <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
275         </div>
276     </div>
277 [% END %]
278
279 [% BLOCK jsinclude %]
280 [% INCLUDE 'datatables.inc' %]
281 <script>
282
283     var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
284     $(document).ready(function() {
285         // We show table ordered by descending dates by default
286         // (so that the more recent query is shown first)
287         $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
288             "order": [[ 1, "desc" ]],
289             "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
290             "columnDefs": [
291                 { "targets": [ 0 ], "sortable": false, "searchable": false },
292                 {"className": 'dtr-control',"orderable": false,"targets":   -1}
293             ],
294             "language": {
295                 "search": "_INPUT_",
296                 "searchPlaceholder": _("Search")
297             },
298             "autoWidth": false,
299             "responsive": {
300                 details: {
301                     type: 'column',
302                     target: -1
303                 }
304             },
305         }));
306
307         $(".CheckNone").click(function(e){
308             e.preventDefault();
309             var form = $(this).parents("form").get(0);
310             $(form).find("input:checkbox").prop("checked", false);
311             enableCheckboxActions(form);
312         });
313         $(".CheckAll").click(function(e){
314             e.preventDefault();
315             var form = $(this).parents("form").get(0);
316             $(form).find("input:checkbox").prop("checked", true);
317             enableCheckboxActions(form);
318         });
319
320         $("input:checkbox").click(function(){
321             var form = $(this).parents("form").get(0);
322             enableCheckboxActions(form);
323         });
324
325         $(".removeitems,.remove-selected").click(function(e){
326             e.preventDefault();
327             var form = $(this).parents("form").get(0);
328             var ids = $(form).find("input:checkbox:checked");
329             if ( $(ids).length < 1 ) {
330                 return false;
331             }
332             if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
333                 $(form).submit();
334             }
335             return false;
336         });
337         $(".remove-selected").addClass("disabled");
338     });
339
340     function enableCheckboxActions(form){
341         // Enable/disable controls if checkboxes are checked
342         var checkedBoxes = $(form).find("input:checkbox:checked");
343         if ($(checkedBoxes).size()) {
344             $(form).find(".selections").html(_("With selected searches: "));
345             $(form).find(".selections-toolbar .links a").removeClass("disabled");
346             $(form).find(".remove-selected").removeClass("disabled");
347         } else {
348             $(form).find(".selections").html(_("Select searches to: "));
349             $(form).find(".selections-toolbar .links a").addClass("disabled");
350             $(form).find(".remove-selected").addClass("disabled");
351         }
352     }
353
354
355
356 </script>
357 [% END %]