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 (-93 / +168 lines)
Lines 5-28 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="[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
8
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9
<script type="text/javascript">
9
<script type="text/javascript">
10
//<![CDATA[
10
//<![CDATA[
11
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?");
12
$(document).ready(function() {
12
$(document).ready(function() {
13
    // We show table ordered by descending dates by default
13
    // We show table ordered by descending dates by default
14
    // (so that the more recent query is shown first)
14
    // (so that the more recent query is shown first)
15
    $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
15
    $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
16
        "aaSorting": [[ 0, "desc" ]],
16
        "aaSorting": [[ 1, "desc" ]],
17
        "aoColumns": [
17
        "aoColumnDefs": [
18
            { "sType": "title-string" },
18
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
19
            null,
19
            { "aTargets": [ 1 ], "sType": "title-string" },
20
            null
20
        ],
21
        ]
22
    }));
21
    }));
23
22
24
    $('#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
25
});
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
26
//]]>
70
//]]>
27
71
28
</script>
72
</script>
Lines 51-107 $(document).ready(function() { Link Here
51
          [% IF ( current_biblio_searches ) %]
95
          [% IF ( current_biblio_searches ) %]
52
            <h2>Current session</h2>
96
            <h2>Current session</h2>
53
            <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>
54
              <input type="hidden" name="action" value="delete" />
107
              <input type="hidden" name="action" value="delete" />
55
              <input type="hidden" name="previous" value="0" />
108
              <table class="historyt">
56
              <input type="hidden" name="type" value="biblio" />
109
                <thead>
57
              <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>
58
            </form>
128
            </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/catalogue/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 %]
129
          [% END %]
78
130
79
          [% IF ( previous_biblio_searches ) %]
131
          [% IF ( previous_biblio_searches ) %]
80
            <h2>Previous sessions</h2>
132
            <h2>Previous sessions</h2>
81
            <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>
82
              <input type="hidden" name="action" value="delete" />
143
              <input type="hidden" name="action" value="delete" />
83
              <input type="hidden" name="previous" value="1" />
144
              <table class="historyt">
84
              <input type="hidden" name="type" value="biblio" />
145
                <thead>
85
              <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>
86
            </form>
164
            </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/catalogue/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 %]
165
          [% END %]
106
166
107
          [% IF !current_biblio_searches && !previous_biblio_searches %]
167
          [% IF !current_biblio_searches && !previous_biblio_searches %]
Lines 113-169 $(document).ready(function() { Link Here
113
          [% IF ( current_authority_searches ) %]
173
          [% IF ( current_authority_searches ) %]
114
            <h2>Current session</h2>
174
            <h2>Current session</h2>
115
            <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>
116
              <input type="hidden" name="action" value="delete" />
185
              <input type="hidden" name="action" value="delete" />
117
              <input type="hidden" name="previous" value="0" />
186
              <table class="historyt">
118
              <input type="hidden" name="type" value="authority" />
187
                <thead>
119
              <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>
120
            </form>
206
            </form>
121
            <table class="historyt">
122
              <thead>
123
                <tr>
124
                  <th>Date</th>
125
                  <th>Search</th>
126
                  <th>Results</th>
127
                </tr>
128
              </thead>
129
              <tbody>
130
              [% FOREACH s IN current_authority_searches %]
131
                <tr>
132
                  <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
133
                  <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
134
                  <td>[% s.total %]</td>
135
                </tr>
136
              [% END %]
137
              </tbody>
138
            </table>
139
          [% END %]
207
          [% END %]
140
208
141
          [% IF ( previous_authority_searches ) %]
209
          [% IF ( previous_authority_searches ) %]
142
            <h2>Previous sessions</h2>
210
            <h2>Previous sessions</h2>
143
            <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>
144
              <input type="hidden" name="action" value="delete" />
221
              <input type="hidden" name="action" value="delete" />
145
              <input type="hidden" name="previous" value="1" />
222
              <table class="historyt">
146
              <input type="hidden" name="type" value="authority" />
223
                <thead>
147
              <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>
148
            </form>
242
            </form>
149
            <table class="historyt">
150
              <thead>
151
                <tr>
152
                  <th>Date</th>
153
                  <th>Search</th>
154
                  <th>Results</th>
155
                </tr>
156
              </thead>
157
              <tbody>
158
              [% FOREACH s IN previous_authority_searches %]
159
                <tr>
160
                  <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
161
                  <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
162
                  <td>[% s.total %]</td>
163
                </tr>
164
              [% END %]
165
              </tbody>
166
            </table>
167
          [% END %]
243
          [% END %]
168
244
169
          [% IF !current_authority_searches && !previous_authority_searches %]
245
          [% IF !current_authority_searches && !previous_authority_searches %]
170
- 

Return to bug 11430