package JCRRecord; # -------------------------------------------------------------------- # 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: JCRRecord.pm,v 1.73 2008/10/22 17:33:27 ssidanal Exp $ use strict; use JCR::Category; use JCR::Country; use Data::Dumper; use ISIBench; use JCRErrorList; use JCR::Journal; use JCR::Publisher; use Links; use JCR::MarkedList; use Log::Log4perl qw(get_logger); use URL; use LWP::Simple; use base qq(JCRPage); sub build_page { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; #Get input parameters my $request = $self->{'request'}; my $rqparam = $request->{'RQ'}; my $j20 = $request->{'journal'}; my $category_name = $request->{'category'}; my $journal_rank = $request->{'rank'}; my $category_rank = $request->{'rank'}; my $markparam = $request->{'mark'}; my $issn = $request->{'issn'}; my $return_link = $request->{'ReturnLink'}; my $img_logo = $request->{'ImgLogo'}; my $src_desc = $request->{'SrcDesc'}; my $request_from = $request->{'req_from'}; $logger->debug("Args is : ", sub{Dumper($request)}); my($edition, $year, $journal, $permissions, $journal_hash, $toolbar); my($details, $journal_enc, $check_mark, $languages, $pubinfo, $categories); my($j_cited, $j_citing, $links_results, $corrections, $show_corrections_link); my($ccc_url, $ccc_subscriber, $show_changes_link, $cat, $category_enc); my($cathash, $show_related_journals, $related_journals); my($journal_self_cites); #Get the year and edition from Session my $session = $self->{session}; $edition = $session->get('value' => 'edition'); $year = $session->get('value' => 'year'); if ( $issn && !defined($j20) ) { $session->set( 'name' => 'source_app_URI', 'value' => $return_link, ); $session->set( 'name' => 'source_image_URI', 'value' => $img_logo, ); $session->set( 'name' => 'source_image_alttext', 'value' => $src_desc, ); my($edition_name,$journal_hash); # If linking in, we may need to determine the year and edition to use since it may be a new session # Note that we need to do this reguardless if an edition is already selected because # if the user has the science edition chosen, but links in from and app with an ISSN # for a social edition, we need to search both editions or it will fail when it does # not find the journal in the science edition. # FIXME: Make OO in 4.0 $permissions = $session->get_editions( 'year_min' => $CF::data_year_start, 'year_max' => $CF::data_year_end, ); foreach my $edition_name (keys %$permissions) { $year->{year} = $permissions->{$edition_name}->{end_year}; $edition->{edition} = $edition_name; $journal = JCR::Journal->new( 'db' => $self->{db}, 'edition' => $edition_name, 'year' => $year->{year}, ); if (defined($journal) && (ref($journal) =~ /journal/i)) { $journal_hash = $journal->get_journal_j20( 'issn' => $issn ); last if (defined($journal_hash) && (ref($journal_hash) =~ /hash/i)); } } unless (defined($journal_hash) && (ref($journal_hash) =~ /hash/i)) { ISIBench::stop(); return $journal_hash; } $j20 = $journal_hash->{journal}; $session->set( 'name' => 'year', 'value' => $year->{'year'}, ); $session->set( 'name' => 'edition', 'value' => $edition->{'edition'}, ); } if ( defined($j20) ) { # We may or may not have a journal object, so if not create one unless (defined($journal) && (ref($journal) =~ /journal/i)) { $journal = JCR::Journal->new( 'db' => $self->{db}, 'edition' => $edition->{edition}, 'year' => $year->{year}, ); unless (defined($journal) && (ref($journal) =~ /journal/i)) { $logger->error("Could not create journal object (#$journal)!"); ISIBench::stop(); return $journal; } } } elsif ( defined($category_name) ) { $cat = JCR::Category->new( 'db' => $self->{db}, 'edition' => $edition->{edition}, 'year' => $year->{year}, ); unless (defined($cat) && (ref($cat) =~ /category/i)) { $logger->error("Could not create category object (#$cat)!"); ISIBench::stop(); return $cat; } } if ( defined($j20) ) { # Create links object my $links = Links->new ( 'links_db' => $CF::links_db_location, 'links_lib' => $CF::links_lib, 'product' => $CF::product_code, ); unless (defined($links) && (ref($links) =~ /links/i)) { $logger->error("Could not create links object (#$links)!"); ISIBench::stop(); return $links; } # Create publisher object my $publisher = JCR::Publisher->new( 'db' => $self->{'db'}, 'year' => $year->{'year'}, 'edition' => $edition->{'edition'}, ); unless (defined($publisher) && (ref($publisher) =~ /publisher/i)) { $logger->error("Could not create publisher object (#$publisher)!"); ISIBench::stop(); return $publisher; } # Create markedlist object $check_mark = 0; my $marked_list = JCR::MarkedList->new( 'session' => $session, 'max_marked' => $CF::marked_list_max, 'db' => $self->{db}, 'edition' => $edition->{edition}, 'year' => $year->{year}, ); if (defined($marked_list) && (ref($marked_list) =~ /markedlist/i)) { # First get the current marked list count # Are we marking or unmarking this record? if ($rqparam eq "RECORD_MARK") { # Call mark_record to mark, uncomment this later if ($markparam eq "on") { my $count = $marked_list->get_marked_list_count(); if ($count->{count} < $CF::marked_list_max) { $marked_list->mark_records( 'j20' => $j20 ); } else { my $errorlist = JCRErrorList->new(); my $error = $errorlist->map( 'error' => '3106' ); $self->{ERROR} = $error->{error}; } } else { $marked_list->unmark_records( 'j20' => $j20 ); } } # Is the current journal marked? my $j20list = $marked_list->get_marked_list(); #Check each j20 in marked list if it matches current j20 foreach my $marked_j20 (@$j20list) { if ($marked_j20 eq $j20) { $check_mark = 1; last; } } } # Get journal detail data $details = $journal->get_journal_data( 'j20' => $j20, 'mode' => 'detail', ); #$logger->debug("Details : ", sub{Dumper($details)}); # Get journal cited data $j_cited = $journal->get_journal_cites( 'j20' => $j20, 'mode' => 'cited' ); $logger->debug("Journal Cited Data : ", sub{Dumper($j_cited)}); # Get journal citing data $j_citing = $journal->get_journal_cites( 'j20' => $j20, 'mode' => 'citing' ); $logger->debug("Journal Citing Data : ", sub{Dumper($j_citing)}); # Get journal languages $languages = $journal->get_journal_languages('j20' => $j20); $logger->debug("Languages : ", sub{Dumper($languages)}); # Get publisher info $pubinfo = $publisher->get_publisher_info('publisher' => $details->{'publisher'}); $logger->debug("Pub Info : ", sub{Dumper($pubinfo)}); # Get categories $categories= $journal->get_journal_categories('j20' => $j20); $logger->debug("Categories : ", sub{Dumper($categories)}); # Get Publishers my $publishers = $session->getPublisherLinks(); # Get Opac Sites my $opac_sites = $session->getOpacSites(); # Get OpenURL Sites my $openurl_sites = $session->getOpenURLsites(); my $images_path = $CF::image_path; my $default_image = $images_path . "/holdings.gif"; #Build links #publishers could be more then one, links_results will be a reference to an #array of hashes, for each link there will be a hash. $links_results = $links->retrieve( 'publishers' => $publishers, 'opac' => $opac_sites, 'default_opac_image' => $default_image, 'openurl' => $openurl_sites, 'default_openurl_image' => $default_image, 'issn' => $details->{'issn'}, 'j20' => $j20, ); $logger->debug("Links results: ", sub{Dumper($links_results)}); # Determine if we should open a new window for each link. foreach my $publisher (@$links_results) { if ($publisher->{url} =~ /.*linkout.cgi\?.*type=window.*dest=(.*)$/io) { $publisher->{url} = URL::decode($1); $publisher->{target} = 'publishers'; } else { $publisher->{target} = '_self'; } } $logger->debug("HACKED Links results: ", sub{Dumper($links_results)}); $logger->debug("Publishers : ", Dumper($publishers)); $journal_enc = URL::encode($j20); $ccc_subscriber = 0; if ( $publishers =~ /CCCTOC/i ) { my $journal_title_enc = URL::encode($details->{title}); $ccc_subscriber = 1; # Get CCCToC link info # Get Portal SID my $psid = $session->getPortalSID(); # Get CCC SID my $ccc_sid = $self->_get_ccc_sid( portal_url => $CF::portal_cgi, PSID => $psid, ); # Get CCC URL $ccc_url = $self->_get_ccc_url( portal_url => $CF::portal_cgi, PSID => $psid, ); #### WOK 3 URL Query String: "&ServiceName=TransferToWos&PointOfEntry=TOC&ServiceUser=Portal&JN=[JOURNAL]&ReturnLink=[Return_Link]&ImgLogo=[ImgLogo]&SrcDesc=[ImgAltText]"; #### For WOK 4: One minor modification in Query String: Replace ReturnLink with CCC_ReturnLink. #### Modification made to code below. Modification - 12/20/07 Dan Eisenstein #### Build CCCToC link URL $ccc_url = $ccc_url . "&ServiceName=TransferToWos&PointOfEntry=TOC&ServiceUser=Portal&JN=[JOURNAL]&CCC_ReturnLink=[Return_Link]&ImgLogo=[ImgLogo]&SrcDesc=[ImgAltText]"; my $replace_string = '\[JOURNAL\]'; $ccc_url =~ s/$replace_string/$journal_title_enc/g; $replace_string = '\[CCC_SID\]'; $ccc_url =~ s/$replace_string/$ccc_sid/g; $replace_string = '\[Return_Link\]'; my $jcr_return_url = URL::encode("$CF::app_path?PointOfEntry=LastPage"); $ccc_url =~ s/$replace_string/$jcr_return_url/g; $replace_string = '\[ImgLogo\]'; my $ret2_jcr_img = $images_path . "/tbr2jcr_ccc.gif"; $ret2_jcr_img = URL::encode($ret2_jcr_img); $ccc_url =~ s/$replace_string/$ret2_jcr_img/g; $replace_string = '\[ImgAltText\]'; $ccc_url =~ s/$replace_string/Return+To+JCRWeb/g; } # Journal Corrections for this journal? my $corrections_file = "$CF::corrections_directory/corrections.txt"; $show_corrections_link = 0; $corrections = $journal->get_journal_corrections('j20' => $j20, 'corrections_file' => $corrections_file, ); $logger->debug("\n\nCORRECTIONS HASH: ", sub{Dumper($corrections)}); if (defined $corrections && (ref($corrections) =~ /hash/i)) { if ($corrections->{count} > 0) { $show_corrections_link = 1; } } # Journal Title Changes for this journal? $show_changes_link = 0; my $changes = $journal->get_journal_title_changes('j20' => $j20); $logger->debug("\n\nCHANGES HASH: ", sub{Dumper($changes)}); if (defined $changes && (ref($changes) =~ /hash/i)) { if ($changes->{count} > 0) { $show_changes_link = 1; } } # Related journals to this subject category? $show_related_journals = $journal->show_related_journals( 'j20' => $j20 ); $logger->debug("\n\nShow Related Journals: ", sub{Dumper($show_related_journals)}); } elsif ( defined($category_name) ) { # Get category detail data $cathash = $cat->get_category_by_name( 'name' => $category_name, 'order_by' => 'name', ); $logger->debug("Cat Hash : ", sub{Dumper($cathash)}); # Related journals to this subject category? $show_related_journals = $cat->show_related_journals( 'subject' => $cathash ); $logger->debug("\n\nShow Related Journals: ", sub{Dumper($show_related_journals)}); } if ( defined($j20) ) { # Add the toolbar $toolbar = $self->build_toolbar( 'help' => '2.8' ); #Add the return to summary button $toolbar->add( 'button' => 'TB_RET2SUMMARY_JOURNAL' ); } elsif ( defined($category_name) ) { # Add the toolbar $toolbar = $self->build_toolbar( 'help' => '2.14' ); #Add the return to summary button $toolbar->add( 'button' => 'TB_RET2SUMMARY_CATEGORY' ); } if ( defined($j20) ) { #If journal rank is not there this request is not coming from summary list page #therefore don't display prev and next buttons if ($journal_rank ne "") { # Grab our original query from the database my $query = $self->_get_query(); my ($next_prev_recs, $prev_j20, $next_j20); if ($query->{type} =~ /search_(.*)/i) { $next_prev_recs = $journal->search_j20s( 'search' => $1, 'query' => $query->{data}, 'order_by' => $query->{sort}, 'limit' => 3, 'start' => ($journal_rank-2), 'prev_next'=> 1, ); } else { $next_prev_recs = $journal->get_journals_by_selection( 'data' => $query->{data}, 'mode' => $query->{type}, 'order_by' => $query->{sort}, 'limit' => 3, 'start' => ($journal_rank-2), 'prev_next'=> 1, ); } $logger->debug("PrevNext is : ", sub{Dumper($next_prev_recs)}); if (defined($next_prev_recs) && (ref($next_prev_recs) =~ /array/i)) { $prev_j20 = $next_prev_recs->[0]; $next_j20 = $next_prev_recs->[1]; $logger->debug("Prev is : ", sub{Dumper($prev_j20)}); $logger->debug("Next is : ", sub{Dumper($next_j20)}); } #add next/prev toolbar toolbar buttons if(defined($prev_j20)) { my $prev_rank = $journal_rank-1 ; $prev_j20 = URL::encode($prev_j20); $toolbar->add( 'button' => 'TB_PREVJOURNAL', 'URI' => "$CF::base_path/JCR?RQ=RECORD&journal=$prev_j20&rank=$prev_rank" ); } if(defined($next_j20)) { my $next_rank = $journal_rank+1 ; $next_j20 = URL::encode($next_j20); $toolbar->add( 'button' => 'TB_NEXTJOURNAL', 'URI' => "$CF::base_path/JCR?RQ=RECORD&journal=$next_j20&rank=$next_rank" ); } } my $source_app = $session->get('value' => 'source_app_URI'); my $supress_button = $session->get('value' => 'supress_return_to_summary'); if ( defined($source_app->{source_app_URI}) && $supress_button->{supress_return_to_summary} == 1 ) { $toolbar->remove( 'button' => 'TB_RET2SUMMARY_JOURNAL', ); } unless (defined($toolbar) && (ref($toolbar) =~ /toolbar/i)) { ISIBench::stop(); return $toolbar; } # Build the JCRRecord page template $logger->debug("Loading jcr_record_journal.html template"); my $ret = $self->set_template( 'template' => "jcr_record_journal.html" ); if ($ret) { ISIBench::stop(); return $ret; } # Set the page title $self->set_title( 'title' => 'Journal Information' ); $logger->debug("Self Cites on Full Journal record before:: $j20"); # Self Cites on Full Journal record. $journal_self_cites = $journal->get_journal_self_cites( 'j20' => $j20, ); unless (defined($journal_self_cites) && (ref($journal_self_cites) =~ /hash/i)) { $logger->debug(" Could not retrieve Categories Stats In JCR Boxplot : $journal_self_cites"); ISIBench::stop(); return 0; } $logger->debug("Self Cites on Full Journal record.: ", sub{Dumper($journal_self_cites)}); $self->set( 'name' => 'journal_self_cites', 'value' => $journal_self_cites, ); } elsif ( defined($category_name) ) { #If category rank is not there this request is not coming from summary list page #therefore don't display prev and next buttons # Grab our original query from the database my $query = $self->_get_query(); if ($category_rank ne "") { my ($next_prev_recs, $prev_cat, $next_cat); $next_prev_recs = $cat->get_categories_by_selection( 'data' => $query->{data}, 'mode' => $query->{type}, 'order_by' => $query->{sort}, 'limit' => 3, 'start' => ($journal_rank-2), 'prev_next'=> 1, ); $logger->debug("PrevNext is : ", sub{Dumper($next_prev_recs)}); if (defined($next_prev_recs) && (ref($next_prev_recs) =~ /array/i)) { $prev_cat = $next_prev_recs->[0]; $next_cat = $next_prev_recs->[1]; $logger->debug("Prev is : ", sub{Dumper($prev_cat)}); $logger->debug("Next is : ", sub{Dumper($next_cat)}); } #add next/prev toolbar toolbar buttons if(defined($prev_cat)) { my $prev_rank = $category_rank-1 ; $prev_cat = URL::encode($prev_cat); $toolbar->add( 'button' => 'TB_PREVCATEGORY', 'URI' => "$CF::base_path/JCR?RQ=RECORD&category=$prev_cat&rank=$prev_rank" ); } if(defined($next_cat)) { my $next_rank = $category_rank+1 ; $next_cat = URL::encode($next_cat); $toolbar->add( 'button' => 'TB_NEXTCATEGORY', 'URI' => "$CF::base_path/JCR?RQ=RECORD&category=$next_cat&rank=$next_rank" ); } } elsif ( $query->{type} =~ /ALL/i || $query->{type} =~ /search_/i || $query->{type} =~ /publisher/i || $query->{type} =~ /country/i ) { $toolbar->remove( 'button' => 'TB_RET2SUMMARY_CATEGORY', ); } # Get category detail data $details = $cat->get_category_data( 'subject' => $cathash, 'mode' => 'detail', ); $logger->debug("Details : ", sub{Dumper($details)}); # Get category cited data $j_cited = $cat->get_category_cites( 'subject' => $cathash, 'mode' => 'cited' ); $logger->debug("Category Cited Data : ", sub{Dumper($j_cited)}); # Get category citing data $j_citing = $cat->get_category_cites( 'subject' => $cathash, 'mode' => 'citing' ); $logger->debug("Category Citing Data : ", sub{Dumper($j_citing)}); $category_enc = URL::encode($category_name); # Build the JCRRecord page template $logger->debug("Loading jcr_record_category.html template"); my $ret = $self->set_template( 'template' => "jcr_record_category.html" ); if ($ret) { ISIBench::stop(); return $ret; } # Set the page title $self->set_title( 'title' => 'Category Information' ); } # Doctor up some values $details->{'cites_all'} = ' ' if ($details->{'cites_all'} eq ''); $details->{'source_current'} = ' ' if $details->{'source_current'} eq ''; $details->{'issn'} = ' ' if $details->{'issn'} eq ''; if ($details->{'cited_hlife'} eq '') { #$details->{'cited_hlife'} = ' '; $details->{'cited_hlife_link'} = ' '; } else { my $temp_cited_hlife = ($details->{'cited_hlife'} > 10.0) ? '>10.0' : $details->{'cited_hlife'}; $details->{'cited_hlife_link'} = qq|$temp_cited_hlife|; } if ($details->{'citing_hlife'} eq '') { #$details->{'citing_hlife'} = ' '; $details->{'citing_hlife_link'} = ' '; } else { my $temp_citing_hlife = ($details->{'citing_hlife'} > 10.0) ? '>10.0' : $details->{'citing_hlife'}; $details->{'citing_hlife_link'} = qq|$temp_citing_hlife|; } if (($details->{'impact_current'} > 99) || ($details->{'impact_current'} eq '')) { $details->{'impact_current'} = ' '; $details->{'impact_current_link'} = ' '; } else { $details->{'impact_current_link'} = qq|$details->{'impact_current'}|; } if (($details->{'immediacy'} > 99) || ($details->{'immediacy'} eq '')) { $details->{'immediacy'} = ' '; $details->{'immediacy_link'} = ' '; } else { $details->{'immediacy_link'} = qq|$details->{'immediacy'}|; } $details->{'cites_1_2'} = '0' if ($details->{'cites_1_2'} eq ''); if ($details->{'impact_5year'} eq '') { $details->{'impact_5year_link'} = ' '; } else { $details->{'impact_5year_link'} = qq|$details->{'impact_5year'}|; } $self->set( 'name' => 'error', 'value' => $self->{ERROR}, ); $self->set( 'name' => 'j20', 'value' => $j20, ); $self->set( 'name' => 'journal_enc', 'value' => $journal_enc, ); $self->set( 'name' => 'category_enc', 'value' => $category_enc, ); $self->set( 'name' => 'rank', 'value' => $journal_rank, ); $self->set( 'name' => 'mark', 'value' => $check_mark, ); $self->set( 'name' => 'details', 'value' => $details, ); $self->set( 'name' => 'languages', 'value' => $languages, ); $self->set( 'name' => 'pubinfo', 'value' => $pubinfo, ); $self->set( 'name' => 'categories', 'value' => $categories, ); $self->set( 'name' => 'SID', 'value' => $session->{SID}, ); $self->set( 'name' => 'j_cited', 'value' => $j_cited, ); $self->set( 'name' => 'j_citing', 'value' => $j_citing, ); $self->set( 'name' => 'links_results', 'value' => $links_results, ); $self->set( 'name' => 'anchor_name', 'value' => $corrections->{anchor_name}, ); $self->set( 'name' => 'show_changes_link', 'value' => $show_changes_link, ); $self->set( 'name' => 'show_corrections_link', 'value' => $show_corrections_link, ); $self->set( 'name' => 'show_related_journals', 'value' => $show_related_journals, ); $self->set( 'name' => 'ccc_url', 'value' => $ccc_url, ); $self->set( 'name' => 'ccc_subscriber', 'value' => $ccc_subscriber, ); $self->set( 'name' => 'show_impact', 'value' => ($year->{year} >= $CF::data_impact_start) ? 1 : 0, ); #Added For Eigen Fator, Article Influence and Five Year Impact factor. $self->set( 'name' => 'show_eigen_five_yr_impact', 'value' => ($year->{year} >= $CF::data_eigen_impact_start) ? 1 : 0, ); # Added for Boxplots $self->set( 'name' => 'show_boxplot', 'value' => (($details->{'impact_current'} >0) && ($details->{'impact_current'} < 99) && ($details->{'impact_current'} ne '')) ? 1 : 0, ); $self->set( 'name' => 'show_subject_category_link', 'value' => ($year->{year} >= $CF::data_subject_category_start) ? 1 : 0, ); # Set the Citing/Cited Journal Graph image width & height $self->set( 'name' => 'cite_image_width', 'value' => $CF::TDCiteGraphWidth, ); $self->set( 'name' => 'cite_image_height', 'value' => $CF::TDCiteGraphHeight, ); # Set the Journal Publication Frequency Graph image width & height $self->set( 'name' => 'freq_image_width', 'value' => $CF::JFGraphWidth, ); $self->set( 'name' => 'freq_image_height', 'value' => $CF::JFGraphHeight, ); if ( $request_from ne 'TRENDS' ) { # Log the Full Record View event $session->log_event( 'event' => 'event_record_view', 'data' => { 'count' => 1, }, ); # error checking my $error_string = $session->getError(); if ( length($error_string) > 1 ) { $logger->error("WURS Event not logged: $error_string"); } } ISIBench::stop(); return 0; } sub _get_query { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; my $session = $self->{session}; my $request = $self->{request}; my ($data, $type); # Get the query type from the session $type = $session->get( 'value' => 'summary_data_type' ); $type = $type->{summary_data_type}; # We are loading a query from the session $data = $session->get( 'value' => 'summary_data' ); $data = $data->{summary_data}; if ($type =~ /(?:category|publisher|country)/i) { $data = [split(', ', $data)]; } # get the sort order my $sort = $session->get( 'value' => 'summary_sort' ); $sort = $sort->{summary_sort} || 'title'; ISIBench::stop(); return { 'type' => $type, 'data' => $data, 'sort' => $sort }; } sub _get_category { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; my $session = $self->{session}; my $request = $self->{request}; my $edition = $session->get( 'value' => 'edition' ); my $year = $session->get( 'value' => 'year' ); my $cat = JCR::Category->new( 'db' => $self->{db}, 'edition' => $edition->{edition}, 'year' => $year->{year}, ); unless (defined($cat) && (ref($cat) =~ /category/i)) { $logger->error("Could not create category object (#$cat)!"); ISIBench::stop(); return $cat; } # Get the category hash my $cathash = {}; if (length($args->{data}[0])>0) { $cathash = $cat->get_category_by_subject( 'subject' => $args->{data}, 'order_by' => 'name', ); } else { $cathash = $cat->get_category_hash(); } $logger->debug("cathash is $cathash : ", sub{Dumper($cathash);}); ISIBench::stop(); return $cathash; } sub _get_publisher { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; my $session = $self->{session}; my $request = $self->{request}; my $edition = $session->get( 'value' => 'edition' ); my $year = $session->get( 'value' => 'year' ); # Get the publisher list from the database my $pub = JCR::Publisher->new( 'db' => $self->{db}, 'edition' => $edition->{edition}, 'year' => $year->{year}, ); unless (defined($pub) && (ref($pub) =~ /publisher/i)) { $logger->error("Could not create publisher object (#$pub)!"); ISIBench::stop(); return $pub; } # Get the publisher hash my $pubhash; if (length($args->{data}[0])>0) { $pubhash = $pub->get_publishers( 'publishers' => $args->{data} ); } else { $pubhash = $pub->get_publishers(); } $logger->debug("pubhash is $pubhash : ", sub{Dumper($pubhash);}); ISIBench::stop(); return $pubhash; } sub _get_country { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; my $data = $args->{data}; my $session = $self->{session}; my $request = $self->{request}; my %conhash; tie %conhash, "Tie::IxHash"; unless (length($args->{data}[0])>0) { my $edition = $session->get( 'value' => 'edition' ); my $year = $session->get( 'value' => 'year' ); # Get the country list from the database my $con = JCR::Country->new( 'db' => $self->{db}, 'edition' => $edition->{edition}, 'year' => $year->{year}, ); unless (defined($con) && (ref($con) =~ /country/i)) { $logger->error("Could not create country object (#$con)!"); ISIBench::stop(); return $con; } # Get the country array $data = $con->get_countries(); } else { # Sort the selection $data = [sort(@$data)]; } foreach my $value (@$data) { $conhash{$value} = $value; } $logger->debug("conhash is %conhash : ", sub{Dumper(\%conhash);}); ISIBench::stop(); return \%conhash; } sub _get_ccc_sid { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; my $pstring = qq{$args->{portal_url}?SID=$args->{PSID}&Func=GetURL&DestApp=CCC}; my $cccURL = get "$pstring"; $logger->debug("pstring is: $pstring"); $logger->debug("cccURL is: $cccURL"); $logger->error("No cccURL received from portal! \n$pstring\n") unless $cccURL; $cccURL =~ /SID\=(.*)/; ISIBench::stop(); return $1; } sub _get_ccc_url { ISIBench::start(); my $logger = get_logger("JCRRecord"); my $self = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; my $pstring = qq{$args->{portal_url}?SID=$args->{PSID}&Func=GetURL&DestApp=CCC}; my $cccURL = get "$pstring"; $logger->debug("pstring is: $pstring"); $logger->debug("cccURL is: $cccURL"); $logger->error("No cccURL received from portal! \n$pstring\n") unless $cccURL; ISIBench::stop(); return $cccURL; } 1;