--- loncom/interface/lonmsg.pm 2007/05/09 23:53:15 1.208 +++ 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.208 2007/05/09 23:53:15 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.'';
@@ -351,8 +359,8 @@ to access the full message.',$url);
&Apache::loncommon::blockcheck(\%setters,'com',$touname,$toudom);
if ($startblock && $endblock) {
$blocked = 1;
- my $showstart = localtime($startblock);
- my $showend = localtime($endblock);
+ my $showstart = &Apache::lonlocal::locallocaltime($startblock);
+ my $showend = &Apache::lonlocal::locallocaltime($endblock);
$blocktext = &mt('LON-CAPA messages sent to you between [_1] and [_2] will be inaccessible until the end of this time period, because you are a student in a course with an active communications block.',$showstart,$showend);
}
}
@@ -385,7 +393,7 @@ to access the full message.',$url);
sub newmail {
if ((time-$env{'user.mailcheck.time'})>300) {
my %what=&Apache::lonnet::get('email_status',['recnewemail']);
- &Apache::lonnet::appenv('user.mailcheck.time'=>time);
+ &Apache::lonnet::appenv({'user.mailcheck.time'=>time});
if ($what{'recnewemail'}>0) { return 1; }
}
return 0;
@@ -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,20 +516,18 @@ 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.='