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