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