<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Seb,<br>
<br>
Not the very newest (3.3.6), but somewhat contemporary WRT the upload bits, I think. Thanks for the note on the trigger, that seems a more sound method.<br>
<br>
Cheers,<br>
Casey<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF111118"><font color="#000000" face="Tahoma" size="2"><b>From:</b> eprints-tech-bounces@ecs.soton.ac.uk [eprints-tech-bounces@ecs.soton.ac.uk] on behalf of sf2 [sf2@ecs.soton.ac.uk]<br>
<b>Sent:</b> Thursday, June 21, 2012 4:13 PM<br>
<b>To:</b> eprints-tech@ecs.soton.ac.uk<br>
<b>Subject:</b> [EP-tech] Re: Messages do not work in UploadMethod - action_add_format (Error)<br>
</font><br>
</div>
<div></div>
<div>
<p>Hi,</p>
<p>Is this on the latest EPrints? I thought messages could be displayed in an ajax context now (perhaps something wrong with the upload component...).</p>
<p>If you're interested, you may want to look into putting your "scan" hook into:</p>
<p>- a trigger (when a document object is committed to the DB, see EP_TRIGGER_AFTER_COMMIT for example)</p>
<p>- when the above trigger's called you may create an Event which will perform the scan (this way the uploader doesn't hang on the scan) and take action if necessary.</p>
<p>Voila, I'll look into the other problems tomorrow,</p>
<p>Seb.</p>
<p> </p>
<p>On Thu, 21 Jun 2012 18:17:27 +0000, <rchilliard@mun.ca> wrote:</p>
<blockquote style="padding-left:5px; border-left:2px solid #1010ff; margin-left:5px; width:100%">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi All,<br>
<br>
In the process of attempting to build a hook for on-demand virus scanning of uploaded files, I've been tinkering with action_add_format within UploadMethod.pm as it seems the most relevant location to hook in. In the case of a bad file, I want to toss the
uploaded file and display an error message, comparable to that which would show up for a file transfer that otherwise fails: as an example, the existing "file didn't show up" handling code:<br>
<br>
--- snip ---<br>
if( !EPrints::Utils::is_set( $filename ) || !defined $fh )<br>
{<br>
$processor->{notes}->{upload} = {};<br>
$processor->add_message( "error", $self->{session}->html_phrase( "Plugin/InputForm/Component/Upload:upload_failed" ) );<br>
<br>
return 0;<br>
}<br>
--- snip ---<br>
<br>
In our case, this test would be replaced for an assessment of the virus scan results on the file, giving pass/fail.<br>
<br>
In building this process, I think I've found a bit of a bug - the current upload configuration, using the ajax code to display the upload progress bar, seems to ignore any add_message() content from ever reaching the workflow page. No matter where in the subroutine
an add_message call is placed; when it is called as a result of a file being uploaded via the form's File control, no message appears.
<br>
<br>
I've found this to be an issue on Firefox, IE and Chrome. Interestingly, on IE, the name of any file selected by the form control persists in the control after upload; if the "Upload" button is then clicked with the form in this state, add_message calls within
action_add_format are respected, however the progress bar does not display.<br>
<br>
As is, it seems the message feedback for any sort of upload trouble seems to be broken, can any others confirm?<br>
<br>
Cheers,<br>
Casey<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px"><span style="font-size:x-small"><span style="font-family:Tahoma"></span></span>
<hr style="width:100%; height:2px">
<span style="font-size:x-small"><span style="font-family:Tahoma">Casey Hilliard</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma">PC Consultant,</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma">Health Sciences Library / QE2 Systems,</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma">Memorial University</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma"><span style="font-family:Tahoma"><br>
</span></span></span></div>
</div>
</div>
<br>
This electronic communication is governed by the terms and conditions at http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php</blockquote>
<p> </p>
</div>
</div>
</div>
<br>This electronic communication is governed by the terms and conditions at http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php
</body>
</html>