--- loncom/interface/lonfeedback.pm 2003/02/10 16:22:28 1.39 +++ loncom/interface/lonfeedback.pm 2003/03/29 22:50:22 1.42 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.39 2003/02/10 16:22:28 www Exp $ +# $Id: lonfeedback.pm,v 1.42 2003/03/29 22:50:22 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -112,8 +112,12 @@ $options
My question/comment/feedback:

- - +Attachment (128 KB max size): +

+

+ + +

ENDDOCUMENT $r->print(&generate_preview_button().''); @@ -248,7 +252,7 @@ sub clear_out_html { } sub assemble_email { - my ($feedurl,$message,$prevattempts,$usersaw)=@_; + my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_; my $email=<<"ENDEMAIL"; Refers to $feedurl @@ -260,6 +264,8 @@ $prevattempts


Original screen output (if applicable)

$usersaw +

Correct Answer(s) (if applicable)

+$useranswer ENDCITE return ($email,$citations); } @@ -340,7 +346,7 @@ sub send_msg { if ($_) { my $declutter=&Apache::lonnet::declutter($feedurl); unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), - 'Feedback ['.$declutter.']',$email,$citations)=~/ok/) { + 'Feedback ['.$declutter.']',$email,$citations,$feedurl)=~/ok/) { $status.='
Error sending message to '.$_.'
'; } else { $sendsomething++; @@ -363,7 +369,7 @@ sub send_msg { } sub adddiscuss { - my ($symb,$email,$anon)=@_; + my ($symb,$email,$anon,$attachmenturl)=@_; my $status=''; if (&Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { @@ -375,7 +381,8 @@ sub adddiscuss { 'plainname' => $ENV{'environment.firstname'}.' '. $ENV{'environment.middlename'}.' '. $ENV{'environment.lastname'}.' '. - $ENV{'enrironment.generation'}); + $ENV{'enrironment.generation'}, + 'attachment' => $attachmenturl); if ($anon) { $contrib{'anonymous'}='true'; } @@ -550,13 +557,24 @@ sub handler { # Get output from resource my $usersaw=&resource_output($feedurl); +# Get resource answer + my $useranswer=&Apache::loncommon::get_student_answers( + $symb,$ENV{'user.name'},$ENV{'user.domain'}, + $ENV{'request.course.id'}); +# Get attachments, if any, and not too large + my $attachmenturl=''; + if ($ENV{'form.attachment.filename'}) { + unless (length($ENV{'form.attachment'})>131072) { + $attachmenturl=&Apache::lonnet::userfileupload('attachment',1); + } + } # Filter HTML out of message (could be nasty) my $message=&clear_out_html($ENV{'form.comment'}); # Assemble email my ($email,$citations)=&assemble_email($feedurl,$message,$prevattempts, - $usersaw); - + $usersaw,$useranswer); + # Who gets this? my ($typestyle,%to) = &decide_receiver($feedurl); @@ -567,12 +585,12 @@ sub handler { my $numpost=0; if ($ENV{'form.discuss'}) { - $typestyle.=&adddiscuss($symb,$message); + $typestyle.=&adddiscuss($symb,$message,0,$attachmenturl); $numpost++; } if ($ENV{'form.anondiscuss'}) { - $typestyle.=&adddiscuss($symb,$message,1); + $typestyle.=&adddiscuss($symb,$message,1,$attachmenturl); $numpost++; }