Bug 11369: (follow-up) generate searchid in browser.js

The search browser feature uses nearly only the browser.js file.
That is why I propose to move the searchid generation from search.pl
to browser.js.
We then use Date.getTime() to use current timestamp as searchid,
prefixed by 'scs_' like before.

Test by using test plan of main patch :
Too many search cursor cookies overflow HTTP-header size, when
making multiple searches in the staff client

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script.
Tested the browse functionality in staff by using the different
options (back to results, next, previous, etc) and the batch
modifications for items. An old cookie can cause a Javascript error,
but after restarting the browser/deleting cookies it all works
correctly.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Fridolin Somers 2014-02-26 17:14:04 +01:00 committed by Galen Charlton
parent 98edbf00cc
commit c4f1765013
2 changed files with 9 additions and 13 deletions

View file

@ -678,14 +678,7 @@ for (my $i=0;$i<@servers;$i++) {
} #/end of the for loop
#$template->param(FEDERATED_RESULTS => \@results_array);
if ($cgi->param('searchid')) {
$template->{'VARS'}->{'searchid'} = $cgi->param('searchid');
}
else {
my $dt = DateTime->now(time_zone => 'local');
#We are generating a clean numeric datetime representation so we can easily compare them using the default javascript lexigraphic sorter.
$template->{'VARS'}->{'searchid'} = 'scs_'.$dt->ymd('').$dt->hms(''); #scs == Staff Client
}
$template->{'VARS'}->{'searchid'} = $cgi->param('searchid');
my $gotonumber = $cgi->param('gotoNumber');
if ($gotonumber eq 'last' || $gotonumber eq 'first') {

View file

@ -2,14 +2,17 @@ if ( KOHA === undefined ) var KOHA = {};
KOHA.browser = function (searchid, biblionumber) {
var me = this;
if (!searchid) {
// We are generating a clean numeric datetime representation so we can easily compare them using the default javascript lexigraphic sorter.
searchid = 'scs_' + (new Date()).getTime(); // scs for Staff Client Search
}
this.searchid = searchid;
if (me.searchid) {
var cookie = $.cookie(me.searchid)
if (cookie) {
me.searchCookie = JSON.parse(cookie);
}
}
var browseRecords = function (movement) {
var newSearchPos = me.curPos + movement;