EPrints Technical Mailing List Archive

Message: #05701


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

Re: [EP-tech] Adding user messages from CGI


Thanks for the response Yuri, but I'm trying to add a 'job done' message for the user to see once they have been sent back to their home deposit screen, rather than generate the appropriate HTML to render immediately.

However, as so often seems to happen, I think I've got an answer, assuming the user visiting the cgi is logged in:

my $repo = new EPrints::Session;
my $db = $repo->database;
my $current_user = $repo->current_user();
my $xml_dom_value = $current_user->render_value( "name" );  # render the user name as an example

$db->save_user_message($current_user->get_value( "userid" ),
"message",
 $repo->html_phrase("html_phrase_id", ("pin_name"=>$xml_dom_value)));


I'll try and find somewhere useful on the Wiki to add it.

Cheers,
Alan



-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Yuri
Sent: 16 May 2016 10:14
To: eprints-tech@ecs.soton.ac.uk
Subject: Re: [EP-tech] Adding user messages from CGI

from cgi/logout:

$page->appendChild( $session->render_message(
    "message",
    $session->make_text( "Logout OK!" ) ) );

add_message works only in plugins, and it calls $session->render_message anyway.

Il 16/05/2016 10:58, Alan.Stiles ha scritto:
>
> Any clue if there is a function to add a message to the message queue
> from a cgi script?  I can use $self->{processor}->add_message() from
> within a plugin but how do I do this without a '$self' ?
>
> Cheers,
>
> Alan
>
> -- 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.
>
>
> *** Options:
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
-- 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.