package JCRTitles; # -------------------------------------------------------------------- # 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. # -------------------------------------------------------------------- # $Id: JCRTitles.pm,v 1.9 2006/08/01 15:09:49 pfoley Exp $ 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("JCRTitles"); 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 $j20 = $request->{'journal'} || undef; $logger->debug("RQ param is : $rqparam"); $logger->debug("journal param is : $j20"); #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 "TITLES_FULL") { $logger->debug("Getting Full Journal Titles..."); #get the titles array reference from Journal module which is the list of titles my $titles = $journal->get_journal_titles_full(); #Build the template $logger->debug("Loading jcr_full_journal_titles.html template"); my $ret = $self->set_template( 'template' => "jcr_full_journal_titles.html" ); if ($ret) { ISIBench::stop(); return $ret; } # Set the page title $self->set_title( 'title' => 'Full Journal Titles' ); #Set template variable for results $self->set( 'name' => 'titles', 'value' => $titles, ); } elsif($rqparam eq "TITLE_CHANGES") { $logger->debug("Getting Journal Title Changes..."); #get the hash of arrays for the title changes table my $results; if (defined $j20) { $results = $journal->get_journal_title_changes('j20' => $j20); } else { $results = $journal->get_journal_title_changes(); } $logger->debug("Count:", sub {Dumper($results->{'count'})}); #Build the template $logger->debug("Loading jcr_title_changes.html template"); my $ret = $self->set_template( 'template' => "jcr_title_changes.html" ); if ($ret) { ISIBench::stop(); return $ret; } # Set the page title $self->set_title( 'title' => 'Title Changes' ); #Set template variables $self->set( 'name' => 'results', 'value' => $results->{'results'}, ); $self->set( 'name' => 'count', 'value' => $results->{'count'}, ); } ISIBench::stop(); return 0; } 1;