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

Return to bug 11430