Bug 7960: Add class to item type descriptions so they can be hidden with CSS
[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                                                 </tr>
82                                             </thead>
83                                             <tbody>
84                                                 [% FOREACH s IN current_biblio_searches %]
85                                                     <tr>
86                                                         <td class="selectcol">
87                                                             <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
88                                                         </td>
89                                                         <td data-order="[% s.time | html %]">
90                                                             <label for="result[% s.id | html %]">
91                                                                 [% s.time |$KohaDates  with_hours => 1 %]
92                                                             </label>
93                                                         </td>
94                                                         <td>
95                                                             <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">
96                                                                 <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
97                                                             </a>
98                                                             <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a>
99                                                         </td>
100                                                         <td>[% s.total | html %]</td>
101                                                     </tr>
102                                                 [% END %]
103                                             </tbody>
104                                         </table>
105                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
106                                     </form>
107                                 [% END # IF ( current_biblio_searches ) %]
108                             </div> <!-- / #current_biblio -->
109                             <hr />
110                             <div id="previous_biblio">
111                                 [% IF ( previous_biblio_searches ) %]
112                                     <h2>Previous sessions</h2>
113                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
114                                         <legend class="sr-only">Toolbar control</legend>
115                                         [% INCLUDE 'toolbar_controls' %]
116
117                                         <input type="hidden" name="action" value="delete" />
118                                         <table class="historyt table table-bordered table-striped">
119                                             <caption class="sr-only">Previous sessions</caption>
120                                             <thead>
121                                                 <tr>
122                                                     <th></th>
123                                                     <th>Date</th>
124                                                     <th>Search</th>
125                                                     <th>Results</th>
126                                                 </tr>
127                                             </thead>
128                                             <tbody>
129                                             [% FOREACH s IN previous_biblio_searches %]
130                                                 <tr>
131                                                     <td class="selectcol">
132                                                         <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
133                                                     </td>
134                                                     <td data-order="[% s.time | html %]">
135                                                         <label for="result[% s.id | html %]">
136                                                             [% s.time |$KohaDates  with_hours => 1 %]
137                                                         </label>
138                                                     </td>
139                                                     <td>
140                                                         <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">
141                                                             <i class="fa fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this search"></i>
142                                                         </a>
143                                                         <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">
144                                                             [% s.query_desc | html %]
145                                                         </a>
146                                                     </td>
147                                                     <td>[% s.total | html %]</td>
148                                                 </tr>
149                                             [% END %]
150                                             </tbody>
151                                         </table>
152                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
153                                     </form>
154                                 [% END # IF ( previous_biblio_searches ) %]
155                             </div> <!-- / #previous_biblio -->
156
157                             [% IF !current_biblio_searches && !previous_biblio_searches %]
158                                 <p>Your catalog search history is empty.</p>
159                             [% END %]
160                         </div> <!-- / #biblio_tab -->
161
162                         [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
163                             <div id="authority_tab" role="tabpanel" class="tab-pane" aria-labelledby="authority-tab-link">
164                                 <div id="current_authority">
165                                     [% IF ( current_authority_searches ) %]
166                                         <h2>Current session</h2>
167                                         <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
168                                             <legend class="sr-only">Toolbar control</legend>
169                                             [% INCLUDE 'toolbar_controls' %]
170                                             <input type="hidden" name="action" value="delete" />
171                                             <table class="historyt table table-bordered table-striped">
172                                                 <caption class="sr-only">Current session</caption>
173                                                 <thead>
174                                                     <tr>
175                                                         <th></th>
176                                                         <th>Date</th>
177                                                         <th>Search</th>
178                                                         <th>Results</th>
179                                                     </tr>
180                                                 </thead>
181                                                 <tbody>
182                                                     [% FOREACH s IN current_authority_searches %]
183                                                         <tr>
184                                                             <td class="selectcol">
185                                                                 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
186                                                             </td>
187                                                             <td data-order="[% s.time | html %]">
188                                                                 <label for="result[% s.id | html %]">
189                                                                     [% s.time |$KohaDates  with_hours => 1 %]
190                                                                 </label>
191                                                             </td>
192                                                             <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
193                                                             <td>[% s.total | html %]</td>
194                                                         </tr>
195                                                     [% END %]
196                                                 </tbody>
197                                             </table>
198                                             <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
199                                         </form>
200                                     [% END # / IF ( current_authority_searches ) %]
201                                 </div> <!-- / #current_authority -->
202                                 <hr />
203                                 <div id="previous_authority">
204                                     [% IF ( previous_authority_searches ) %]
205                                         <h2>Previous sessions</h2>
206                                         <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
207                                             <legend class="sr-only">Toolbar control</legend>
208                                             [% INCLUDE 'toolbar_controls' %]
209                                             <input type="hidden" name="action" value="delete" />
210                                             <table class="historyt table table-bordered table-striped">
211                                                 <caption class="sr-only">Previous sessions</caption>
212                                                 <thead>
213                                                     <tr>
214                                                         <th></th>
215                                                         <th>Date</th>
216                                                         <th>Search</th>
217                                                         <th>Results</th>
218                                                     </tr>
219                                                 </thead>
220                                                 <tbody>
221                                                     [% FOREACH s IN previous_authority_searches %]
222                                                         <tr>
223                                                             <td class="selectcol">
224                                                                 <input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
225                                                             </td>
226                                                             <td data-order="[% s.time | html %]">
227                                                                 <label for="result[% s.id | html %]">
228                                                                     [% s.time |$KohaDates  with_hours => 1 %]
229                                                                 </label>
230                                                             </td>
231                                                             <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
232                                                             <td>[% s.total | html %]</td>
233                                                         </tr>
234                                                     [% END %]
235                                                 </tbody>
236                                             </table>
237                                             <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
238                                         </form>
239                                     [% END # / IF ( previous_authority_searches )%]
240                                 </div>
241
242                                 [% IF !current_authority_searches && !previous_authority_searches %]
243                                     <p>Your authority search history is empty.</p>
244                                 [% END %]
245                             </div> <!-- / #authority_tab -->
246                         </div> <!-- /.tab-content -->
247                         [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
248                     </div> <!-- / #tabs -->
249                 </div> <!-- / #searchhistory -->
250             </div> <!-- / .col-lg-10/12 -->
251         </div> <!-- / .row -->
252     </div> <!-- / .container-fluid -->
253 </div> <!-- / #main -->
254
255 [% INCLUDE 'opac-bottom.inc' %]
256
257 [% BLOCK toolbar_controls %]
258     [% # Identical controls shown at the top of each table of search history %]
259     <div class="selections-toolbar toolbar">
260         <div class="check_control">
261             <a class="CheckAll btn btn-link btn-sm" href="#">Select all</a>
262             <a class="CheckNone btn btn-link btn-sm" href="#">Clear all</a>
263         </div>
264         <div class="links">
265             <span class="selections">Select searches to: </span>
266             <a href="#" class="removeitems disabled btn btn-sm btn-link"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
267         </div>
268     </div>
269 [% END %]
270
271 [% BLOCK jsinclude %]
272 [% INCLUDE 'datatables.inc' %]
273 <script>
274
275     var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
276     $(document).ready(function() {
277         // We show table ordered by descending dates by default
278         // (so that the more recent query is shown first)
279         $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
280             "order": [[ 1, "desc" ]],
281             "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
282             "columnDefs": [
283                 { "targets": [ 0 ], "sortable": false, "searchable": false }
284             ],
285             "language": {
286                 "search": "_INPUT_",
287                 "searchPlaceholder": _("Search")
288             }
289         }));
290
291         $(".CheckNone").click(function(e){
292             e.preventDefault();
293             var form = $(this).parents("form").get(0);
294             $(form).find("input:checkbox").prop("checked", false);
295             enableCheckboxActions(form);
296         });
297         $(".CheckAll").click(function(e){
298             e.preventDefault();
299             var form = $(this).parents("form").get(0);
300             $(form).find("input:checkbox").prop("checked", true);
301             enableCheckboxActions(form);
302         });
303
304         $("input:checkbox").click(function(){
305             var form = $(this).parents("form").get(0);
306             enableCheckboxActions(form);
307         });
308
309         $(".removeitems,.remove-selected").click(function(e){
310             e.preventDefault();
311             var form = $(this).parents("form").get(0);
312             var ids = $(form).find("input:checkbox:checked");
313             if ( $(ids).length < 1 ) {
314                 return false;
315             }
316             if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
317                 $(form).submit();
318             }
319             return false;
320         });
321         $(".remove-selected").addClass("disabled");
322     });
323
324     function enableCheckboxActions(form){
325         // Enable/disable controls if checkboxes are checked
326         var checkedBoxes = $(form).find("input:checkbox:checked");
327         if ($(checkedBoxes).size()) {
328             $(form).find(".selections").html(_("With selected searches: "));
329             $(form).find(".selections-toolbar .links a").removeClass("disabled");
330             $(form).find(".remove-selected").removeClass("disabled");
331         } else {
332             $(form).find(".selections").html(_("Select searches to: "));
333             $(form).find(".selections-toolbar .links a").addClass("disabled");
334             $(form).find(".remove-selected").addClass("disabled");
335         }
336     }
337
338
339
340 </script>
341 [% END %]