View | Details | Raw Unified | Return to bug 11430
Collapse All | Expand All

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

Return to bug 11430