--- loncom/interface/lonmsg.pm 2006/01/23 23:15:51 1.173
+++ loncom/interface/lonmsg.pm 2006/03/16 22:12:17 1.178
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.173 2006/01/23 23:15:51 albertel Exp $
+# $Id: lonmsg.pm,v 1.178 2006/03/16 22:12:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,7 +137,7 @@ my $interdis;
sub packagemsg {
my ($subject,$message,$citation,$baseurl,$attachmenturl,
- $recuser,$recdomain,$msgid,$type)=@_;
+ $recuser,$recdomain,$msgid,$type,$crsmsgid)=@_;
$message =&HTML::Entities::encode($message,'<>&"');
$citation=&HTML::Entities::encode($citation,'<>&"');
$subject =&HTML::Entities::encode($subject,'<>&"');
@@ -170,11 +170,19 @@ sub packagemsg {
$msgid = &buildmsgid($now,$subject,$env{'user.name'},$env{'user.domain'},
$msgcount,$course_context,$$);
}
- my $result=''.$env{'user.name'}.''.
+ my $result = ''.$env{'user.name'}.''.
''.$env{'user.domain'}.''.
''.$subject.''.
- ''.
- ''.$ENV{'SERVER_NAME'}.''.
+ '';
+ if (defined($crsmsgid)) {
+ $result.= ''.$course_context.''.
+ ''.$env{'request.course.sec'}.''.
+ ''.$msgid.''.
+ ''.$crsmsgid.''.
+ ''.$message.'';
+ return ($msgid,$result);
+ }
+ $result .= ''.$ENV{'SERVER_NAME'}.''.
''.$ENV{'HTTP_HOST'}.''.
''.$ENV{'REMOTE_ADDR'}.''.
''.$env{'browser.type'}.''.
@@ -536,7 +544,7 @@ sub user_crit_received {
sub user_normal_msg_raw {
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
- $toperm,$currid,$newid,$sentmessage)=@_;
+ $toperm,$currid,$newid,$sentmessage,$crsmsgid)=@_;
# Check if allowed missing
my ($status,$packed_message);
my $msgid='undefined';
@@ -546,10 +554,9 @@ sub user_normal_msg_raw {
if ($homeserver ne 'no_host') {
($msgid,$packed_message)=
&packagemsg($subject,$message,$citation,$baseurl,
- $attachmenturl,$user,$domain,$currid);
- (undef, my $packed_message_no_citation)=
- &packagemsg($subject,$message,undef ,$baseurl,
- $attachmenturl,$user,$domain,$currid);
+ $attachmenturl,$user,$domain,$currid,
+ undef,$crsmsgid);
+
# Store in user folder
$status=&Apache::lonnet::critical(
'put:'.$domain.':'.$user.':nohist_email:'.
@@ -565,6 +572,11 @@ sub user_normal_msg_raw {
(&Apache::lonnet::allowed('srm',$env{'request.course.id'})
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})))) {
+ (undef, my $packed_message_no_citation)=
+ &packagemsg($subject,$message,undef ,$baseurl,
+ $attachmenturl,$user,$domain,$currid,
+ undef,$crsmsgid);
+
$status .= &store_sent_mail($msgid,$packed_message_no_citation);
}
} else {
@@ -762,7 +774,7 @@ sub discourse {
for (i=0; iprint("");
}
- $r->print(''.&Apache::loncommon::endbodytag().'