Skip to content

Commit

Permalink
Add sandbox switch compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dennmuel committed May 20, 2019
1 parent e6614a3 commit e65fa4d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
12 changes: 8 additions & 4 deletions cfg/cfg.d/z_orcid_support.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -198,21 +201,22 @@ 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" ) );

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 );
Expand Down
6 changes: 5 additions & 1 deletion cfg/cfg.d/zzz_rioxx2_orcid.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) } )
{
Expand All @@ -11,7 +15,7 @@
{
push @authors, {
author => EPrints::Utils::make_name_string( $_->{name} ),
id => "https://orcid.org/$id"
id => "https://" . $orcid_domain . "/" . $id
};
}
else
Expand Down
19 changes: 10 additions & 9 deletions lib/plugins/EPrints/MetaField/Orcid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e65fa4d

Please sign in to comment.