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

(-)a/catalogue/search-history.pl (-4 / +1 lines)
Lines 46-55 if ( $action eq 'delete' ) { Link Here
46
        : q{};
46
        : q{};
47
    C4::Search::History::delete(
47
    C4::Search::History::delete(
48
        {
48
        {
49
            userid => $loggedinuser,
49
            id => [ $cgi->param('id') ],
50
            sessionid => $sessionid,
51
            type => $type,
52
            previous => $previous
53
        }
50
        }
54
    );
51
    );
55
    # Redirecting to this same url so the user won't see the search history link in the header
52
    # Redirecting to this same url so the user won't see the search history link in the header
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt (-92 / +168 lines)
Lines 5-27 Link Here
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
[% INCLUDE 'datatables.inc' %]
7
[% INCLUDE 'datatables.inc' %]
8
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8
<script type="text/javascript">
9
<script type="text/javascript">
9
//<![CDATA[
10
//<![CDATA[
10
var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete your search history?");
11
var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
11
$(document).ready(function() {
12
$(document).ready(function() {
12
    // We show table ordered by descending dates by default
13
    // We show table ordered by descending dates by default
13
    // (so that the more recent query is shown first)
14
    // (so that the more recent query is shown first)
14
    $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
15
    $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
15
        "aaSorting": [[ 0, "desc" ]],
16
        "aaSorting": [[ 1, "desc" ]],
16
        "aoColumns": [
17
        "aoColumnDefs": [
17
            { "sType": "title-string" },
18
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
18
            null,
19
            { "aTargets": [ 1 ], "sType": "title-string" },
19
            null
20
        ],
20
        ]
21
    }));
21
    }));
22
22
23
    $('#tabs').tabs();
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
24
});
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
25
//]]>
70
//]]>
26
71
27
</script>
72
</script>
Lines 50-106 $(document).ready(function() { Link Here
50
          [% IF ( current_biblio_searches ) %]
95
          [% IF ( current_biblio_searches ) %]
51
            <h2>Current session</h2>
96
            <h2>Current session</h2>
52
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
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>
53
              <input type="hidden" name="action" value="delete" />
107
              <input type="hidden" name="action" value="delete" />
54
              <input type="hidden" name="previous" value="0" />
108
              <table class="historyt">
55
              <input type="hidden" name="type" value="biblio" />
109
                <thead>
56
              <input type="submit" class="deleteshelf" value="Delete your current catalog history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
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>
57
            </form>
128
            </form>
58
            <table class="historyt">
59
              <thead>
60
                <tr>
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><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
70
                  <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
71
                  <td>[% s.total %]</td>
72
                </tr>
73
              [% END %]
74
              </tbody>
75
            </table>
76
          [% END %]
129
          [% END %]
77
130
78
          [% IF ( previous_biblio_searches ) %]
131
          [% IF ( previous_biblio_searches ) %]
79
            <h2>Previous sessions</h2>
132
            <h2>Previous sessions</h2>
80
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
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>
81
              <input type="hidden" name="action" value="delete" />
143
              <input type="hidden" name="action" value="delete" />
82
              <input type="hidden" name="previous" value="1" />
144
              <table class="historyt">
83
              <input type="hidden" name="type" value="biblio" />
145
                <thead>
84
              <input type="submit" class="deleteshelf" value="Delete your previous catalog search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
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>
85
            </form>
164
            </form>
86
            <table class="historyt">
87
              <thead>
88
                <tr>
89
                  <th>Date</th>
90
                  <th>Search</th>
91
                  <th>Results</th>
92
                </tr>
93
              </thead>
94
              <tbody>
95
              [% FOREACH s IN previous_biblio_searches %]
96
                <tr>
97
                  <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
98
                  <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
99
                  <td>[% s.total %]</td>
100
                </tr>
101
              [% END %]
102
              </tbody>
103
            </table>
104
          [% END %]
165
          [% END %]
105
166
106
          [% IF !current_biblio_searches && !previous_biblio_searches %]
167
          [% IF !current_biblio_searches && !previous_biblio_searches %]
Lines 112-168 $(document).ready(function() { Link Here
112
          [% IF ( current_authority_searches ) %]
173
          [% IF ( current_authority_searches ) %]
113
            <h2>Current session</h2>
174
            <h2>Current session</h2>
114
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
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>
115
              <input type="hidden" name="action" value="delete" />
185
              <input type="hidden" name="action" value="delete" />
116
              <input type="hidden" name="previous" value="0" />
186
              <table class="historyt">
117
              <input type="hidden" name="type" value="authority" />
187
                <thead>
118
              <input type="submit" class="deleteshelf" value="Delete your current authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
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>
119
            </form>
206
            </form>
120
            <table class="historyt">
121
              <thead>
122
                <tr>
123
                  <th>Date</th>
124
                  <th>Search</th>
125
                  <th>Results</th>
126
                </tr>
127
              </thead>
128
              <tbody>
129
              [% FOREACH s IN current_authority_searches %]
130
                <tr>
131
                  <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
132
                  <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
133
                  <td>[% s.total %]</td>
134
                </tr>
135
              [% END %]
136
              </tbody>
137
            </table>
138
          [% END %]
207
          [% END %]
139
208
140
          [% IF ( previous_authority_searches ) %]
209
          [% IF ( previous_authority_searches ) %]
141
            <h2>Previous sessions</h2>
210
            <h2>Previous sessions</h2>
142
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
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>
143
              <input type="hidden" name="action" value="delete" />
221
              <input type="hidden" name="action" value="delete" />
144
              <input type="hidden" name="previous" value="1" />
222
              <table class="historyt">
145
              <input type="hidden" name="type" value="authority" />
223
                <thead>
146
              <input type="submit" class="deleteshelf" value="Delete your previous authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
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>
147
            </form>
242
            </form>
148
            <table class="historyt">
149
              <thead>
150
                <tr>
151
                  <th>Date</th>
152
                  <th>Search</th>
153
                  <th>Results</th>
154
                </tr>
155
              </thead>
156
              <tbody>
157
              [% FOREACH s IN previous_authority_searches %]
158
                <tr>
159
                  <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
160
                  <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
161
                  <td>[% s.total %]</td>
162
                </tr>
163
              [% END %]
164
              </tbody>
165
            </table>
166
          [% END %]
243
          [% END %]
167
244
168
          [% IF !current_authority_searches && !previous_authority_searches %]
245
          [% IF !current_authority_searches && !previous_authority_searches %]
169
- 

Return to bug 11430