--- loncom/interface/lonmsg.pm 2008/03/12 02:45:07 1.211 +++ loncom/interface/lonmsg.pm 2008/06/06 05:24:28 1.212 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.211 2008/03/12 02:45:07 raeburn Exp $ +# $Id: lonmsg.pm,v 1.212 2008/06/06 05:24:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -179,9 +179,17 @@ sub packagemsg { sub get_course_context { my $course_context; + my $msgkey; if (defined($env{'form.replyid'})) { + $msgkey = $env{'form.replyid'}; + } elsif (defined($env{'form.forwid'})) { + $msgkey = $env{'form.forwid'} + } elsif (defined($env{'form.multiforwid'})) { + $msgkey = $env{'form.multiforwid'}; + } + if ($msgkey ne '') { my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$origcid)= - split(/\:/,&unescape($env{'form.replyid'})); + split(/\:/,&unescape($msgkey)); $course_context = $origcid; } foreach my $key (keys(%env)) { @@ -201,7 +209,7 @@ sub get_course_context { # ================================================== Unpack message into a hash sub unpackagemsg { - my ($message,$notoken)=@_; + my ($message,$notoken,$noattachmentlink)=@_; my %content=(); my $parser=HTML::TokeParser->new(\$message); my $token; @@ -221,7 +229,7 @@ sub unpackagemsg { } } if (!exists($content{'recuser'})) { $content{'recuser'} = []; } - if ($content{'attachmenturl'}) { + if (($content{'attachmenturl'}) && (!$noattachmentlink)) { my ($fname)=($content{'attachmenturl'}=~m|/([^/]+)$|); if ($notoken) { $content{'message'}.='

'.&mt('Attachment').': '.$fname.''; @@ -499,7 +507,7 @@ sub store_instructor_comment { sub user_crit_msg_raw { my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage, - $nosentstore,$recipid)=@_; + $nosentstore,$recipid,$attachmenturl)=@_; # Check if allowed missing my ($status,$packed_message); my $msgid='undefined'; @@ -508,8 +516,8 @@ sub user_crit_msg_raw { my $homeserver=&Apache::lonnet::homeserver($user,$domain); if ($homeserver ne 'no_host') { ($msgid,$packed_message)=&packagemsg($subject,$message,undef,undef, - undef,undef,undef,undef,undef,undef,undef, - undef,$recipid); + $attachmenturl,undef,undef,undef,undef,undef, + undef,undef,$recipid); if ($sendback) { $packed_message.='true'; } $status=&Apache::lonnet::cput('critical', {$msgid => $packed_message}, $domain,$user); @@ -518,8 +526,8 @@ sub user_crit_msg_raw { } if (!$nosentstore) { (undef,my $packed_message_no_citation) = - &packagemsg($subject,$message,undef,undef,undef,$user,$domain, - $msgid); + &packagemsg($subject,$message,undef,undef,$attachmenturl,$user, + $domain,$msgid); if ($status eq 'ok' || $status eq 'con_delayed') { &store_sent_mail($msgid,$packed_message_no_citation); } @@ -553,7 +561,7 @@ sub user_crit_msg_raw { =pod -=item * B: +=item * B: Sends a critical message $message to the $user at $domain. If $sendback is true, a receipt will be sent to the current user when $user receives the message. @@ -570,7 +578,7 @@ sub user_crit_msg_raw { sub user_crit_msg { my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage, - $nosentstore,$recipid)=@_; + $nosentstore,$recipid,$attachmenturl)=@_; my @status; my %userenv = &Apache::lonnet::get('environment',['msgforward'], $domain,$user); @@ -581,12 +589,13 @@ sub user_crit_msg { push(@status, &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message, $sendback,$toperm,$sentmessage,$nosentstore, - $recipid)); + $recipid,$attachmenturl)); } } else { push(@status, &user_crit_msg_raw($user,$domain,$subject,$message,$sendback, - $toperm,$sentmessage,$nosentstore,$recipid)); + $toperm,$sentmessage,$nosentstore,$recipid, + $attachmenturl)); } if (wantarray) { return @status;