0458cb669fb72a4441304b186cda7ef632650f04
[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     <ul class="breadcrumb">
15         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
16         [% IF ( loggedinusername ) %]
17             <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
18             <li><a href="#">Your search history</a></li>
19         [% ELSE %]
20             <li><a href="#">Search history</a></li>
21         [% END %]
22     </ul>
23
24     <div class="container-fluid">
25         <div class="row-fluid">
26             [% IF ( OpacNav||loggedinusername ) %]
27                 <div class="span2">
28                     <div id="navigation">
29                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
30                     </div>
31                 </div>
32                 <div class="span10">
33             [% ELSE %]
34                 <div class="span12">
35             [% END %]
36                 <div id="searchhistory" class="maincontent">
37                     <h1>Search history</h1>
38                     [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
39                         <div id="tabs" class="toptabs">
40                             <ul>
41                                 <li><a href="#biblio_tab">Catalog</a></li>
42                                 <li><a href="#authority_tab">Authority</a></li>
43                             </ul>
44                     [% END %]
45                         <div id="biblio_tab">
46                             <div id="current_biblio">
47                                 [% IF ( current_biblio_searches ) %]
48                                     <h2>Current session</h2>
49                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
50                                         <div class="selections-toolbar toolbar">
51                                             <a class="CheckAll" href="#">Select all</a>
52                                             <a class="CheckNone" href="#">Clear all</a>
53                                             <span class="sep">|</span>
54                                             <span class="links">
55                                                 <span class="selections">Select searches to: </span>
56                                                 <a href="#" class="removeitems disabled">Delete</a>
57                                             </span>
58                                         </div>
59                                         <input type="hidden" name="action" value="delete" />
60                                         <table class="historyt table table-bordered table-striped">
61                                             <thead>
62                                                 <tr>
63                                                     <th></th>
64                                                     <th>Date</th>
65                                                     <th>Search</th>
66                                                     <th>Results</th>
67                                                 </tr>
68                                             </thead>
69                                             <tbody>
70                                                 [% FOREACH s IN current_biblio_searches %]
71                                                     <tr>
72                                                         <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
73                                                         <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
74                                                         <td><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi |url %][% limit_cgi | url %]&amp;[% s.query_cgi | url %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
75                                                         <td>[% s.total | html %]</td>
76                                                     </tr>
77                                                 [% END %]
78                                             </tbody>
79                                         </table>
80                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
81                                     </form>
82                                 [% END # IF ( current_biblio_searches ) %]
83                             </div> <!-- / #current_biblio -->
84
85                             <div id="previous_biblio">
86                                 [% IF ( previous_biblio_searches ) %]
87                                     <h2>Previous sessions</h2>
88                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
89                                         <div class="selections-toolbar toolbar">
90                                             <a class="CheckAll" href="#">Select all</a>
91                                             <a class="CheckNone" href="#">Clear all</a>
92                                             <span class="sep">|</span>
93                                             <span class="links">
94                                                 <span class="selections">Select searches to: </span>
95                                                 <a href="#" class="removeitems disabled">Delete</a>
96                                             </span>
97                                         </div>
98
99                                         <input type="hidden" name="action" value="delete" />
100                                         <table class="historyt table table-bordered table-striped">
101                                             <thead>
102                                                 <tr>
103                                                     <th></th>
104                                                     <th>Date</th>
105                                                     <th>Search</th>
106                                                     <th>Results</th>
107                                                 </tr>
108                                             </thead>
109                                             <tbody>
110                                             [% FOREACH s IN previous_biblio_searches %]
111                                                 <tr>
112                                                     <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
113                                                     <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
114                                                     <td><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi |url %][% limit_cgi | url %]&amp;[% s.query_cgi | url %]&amp;count=[% countrss | uri %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
115                                                     <td>[% s.total | html %]</td>
116                                                 </tr>
117                                             [% END %]
118                                             </tbody>
119                                         </table>
120                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
121                                     </form>
122                                 [% END # IF ( previous_biblio_searches ) %]
123                             </div> <!-- / #previous_biblio -->
124
125                             [% IF !current_biblio_searches && !previous_biblio_searches %]
126                                 <p>Your catalog search history is empty.</p>
127                             [% END %]
128                         </div> <!-- / #biblio_tab -->
129
130                         [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
131                             <div id="authority_tab">
132                                 [% IF ( current_authority_searches ) %]
133                                     <h2>Current session</h2>
134                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
135                                         <div class="selections-toolbar toolbar">
136                                             <a class="CheckAll" href="#">Select all</a>
137                                             <a class="CheckNone" href="#">Clear all</a>
138                                             <span class="sep">|</span>
139                                             <span class="links">
140                                                 <span class="selections">Select searches to: </span>
141                                                 <a href="#" class="removeitems disabled">Delete</a>
142                                             </span>
143                                         </div>
144                                         <input type="hidden" name="action" value="delete" />
145                                         <table class="historyt table table-bordered table-striped">
146                                             <thead>
147                                                 <tr>
148                                                     <th></th>
149                                                     <th>Date</th>
150                                                     <th>Search</th>
151                                                     <th>Results</th>
152                                                 </tr>
153                                             </thead>
154                                             <tbody>
155                                                 [% FOREACH s IN current_authority_searches %]
156                                                     <tr>
157                                                         <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
158                                                         <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
159                                                         <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
160                                                         <td>[% s.total | html %]</td>
161                                                     </tr>
162                                                 [% END %]
163                                             </tbody>
164                                         </table>
165                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
166                                     </form>
167                                 [% END # / IF ( current_authority_searches ) %]
168
169                                 [% IF ( previous_authority_searches ) %]
170                                     <h2>Previous sessions</h2>
171                                     <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
172                                         <div class="selections-toolbar toolbar">
173                                             <a class="CheckAll" href="#">Select all</a>
174                                             <a class="CheckNone" href="#">Clear all</a>
175                                             <span class="sep">|</span>
176                                             <span class="links">
177                                                 <span class="selections">Select searches to: </span>
178                                                 <a href="#" class="removeitems disabled">Delete</a>
179                                             </span>
180                                         </div>
181                                         <input type="hidden" name="action" value="delete" />
182                                         <table class="historyt table table-bordered table-striped">
183                                             <thead>
184                                                 <tr>
185                                                     <th></th>
186                                                     <th>Date</th>
187                                                     <th>Search</th>
188                                                     <th>Results</th>
189                                                 </tr>
190                                             </thead>
191                                             <tbody>
192                                                 [% FOREACH s IN previous_authority_searches %]
193                                                     <tr>
194                                                         <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
195                                                         <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
196                                                         <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | url %]">[% s.query_desc | html %]</a></td>
197                                                         <td>[% s.total | html %]</td>
198                                                     </tr>
199                                                 [% END %]
200                                             </tbody>
201                                         </table>
202                                         <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
203                                     </form>
204                                 [% END # / IF ( previous_authority_searches )%]
205
206                                 [% IF !current_authority_searches && !previous_authority_searches %]
207                                     <p>Your authority search history is empty.</p>
208                                 [% END %]
209                             </div> <!-- / #authority_tab -->
210                         [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
211                     </div> <!-- / #tabs -->
212                 </div> <!-- / #searchhistory -->
213             </div> <!-- / .span10/12 -->
214         </div> <!-- / .row-fluid -->
215     </div> <!-- / .container-fluid -->
216 </div> <!-- / #main -->
217
218 [% INCLUDE 'opac-bottom.inc' %]
219 [% BLOCK jsinclude %]
220 [% INCLUDE 'datatables.inc' %]
221 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
222 <script>
223 //<![CDATA[
224     var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
225     $(document).ready(function() {
226         // We show table ordered by descending dates by default
227         // (so that the more recent query is shown first)
228         $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
229             "order": [[ 1, "desc" ]],
230             "columnDefs": [
231                 { "targets": [ 0 ], "sortable": false, "searchable": false },
232                 { "targets": [ 1 ], "type": "title-string" },
233             ]
234         }));
235
236         [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
237
238         $(".CheckNone").click(function(e){
239             e.preventDefault();
240             var form = $(this).parents("form").get(0);
241             $(form).unCheckCheckboxes();
242             enableCheckboxActions(form);
243         });
244         $(".CheckAll").click(function(e){
245             e.preventDefault();
246             var form = $(this).parents("form").get(0);
247             $(form).checkCheckboxes();
248             enableCheckboxActions(form);
249         });
250
251         $("input:checkbox").click(function(){
252             var form = $(this).parents("form").get(0);
253             enableCheckboxActions(form);
254         });
255
256         $(".removeitems,.remove-selected").click(function(e){
257             e.preventDefault();
258             var form = $(this).parents("form").get(0);
259             var ids = $(form).find("input:checkbox:checked");
260             if ( $(ids).length < 1 ) {
261                 return false;
262             }
263             if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
264                 $(form).submit();
265             }
266             return false;
267         });
268     });
269
270     function enableCheckboxActions(form){
271         // Enable/disable controls if checkboxes are checked
272         var checkedBoxes = $(form).find("input:checkbox:checked");
273         if ($(checkedBoxes).size()) {
274             $(form).find(".selections").html(_("With selected searches: "));
275             $(form).find(".selections-toolbar .links a").removeClass("disabled");
276         } else {
277             $(form).find(".selections").html(_("Select searches to: "));
278             $(form).find(".selections-toolbar .links a").addClass("disabled");
279         }
280     }
281
282 //]]>
283
284 </script>
285 [% END %]