Bug 10862: Add search history to the intranet interface
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / search-history.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 <title>Koha &rsaquo; Catalog &rsaquo; History search</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
8 [% INCLUDE 'datatables-strings.inc' %]
9 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
10 <script type="text/javascript">
11 //<![CDATA[
12 var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete your search history?");
13 $(document).ready(function() {
14     // We show table ordered by descending dates by default
15     // (so that the more recent query is shown first)
16     $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
17         "aaSorting": [[ 0, "desc" ]],
18         "aoColumns": [
19             { "sType": "title-string" },
20             null,
21             null
22         ]
23     }));
24
25     $('#tabs').tabs();
26 });
27 //]]>
28
29 </script>
30 </head>
31 <body id="catalogue_search-history" class="catalogue">
32
33 [% INCLUDE 'header.inc' %]
34 [% INCLUDE 'cat-search.inc' %]
35
36 <div id="breadcrumbs">
37   <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  &rsaquo; History search
38 </div>
39
40 <div id="doc3" class="yui-t2">
41
42 <div id="bd">
43   <div id="yui-main">
44     <div class="yui-b">
45       <h1>Search history</h1>
46       <div id="tabs" class="toptabs">
47         <ul>
48           <li><a href="#biblio_tab">Biblio</a></li>
49           <li><a href="#authority_tab">Authority</a></li>
50         </ul>
51         <div id="biblio_tab">
52           [% IF ( current_biblio_searches ) %]
53             <h2>Current session</h2>
54             <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
55               <input type="hidden" name="action" value="delete" />
56               <input type="hidden" name="previous" value="0" />
57               <input type="hidden" name="type" value="biblio" />
58               <input type="submit" class="deleteshelf" value="Delete your current biblio history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
59             </form>
60             <table class="historyt">
61               <thead>
62                 <tr>
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><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
72                   <td><a href="/cgi-bin/koha/catalogue/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           [% END %]
79
80           [% IF ( previous_biblio_searches ) %]
81             <h2>Previous sessions</h2>
82             <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
83               <input type="hidden" name="action" value="delete" />
84               <input type="hidden" name="previous" value="1" />
85               <input type="hidden" name="type" value="biblio" />
86               <input type="submit" class="deleteshelf" value="Delete your previous biblio search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
87             </form>
88             <table class="historyt">
89               <thead>
90                 <tr>
91                   <th>Date</th>
92                   <th>Search</th>
93                   <th>Results</th>
94                 </tr>
95               </thead>
96               <tbody>
97               [% FOREACH s IN previous_biblio_searches %]
98                 <tr>
99                   <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
100                   <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
101                   <td>[% s.total %]</td>
102                 </tr>
103               [% END %]
104               </tbody>
105             </table>
106           [% END %]
107
108           [% IF !current_biblio_searches && !previous_biblio_searches %]
109             <p>Your biblio search history is empty.</p>
110           [% END %]
111         </div>
112
113         <div id="authority_tab">
114           [% IF ( current_authority_searches ) %]
115             <h2>Current session</h2>
116             <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
117               <input type="hidden" name="action" value="delete" />
118               <input type="hidden" name="previous" value="0" />
119               <input type="hidden" name="type" value="authority" />
120               <input type="submit" class="deleteshelf" value="Delete your current authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
121             </form>
122             <table class="historyt">
123               <thead>
124                 <tr>
125                   <th>Date</th>
126                   <th>Search</th>
127                   <th>Results</th>
128                 </tr>
129               </thead>
130               <tbody>
131               [% FOREACH s IN current_authority_searches %]
132                 <tr>
133                   <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
134                   <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
135                   <td>[% s.total %]</td>
136                 </tr>
137               [% END %]
138               </tbody>
139             </table>
140           [% END %]
141
142           [% IF ( previous_authority_searches ) %]
143             <h2>Previous sessions</h2>
144             <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
145               <input type="hidden" name="action" value="delete" />
146               <input type="hidden" name="previous" value="1" />
147               <input type="hidden" name="type" value="authority" />
148               <input type="submit" class="deleteshelf" value="Delete your previous authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
149             </form>
150             <table class="historyt">
151               <thead>
152                 <tr>
153                   <th>Date</th>
154                   <th>Search</th>
155                   <th>Results</th>
156                 </tr>
157               </thead>
158               <tbody>
159               [% FOREACH s IN previous_authority_searches %]
160                 <tr>
161                   <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
162                   <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
163                   <td>[% s.total %]</td>
164                 </tr>
165               [% END %]
166               </tbody>
167             </table>
168           [% END %]
169
170           [% IF !current_authority_searches && !previous_authority_searches %]
171             <p>Your authority search history is empty.</p>
172           [% END %]
173         </div>
174       </div>
175     </div>
176   </div>
177 </div>
178 [% INCLUDE 'intranet-bottom.inc' %]