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