<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Interesting. I had thought it was easier than this, but a scan of the code shows that this is, indeed, what's happening. It's used 'officially' only a couple of times, but the key example is when you take an edit lock from someone it shows them a message
(see <a href="https://github.com/eprints/eprints/blob/33a7bb8a8b3f80ba02ddd6618eb4e7dc3209ec68/perl_lib/EPrints/Plugin/Screen/EPrint/TakeLock.pm#L72">https://github.com/eprints/eprints/blob/33a7bb8a8b3f80ba02ddd6618eb4e7dc3209ec68/perl_lib/EPrints/Plugin/Screen/EPrint/TakeLock.pm#L72</a> )</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
I would, however, say that if you're having to jump through hoops like this, your approach may be wrong. The screen plugin infrastructure is there to manage things like this. What are you doing with the cgi script, and why can't it be a screen plugin?</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<span style="font-size: 11pt;"><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<span style="font-size: 11pt;"> </span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<div id="MAC_OUTLOOK_SIGNATURE">
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="font-family: Calibri;">
<tbody>
<tr>
<td valign="top" style="border-style: solid none none; border-top-color: rgb(44, 56, 65); border-top-width: 1pt; padding: 0cm 0cm 3pt;">
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<a href="http://www.jisc.ac.uk/" style="color: rgb(149, 79, 114);"><span style="font-size: 12pt; font-family: 'Times New Roman', serif; color: blue; text-decoration: none;"><img border="0" width="60" height="35" id="Picture_x0020_1" src="cid:2C74E28E-7D65-4A51-8162-3ADA3934ACA1" alt="Jisc" type="image/png"></span></a><span style="font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td valign="top" style="padding: 7.5pt 0cm 0cm;">
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<b><span style="font-size: 12pt; font-family: Corbel, sans-serif; color: rgb(44, 56, 65);">Adam Field</span></b><span style="font-size: 12pt; font-family: 'Times New Roman', serif;"><br>
</span><span style="font-size: 12pt; font-family: Corbel, sans-serif; color: rgb(44, 56, 65);">SHERPA services analyst developer</span></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span><<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">eprints-tech-bounces@ecs.soton.ac.uk</a>> on behalf of "Alan.Stiles" <<a href="mailto:alan.stiles@open.ac.uk">alan.stiles@open.ac.uk</a>><br>
<span style="font-weight:bold">Reply-To: </span>"<a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a>" <<a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a>><br>
<span style="font-weight:bold">Date: </span>Monday, 16 May 2016 10:37<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a>" <<a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [EP-tech] Adding user messages from CGI<br>
</div>
<div><br>
</div>
<span style="mso-bookmark:_MailOriginalBody">
<div>
<div>
<div>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.</div>
<div><br>
</div>
<div>However, as so often seems to happen, I think I've got an answer, assuming the user visiting the cgi is logged in:</div>
<div><br>
</div>
<div>my $repo = new EPrints::Session;</div>
<div>my $db = $repo->database;</div>
<div>my $current_user = $repo->current_user();</div>
<div>my $xml_dom_value = $current_user->render_value( "name" ); # render the user name as an example</div>
<div><br>
</div>
<div>$db->save_user_message($current_user->get_value( "userid" ),</div>
<div>"message",</div>
<div>$repo->html_phrase("html_phrase_id", ("pin_name"=>$xml_dom_value)));</div>
<div><br>
</div>
<div><br>
</div>
<div>I'll try and find somewhere useful on the Wiki to add it.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Alan</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>-----Original Message-----</div>
<div>From: <a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">eprints-tech-bounces@ecs.soton.ac.uk</a> [<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">mailto:eprints-tech-bounces@ecs.soton.ac.uk</a>] On Behalf Of Yuri</div>
<div>Sent: 16 May 2016 10:14</div>
<div>To: <a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a></div>
<div>Subject: Re: [EP-tech] Adding user messages from CGI</div>
<div><br>
</div>
<div>from cgi/logout:</div>
<div><br>
</div>
<div>$page->appendChild( $session->render_message(</div>
<div> "message",</div>
<div> $session->make_text( "Logout OK!" ) ) );</div>
<div><br>
</div>
<div>add_message works only in plugins, and it calls $session->render_message anyway.</div>
<div><br>
</div>
<div>Il 16/05/2016 10:58, Alan.Stiles ha scritto:</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div><br>
</div>
<div>Any clue if there is a function to add a message to the message queue</div>
<div>from a cgi script? I can use $self->{processor}->add_message() from</div>
<div>within a plugin but how do I do this without a '$self' ?</div>
<div><br>
</div>
<div>Cheers,</div>
<div><br>
</div>
<div>Alan</div>
<div><br>
</div>
<div>-- The Open University is incorporated by Royal Charter (RC 000391),</div>
<div>an exempt charity in England & Wales and a charity registered in</div>
<div>Scotland (SC 038302). The Open University is authorised and regulated</div>
<div>by the Financial Conduct Authority.</div>
<div><br>
</div>
<div><br>
</div>
<div>*** Options:</div>
<div><a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a></div>
<div>*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a></div>
<div>*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a></div>
<div>*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a></div>
</blockquote>
<div><br>
</div>
<div>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a></div>
<div>*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a></div>
<div>*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a></div>
<div>*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a></div>
<div>-- 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.</div>
<div><br>
</div>
<div>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a></div>
<div>*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a></div>
<div>*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a></div>
<div>*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a></div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</span></span>
<font size="1"> <font face="Corbel"> <br />
Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.<br /><br />
Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.
</font></font></body>
</html>