--- loncom/interface/lonmsg.pm 2005/01/30 23:32:29 1.131 +++ loncom/interface/lonmsg.pm 2005/02/02 21:35:16 1.133 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.131 2005/01/30 23:32:29 www Exp $ +# $Id: lonmsg.pm,v 1.133 2005/02/02 21:35:16 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -90,7 +90,7 @@ also has a student role in the course, A Users can ask LON-CAPA to forward messages to conventional e-mail addresses on their B screen, but generally, LON-CAPA messages -are much more useful then traditional email can be made to be, even +are much more useful than traditional email can be made to be, even with HTML support. Right now, this document will cover just how to send a message, since @@ -356,7 +356,7 @@ sub all_url_author_res_msg { # ================================================== Critical message to a user sub user_crit_msg_raw { - my ($user,$domain,$subject,$message,$sendback)=@_; + my ($user,$domain,$subject,$message,$sendback,$toperm)=@_; # Check if allowed missing my $status=''; my $msgid='undefined'; @@ -381,12 +381,17 @@ sub user_crit_msg_raw { $status='no_host'; } # Notifications - my %userenv = &Apache::lonnet::get('environment',['critnotification'], + my %userenv = &Apache::lonnet::get('environment',['critnotification', + 'permanentemail'], $domain,$user); if ($userenv{'critnotification'}) { &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1, $text); } + if ($toperm && $userenv{'permanentemail'}) { + &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,1, + $text); + } # Log this &Apache::lonnet::logthis( 'Sending critical email '.$msgid. @@ -409,7 +414,7 @@ sub user_crit_msg_raw { =cut sub user_crit_msg { - my ($user,$domain,$subject,$message,$sendback)=@_; + my ($user,$domain,$subject,$message,$sendback,$toperm)=@_; my $status=''; my %userenv = &Apache::lonnet::get('environment',['msgforward'], $domain,$user); @@ -419,10 +424,10 @@ sub user_crit_msg { my ($forwuser,$forwdomain)=split(/\:/,$_); $status.= &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message, - $sendback).' '; + $sendback,$toperm).' '; } } else { - $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback); + $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback,$toperm); } return $status; } @@ -456,7 +461,8 @@ sub user_crit_received { # ======================================================== Normal communication sub user_normal_msg_raw { - my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl)=@_; + my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, + $toperm)=@_; # Check if allowed missing my $status=''; my $msgid='undefined'; @@ -484,12 +490,17 @@ sub user_normal_msg_raw { $status='no_host'; } # Notifications - my %userenv = &Apache::lonnet::get('environment',['notification'], + my %userenv = &Apache::lonnet::get('environment',['notification', + 'permanentemail'], $domain,$user); if ($userenv{'notification'}) { &sendnotification($userenv{'notification'},$user,$domain,$subject,0, $text); } + if ($toperm && $userenv{'permanentemail'}) { + &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,0, + $text); + } &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'}, $ENV{'user.home'}, 'Sending '.$msgid.' to '.$user.' at '.$domain.' with status: '.$status); @@ -507,7 +518,8 @@ sub user_normal_msg_raw { =cut sub user_normal_msg { - my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl)=@_; + my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, + $toperm)=@_; my $status=''; my %userenv = &Apache::lonnet::get('environment',['msgforward'], $domain,$user); @@ -517,11 +529,11 @@ sub user_normal_msg { my ($forwuser,$forwdomain)=split(/\:/,$_); $status.= &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message, - $citation,$baseurl,$attachmenturl).' '; + $citation,$baseurl,$attachmenturl,$toperm).' '; } } else { $status=&user_normal_msg_raw($user,$domain,$subject,$message, - $citation,$baseurl,$attachmenturl); + $citation,$baseurl,$attachmenturl,$toperm); } return $status; } @@ -1071,9 +1083,11 @@ sub compout { my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message"); $dispcrit= ' '.&mt('Send as critical message').' ' . $crithelp . - '
'. + '
'. ' '.&mt('Send as critical message').' ' . - &mt('and return receipt') . $crithelp . '

'; + &mt('and return receipt') . $crithelp . + '
'. +&mt('Send copy to permanent email address (if known)').'

'; } my %message; my %content; @@ -1948,13 +1962,13 @@ sub sendoffmail { $thismsg=&user_crit_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, - $ENV{'form.sendbck'}); + $ENV{'form.sendbck'},$ENV{'form.permanent'}); } else { $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); $thismsg=&user_normal_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, - $content{'citation'}); + $content{'citation'},undef,undef,$ENV{'form.permanent'}); if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) { &user_normal_msg_raw( $ENV{'course.'.$ENV{'request.course.id'}.'.num'},