Skip to content

Commit 9de062e

Browse files
committed
add sandbox switch compatibility (advance plugin)
1 parent e6614a3 commit 9de062e

3 files changed

Lines changed: 30 additions & 17 deletions

File tree

cfg/cfg.d/z_orcid_support.pl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ =head2 Changes
2323
$c->{plugins}{"Screen::Report::Orcid::CreatorsOrcid"}{params}{disable} = 0;
2424
$c->{plugins}{"Export::Report::CSV::CreatorsOrcid"}{params}{disable} = 0;
2525

26+
#Define the orcid domain (can depend on the orcid support advance plugin)
27+
if( $c->{orcid_support_advance}->{orcid_domain} ) {
28+
$c->{orcid_support}->{orcid_domain} = $c->{orcid_support_advance}->{orcid_domain};
29+
} else {
30+
$c->{orcid_support}->{orcid_domain} = "orcid.org";
31+
}
32+
2633
#---Users---#
2734
#add orcid field to the user profile's
2835
#but checking first to see if the field is already present in the user dataset before adding it
@@ -197,22 +204,23 @@ sub run_people_with_orcids
197204

198205
my $person_span = $session->make_element( "span", "class" => "person" );
199206
$person_span->appendChild( $session->render_name( $creator->{name} ) );
200-
207+
208+
my $orcid_domain = $session->config( 'orcid_support', 'orcid_domain' );
201209
my $orcid = $creator->{orcid};
202-
if( defined $orcid && $orcid =~ m/^(?:orcid.org\/)?(\d{4}\-\d{4}\-\d{4}\-\d{3}(?:\d|X))$/ )
210+
if( defined $orcid && $orcid =~ m/^(?:\Q$orcid_domain\E\/)?(\d{4}\-\d{4}\-\d{4}\-\d{3}(?:\d|X))$/ )
203211
{
204-
my $orcid_link = $session->make_element( "a",
212+
my $orcid_link = $session->make_element( "a",
205213
"class" => "orcid",
206-
"href" => "https://orcid.org/$1",
214+
"href" => "https://" . $orcid_domain . "/" . $1,
207215
"target" => "_blank",
208216
);
209217
$orcid_link->appendChild( $session->make_element( "img", "src" => "/images/orcid_16x16.png" ) );
210218

211219
my $orcid_span = $session->make_element( "span", "class" => "orcid-tooltip" );
212-
220+
213221
$orcid_span->appendChild( $session->make_text( "ORCID: " ) );
214-
$orcid_span->appendChild( $session->make_text( "https://orcid.org/$1" ) );
215-
$orcid_link->appendChild( $orcid_span );
222+
$orcid_span->appendChild( $session->make_text( "https://" . $orcid_domain . "/" . $1 ) );
223+
$orcid_link->appendChild( $orcid_span );
216224

217225
$person_span->appendChild( $session->make_text( " " ) );
218226
$person_span->appendChild( $orcid_link );

cfg/cfg.d/zzz_rioxx2_orcid.pl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
$c->{rioxx2_value_author} = sub {
33
my( $eprint ) = @_;
44

5+
6+
my $session = $eprint->{session};
7+
my $orcid_domain = $session->config( 'orcid_support', 'orcid_domain' );
8+
59
my @authors;
610
for( @{ $eprint->value( "creators" ) } )
711
{
@@ -11,7 +15,7 @@
1115
{
1216
push @authors, {
1317
author => EPrints::Utils::make_name_string( $_->{name} ),
14-
id => "https://orcid.org/$id"
18+
id => "https://" . $orcid_domain . "/" . $id
1519
};
1620
}
1721
else

lib/plugins/EPrints/MetaField/Orcid.pm

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,16 @@ sub get_basic_input_elements
7272

7373
sub render_single_value
7474
{
75-
my( $self, $session, $value ) = @_;
76-
77-
my $url = "https://orcid.org/$value";
78-
79-
my $link = $session->render_link( $url, "_blank" );
80-
$link->appendChild( $session->make_element( "img", src => "/images/orcid_16x16.png", class => "orcid-icon" ) );
81-
$link->appendChild( $session->make_text( "https://orcid.org/$value" ) );
82-
83-
return $link;
75+
my( $self, $session, $value ) = @_;
76+
my $orcid_domain =$session->config( 'orcid_support', 'orcid_domain' );
77+
78+
my $url = "https://" . $orcid_domain . "/" . $value;
79+
80+
my $link = $session->render_link( $url, "_blank" );
81+
$link->appendChild( $session->make_element( "img", src => "/images/orcid_16x16.png", class => "orcid-icon" ) );
82+
$link->appendChild( $session->make_text( "https://" . $orcid_domain . "/" . $value ) );
83+
84+
return $link;
8485
}
8586

8687
sub validate

0 commit comments

Comments
 (0)