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