diff --git a/cfg/cfg.d/z_orcid_support.pl b/cfg/cfg.d/z_orcid_support.pl index 619986b..25236f7 100644 --- a/cfg/cfg.d/z_orcid_support.pl +++ b/cfg/cfg.d/z_orcid_support.pl @@ -23,6 +23,9 @@ =head2 Changes $c->{plugins}{"Screen::Report::Orcid::CreatorsOrcid"}{params}{disable} = 0; $c->{plugins}{"Export::Report::CSV::CreatorsOrcid"}{params}{disable} = 0; +#Define the orcid domain (can be overwritten by the orcid support advance plugin) +$c->{orcid_support}->{orcid_domain} = "orcid.org"; + #---Users---# #add orcid field to the user profile's #but checking first to see if the field is already present in the user dataset before adding it @@ -198,12 +201,13 @@ sub run_people_with_orcids my $person_span = $session->make_element( "span", "class" => "person" ); $person_span->appendChild( $session->render_name( $creator->{name} ) ); + my $orcid_domain = $session->config( 'orcid_support', 'orcid_domain' ); my $orcid = $creator->{orcid}; - if( defined $orcid && $orcid =~ m/^(?:orcid.org\/)?(\d{4}\-\d{4}\-\d{4}\-\d{3}(?:\d|X))$/ ) + if( defined $orcid && $orcid =~ m/^(?:\Q$orcid_domain\E\/)?(\d{4}\-\d{4}\-\d{4}\-\d{3}(?:\d|X))$/ ) { my $orcid_link = $session->make_element( "a", "class" => "orcid", - "href" => "https://orcid.org/$1", + "href" => "https://" . $orcid_domain . "/" . $1, "target" => "_blank", ); $orcid_link->appendChild( $session->make_element( "img", "src" => "/images/orcid_16x16.png" ) ); @@ -211,8 +215,8 @@ sub run_people_with_orcids my $orcid_span = $session->make_element( "span", "class" => "orcid-tooltip" ); $orcid_span->appendChild( $session->make_text( "ORCID: " ) ); - $orcid_span->appendChild( $session->make_text( "https://orcid.org/$1" ) ); - $orcid_link->appendChild( $orcid_span ); + $orcid_span->appendChild( $session->make_text( "https://" . $orcid_domain . "/" . $1 ) ); + $orcid_link->appendChild( $orcid_span ); $person_span->appendChild( $session->make_text( " " ) ); $person_span->appendChild( $orcid_link ); diff --git a/cfg/cfg.d/zzz_rioxx2_orcid.pl b/cfg/cfg.d/zzz_rioxx2_orcid.pl index 9a19d02..7b0b718 100644 --- a/cfg/cfg.d/zzz_rioxx2_orcid.pl +++ b/cfg/cfg.d/zzz_rioxx2_orcid.pl @@ -2,6 +2,10 @@ $c->{rioxx2_value_author} = sub { my( $eprint ) = @_; + + my $session = $eprint->{session}; + my $orcid_domain = $session->config( 'orcid_support', 'orcid_domain' ); + my @authors; for( @{ $eprint->value( "creators" ) } ) { @@ -11,7 +15,7 @@ { push @authors, { author => EPrints::Utils::make_name_string( $_->{name} ), - id => "https://orcid.org/$id" + id => "https://" . $orcid_domain . "/" . $id }; } else diff --git a/lib/plugins/EPrints/MetaField/Orcid.pm b/lib/plugins/EPrints/MetaField/Orcid.pm index c818db3..a85f6c5 100644 --- a/lib/plugins/EPrints/MetaField/Orcid.pm +++ b/lib/plugins/EPrints/MetaField/Orcid.pm @@ -72,15 +72,16 @@ sub get_basic_input_elements sub render_single_value { - my( $self, $session, $value ) = @_; - - my $url = "https://orcid.org/$value"; - - my $link = $session->render_link( $url, "_blank" ); - $link->appendChild( $session->make_element( "img", src => "/images/orcid_16x16.png", class => "orcid-icon" ) ); - $link->appendChild( $session->make_text( "https://orcid.org/$value" ) ); - - return $link; + my( $self, $session, $value ) = @_; + my $orcid_domain =$session->config( 'orcid_support', 'orcid_domain' ); + + my $url = "https://" . $orcid_domain . "/" . $value; + + my $link = $session->render_link( $url, "_blank" ); + $link->appendChild( $session->make_element( "img", src => "/images/orcid_16x16.png", class => "orcid-icon" ) ); + $link->appendChild( $session->make_text( "https://" . $orcid_domain . "/" . $value ) ); + + return $link; } sub validate