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