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