d07df7d512
Storing search history into cookie can cause problems, due to the size limitation of 4KB. The solution here is to store search history into the CGI::Session object, so there is no size limitation (but anonymous search history still remember up to 15 requests max.) Test plan: - Go to OPAC in anonymous mode. - Check that the "Search history" link is *not* shown in the top right corner of the page - Make some searches on /cgi-bin/koha/opac-search.pl - The "Search history" link should appear. Click. - Your search history should be displayed. - Try to log in with invalid username/password - Go back to search history, it's still there - Now log in with valid username/password - Your anonymous search history should be saved into your own search history. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Restoring original sign offs and comments below Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work as described. No koha-qa errors Well, search history saving is similar before and after patch. i.e. anonmymous search is saved when user logs in, but cookie KohaOpacRecentSearches is empty. Shows current an previous session searches Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> All tests and QA script pass, works as described. Signed-off-by: Charlene Criton <charlene.criton@univ-lyon2.fr> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
101 lines
3.6 KiB
Text
101 lines
3.6 KiB
Text
[% USE Koha %]
|
|
[% USE KohaDates %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your search history
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete your search history?");
|
|
$(document).ready(function() {
|
|
// We show table ordered by descending dates by default
|
|
// (so that the more recent query is shown first)
|
|
$(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"aaSorting": [[ 0, "desc" ]],
|
|
"aoColumns": [
|
|
{ "sType": "title-string" },
|
|
null,
|
|
null
|
|
]
|
|
}));
|
|
});
|
|
//]]>
|
|
|
|
</script>
|
|
</head>
|
|
<body id="opac-search-history">
|
|
[% IF ( OpacNav ) %]
|
|
<div id="doc3" class="yui-t1">
|
|
[% ELSIF ( loggedinusername ) %]
|
|
<div id="doc3" class="yui-t1">
|
|
[% ELSE %]
|
|
<div id="doc3" class="yui-t7">
|
|
[% END %]
|
|
<div id="bd">
|
|
[% INCLUDE 'masthead.inc' %]
|
|
|
|
<div id="yui-main">
|
|
<div class="yui-b"><div class="yui-g">
|
|
<div id="searchhistory" class="container">
|
|
<h1>Search history</h1>
|
|
[% IF ( recentSearches ) %]<form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /></form>[% ELSE %][% IF ( previousSearches ) %]<form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /></form>[% END %][% END %]
|
|
|
|
[% IF ( recentSearches ) %]
|
|
<table class="historyt">
|
|
[% IF ( previousSearches ) %]
|
|
<caption>Current session</caption>
|
|
[% END %]
|
|
<thead>
|
|
<tr><th>Date</th><th>Search</th><th>Results</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH recentSearche IN recentSearches %]
|
|
<tr>
|
|
<td><span title="[% recentSearche.time %]">[% recentSearche.time %]</span></td>
|
|
<td><a href="/cgi-bin/koha/opac-search.pl?[% recentSearche.query_cgi |html %]">[% recentSearche.query_desc |html %]</a></td>
|
|
<td>[% recentSearche.total %]</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
[% IF ( previousSearches ) %]
|
|
<table class="historyt">
|
|
<caption>Previous sessions</caption>
|
|
<thead>
|
|
<tr><th>Date</th><th>Search</th><th>Results</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH previousSearche IN previousSearches %]
|
|
<tr>
|
|
<td><span title="[% previousSearche.time %]">[% previousSearche.time |$KohaDates with_hours => 1 %]</span></td>
|
|
<td><a href="/cgi-bin/koha/opac-search.pl?[% previousSearche.query_cgi |html %]">[% previousSearche.query_desc |html %]</a></td>
|
|
<td>[% previousSearche.total %]</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
[% IF ( recentSearches ) %][% ELSE %][% IF ( previousSearches ) %][% ELSE %]<p>Your search history is empty.</p>[% END %][% END %]
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
[% IF ( OpacNav ) %]
|
|
<div class="yui-b"><div id="leftmenus" class="container">
|
|
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
|
|
</div></div>
|
|
[% ELSIF ( loggedinusername ) %]
|
|
<div class="yui-b"><div id="leftmenus" class="container">
|
|
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
|
|
</div></div>
|
|
[% ELSE %]
|
|
[% END %]
|
|
|
|
|
|
</div>
|
|
[% INCLUDE 'opac-bottom.inc' %]
|