--- loncom/interface/lonmsg.pm 2004/03/01 18:30:50 1.90 +++ loncom/interface/lonmsg.pm 2004/05/07 12:03:53 1.99 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.90 2004/03/01 18:30:50 www Exp $ +# $Id: lonmsg.pm,v 1.99 2004/05/07 12:03:53 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++; @@ -175,9 +176,11 @@ sub unpackagemsg { if ($notoken) { $content{'message'}.='
'.&mt('Attachment').': '.$fname.'.'.$ft.''; } else { - $content{'message'}.='
'.&mt('Attachment').': '.$fname.'.'.$ft.''; + &Apache::lonnet::allowuploaded('/adm/msg', + $content{'attachmenturl'}); + $content{'message'}.='
'.&mt('Attachment').
+ ': '.
+ $fname.'.'.$ft.'';
}
}
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;
}
@@ -508,7 +511,7 @@ sub discourse {
'cfs' => 'Check for Section/Group',
'cfn' => 'Check for None');
$r->print(<
ENDDISHEADER
my %coursepersonnel=
@@ -618,51 +621,6 @@ $content{'sendername'}.'@'.
$r->print('');
}
-# =============================================================== Compose reply
-
-sub comprep {
- my ($r,$msgid)=@_;
- my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
- my %content=&unpackagemsg($message{$msgid},1);
- my $quotemsg='> '.$content{'message'};
- $quotemsg=~s/\r/\n/g;
- $quotemsg=~s/\f/\n/g;
- $quotemsg=~s/\n+/\n\> /g;
- my $torepl=&Apache::loncommon::aboutmewrapper(
- &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
-$content{'sendername'}.'@'.
- $content{'senderdomain'}.')';
- my $subject=&mt('Re').': '.$content{'subject'};
- my $dispcrit='';
- if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
- my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message");
- $dispcrit=
- ' '.&mt('Send as critical message').' ' . $crithelp .
- ' ';
- }
- my %lt=&Apache::lonlocal::texthash(
- 'to' => 'To',
- 'sb' => 'Subject',
- 'sr' => 'Send Reply',
- 'ca' => 'Cancel'
- );
- $r->print(<<"ENDREPLY");
- '.
''.
- ''.
+ ''.
'
'.
- ' '.&mt('Send as critical message').' ' .
- &mt('and return receipt') . $crithelp . ''.&mt('Open').' '.&mt('Delete').' '.
+ '">'.&mt('Delete').''.
''.&Apache::lonlocal::locallocaltime($sendtime).' '.
$fromname.' '.$fromdomain.' '.
&Apache::lonnet::unescape($shortsubj).' '.
@@ -794,16 +752,41 @@ ENDDISHEADER
''.&mt('Check All').' '.
''.&mt('Uncheck All').'