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

(-)a/C4/Search/History.pm (-19 / +26 lines)
Lines 162-198 sub get { Link Here
162
    }
162
    }
163
163
164
    my $query = q{
164
    my $query = q{
165
        SELECT *
165
        SELECT sh.* , s.a_session
166
        FROM search_history
166
        FROM search_history sh
167
        LEFT JOIN sessions s ON (sh.sessionid = s.id)
167
        WHERE 1
168
        WHERE 1
168
    };
169
    };
169
170
170
    $query .= q{ AND id IN ( } . join( q{,}, (q{?}) x @$id ) . q{ )}
171
    my @bind_params;
171
        if @$id;
172
172
173
    $query .= q{
173
    if (@$id) {
174
        AND userid = ?
174
        $query .= q{ AND sh.id IN ( } . join( q{,}, (q{?}) x @$id ) . q{ )};
175
    } if $userid;
175
        push @bind_params, @$id;
176
    }
177
178
    if ($userid) {
179
        $query .= q{ AND sh.userid = ? };
180
        push @bind_params, $userid;
181
    }
176
182
177
    if ($sessionid) {
183
    if ($sessionid) {
178
        $query .=
184
        if (defined $previous) {
179
          $previous
185
            $query .=
180
          ? q{ AND sessionid != ?}
186
              $previous
181
          : q{ AND sessionid = ?};
187
              ? q{ AND sh.sessionid != ?}
188
              : q{ AND sh.sessionid = ?};
189
            push @bind_params, $sessionid;
190
        }
182
    }
191
    }
183
192
184
    $query .= q{ AND type = ?}
193
    if ($type) {
185
      if $type;
194
        $query .= q{ AND sh.type = ?};
195
        push @bind_params, $type;
196
    }
186
197
187
    my $dbh = C4::Context->dbh;
198
    my $dbh = C4::Context->dbh;
188
    my $sth = $dbh->prepare($query);
199
    my $sth = $dbh->prepare($query);
189
    $sth->execute(
200
    $sth->execute(@bind_params);
190
        ( @$id ? ( @$id ) : () ),
191
        ( $userid ? $userid : () ),
192
        ( $sessionid ? $sessionid : () ),
193
        ( $type      ? $type      : () )
194
    );
195
    return $sth->fetchall_arrayref( {} );
201
    return $sth->fetchall_arrayref( {} );
202
196
}
203
}
197
204
198
sub get_from_session {
205
sub get_from_session {
(-)a/catalogue/search-history.pl (-37 / +55 lines)
Lines 20-27 Link Here
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use URI::Escape;
23
24
24
use C4::Auth;
25
use C4::Auth;
26
use C4::Languages;
27
use C4::Search;
25
use C4::Search::History;
28
use C4::Search::History;
26
use C4::Output;
29
use C4::Output;
27
30
Lines 37-97 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
37
40
38
my $type = $cgi->param('type');
41
my $type = $cgi->param('type');
39
my $action = $cgi->param('action') || q{list};
42
my $action = $cgi->param('action') || q{list};
40
my $previous = $cgi->param('previous');
41
43
42
# Deleting search history
44
if ( $action eq 'search' ) {
43
if ( $action eq 'delete' ) {
45
    # Start a new search
44
    my $sessionid = defined $previous
46
45
        ? $cgi->cookie("CGISESSID")
47
    my @ids = $cgi->multi_param('id');
46
        : q{};
48
    my @nots = $cgi->multi_param('not');
49
    my $searches = C4::Search::History::get({
50
        userid => $loggedinuser,
51
        id => \@ids,
52
    });
53
    my @ccl_queries;
54
    foreach my $search (@$searches) {
55
        my $scgi = new CGI($search->{query_cgi});
56
        my @operators = map uri_unescape($_), $scgi->multi_param('op');
57
        my @indexes = map uri_unescape($_), $scgi->multi_param('idx');
58
        my @operands = map uri_unescape($_), $scgi->multi_param('q');
59
        my @limits = map uri_unescape($_), $scgi->multi_param('limit');
60
        my @sort_by = $scgi->param('sort_by');
61
        my $scan = $scgi->param('scan');
62
        my $lang = C4::Languages::getlanguage($cgi);
63
        my ( $error, $query ) =
64
          buildQuery( \@operators, \@operands, \@indexes, \@limits, \@sort_by,
65
            $scan, $lang );
66
67
        if (grep {$_ == $search->{id}} @nots) {
68
            $query = "allrecords,alwaysmatches='' not ($query)";
69
        }
70
71
        push @ccl_queries, $query;
72
    }
73
    my $join = ($cgi->param('join') eq 'or') ? 'or' : 'and';
74
    my $query = 'ccl=(' . join(") $join (", @ccl_queries) . ')';
75
    print $cgi->redirect("/cgi-bin/koha/catalogue/search.pl?q=$query");
76
    exit;
77
} elsif ( $action eq 'delete' ) {
47
    C4::Search::History::delete(
78
    C4::Search::History::delete(
48
        {
79
        {
49
            userid => $loggedinuser,
80
            userid => $loggedinuser,
50
            id     => [ $cgi->param('id') ],
81
            id     => [ $cgi->multi_param('id') ],
51
        }
82
        }
52
    );
83
    );
53
    # Redirecting to this same url so the user won't see the search history link in the header
84
    # Redirecting to this same url so the user won't see the search history link in the header
54
    print $cgi->redirect('/cgi-bin/koha/catalogue/search-history.pl');
85
    print $cgi->redirect('/cgi-bin/koha/catalogue/search-history.pl');
55
86
    exit;
56
# Showing search history
57
} else {
87
} else {
58
    my $current_searches = C4::Search::History::get({
88
    # Showing search history
89
    my $searches = C4::Search::History::get({
59
        userid => $loggedinuser,
90
        userid => $loggedinuser,
60
        sessionid => $cgi->cookie("CGISESSID")
91
        sessionid => $cgi->cookie("CGISESSID")
61
    });
92
    });
62
    my @current_biblio_searches = map {
93
    foreach my $row (@$searches) {
63
        $_->{type} eq 'biblio' ? $_ : ()
94
        if ($row->{a_session}) {
64
    } @$current_searches;
95
            $row->{session} = YAML::Load($row->{a_session});
65
96
            $row->{session}->{session_ctime} = $row->{session}->{_SESSION_CTIME};
66
    my @current_authority_searches = map {
97
            $row->{session}->{session_id} = $row->{session}->{_SESSION_ID};
67
        $_->{type} eq 'authority' ? $_ : ()
98
        }
68
    } @$current_searches;
99
    }
69
100
    my @biblio_searches = map {
70
    my $previous_searches = C4::Search::History::get({
71
        userid => $loggedinuser,
72
        sessionid => $cgi->cookie("CGISESSID"),
73
        previous => 1
74
    });
75
76
    my @previous_biblio_searches = map {
77
        $_->{type} eq 'biblio' ? $_ : ()
101
        $_->{type} eq 'biblio' ? $_ : ()
78
    } @$previous_searches;
102
    } @$searches;
79
103
80
    my @previous_authority_searches = map {
104
    my @authority_searches = map {
81
        $_->{type} eq 'authority' ? $_ : ()
105
        $_->{type} eq 'authority' ? $_ : ()
82
    } @$previous_searches;
106
    } @$searches;
83
107
84
    $template->param(
108
    $template->param(
85
        current_biblio_searches => \@current_biblio_searches,
109
        biblio_searches => \@biblio_searches,
86
        current_authority_searches => \@current_authority_searches,
110
        authority_searches => \@authority_searches,
87
        previous_biblio_searches => \@previous_biblio_searches,
111
        sessionid => $cgi->cookie("CGISESSID"),
88
        previous_authority_searches => \@previous_authority_searches,
89
90
    );
112
    );
91
}
113
}
92
114
93
94
$template->param(
95
);
96
97
output_html_with_http_headers $cgi, $cookie, $template->output;
115
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt (-155 / +130 lines)
Lines 1-6 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% USE Koha %]
1
[% USE Koha %]
3
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE date %]
4
5
[% BLOCK search_history_table %]
6
  <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
7
    [%# Search from multiple lines is only enabled for biblios %]
8
    [% IF type == 'biblio' %]
9
    <div>
10
      <a href="#" class="action_search">Start a new search</a>
11
      <span class='search_options'>
12
        <span>New search:</span>
13
        <select name='join'>
14
          <option value="or" selected="selected">match any of selected searches</option>
15
          <option value="and">match all of selected searches</option>
16
        </select>
17
        <button type="submit">Go</button>
18
        <a href="#" class="action_search_cancel">Cancel</a>
19
      </span>
20
    </div>
21
    [% END %]
22
    <div class="selections-toolbar">
23
      <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
24
      <span class="sep">|</span>
25
      <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
26
      <span class="sep">|</span>
27
      <span class="links">
28
        <span class="selections">Select searches to: </span>
29
        <a href="#" class="action_delete disabled">Delete</a>
30
      </span>
31
    </div>
32
    <input type="hidden" name="action" value="delete" />
33
    <table class="historyt">
34
      <thead>
35
        <tr>
36
          <th></th>
37
          <th class="not">Not</th>
38
          <th>Session date</th>
39
          <th>Date</th>
40
          <th>Search</th>
41
          <th>Results</th>
42
        </tr>
43
      </thead>
44
      <tbody>
45
      [% FOREACH s IN searches %]
46
        <tr>
47
          <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
48
          <td class="not">
49
            <select name="not">
50
              <option value=""></option>
51
              <option value="[% s.id %]" title="Search for the opposite of the criteria on this row">NOT</option>
52
            </select>
53
          </td>
54
          <td>
55
            [% IF s.session %]
56
              [% session_ctime = date.format(s.session.session_ctime, '%Y-%m-%d %H:%M:%S') %]
57
              <span title="[% session_ctime %]">
58
                [% IF s.session.session_id == sessionid %]
59
                  <strong title="Current session">
60
                [% END %]
61
                [% session_ctime | $KohaDates %]
62
                [% IF s.session.session_id == sessionid %]
63
                  </strong>
64
                [% END %]
65
              </span>
66
            [% ELSE %]
67
              <span title="">Unknown</span>
68
            [% END %]
69
          </td>
70
          <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
71
          [% IF type == 'biblio' %]
72
            [% search_url = '/cgi-bin/koha/catalogue/search.pl' %]
73
          [% ELSE %]
74
            [% search_url = '/cgi-bin/koha/authorities/authorities-home.pl' %]
75
          [% END %]
76
          <td><a href="[% search_url %]?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
77
          <td>[% s.total %]</td>
78
        </tr>
79
      [% END %]
80
      </tbody>
81
    </table>
82
  </form>
83
[% END %]
84
85
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Catalog &rsaquo; Search history</title>
86
<title>Koha &rsaquo; Catalog &rsaquo; Search history</title>
5
[% INCLUDE 'doc-head-close.inc' %]
87
[% INCLUDE 'doc-head-close.inc' %]
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
88
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
Lines 12-21 $(document).ready(function() { Link Here
12
    // We show table ordered by descending dates by default
94
    // We show table ordered by descending dates by default
13
    // (so that the more recent query is shown first)
95
    // (so that the more recent query is shown first)
14
    $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
96
    $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
15
        "aaSorting": [[ 1, "desc" ]],
97
        "aaSorting": [[ 3, "desc" ]],
16
        "aoColumnDefs": [
98
        "aoColumnDefs": [
17
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
99
            { "aTargets": [ 0, 1 ], "bSortable": false, "bSearchable": false },
18
            { "aTargets": [ 1 ], "sType": "title-string" },
100
            { "aTargets": [ 2, 3 ], "sType": "title-string" },
101
            { "aTargets": [ 1 ], "bVisible": false }
19
        ],
102
        ],
20
        "sPaginationType": "full_numbers"
103
        "sPaginationType": "full_numbers"
21
    }));
104
    }));
Lines 34-40 $(document).ready(function() { Link Here
34
        var new_form = $('<form>')
117
        var new_form = $('<form>')
35
            .attr('action', form.attr('action'))
118
            .attr('action', form.attr('action'))
36
            .attr('method', form.attr('method'));
119
            .attr('method', form.attr('method'));
37
        form.find('input[type="hidden"]')
120
        form.find('input[type="hidden"],select')
38
            .add(table.$('input:checkbox:checked'))
121
            .add(table.$('input:checkbox:checked'))
39
            .each(function() {
122
            .each(function() {
40
                var input = $('<input type="hidden">')
123
                var input = $('<input type="hidden">')
Lines 81-90 $(document).ready(function() { Link Here
81
        }
164
        }
82
165
83
        if ( confirm(msg) ) {
166
        if ( confirm(msg) ) {
167
            form.find('input[name="action"]').val('delete');
84
            form.submit();
168
            form.submit();
85
        }
169
        }
86
        return false;
170
        return false;
87
    });
171
    });
172
    $(".action_search").click(function() {
173
      var $form = $(this).parents('form');
174
      var table = $form.find('table').dataTable();
175
      var $checked = table.$('input:checkbox:checked');
176
      $(this).hide();
177
      $('.search_options').show();
178
      table.fnSetColumnVis(1, true);
179
      return false;
180
    });
181
182
    $('.search_options button[type="submit"]').click(function() {
183
      var $form = $(this).parents('form');
184
      var table = $form.find('table').dataTable();
185
      var $checked = table.$('input:checkbox:checked');
186
      if ($checked.length) {
187
        $form.find('input[name="action"]').val('search');
188
        $form.submit();
189
      } else {
190
        alert(_("You have to select searches first"));
191
      }
192
      return false;
193
    });
194
195
    $('.action_search_cancel').click(function() {
196
      var form = $(this).parents('form').first();
197
      var table = form.find('table').dataTable();
198
      $('.action_search').show();
199
      $('.search_options').hide();
200
      table.fnSetColumnVis(1, false);
201
      return false;
202
    }).click();
88
203
89
    $('#tabs form').each(function() {
204
    $('#tabs form').each(function() {
90
        enableCheckboxActions($(this));
205
        enableCheckboxActions($(this));
Lines 133-293 function enableCheckboxActions(form){ Link Here
133
          <li><a href="#authority_tab">Authority</a></li>
248
          <li><a href="#authority_tab">Authority</a></li>
134
        </ul>
249
        </ul>
135
        <div id="biblio_tab">
250
        <div id="biblio_tab">
136
          [% IF ( current_biblio_searches ) %]
251
          [% IF ( biblio_searches ) %]
137
            <h2>Current session</h2>
252
            [% INCLUDE search_history_table
138
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
253
              searches = biblio_searches
139
              <div class="selections-toolbar">
254
              type = 'biblio' %]
140
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
255
          [% ELSE %]
141
                <span class="sep">|</span>
142
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
143
                <span class="sep">|</span>
144
                <span class="links">
145
                  <span class="selections">Select searches to: </span>
146
                  <a href="#" class="action_delete disabled">Delete</a>
147
                </span>
148
              </div>
149
              <input type="hidden" name="action" value="delete" />
150
              <table class="historyt">
151
                <thead>
152
                  <tr>
153
                    <th></th>
154
                    <th>Date</th>
155
                    <th>Search</th>
156
                    <th>Results</th>
157
                  </tr>
158
                </thead>
159
                <tbody>
160
                [% FOREACH s IN current_biblio_searches %]
161
                  <tr>
162
                    <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
163
                    <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
164
                    <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
165
                    <td>[% s.total %]</td>
166
                  </tr>
167
                [% END %]
168
                </tbody>
169
              </table>
170
            </form>
171
          [% END %]
172
173
          [% IF ( previous_biblio_searches ) %]
174
            <h2>Previous sessions</h2>
175
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
176
              <div class="selections-toolbar">
177
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
178
                <span class="sep">|</span>
179
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</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>
186
              <input type="hidden" name="action" value="delete" />
187
              <table class="historyt">
188
                <thead>
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 previous_biblio_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/catalogue/search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
202
                    <td>[% s.total %]</td>
203
                  </tr>
204
                [% END %]
205
                </tbody>
206
              </table>
207
            </form>
208
          [% END %]
209
210
          [% IF !current_biblio_searches && !previous_biblio_searches %]
211
            <p>Your catalog search history is empty.</p>
256
            <p>Your catalog search history is empty.</p>
212
          [% END %]
257
          [% END %]
213
        </div>
258
        </div>
214
259
215
        <div id="authority_tab">
260
        <div id="authority_tab">
216
          [% IF ( current_authority_searches ) %]
261
          [% IF ( authority_searches ) %]
217
            <h2>Current session</h2>
262
            [% INCLUDE search_history_table
218
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
263
              searches = authority_searches
219
              <div class="selections-toolbar">
264
              type = 'authority' %]
220
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
265
          [% ELSE %]
221
                <span class="sep">|</span>
222
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
223
                <span class="sep">|</span>
224
                <span class="links">
225
                  <span class="selections">Select searches to: </span>
226
                  <a href="#" class="action_delete disabled">Delete</a>
227
                </span>
228
              </div>
229
              <input type="hidden" name="action" value="delete" />
230
              <table class="historyt">
231
                <thead>
232
                  <tr>
233
                    <th></th>
234
                    <th>Date</th>
235
                    <th>Search</th>
236
                    <th>Results</th>
237
                  </tr>
238
                </thead>
239
                <tbody>
240
                [% FOREACH s IN current_authority_searches %]
241
                  <tr>
242
                    <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
243
                    <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
244
                    <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
245
                    <td>[% s.total %]</td>
246
                  </tr>
247
                [% END %]
248
                </tbody>
249
              </table>
250
            </form>
251
          [% END %]
252
253
          [% IF ( previous_authority_searches ) %]
254
            <h2>Previous sessions</h2>
255
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
256
              <div class="selections-toolbar">
257
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
258
                <span class="sep">|</span>
259
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
260
                <span class="sep">|</span>
261
                <span class="links">
262
                  <span class="selections">Select searches to: </span>
263
                  <a href="#" class="action_delete disabled">Delete</a>
264
                </span>
265
              </div>
266
              <input type="hidden" name="action" value="delete" />
267
              <table class="historyt">
268
                <thead>
269
                  <tr>
270
                    <th></th>
271
                    <th>Date</th>
272
                    <th>Search</th>
273
                    <th>Results</th>
274
                  </tr>
275
                </thead>
276
                <tbody>
277
                [% FOREACH s IN previous_authority_searches %]
278
                  <tr>
279
                    <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
280
                    <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
281
                    <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
282
                    <td>[% s.total %]</td>
283
                  </tr>
284
                [% END %]
285
                </tbody>
286
              </table>
287
            </form>
288
          [% END %]
289
290
          [% IF !current_authority_searches && !previous_authority_searches %]
291
            <p>Your authority search history is empty.</p>
266
            <p>Your authority search history is empty.</p>
292
          [% END %]
267
          [% END %]
293
        </div>
268
        </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt (-186 / +165 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE date %]
4
5
[% BLOCK search_history_table %]
6
  <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
7
    <div>
8
      [% IF type == 'biblio' %]
9
        <a href="#" class="action_search">Start a new search</a>
10
        <span class='search_options form-inline'>
11
          <span>New search:</span>
12
          <select name='join'>
13
            <option value="or" selected="selected">match any of selected searches</option>
14
            <option value="and">match all of selected searches</option>
15
          </select>
16
          <button type="submit">Go</button>
17
          <a href="#" class="action_search_cancel">Cancel</a>
18
        </span>
19
        &nbsp;
20
      [% END %]
21
    </div>
22
    <div class="selections-toolbar toolbar">
23
      <a class="CheckAll" href="#">Select all</a>
24
      <a class="CheckNone" href="#">Clear all</a>
25
      <span class="sep">|</span>
26
      <span class="links">
27
        <span class="selections">Select searches to: </span>
28
        <a href="#" class="removeitems disabled">Delete</a>
29
      </span>
30
    </div>
31
    <input type="hidden" name="action" value="delete" />
32
    <table class="historyt table table-bordered table-striped">
33
      <thead>
34
        <tr>
35
          <th></th>
36
          <th class="not">Not</th>
37
          [% IF hide_session_column %]
38
            <th class="hide">Session date</th>
39
          [% ELSE %]
40
            <th>Session date</th>
41
          [% END %]
42
          <th>Date</th>
43
          <th>Search</th>
44
          <th>Results</th>
45
        </tr>
46
      </thead>
47
      <tbody>
48
      [% FOREACH s IN searches %]
49
        <tr>
50
          <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
51
          <td class="not">
52
            <select name="not">
53
              <option value=""></option>
54
              <option value="[% s.id %]" title="Search for the opposite of the criteria on this row">NOT</option>
55
            </select>
56
          </td>
57
          [% IF hide_session_column %]
58
            <td class="hide">
59
          [% ELSE %]
60
            <td>
61
          [% END %]
62
            [% IF s.session %]
63
              [% session_ctime = date.format(s.session.session_ctime, '%Y-%m-%d %H:%M:%S') %]
64
              <span title="[% session_ctime %]">
65
                [% IF s.session.session_id == sessionid %]
66
                  <strong title="Current session">
67
                [% END %]
68
                [% session_ctime | $KohaDates %]
69
                [% IF s.session.session_id == sessionid %]
70
                  </strong>
71
                [% END %]
72
              </span>
73
            [% ELSE %]
74
              <span title="">Unknown</span>
75
            [% END %]
76
          </td>
77
          <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
78
          [% IF type == 'biblio' %]
79
            [% search_url = '/cgi-bin/koha/opac-search.pl' %]
80
          [% ELSIF type == 'authority' %]
81
            [% search_url = '/cgi-bin/koha/opac-authorities-home.pl' %]
82
          [% END %]
83
          <td>
84
            [% IF type == 'biblio' %]
85
              <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;[% s.query_cgi |html %]&amp;count=[% countrss |html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink">
86
                <img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/>
87
              </a>
88
            [% END %]
89
            <a href="[% search_url %]?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
90
          <td>[% s.total %]</td>
91
        </tr>
92
      [% END %]
93
      </tbody>
94
    </table>
95
    <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
96
  </form>
97
[% END %]
98
3
[% INCLUDE 'doc-head-open.inc' %]
99
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your search history</title>
100
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your search history</title>
5
[% INCLUDE 'doc-head-close.inc' %]
101
[% INCLUDE 'doc-head-close.inc' %]
Lines 31-216 Link Here
31
                <div class="span12">
127
                <div class="span12">
32
            [% END %]
128
            [% END %]
33
                <div id="searchhistory" class="maincontent">
129
                <div id="searchhistory" class="maincontent">
34
                    <h1>Search history</h1>
130
                  <h1>Search history</h1>
35
                    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
131
                  [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
36
                        <div id="tabs" class="toptabs">
132
                    <div id="tabs" class="toptabs">
37
                            <ul>
133
                      <ul>
38
                                <li><a href="#biblio_tab">Catalog</a></li>
134
                        <li><a href="#biblio_tab">Catalog</a></li>
39
                                <li><a href="#authority_tab">Authority</a></li>
135
                        <li><a href="#authority_tab">Authority</a></li>
40
                            </ul>
136
                      </ul>
137
                  [% END %]
138
                  <div id="biblio_tab">
139
                    [% IF ( biblio_searches ) %]
140
                      [% INCLUDE search_history_table
141
                        searches = biblio_searches
142
                        type = 'biblio' %]
143
                    [% ELSE %]
144
                      <p>Your catalog search history is empty.</p>
41
                    [% END %]
145
                    [% END %]
42
                        <div id="biblio_tab">
146
                  </div>
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="removeitems 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="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;[% s.query_cgi |html %]&amp;count=[% countrss |html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <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
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
78
                                    </form>
79
                                [% END # IF ( current_biblio_searches ) %]
80
                            </div> <!-- / #current_biblio -->
81
82
                            <div id="previous_biblio">
83
                                [% IF ( previous_biblio_searches ) %]
84
                                    <h2>Previous sessions</h2>
85
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
86
                                        <div class="selections-toolbar toolbar">
87
                                            <a class="CheckAll" href="#">Select all</a>
88
                                            <a class="CheckNone" href="#">Clear all</a>
89
                                            <span class="sep">|</span>
90
                                            <span class="links">
91
                                                <span class="selections">Select searches to: </span>
92
                                                <a href="#" class="removeitems disabled">Delete</a>
93
                                            </span>
94
                                        </div>
95
96
                                        <input type="hidden" name="action" value="delete" />
97
                                        <table class="historyt table table-bordered table-striped">
98
                                            <thead>
99
                                                <tr>
100
                                                    <th></th>
101
                                                    <th>Date</th>
102
                                                    <th>Search</th>
103
                                                    <th>Results</th>
104
                                                </tr>
105
                                            </thead>
106
                                            <tbody>
107
                                            [% FOREACH s IN previous_biblio_searches %]
108
                                                <tr>
109
                                                    <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
110
                                                    <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
111
                                                    <td><a href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;[% s.query_cgi |html %]&amp;count=[% countrss |html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
112
                                                    <td>[% s.total %]</td>
113
                                                </tr>
114
                                            [% END %]
115
                                            </tbody>
116
                                        </table>
117
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
118
                                    </form>
119
                                [% END # IF ( previous_biblio_searches ) %]
120
                            </div> <!-- / #previous_biblio -->
121
122
                            [% IF !current_biblio_searches && !previous_biblio_searches %]
123
                                <p>Your catalog search history is empty.</p>
124
                            [% END %]
125
                        </div> <!-- / #biblio_tab -->
126
147
127
                        [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
148
                  [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
128
                            <div id="authority_tab">
149
                    <div id="authority_tab">
129
                                [% IF ( current_authority_searches ) %]
150
                      [% IF ( authority_searches ) %]
130
                                    <h2>Current session</h2>
151
                        [% INCLUDE search_history_table
131
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
152
                          searches = authority_searches
132
                                        <div class="selections-toolbar toolbar">
153
                          type = 'authority' %]
133
                                            <a class="CheckAll" href="#">Select all</a>
154
                      [% ELSE %]
134
                                            <a class="CheckNone" href="#">Clear all</a>
155
                        <p>Your authority search history is empty.</p>
135
                                            <span class="sep">|</span>
156
                      [% END %]
136
                                            <span class="links">
157
                    </div>
137
                                                <span class="selections">Select searches to: </span>
158
                  [% END %]
138
                                                <a href="#" class="removeitems disabled">Delete</a>
159
                </div> <!-- / #search_history -->
139
                                            </span>
160
        </div> <!-- / .span10/12 -->
140
                                        </div>
161
    </div> <!-- / .row-fluid -->
141
                                        <input type="hidden" name="action" value="delete" />
162
</div> <!-- / .container-fluid -->
142
                                        <table class="historyt table table-bordered table-striped">
143
                                            <thead>
144
                                                <tr>
145
                                                    <th></th>
146
                                                    <th>Date</th>
147
                                                    <th>Search</th>
148
                                                    <th>Results</th>
149
                                                </tr>
150
                                            </thead>
151
                                            <tbody>
152
                                                [% FOREACH s IN current_authority_searches %]
153
                                                    <tr>
154
                                                        <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
155
                                                        <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>
157
                                                        <td>[% s.total %]</td>
158
                                                    </tr>
159
                                                [% END %]
160
                                            </tbody>
161
                                        </table>
162
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
163
                                    </form>
164
                                [% END # / IF ( current_authority_searches ) %]
165
166
                                [% IF ( previous_authority_searches ) %]
167
                                    <h2>Previous sessions</h2>
168
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
169
                                        <div class="selections-toolbar toolbar">
170
                                            <a class="CheckAll" href="#">Select all</a>
171
                                            <a class="CheckNone" href="#">Clear all</a>
172
                                            <span class="sep">|</span>
173
                                            <span class="links">
174
                                                <span class="selections">Select searches to: </span>
175
                                                <a href="#" class="removeitems disabled">Delete</a>
176
                                            </span>
177
                                        </div>
178
                                        <input type="hidden" name="action" value="delete" />
179
                                        <table class="historyt table table-bordered table-striped">
180
                                            <thead>
181
                                                <tr>
182
                                                    <th></th>
183
                                                    <th>Date</th>
184
                                                    <th>Search</th>
185
                                                    <th>Results</th>
186
                                                </tr>
187
                                            </thead>
188
                                            <tbody>
189
                                                [% FOREACH s IN previous_authority_searches %]
190
                                                    <tr>
191
                                                        <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
192
                                                        <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
193
                                                        <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
194
                                                        <td>[% s.total %]</td>
195
                                                    </tr>
196
                                                [% END %]
197
                                            </tbody>
198
                                        </table>
199
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
200
                                    </form>
201
                                [% END # / IF ( previous_authority_searches )%]
202
203
                                [% IF !current_authority_searches && !previous_authority_searches %]
204
                                    <p>Your authority search history is empty.</p>
205
                                [% END %]
206
                            </div> <!-- / #authority_tab -->
207
                        [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
208
                    </div> <!-- / #tabs -->
209
                </div> <!-- / #searchhistory -->
210
            </div> <!-- / .span10/12 -->
211
        </div> <!-- / .row-fluid -->
212
    </div> <!-- / .container-fluid -->
213
</div> <!-- / #main -->
214
163
215
[% INCLUDE 'opac-bottom.inc' %]
164
[% INCLUDE 'opac-bottom.inc' %]
216
[% BLOCK jsinclude %]
165
[% BLOCK jsinclude %]
Lines 220-233 Link Here
220
//<![CDATA[
169
//<![CDATA[
221
    var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
170
    var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?");
222
    $(document).ready(function() {
171
    $(document).ready(function() {
223
        // We show table ordered by descending dates by default
172
       // We show table ordered by descending dates by default
224
        // (so that the more recent query is shown first)
173
       // (so that the more recent query is shown first)
225
        $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
174
       $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
226
            "aaSorting": [[ 1, "desc" ]],
175
           "aaSorting": [[ 3, "desc" ]],
227
            "aoColumnDefs": [
176
           "aoColumnDefs": [
228
                { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
177
               { "aTargets": [ 0, 1 ], "bSortable": false, "bSearchable": false },
229
                { "aTargets": [ 1 ], "sType": "title-string" },
178
               { "aTargets": [ 2, 3 ], "sType": "title-string" },
230
            ]
179
           ]
231
        }));
180
        }));
232
181
233
        [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
182
        [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
Lines 262-267 Link Here
262
            }
211
            }
263
            return false;
212
            return false;
264
        });
213
        });
214
        $(".action_search").click(function() {
215
          var $form = $(this).parents('form');
216
          $(this).hide();
217
          $('.search_options').show();
218
          $('.not').show();
219
          return false;
220
        });
221
222
        $('.search_options button[type="submit"]').click(function() {
223
          var $form = $(this).parents('form');
224
          var $checked = $form.find('input:checkbox:checked');
225
          if ($checked.length ) {
226
            $form.find('input[name="action"]').val('search');
227
            $form.submit();
228
          } else {
229
            alert(_("You have to select searches first"));
230
          }
231
          return false;
232
        });
233
234
        $('.action_search_cancel').click(function() {
235
          $('.action_search').show();
236
          $('.search_options').hide();
237
          $('.not').hide();
238
          return false;
239
        }).click();
240
241
        $('form').each(function() {
242
          enableCheckboxActions(this);
243
        });
265
    });
244
    });
266
245
267
    function enableCheckboxActions(form){
246
    function enableCheckboxActions(form){
(-)a/opac/opac-search-history.pl (-80 / +93 lines)
Lines 22-31 use Modern::Perl; Link Here
22
use C4::Auth qw(:DEFAULT get_session);
22
use C4::Auth qw(:DEFAULT get_session);
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use C4::Context;
24
use C4::Context;
25
use C4::Languages;
25
use C4::Output;
26
use C4::Output;
26
use C4::Log;
27
use C4::Log;
27
use C4::Items;
28
use C4::Items;
28
use C4::Debug;
29
use C4::Debug;
30
use C4::Search;
29
use C4::Search::History;
31
use C4::Search::History;
30
32
31
use URI::Escape;
33
use URI::Escape;
Lines 46-110 my ($template, $loggedinuser, $cookie) = get_template_and_user( Link Here
46
    }
48
    }
47
);
49
);
48
50
49
my $type = $cgi->param('type');
50
my $action = $cgi->param('action') || q{};
51
my $action = $cgi->param('action') || q{};
51
my $previous = $cgi->param('previous');
52
52
53
# If the user is not logged in, we deal with the session
53
if ( $action eq 'search' ) {
54
unless ( $loggedinuser ) {
54
    # Start a new search
55
    # Deleting search history
56
    if ( $action eq 'delete') {
57
        # Deleting session's search history
58
        my @id = $cgi->multi_param('id');
59
        my $all = not scalar( @id );
60
61
        my $type = $cgi->param('type');
62
        my @searches = ();
63
        unless ( $all ) {
64
            @searches = C4::Search::History::get_from_session({ cgi => $cgi });
65
            if ( $type ) {
66
                @searches = map { $_->{type} ne $type ? $_ : () } @searches;
67
            }
68
            if ( @id ) {
69
                @searches = map { my $search = $_; ( grep {/^$search->{id}$/} @id ) ? () : $_ } @searches;
70
            }
71
        }
72
        C4::Search::History::set_to_session({ cgi => $cgi, search_history => \@searches });
73
55
74
        # Redirecting to this same url so the user won't see the search history link in the header
56
    my @ids = $cgi->multi_param('id');
75
        print $cgi->redirect(-uri => '/cgi-bin/koha/opac-search-history.pl');
57
    my @nots = $cgi->multi_param('not');
76
    # Showing search history
58
    my @searches;
59
    if ($loggedinuser) {
60
        @searches = @{ C4::Search::History::get({
61
            userid => $loggedinuser,
62
            id => \@ids,
63
        }) };
77
    } else {
64
    } else {
78
        # Getting the searches from session
65
        @searches = C4::Search::History::get_from_session({ cgi => $cgi });
79
        my @current_searches = C4::Search::History::get_from_session({
66
        if ( @ids ) {
80
            cgi => $cgi,
67
            @searches = map {
81
        });
68
                my $search = $_;
82
69
                ( grep {/^$search->{id}$/} @ids ) ? $_ : ()
83
        my @current_biblio_searches = map {
70
            } @searches;
84
            $_->{type} eq 'biblio' ? $_ : ()
71
        }
85
        } @current_searches;
86
87
        my @current_authority_searches = map {
88
            $_->{type} eq 'authority' ? $_ : ()
89
        } @current_searches;
90
91
        $template->param(
92
            current_biblio_searches => \@current_biblio_searches,
93
            current_authority_searches => \@current_authority_searches,
94
        );
95
    }
72
    }
96
} else {
73
    my @ccl_queries;
97
    # And if the user is logged in, we deal with the database
74
    foreach my $search (@searches) {
98
    my $dbh = C4::Context->dbh;
75
        my $scgi = new CGI($search->{query_cgi});
76
        my @operators = map uri_unescape($_), $scgi->multi_param('op');
77
        my @indexes = map uri_unescape($_), $scgi->multi_param('idx');
78
        my @operands = map uri_unescape($_), $scgi->multi_param('q');
79
        my @limits = map uri_unescape($_), $scgi->multi_param('limit');
80
        my @sort_by = $scgi->multi_param('sort_by');
81
        my $scan = $scgi->param('scan');
82
        my $lang = C4::Languages::getlanguage($cgi);
83
        my ( $error, $query ) =
84
          buildQuery( \@operators, \@operands, \@indexes, \@limits, \@sort_by,
85
            $scan, $lang );
86
87
        if (grep {$_ == $search->{id}} @nots) {
88
            $query = "allrecords,alwaysmatches='' not ($query)";
89
        }
99
90
91
        push @ccl_queries, $query;
92
    }
93
    my $join = ($cgi->param('join') eq 'or') ? 'or' : 'and';
94
    my $query = 'ccl=(' . join(") $join (", @ccl_queries) . ')';
95
    print $cgi->redirect("/cgi-bin/koha/opac-search.pl?q=$query");
96
    exit;
97
} elsif ( $action eq 'delete' ) {
100
    # Deleting search history
98
    # Deleting search history
101
    if ( $action eq 'delete' ) {
99
    my @id = $cgi->multi_param('id');
102
        my @id = $cgi->multi_param('id');
100
    if ($loggedinuser) {
103
        if ( @id ) {
101
        if ( @id ) {
104
            C4::Search::History::delete(
102
            C4::Search::History::delete(
105
                {
103
                {
106
                    userid => $loggedinuser,
104
                    userid => $loggedinuser,
107
                    id     => [ $cgi->param('id') ],
105
                    id     => \@id,
108
                }
106
                }
109
            );
107
            );
110
        } else {
108
        } else {
Lines 114-158 unless ( $loggedinuser ) { Link Here
114
                }
112
                }
115
            );
113
            );
116
        }
114
        }
117
        # Redirecting to this same url so the user won't see the search history link in the header
118
        print $cgi->redirect(-uri => '/cgi-bin/koha/opac-search-history.pl');
119
120
    # Showing search history
121
    } else {
115
    } else {
122
        my $current_searches = C4::Search::History::get({
116
        # Deleting session's search history
117
        my $type = $cgi->param('type');
118
        my @searches = ();
119
        if ( scalar @id ) {
120
            @searches = C4::Search::History::get_from_session({ cgi => $cgi });
121
            if ( $type ) {
122
                @searches = map { $_->{type} ne $type ? $_ : () } @searches;
123
            }
124
            if ( @id ) {
125
                @searches = map { my $search = $_; ( grep {/^$search->{id}$/} @id ) ? () : $_ } @searches;
126
            }
127
        }
128
        C4::Search::History::set_to_session({ cgi => $cgi, search_history => \@searches });
129
    }
130
    # Redirecting to this same url so the user won't see the search history link in the header
131
    print $cgi->redirect(-uri => '/cgi-bin/koha/opac-search-history.pl');
132
    exit;
133
} else {
134
    # Showing search history
135
    my @searches;
136
    if ($loggedinuser) {
137
        @searches = @{ C4::Search::History::get({
123
            userid => $loggedinuser,
138
            userid => $loggedinuser,
124
            sessionid => $cgi->cookie("CGISESSID")
139
            sessionid => $cgi->cookie("CGISESSID")
140
        }) };
141
        foreach my $row (@searches) {
142
            if ($row->{a_session}) {
143
                $row->{session} = YAML::Load($row->{a_session});
144
                $row->{session}->{session_ctime} = $row->{session}->{_SESSION_CTIME};
145
                $row->{session}->{session_id} = $row->{session}->{_SESSION_ID};
146
            }
147
        }
148
    } else {
149
        # Getting the searches from session
150
        @searches = C4::Search::History::get_from_session({
151
            cgi => $cgi,
125
        });
152
        });
126
        my @current_biblio_searches = map {
153
        $template->param(hide_session_column => 1);
127
            $_->{type} eq 'biblio' ? $_ : ()
154
    }
128
        } @$current_searches;
129
130
        my @current_authority_searches = map {
131
            $_->{type} eq 'authority' ? $_ : ()
132
        } @$current_searches;
133
134
        my $previous_searches = C4::Search::History::get({
135
            userid => $loggedinuser,
136
            sessionid => $cgi->cookie("CGISESSID"),
137
            previous => 1
138
        });
139
155
140
        my @previous_biblio_searches = map {
141
            $_->{type} eq 'biblio' ? $_ : ()
142
        } @$previous_searches;
143
156
144
        my @previous_authority_searches = map {
157
    my @biblio_searches = map {
145
            $_->{type} eq 'authority' ? $_ : ()
158
        $_->{type} eq 'biblio' ? $_ : ()
146
        } @$previous_searches;
159
    } @searches;
147
160
148
        $template->param(
161
    my @authority_searches = map {
149
            current_biblio_searches => \@current_biblio_searches,
162
        $_->{type} eq 'authority' ? $_ : ()
150
            current_authority_searches => \@current_authority_searches,
163
    } @searches;
151
            previous_biblio_searches => \@previous_biblio_searches,
152
            previous_authority_searches => \@previous_authority_searches,
153
164
154
        );
165
    $template->param(
155
    }
166
        biblio_searches => \@biblio_searches,
167
        authority_searches => \@authority_searches,
168
        sessionid => $cgi->cookie('CGISESSID'),
169
    );
156
}
170
}
157
171
158
$template->param(searchhistoryview => 1);
172
$template->param(searchhistoryview => 1);
159
- 

Return to bug 12460