Skip to content
Permalink
Browse files
Add title phrase and warning if some how SetLang page is loaded and n…
…ot redirected. Allow referrer to also be a local path. Use frontpage not home_page config option as default referrer if not otherwise set.
  • Loading branch information
drn05r authored and root committed Jun 4, 2021
1 parent dff6356 commit 94aa768e930445c3b75c9a98f74cb35e8008939d
Showing with 16 additions and 2 deletions.
  1. +3 −0 lib/lang/en/phrases/system.xml
  2. +13 −2 perl_lib/EPrints/Plugin/Screen/SetLang.pm
@@ -3334,7 +3334,10 @@ PY = 2006 and OG = (Cambridge)<br />

<epp:phrase id="Plugin/Screen/Admin/Config/Edit:could_not_write">Could not write file '<epc:pin name="filename" />'. Error message: <epc:pin name="error_msg" /></epp:phrase>

<!-- Language -->

<epp:phrase id="Plugin/Screen/SetLang:title">Set Language</epp:phrase>
<epp:phrase id="Plugin/Screen/SetLang:no_redirect">If you are viewing this page, something has gone wrong. This page only exists as a means for setting the language in which you want to view this repository and then redirecting you back to your original page.</epp:phrase>

<epp:phrase id="languages_typename_" ref="lib/metafield:unspecified" />

@@ -47,12 +47,12 @@ sub from
{
my $referrer_uri = URI->new($referrer);
my $repository_uri = URI->new($session->config('base_url'));
if ($referrer_uri->host ne $repository_uri->host)
if ($referrer_uri->can( "host" ) && $referrer_uri->host ne $repository_uri->host)
{
$referrer = undef;
}
}
$referrer = $session->config( "home_page" ) unless( EPrints::Utils::is_set( $referrer ) );
$referrer = $session->config( "frontpage" ) unless( EPrints::Utils::is_set( $referrer ) );

$self->{processor}->{redirect} = $referrer;
}
@@ -129,6 +129,17 @@ sub render_action_link
return $div;
}

sub render
{
my( $self ) = @_;

my $chunk = $self->{session}->make_doc_fragment;
$chunk->appendChild( $self->html_phrase( "no_redirect" ) );

return $chunk;
}


1;

=head1 COPYRIGHT

0 comments on commit 94aa768

Please sign in to comment.