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

(-)a/koha-tmpl/opac-tmpl/bootstrap/css/opac.css (-4 / +11 lines)
Lines 167-173 td { Link Here
167
#opacheader {
167
#opacheader {
168
  background-color: #DDD;
168
  background-color: #DDD;
169
}
169
}
170
#selections {
170
#selections,
171
.selections {
171
  font-weight: bold;
172
  font-weight: bold;
172
}
173
}
173
.actions a {
174
.actions a {
Lines 881-887 div.rows ol li li { Link Here
881
#basket .toolbar {
882
#basket .toolbar {
882
  padding: 7px 5px 9px 9px;
883
  padding: 7px 5px 9px 9px;
883
}
884
}
884
#selections-toolbar {
885
#selections-toolbar,
886
.selections-toolbar {
885
  background: -moz-linear-gradient(top, #b2b2b2 0%, #e0e0e0 14%, #e8e8e8 100%);
887
  background: -moz-linear-gradient(top, #b2b2b2 0%, #e0e0e0 14%, #e8e8e8 100%);
886
  /* FF3.6+ */
888
  /* FF3.6+ */
887
889
Lines 940-946 div.rows ol li li { Link Here
940
#selections-toolbar input.hold.disabled,
942
#selections-toolbar input.hold.disabled,
941
#selections-toolbar input.hold.disabled:hover,
943
#selections-toolbar input.hold.disabled:hover,
942
#selections-toolbar a.disabled,
944
#selections-toolbar a.disabled,
943
#selections-toolbar a.disabled:hover {
945
#selections-toolbar a.disabled:hover,
946
.selections-toolbar a.disabled,
947
.selections-toolbar a.disabled:hover {
944
  color: #888888;
948
  color: #888888;
945
  text-decoration: none;
949
  text-decoration: none;
946
  padding-left: 23px;
950
  padding-left: 23px;
Lines 1833-1839 a.listmenulink:active { Link Here
1833
  font-style: italic;
1837
  font-style: italic;
1834
}
1838
}
1835
#CheckAll,
1839
#CheckAll,
1836
#CheckNone {
1840
#CheckNone,
1841
.CheckAll,
1842
.CheckNone {
1837
  font-weight: normal;
1843
  font-weight: normal;
1838
  margin: 0 .5em;
1844
  margin: 0 .5em;
1839
  text-decoration: underline;
1845
  text-decoration: underline;
Lines 2333-2338 td img { Link Here
2333
  .clearall,
2339
  .clearall,
2334
  .highlight_controls,
2340
  .highlight_controls,
2335
  #selections-toolbar,
2341
  #selections-toolbar,
2342
  .selections-toolbar,
2336
  .selectcol,
2343
  .selectcol,
2337
  .list-actions,
2344
  .list-actions,
2338
  #remove-selected {
2345
  #remove-selected {
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt (-107 / +186 lines)
Lines 31-121 Link Here
31
                <div class="span12">
31
                <div class="span12">
32
            [% END %]
32
            [% END %]
33
                <div id="searchhistory" class="maincontent">
33
                <div id="searchhistory" class="maincontent">
34
                    <h1>Search history</h1>
34
                  <h1>Search history</h1>
35
35
                  [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
36
                    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
36
                    <div id="tabs" class="toptabs">
37
                      <div id="tabs" class="toptabs">
37
                      <ul>
38
                        <ul>
38
                        <li><a href="#biblio_tab">Catalog</a></li>
39
                          <li><a href="#biblio_tab">Catalog</a></li>
39
                        <li><a href="#authority_tab">Authority</a></li>
40
                          <li><a href="#authority_tab">Authority</a></li>
40
                      </ul>
41
                        </ul>
41
                  [% END %]
42
                  <div id="biblio_tab">
43
                    <div id="current_biblio">
44
                    [% IF ( current_biblio_searches ) %]
45
                      <h2>Current session</h2>
46
                      <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
47
                        <div class="selections-toolbar toolbar">
48
                          <a class="CheckAll" href="#">Select all</a>
49
                          <a class="CheckNone" href="#">Clear all</a>
50
                          <span class="sep">|</span>
51
                          <span class="links">
52
                            <span class="selections">Select searches to: </span>
53
                            <a href="#" class="action_delete disabled">Delete</a>
54
                          </span>
55
                        </div>
56
                        <input type="hidden" name="action" value="delete" />
57
                        <table class="historyt table table-bordered table-striped">
58
                          <thead>
59
                            <tr>
60
                              <th></th>
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><input type="checkbox" name="id" value="[% s.id %]" /></td>
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
                      </form>
42
                    [% END %]
78
                    [% END %]
43
                      <div id="biblio_tab">
79
                    </div>
44
                        [% IF ( current_biblio_searches ) %]
45
                          <h2>Current session</h2>
46
                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
47
                            <input type="hidden" name="action" value="delete" />
48
                            <input type="hidden" name="previous" value="0" />
49
                            <input type="hidden" name="type" value="biblio" />
50
                            <input type="submit" class="deleteshelf" value="Delete your current catalog history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
51
                          </form>
52
                          <table class="historyt table table-bordered table-condensed table-striped">
53
                            <thead>
54
                              <tr>
55
                                <th>Date</th>
56
                                <th>Search</th>
57
                                <th>Results</th>
58
                              </tr>
59
                            </thead>
60
                            <tbody>
61
                            [% FOREACH s IN current_biblio_searches %]
62
                              <tr>
63
                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
64
                                <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
65
                                <td>[% s.total %]</td>
66
                              </tr>
67
                            [% END %]
68
                            </tbody>
69
                          </table>
70
                        [% END %]
71
72
                        [% IF ( previous_biblio_searches ) %]
73
                          <h2>Previous sessions</h2>
74
                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
75
                            <input type="hidden" name="action" value="delete" />
76
                            <input type="hidden" name="previous" value="1" />
77
                            <input type="hidden" name="type" value="biblio" />
78
                            <input type="submit" class="deleteshelf" value="Delete your previous catalog search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
79
                          </form>
80
                          <table class="historyt table table-bordered table-condensed table-striped">
81
                            <thead>
82
                              <tr>
83
                                <th>Date</th>
84
                                <th>Search</th>
85
                                <th>Results</th>
86
                              </tr>
87
                            </thead>
88
                            <tbody>
89
                            [% FOREACH s IN previous_biblio_searches %]
90
                              <tr>
91
                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
92
                                <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
93
                                <td>[% s.total %]</td>
94
                              </tr>
95
                            [% END %]
96
                            </tbody>
97
                          </table>
98
                        [% END %]
99
80
100
                        [% IF !current_biblio_searches && !previous_biblio_searches %]
81
                    <div id="previous_biblio">
101
                          <p>Your catalog search history is empty.</p>
82
                    [% IF ( previous_biblio_searches ) %]
102
                        [% END %]
83
                      <h2>Previous sessions</h2>
103
                      </div>
84
                      <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
85
                        <div class="selections-toolbar toolbar">
86
                          <a class="CheckAll" href="#">Select all</a>
87
                          <a class="CheckNone" href="#">Clear all</a>
88
                          <span class="sep">|</span>
89
                          <span class="links">
90
                            <span class="selections">Select searches to: </span>
91
                            <a href="#" class="action_delete disabled">Delete</a>
92
                          </span>
93
                        </div>
94
95
                        <input type="hidden" name="action" value="delete" />
96
                        <table class="historyt table table-bordered table-striped">
97
                          <thead>
98
                            <tr>
99
                              <th></th>
100
                              <th>Date</th>
101
                              <th>Search</th>
102
                              <th>Results</th>
103
                            </tr>
104
                          </thead>
105
                          <tbody>
106
                          [% FOREACH s IN previous_biblio_searches %]
107
                            <tr>
108
                              <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
109
                              <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
110
                              <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
111
                              <td>[% s.total %]</td>
112
                            </tr>
113
                          [% END %]
114
                          </tbody>
115
                        </table>
116
                      </form>
117
                    [% END %]
118
                    </div>
104
119
120
                    [% IF !current_biblio_searches && !previous_biblio_searches %]
121
                      <p>Your catalog search history is empty.</p>
122
                    [% END %]
123
                  </div>
105
124
106
                    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
125
                  [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
107
                      <div id="authority_tab">
126
                    <div id="authority_tab">
108
                        [% IF ( current_authority_searches ) %]
127
                      [% IF ( current_authority_searches ) %]
109
                          <h2>Current session</h2>
128
                        <h2>Current session</h2>
110
                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
129
                        <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
111
                            <input type="hidden" name="action" value="delete" />
130
                          <div class="selections-toolbar toolbar">
112
                            <input type="hidden" name="previous" value="0" />
131
                            <a class="CheckAll" href="#">Select all</a>
113
                            <input type="hidden" name="type" value="authority" />
132
                            <a class="CheckNone" href="#">Clear all</a>
114
                            <input type="submit" class="deleteshelf" value="Delete your current authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
133
                            <span class="sep">|</span>
115
                          </form>
134
                            <span class="links">
116
                          <table class="historyt table table-bordered table-condensed table-striped">
135
                              <span class="selections">Select searches to: </span>
136
                              <a href="#" class="action_delete disabled">Delete</a>
137
                            </span>
138
                          </div>
139
                          <input type="hidden" name="action" value="delete" />
140
                          <table class="historyt table table-bordered table-striped">
117
                            <thead>
141
                            <thead>
118
                              <tr>
142
                              <tr>
143
                                <th></th>
119
                                <th>Date</th>
144
                                <th>Date</th>
120
                                <th>Search</th>
145
                                <th>Search</th>
121
                                <th>Results</th>
146
                                <th>Results</th>
Lines 124-129 Link Here
124
                            <tbody>
149
                            <tbody>
125
                            [% FOREACH s IN current_authority_searches %]
150
                            [% FOREACH s IN current_authority_searches %]
126
                              <tr>
151
                              <tr>
152
                                <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
127
                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
153
                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
128
                                <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
154
                                <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
129
                                <td>[% s.total %]</td>
155
                                <td>[% s.total %]</td>
Lines 131-149 Link Here
131
                            [% END %]
157
                            [% END %]
132
                            </tbody>
158
                            </tbody>
133
                          </table>
159
                          </table>
134
                        [% END %]
160
                        </form>
135
161
                      [% END %]
136
                        [% IF ( previous_authority_searches ) %]
162
137
                          <h2>Previous sessions</h2>
163
                      [% IF ( previous_authority_searches ) %]
138
                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
164
                        <h2>Previous sessions</h2>
139
                            <input type="hidden" name="action" value="delete" />
165
                        <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
140
                            <input type="hidden" name="previous" value="1" />
166
                          <div class="selections-toolbar toolbar">
141
                            <input type="hidden" name="type" value="authority" />
167
                            <a class="CheckAll" href="#">Select all</a>
142
                            <input type="submit" class="deleteshelf" value="Delete your previous authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
168
                            <a class="CheckNone" href="#">Clear all</a>
143
                          </form>
169
                            <span class="sep">|</span>
144
                          <table class="historyt table table-bordered table-condensed table-striped">
170
                            <span class="links">
171
                              <span class="selections">Select searches to: </span>
172
                              <a href="#" class="action_delete disabled">Delete</a>
173
                            </span>
174
                          </div>
175
                          <input type="hidden" name="action" value="delete" />
176
                          <table class="historyt table table-bordered table-striped">
145
                            <thead>
177
                            <thead>
146
                              <tr>
178
                              <tr>
179
                                <th></th>
147
                                <th>Date</th>
180
                                <th>Date</th>
148
                                <th>Search</th>
181
                                <th>Search</th>
149
                                <th>Results</th>
182
                                <th>Results</th>
Lines 152-157 Link Here
152
                            <tbody>
185
                            <tbody>
153
                            [% FOREACH s IN previous_authority_searches %]
186
                            [% FOREACH s IN previous_authority_searches %]
154
                              <tr>
187
                              <tr>
188
                                <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
155
                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
189
                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
156
                                <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
190
                                <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
157
                                <td>[% s.total %]</td>
191
                                <td>[% s.total %]</td>
Lines 159-169 Link Here
159
                            [% END %]
193
                            [% END %]
160
                            </tbody>
194
                            </tbody>
161
                          </table>
195
                          </table>
162
                        [% END %]
196
                        </form>
197
                      [% END %]
163
198
164
                        [% IF !current_authority_searches && !previous_authority_searches %]
199
                      [% IF !current_authority_searches && !previous_authority_searches %]
165
                          <p>Your authority search history is empty.</p>
200
                        <p>Your authority search history is empty.</p>
166
                        [% END %]
201
                      [% END %]
167
                      </div>
202
                      </div>
168
                    </div>
203
                    </div>
169
                    [% END %]
204
                    [% END %]
Lines 176-198 Link Here
176
[% INCLUDE 'opac-bottom.inc' %]
211
[% INCLUDE 'opac-bottom.inc' %]
177
[% BLOCK jsinclude %]
212
[% BLOCK jsinclude %]
178
[% INCLUDE 'datatables.inc' %]
213
[% INCLUDE 'datatables.inc' %]
214
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
179
<script type="text/javascript">
215
<script type="text/javascript">
180
//<![CDATA[
216
//<![CDATA[
181
    var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete your search history?");
217
    var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history?");
182
         $(document).ready(function() {
218
    $(document).ready(function() {
183
            // We show table ordered by descending dates by default
219
       // We show table ordered by descending dates by default
184
            // (so that the more recent query is shown first)
220
       // (so that the more recent query is shown first)
185
            $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
221
       $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
186
                "aaSorting": [[ 0, "desc" ]],
222
           "aaSorting": [[ 1, "desc" ]],
187
                "aoColumns": [
223
           "aoColumnDefs": [
188
                    { "sType": "title-string" },
224
               { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
189
                    null,
225
               { "aTargets": [ 1 ], "sType": "title-string" },
190
                    null
226
           ]
191
                ]
227
        }));
192
            }));
228
229
        [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
230
231
        $(".CheckNone").click(function(e){
232
            e.preventDefault();
233
            var form = $(this).parents("form").get(0);
234
            $(form).unCheckCheckboxes();
235
            enableCheckboxActions(form);
236
        });
237
        $(".CheckAll").click(function(e){
238
            e.preventDefault();
239
            var form = $(this).parents("form").get(0);
240
            $(form).checkCheckboxes();
241
            enableCheckboxActions(form);
193
        });
242
        });
194
243
195
    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
244
        $("input:checkbox").click(function(){
245
            var form = $(this).parents("form").get(0);
246
            enableCheckboxActions(form);
247
        });
248
249
        $(".action_delete").click(function(e){
250
            e.preventDefault();
251
            var form = $(this).parents("form").get(0);
252
            var ids = $(form).find("input:checkbox:checked");
253
            if ( $(ids).length < 1 ) {
254
                return false;
255
            }
256
            if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) {
257
                $(form).submit();
258
            }
259
            return false;
260
        });
261
    });
262
263
    function enableCheckboxActions(form){
264
        // Enable/disable controls if checkboxes are checked
265
        var checkedBoxes = $(form).find("input:checkbox:checked");
266
        if ($(checkedBoxes).size()) {
267
          $(form).find(".selections").html(_("With selected searches: "));
268
          $(form).find(".selections-toolbar .links a").removeClass("disabled");
269
        } else {
270
          $(form).find(".selections").html(_("Select searches to: "));
271
          $(form).find(".selections-toolbar .links a").addClass("disabled");
272
        }
273
    }
274
196
//]]>
275
//]]>
197
276
198
</script>
277
</script>
(-)a/opac/opac-search-history.pl (-10 / +23 lines)
Lines 37-43 my $cgi = new CGI; Link Here
37
# Getting the template and auth
37
# Getting the template and auth
38
my ($template, $loggedinuser, $cookie) = get_template_and_user(
38
my ($template, $loggedinuser, $cookie) = get_template_and_user(
39
    {
39
    {
40
        template_name => "opac-search-history.tmpl",
40
        template_name => "opac-search-history.tt",
41
        query => $cgi,
41
        query => $cgi,
42
        type => "opac",
42
        type => "opac",
43
        authnotrequired => 1,
43
        authnotrequired => 1,
Lines 56-65 unless ( $loggedinuser ) { Link Here
56
    # Deleting search history
56
    # Deleting search history
57
    if ( $action eq 'delete' ) {
57
    if ( $action eq 'delete' ) {
58
        # Deleting cookie's content
58
        # Deleting cookie's content
59
        my $current_searches_cookie = C4::Search::History::get_empty_cookie({
59
60
            cgi => $cgi,
60
        my @id = $cgi->param('id');
61
            name => 'KohaOpacRecentSearches',
61
        my $all = not scalar( @id );
62
        });
62
        my $current_searches_cookie;
63
        if ( $all ) {
64
            $current_searches_cookie = C4::Search::History::get_empty_cookie({
65
                cgi => $cgi,
66
                name => 'KohaOpacRecentSearches',
67
            });
68
        } else {
69
            my $new_value = C4::Search::History::delete_from_cookie({
70
                cookie => $cgi->cookie('KohaOpacRecentSearches'),
71
                id => \@id,
72
            });
73
            $current_searches_cookie = $cgi->cookie(
74
                -name => 'KohaOpacRecentSearches',
75
                # We uri_escape the whole serialized structure so we're sure we won't have any encoding problems
76
                -value => $new_value,
77
                -expires => ''
78
            );
79
        }
63
80
64
        # Redirecting to this same url with the cookie in the headers so it's deleted immediately
81
        # Redirecting to this same url with the cookie in the headers so it's deleted immediately
65
        my $uri = $cgi->url();
82
        my $uri = $cgi->url();
Lines 101-110 unless ( $loggedinuser ) { Link Here
101
            : q{};
118
            : q{};
102
        C4::Search::History::delete(
119
        C4::Search::History::delete(
103
            {
120
            {
104
                userid => $loggedinuser,
121
                id => [ $cgi->param('id') ],
105
                sessionid => $sessionid,
106
                type => $type,
107
                previous => $previous
108
            }
122
            }
109
        );
123
        );
110
        # Redirecting to this same url so the user won't see the search history link in the header
124
        # Redirecting to this same url so the user won't see the search history link in the header
111
- 

Return to bug 11430