--- loncom/interface/lonmsg.pm 2002/08/28 14:11:27 1.37 +++ loncom/interface/lonmsg.pm 2002/09/16 20:06:12 1.39 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.37 2002/08/28 14:11:27 www Exp $ +# $Id: lonmsg.pm,v 1.39 2002/09/16 20:06:12 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -141,7 +141,7 @@ sub author_res_msg { # ================================================== Critical message to a user -sub user_crit_msg { +sub user_crit_msg_raw { my ($user,$domain,$subject,$message,$sendback)=@_; # Check if allowed missing my $status=''; @@ -168,6 +168,27 @@ sub user_crit_msg { return $status; } +# New routine that respects "forward" and calls old routine + +sub user_crit_msg { + my ($user,$domain,$subject,$message,$sendback)=@_; + my $status=''; + my %userenv = &Apache::lonnet::get('environment',['msgforward'], + $domain,$user); + my $msgforward=$userenv{'msgforward'}; + if ($msgforward) { + foreach (split(/\,/,$msgforward)) { + my ($forwuser,$forwdomain)=split(/\:/,$_); + $status.= + &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message, + $sendback).' '; + } + } else { + $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback); + } + return $status; +} + # =================================================== Critical message received sub user_crit_received { @@ -195,7 +216,7 @@ sub user_crit_received { # ======================================================== Normal communication -sub user_normal_msg { +sub user_normal_msg_raw { my ($user,$domain,$subject,$message,$citation)=@_; # Check if allowed missing my $status=''; @@ -217,6 +238,29 @@ sub user_normal_msg { return $status; } +# New routine that respects "forward" and calls old routine + +sub user_normal_msg { + my ($user,$domain,$subject,$message,$citation)=@_; + my $status=''; + my %userenv = &Apache::lonnet::get('environment',['msgforward'], + $domain,$user); + my $msgforward=$userenv{'msgforward'}; + if ($msgforward) { + foreach (split(/\,/,$msgforward)) { + my ($forwuser,$forwdomain)=split(/\:/,$_); + $status.= + &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message, + $citation).' '; + } + } else { + $status= + &user_normal_msg_raw($user,$domain,$subject,$message,$citation); + } + return $status; +} + + # =============================================================== Status Change sub statuschange { @@ -406,24 +450,24 @@ ENDDISHEADER $ENV{'user.home'}))) { my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= &Apache::lonmsg::unpackmsgid($_); - unless (($status eq 'deleted') || ($sendtime=~/error/)) { - if ($status eq 'new') { - $r->print(''); - } elsif ($status eq 'read') { - $r->print(''); - } elsif ($status eq 'replied') { - $r->print(''); - } else { - $r->print(''); - } - $r->print('OpenDelete'. - ''.localtime($sendtime).''. - $fromname.''.$fromdomain.''. + if (($status ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { + if ($status eq 'new') { + $r->print(''); + } elsif ($status eq 'read') { + $r->print(''); + } elsif ($status eq 'replied') { + $r->print(''); + } else { + $r->print(''); + } + $r->print('OpenDelete'. + ''.localtime($sendtime).''. + $fromname.''.$fromdomain.''. &Apache::lonnet::unescape($shortsubj).''. $status.''); - } + } } $r->print('

'. 'Check All '.