EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #05683


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] redirecting to external URLs


Hi Alan,

 

Do you want the user to click on a link ? Or force the page to redirect to the new location automatically??

 

If it’s the former, you could do it in a similar way that the DOI’s get processed…

 

e.g. in the eprint_fields.pl

{

        name => 'id_number',

        type => 'text',

        render_value => 'EPrints::Extras::render_possible_doi',

},

 

Then in perl_lib/EPrints/extras.pm

 

 

sub render_possible_doi

{

        my( $session, $field, $value ) = @_;

 

        $value = "" unless defined $value;

 

        if( $value !~ /^(doi:)?10\.\d\d\d\d\// ) { return $session->make_text( $value ); }

       

        $value =~ s/^doi://;

 

        my $url = "">

        my $link = $session->render_link( $url );

        $link->appendChild( $session->make_text( $value ) );

        return $link;

}

 

This will take the value entered into the id_number field, and render it as a link on the screen, prefixing it with the appropriate http url leader etc…

 

 

Cheers

 

Matt

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Alan.Stiles
Sent: Tuesday, 10 May 2016 11:57 PM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] redirecting to external URLs

 

So anyone know how I should be redirecting the user to an alternative URL based on some processing in a Screen action?

 

As it is, I’m setting the url in the action by

 

$self->{processor}->{redirect_to_url} = “http://example.org”;

 

and then checking for it in

 

sub redirect_to_me_url {

                …

                return $self->{processor}->{redirect_to_url};

}  

 

It seems a little too hacky!

Cheers,

 

 

Alan Stiles

Digital Repository Developer

Library Services, The Open University

oro.open.ac.uk

 

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority.

_____________________________________________________________
This email (including any attached files) is confidential and is for the intended recipient(s) only. If you received this email by mistake, please, as a courtesy, tell the sender, then delete this email.

The views and opinions are the originator's and do not necessarily reflect those of the University of Southern Queensland. Although all reasonable precautions were taken to ensure that this email contained no viruses at the time it was sent we accept no liability for any losses arising from its receipt.

The University of Southern Queensland is a registered provider of education with the Australian Government.
(CRICOS Institution Code QLD 00244B / NSW 02225M, TEQSA PRV12081 )