EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #05685
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] [solved] redirecting to external URLs
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] [solved] redirecting to external URLs
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- Date: Wed, 11 May 2016 09:00:26 +0000
Okay, so I think I’ve resolved it and I wasn’t too far off originally… Rather than messing with the redirect_to_me_url () function, the answer (from examining
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/ScreenProcessor.pm#L313) appears to be to just set the desired destination as redirect in the screen processor hash. e.g. $self->{processor}->{redirect} = “http://wiki.eprints.org”; Alan From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Alan.Stiles Thanks Matt, but it’s the latter I’m after – sending the user automatically to a new location with parameters based upon the values submitted in a form. Alan From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Matthew Brady 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 = "" href="http://dx.doi.org/$value">http://dx.doi.org/$value"; 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 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 -- 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 )
|
- Prev by Date: Re: [EP-tech] redirecting to external URLs
- Next by Date: Re: [EP-tech] redirecting to external URLs
- Previous by thread: [EP-tech] redirecting to external URLs
- Next by thread: [EP-tech] Simple meta data select list populated by file?
- Index(es):