} #/end of the for loop
#$template->param(FEDERATED_RESULTS => \@results_array);
-$template->{'VARS'}->{'searchid'} = $cgi->param('searchid')
- || String::Random::random_string('ssssssss');
+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
+}
+
my $gotonumber = $cgi->param('gotoNumber');
if ($gotonumber eq 'last' || $gotonumber eq 'first') {
$template->{'VARS'}->{'gotoNumber'} = $gotonumber;
pagelen: newresults.length,
results: newresults
};
+
+ //Bug_11369 Cleaning up excess searchCookies to prevent cookie overflow in the browser memory.
+ var allVisibleCookieKeys = Object.keys( $.cookie() );
+ var scsCookieKeys = $.grep( allVisibleCookieKeys,
+ function(elementOfArray, indexInArray) {
+ return ( elementOfArray.search(/^scs_\d/) != -1 ); //We are looking for specifically staff client searchCookies.
+ }
+ );
+ if (scsCookieKeys.length >= 10) {
+ scsCookieKeys.sort(); //Make sure they are in order, oldest first!
+ $.removeCookie( scsCookieKeys[0], { path: '/' } );
+ }
+ //EO Bug_11369
}
$.cookie(me.searchid, JSON.stringify(me.searchCookie), { path: '/' });
$(document).ready(function () {