--- loncom/interface/lonmsg.pm 2003/10/15 21:10:24 1.69 +++ loncom/interface/lonmsg.pm 2003/12/05 22:14:15 1.71 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.69 2003/10/15 21:10:24 www Exp $ +# $Id: lonmsg.pm,v 1.71 2003/12/05 22:14:15 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -270,16 +270,22 @@ sub author_res_msg { my ($filename,$message)=@_; unless ($message) { return 'empty'; } $filename=&Apache::lonnet::declutter($filename); - my ($domain,$author,@dummy)=split(/\//,$filename); + my ($domain,$author)=split(/\//,$filename); my $homeserver=&Apache::lonnet::homeserver($author,$domain); if ($homeserver ne 'no_host') { my $id=unpack("%32C*",$message); my $msgid; - ($msgid,$message)=&packagemsg($filename,$message); + ($msgid,$message)=&packagemsg("Error: [$filename]",$message); + #FIXME this should be nohist_res_msg, we need to provide an interface + # to this hash BUG#2444 + #return &Apache::lonnet::reply('put:'.$domain.':'.$author. + # ':nohist_res_msg:'. + # &Apache::lonnet::escape($filename.'_'.$id).'='. + # &Apache::lonnet::escape($message),$homeserver); return &Apache::lonnet::reply('put:'.$domain.':'.$author. - ':nohist_res_msgs:'. - &Apache::lonnet::escape($filename.'_'.$id).'='. - &Apache::lonnet::escape($message),$homeserver); + ':nohist_email:'. + &Apache::lonnet::escape($msgid).'='. + &Apache::lonnet::escape($message),$homeserver); } return 'no_host'; } @@ -1060,7 +1066,7 @@ $content{'sendername'},$content{'senderd &statuschange($msgid,'replied'); if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { - $r->print(&mt('Sending critical').': '. + $r->print(&mt('Sending critical message').': '. &user_crit_msg($content{'sendername'}, $content{'senderdomain'}, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), @@ -1118,6 +1124,7 @@ $content{'sendername'},$content{'senderd } elsif ($ENV{'form.recordftf'}) { &facetoface($r,$ENV{'form.recordftf'}); } elsif ($ENV{'form.sendmail'}) { + my $sendstatus=''; if ($ENV{'form.send'}) { my %content=(); undef %content; @@ -1160,24 +1167,32 @@ $content{'sendername'},$content{'senderd if ($toaddr{$_}) { $msgtxt.='
'.$toaddr{$_}; } if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { - $r->print('Sending critical: '. - &user_crit_msg($recuname,$recdomain, + $r->print(&mt('Sending critical message').' ...'); + $sendstatus.=' '.&user_crit_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, - $ENV{'form.sendbck'})); + $ENV{'form.sendbck'}); } else { - $r->print('Sending: '.&user_normal_msg($recuname,$recdomain, - &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), + $r->print(&mt('Sending').' ...'); + $sendstatus.=' '.&user_normal_msg($recuname,$recdomain, + &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, - $content{'citation'})); + $content{'citation'}); } $r->print('
'); } } - if ($ENV{'form.displayedcrit'}) { - &discrit($r); + if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) { + if ($ENV{'form.displayedcrit'}) { + &discrit($r); + } else { + &disall($r); + } } else { - &disall($r); + $r->print( + '

'.&mt('Could not deliver message').'

'. + &mt('Please use the browser "Back" button and correct the recipient addresses') + ); } } else { &disall($r);