--- loncom/interface/lonmsg.pm 2004/03/26 17:13:59 1.94 +++ loncom/interface/lonmsg.pm 2004/05/10 22:39:51 1.100 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.94 2004/03/26 17:13:59 www Exp $ +# $Id: lonmsg.pm,v 1.100 2004/05/10 22:39:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -101,6 +101,7 @@ use Apache::lontexconvert(); use HTML::Entities(); use Mail::Send; use Apache::lonlocal; +use Apache::loncommunicate; # Querystring component with sorting type my $sqs; @@ -109,15 +110,15 @@ my $sqs; sub packagemsg { my ($subject,$message,$citation,$baseurl,$attachmenturl)=@_; - $message =&HTML::Entities::encode($message); - $citation=&HTML::Entities::encode($citation); - $subject =&HTML::Entities::encode($subject); + $message =&HTML::Entities::encode($message,'<>&"'); + $citation=&HTML::Entities::encode($citation,'<>&"'); + $subject =&HTML::Entities::encode($subject,'<>&"'); #remove machine specification $baseurl =~ s|^http://[^/]+/|/|; - $baseurl =&HTML::Entities::encode($baseurl); + $baseurl =&HTML::Entities::encode($baseurl,'<>&"'); #remove machine specification $attachmenturl =~ s|^http://[^/]+/|/|; - $attachmenturl =&HTML::Entities::encode($attachmenturl); + $attachmenturl =&HTML::Entities::encode($attachmenturl,'<>&"'); my $now=time; $msgcount++; @@ -171,13 +172,15 @@ sub unpackagemsg { } } if ($content{'attachmenturl'}) { - my ($fname,$ft)=($content{'attachmenturl'}=~/\/(\w+)\.(\w+)$/); + my ($fname)=($content{'attachmenturl'}=~m|/([^/]+)$|); if ($notoken) { - $content{'message'}.='

'.&mt('Attachment').': '.$fname.'.'.$ft.''; + $content{'message'}.='

'.&mt('Attachment').': '.$fname.''; } else { - $content{'message'}.='

'.&mt('Attachment').': '.$fname.'.'.$ft.''; + &Apache::lonnet::allowuploaded('/adm/msg', + $content{'attachmenturl'}); + $content{'message'}.='

'.&mt('Attachment'). + ': '. + $fname.''; } } return %content; @@ -204,7 +207,7 @@ sub sendemail { my $msg = new Mail::Send; $msg->to($to); $msg->subject('[LON-CAPA] '.$subject); - if (my $fh = $msg->open('smtp',Server => 'localhost')) { + if (my $fh = $msg->open()) { print $fh $body; $fh->close; } @@ -910,6 +913,7 @@ ENDUPLOAD sub disfacetoface { my ($r,$user,$domain)=@_; + my $target=$ENV{'form.grade_target'}; unless ($ENV{'request.course.id'}) { return; } unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { return; @@ -943,7 +947,11 @@ $content{'sendername'}.'@'. } # Check to see if there were any messages. if ($result eq '') { - $r->print("

".&mt("No notes, face-to-face discussion records, or critical messages in this course.")."

"); + if ($target ne 'tex') { + $r->print("

".&mt("No notes, face-to-face discussion records, or critical messages in this course.")."

"); + } else { + $r->print('\textbf{'.&mt("No notes, face-to-face discussion records, or critical messages in this course.").'}\\\\'); + } } else { $r->print($result); } @@ -1249,13 +1257,15 @@ sub handler { $r->print($thismsg.'
'); $sendstatus.=' '.$thismsg; } + } else { + &printheader($r,'','No messages sent.'); } if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) { $r->print('
'.&mt('Completed.').''); if ($ENV{'form.displayedcrit'}) { &discrit($r); } else { - &disall($r); + &Apache::loncommunicate::menu($r); } } else { $r->print(