package JCRCorrections; # -------------------------------------------------------------------- # The copyright and all other proprietary rights in this Database # (including software - SEE LICENSING AGREEMENT) are the sole and # exclusive property of the Institute for Scientific Information # (ISI). This Database and source code, or any derivative works # thereof, are confidential and proprietary to ISI . Therefore, # duplication, reuse, redistribution, reverse assembling, reverse # compiling, or translation of the Database, source code, or any # portion thereof IS NOT PERMITTED. Consult Licensing Agreement. # -------------------------------------------------------------------- use strict; use Data::Dumper; use ISIBench; use JCR::Journal; use Log::Log4perl qw(get_logger); use base qq(JCRPage); sub build_page { ISIBench::start(); my $logger = get_logger("JCRCorrections"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; #Get session object my $session = $self->{session}; #Get rq parameter my $request = $self->{'request'}; my $rqparam = $request->{'RQ'}; my $anchor_name = $request->{'anchor_name'} || undef; my($corrections_file); $logger->debug("RQ param is : $rqparam"); $logger->debug("Anchor Name param is : $anchor_name"); #Get the year and edition from Session my $edition = $session->get('value' => 'edition'); my $year = $session->get('value' => 'year'); $logger->debug("Edition is : ", sub{Dumper($edition)}); $logger->debug("Year is : ", sub{Dumper($year)}); #Create a journal object my $journal = JCR::Journal->new( 'db' => $self->{'db'}, 'year' => $year->{year}, 'edition' => $edition->{edition}, ); unless (defined($journal) && (ref($journal) =~ /journal/i)) { $logger->error("Could not create journal object (#$journal)!"); ISIBench::stop(); return $journal; } #Check if the request is list of full journal titles or title changes if ($rqparam eq "CORRECTIONS") { $logger->debug("Getting Corrections..."); $corrections_file = "$CF::corrections_directory/corrections.txt"; #get the journal corrections info my $corrections = $journal->get_journal_corrections_page_data( 'corrections_file' => $corrections_file, ); #Build the template $logger->debug("Loading jcr_journal_corrections.html template"); my $ret = $self->set_template( 'template' => "jcr_journal_corrections.html" ); if ($ret) { ISIBench::stop(); return $ret; } # Set the page title $self->set_title( 'title' => 'Journal Citation Reports on the Web Errata' ); #Set template variable for results $self->set( 'name' => 'last_updated', 'value' => $corrections->{last_modified}, ); #Set template variable for results $self->set( 'name' => 'toc_links', 'value' => $corrections->{contents_links}, ); #Set template variable for results $self->set( 'name' => 'results', 'value' => $corrections->{results}, ); } ISIBench::stop(); return 0; } 1;