version 1.204, 2007/05/05 03:14:21
|
version 1.207, 2007/05/09 21:04:51
|
Line 304 sub sendnotification {
|
Line 304 sub sendnotification {
|
my $critical=($crit?' critical':''); |
my $critical=($crit?' critical':''); |
$text=~s/\<\;/\</gs; |
$text=~s/\<\;/\</gs; |
$text=~s/\>\;/\>/gs; |
$text=~s/\>\;/\>/gs; |
$text=~s/\<\/*[^\>]+\>//gs; |
|
my $url='http://'. |
my $url='http://'. |
&Apache::lonnet::hostname(&Apache::lonnet::homeserver($touname,$toudom)). |
&Apache::lonnet::hostname(&Apache::lonnet::homeserver($touname,$toudom)). |
'/adm/email?username='.$touname.'&domain='.$toudom; |
'/adm/email?username='.$touname.'&domain='.$toudom; |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid, |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid, |
$symb,$error) = &Apache::lonmsg::unpackmsgid($msgid); |
$symb,$error) = &Apache::lonmsg::unpackmsgid($msgid); |
my $coursetext; |
my ($coursetext,$body,$bodystart,$bodyend); |
if ($fromcid ne '') { |
if ($fromcid ne '') { |
$coursetext = "\n".&mt('Course').': '; |
$coursetext = "\n".&mt('Course').': '; |
if ($env{'course.'.$fromcid.'.description'} ne '') { |
if ($env{'course.'.$fromcid.'.description'} ne '') { |
Line 323 sub sendnotification {
|
Line 322 sub sendnotification {
|
} |
} |
$coursetext .= "\n\n"; |
$coursetext .= "\n\n"; |
} |
} |
my $body = $coursetext. |
my @recipients = split(/,/,$to); |
|
$bodystart = $coursetext. |
&mt('You received a'.$critical.' message from [_1] in LON-CAPA.',$sender).' '.&mt('The subject is |
&mt('You received a'.$critical.' message from [_1] in LON-CAPA.',$sender).' '.&mt('The subject is |
|
|
[_1] |
[_1] |
|
|
',$subj)."\n". |
',$subj)."\n". |
'=== '.&mt('Excerpt')." ============================================================ |
'=== '.&mt('Excerpt')." ============================================================ |
$text |
"; |
|
$bodyend = " |
======================================================================== |
======================================================================== |
|
|
".&mt('Use |
".&mt('Use |
Line 338 $text
|
Line 339 $text
|
[_1] |
[_1] |
|
|
to access the full message.',$url); |
to access the full message.',$url); |
&sendemail($to,'New'.$critical.' message from '.$sender,$body); |
my %userenv = &Apache::lonnet::get('environment',['notifywithhtml'],$toudom,$touname); |
|
my $subject = &mt("'New' $critical message from ").$sender; |
|
if ($userenv{'notifywithhtml'} ne '') { |
|
my @htmlexcerpt = split(/,/,$userenv{'notifywithhtml'}); |
|
foreach my $addr (@recipients) { |
|
my $sendtext = $text; |
|
if (!grep/^\Q$addr\E/,@htmlexcerpt) { |
|
$sendtext =~ s/\<\/*[^\>]+\>//gs; |
|
} |
|
$body = $bodystart.$sendtext.$bodyend; |
|
&sendemail($addr,$subject,$body); |
|
} |
|
} else { |
|
$text =~ s/\<\/*[^\>]+\>//gs; |
|
$body = $bodystart.$text.$bodyend; |
|
&sendemail($to,$subject,$body); |
|
} |
} |
} |
# ============================================================= Check for email |
# ============================================================= Check for email |
|
|
Line 634 sub user_normal_msg_raw {
|
Line 651 sub user_normal_msg_raw {
|
$$sentmessage = $packed_message; |
$$sentmessage = $packed_message; |
} |
} |
# Notifications |
# Notifications |
my %userenv = &Apache::lonnet::get('environment',['notification', |
my %userenv = &Apache::loncommon::getemails($user,$domain); |
'permanentemail'], |
|
$domain,$user); |
|
if ($userenv{'notification'}) { |
if ($userenv{'notification'}) { |
&sendnotification($userenv{'notification'},$user,$domain,$subject,0, |
&sendnotification($userenv{'notification'},$user,$domain,$subject,0, |
$text,$msgid); |
$text,$msgid); |
Line 706 sub process_sent_mail {
|
Line 721 sub process_sent_mail {
|
my $sentsubj; |
my $sentsubj; |
if ($numsent > 1) { |
if ($numsent > 1) { |
$sentsubj = $subj_prefix.' ('.$numsent.' sent) '.$msgsubj; |
$sentsubj = $subj_prefix.' ('.$numsent.' sent) '.$msgsubj; |
|
} else { |
|
if ($subj_prefix) { |
|
$sentsubj = $subj_prefix.' '; |
|
} |
|
$sentsubj .= $msgsubj; |
} |
} |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
my $sentmsgid = |
my $sentmsgid = |