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