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