var arrRecords = new Array(); var arrCookie = new Array(); var recCount = 0; var strRecord=""; function cookieVal(cookieName) { thisCookie = document.cookie.split("; ") for (i = 0; i < thisCookie.length; i++) { if (cookieName == thisCookie[i].split("=")[0]) { return thisCookie[i].split("=")[1]; } } return 0; } function loadCookie() { if(document.cookie != "") { if(cookieVal("Records") != 0) { arrRecords = cookieVal("Records").split(","); recCount = arrRecords.length; } } } function addToCookie(id) { /* * Comments needs to writen * * */ strRecord = ""; strRemove = ""; if(document.getElementById(id).checked == true) { strRecord = strRecord + document.getElementById(id).value; arrRecords[recCount] = strRecord; recCount = arrRecords.length; } else { strRemove = document.getElementById(id).value; strRecord = remove(strRecord, strRemove); arrRecords.splice(arrRecords.indexOf(strRemove), 1); recCount = arrRecords.length; } if (arrRecords.length != 0) { document.cookie = "Records="+arrRecords+";expires=;path=/"; } else { eraseCookie("Records"); } document.getElementById('myArticleCount').innerHTML = countRecords(); document.getElementById('myArticleCountTop').innerHTML = countRecords(); } function selectAll(start, end) { var arrCheckbox = new Array(); if(cookieVal("Records") != 0) { var noOfRecords = (end - start) + 1; var k = start; for (var i = 0; i < noOfRecords ; i++) { var checkbox = document.getElementById('checkbox'+ k); checkbox.checked = true; k = k+1; arrCheckbox[i] = checkbox.value; } for(i=0;i## if (exists $ENV{'HTTP_COOKIE'}) { my $cookies = $ENV{'HTTP_COOKIE'}; my @cookies_record = split(';',$ENV{'HTTP_COOKIE'}); foreach (@cookies_record) { my ($k,$v) = split('=',$_); $k =~ s/ //g; if ($k eq 'Records') { $value = $v; } } } @selected_records = split(',', $value); #### [% SET subscription = cgi.param('first') %] [% SET subject = cgi.param('second') %] [% SET content = cgi.param('third') %] [% SET resource = cgi.param('forth') %] [% SET saved_search = cgi.param('saved_search') %] [% cookie = cgi.cookie( name = saved_search, value = resource, expires = '+1m', ); cookies.push(cookie) %] #### my $template = $self->load_tt_template('setup_resource_final'); my $setup_resource_final; my @cookies; my $hash = { 'page_header' => $self->page_header(), 'page_title' => $self->page_title(), 'errors' => $submission_errors, 'content' => $self->content(), 'url' => url(), 'cookies' => \@cookies, 'page_footer' => $self->footer(), }; $$hash{'main_search'} = $self->show_main_search(); $$hash{'site'} = $self->current_site()->nuc_code; $$hash{'cgi'} = $cgi; $template->process('setup_resource_final', $hash, \$setup_resource_final); if(@cookies) { @cookies = ('-cookie', [@cookies]); } $output = header(@cookies, '-CHARSET' => 'UTF-8'); $output .= $self->http_header(); $output .= $setup_resource_final; $output .= $self->http_footer();