version 1.127, 2005/01/01 18:24:12
|
version 1.132, 2005/01/31 11:27:14
|
Line 90 also has a student role in the course, A
|
Line 90 also has a student role in the course, A
|
|
|
Users can ask LON-CAPA to forward messages to conventional e-mail |
Users can ask LON-CAPA to forward messages to conventional e-mail |
addresses on their B<PREF> screen, but generally, LON-CAPA messages |
addresses on their B<PREF> 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. |
with HTML support. |
|
|
Right now, this document will cover just how to send a message, since |
Right now, this document will cover just how to send a message, since |
Line 239 sub sendemail {
|
Line 239 sub sendemail {
|
# ==================================================== Send notification emails |
# ==================================================== Send notification emails |
|
|
sub sendnotification { |
sub sendnotification { |
my ($to,$touname,$toudom,$subj,$crit)=@_; |
my ($to,$touname,$toudom,$subj,$crit,$text)=@_; |
my $sender=$ENV{'environment.firstname'}.' '.$ENV{'environment.lastname'}; |
my $sender=$ENV{'environment.firstname'}.' '.$ENV{'environment.lastname'}; |
|
unless ($sender=~/\w/) { |
|
$sender=$ENV{'user.name'}.'@'.$ENV{'user.domain'}; |
|
} |
my $critical=($crit?' critical':''); |
my $critical=($crit?' critical':''); |
|
$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; |
Line 250 You received a$critical message from $se
|
Line 256 You received a$critical message from $se
|
|
|
$subj |
$subj |
|
|
|
=== Excerpt ============================================================ |
|
$text |
|
======================================================================== |
|
|
Use |
Use |
|
|
$url |
$url |
|
|
to access this message. |
to access the full message. |
ENDMSG |
ENDMSG |
&sendemail($to,'New'.$critical.' message from '.$sender,$body); |
&sendemail($to,'New'.$critical.' message from '.$sender,$body); |
} |
} |
Line 346 sub all_url_author_res_msg {
|
Line 356 sub all_url_author_res_msg {
|
# ================================================== Critical message to a user |
# ================================================== Critical message to a user |
|
|
sub user_crit_msg_raw { |
sub user_crit_msg_raw { |
my ($user,$domain,$subject,$message,$sendback)=@_; |
my ($user,$domain,$subject,$message,$sendback,$toperm)=@_; |
# Check if allowed missing |
# Check if allowed missing |
my $status=''; |
my $status=''; |
my $msgid='undefined'; |
my $msgid='undefined'; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
|
my $text=$message; |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
($msgid,$message)=&packagemsg($subject,$message); |
($msgid,$message)=&packagemsg($subject,$message); |
Line 370 sub user_crit_msg_raw {
|
Line 381 sub user_crit_msg_raw {
|
$status='no_host'; |
$status='no_host'; |
} |
} |
# Notifications |
# Notifications |
my %userenv = &Apache::lonnet::get('environment',['critnotification'], |
my %userenv = &Apache::lonnet::get('environment',['critnotification', |
|
'permanentemail'], |
$domain,$user); |
$domain,$user); |
if ($userenv{'critnotification'}) { |
if ($userenv{'critnotification'}) { |
&sendnotification($userenv{'critnotification'},$user,$domain,$subject,1); |
&sendnotification($userenv{'critnotification'},$user,$domain,$subject,1, |
|
$text); |
|
} |
|
if ($toperm && $userenv{'permanentemail'}) { |
|
&sendnotification($userenv{'permanentemail'},$user,$domain,$subject,1, |
|
$text); |
} |
} |
# Log this |
# Log this |
&Apache::lonnet::logthis( |
&Apache::lonnet::logthis( |
Line 444 sub user_crit_received {
|
Line 461 sub user_crit_received {
|
# ======================================================== Normal communication |
# ======================================================== Normal communication |
|
|
sub user_normal_msg_raw { |
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 |
# Check if allowed missing |
my $status=''; |
my $status=''; |
my $msgid='undefined'; |
my $msgid='undefined'; |
|
my $text=$message; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
Line 471 sub user_normal_msg_raw {
|
Line 490 sub user_normal_msg_raw {
|
$status='no_host'; |
$status='no_host'; |
} |
} |
# Notifications |
# Notifications |
my %userenv = &Apache::lonnet::get('environment',['notification'], |
my %userenv = &Apache::lonnet::get('environment',['notification', |
|
'permanentemail'], |
$domain,$user); |
$domain,$user); |
if ($userenv{'notification'}) { |
if ($userenv{'notification'}) { |
&sendnotification($userenv{'notification'},$user,$domain,$subject,0); |
&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'}, |
&Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'}, |
$ENV{'user.home'}, |
$ENV{'user.home'}, |
Line 493 sub user_normal_msg_raw {
|
Line 518 sub user_normal_msg_raw {
|
=cut |
=cut |
|
|
sub user_normal_msg { |
sub user_normal_msg { |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl)=@_; |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
|
$toperm)=@_; |
my $status=''; |
my $status=''; |
my %userenv = &Apache::lonnet::get('environment',['msgforward'], |
my %userenv = &Apache::lonnet::get('environment',['msgforward'], |
$domain,$user); |
$domain,$user); |
Line 503 sub user_normal_msg {
|
Line 529 sub user_normal_msg {
|
my ($forwuser,$forwdomain)=split(/\:/,$_); |
my ($forwuser,$forwdomain)=split(/\:/,$_); |
$status.= |
$status.= |
&user_normal_msg_raw($forwuser,$forwdomain,$subject,$message, |
&user_normal_msg_raw($forwuser,$forwdomain,$subject,$message, |
$citation,$baseurl,$attachmenturl).' '; |
$citation,$baseurl,$attachmenturl,$toperm).' '; |
} |
} |
} else { |
} else { |
$status=&user_normal_msg_raw($user,$domain,$subject,$message, |
$status=&user_normal_msg_raw($user,$domain,$subject,$message, |
$citation,$baseurl,$attachmenturl); |
$citation,$baseurl,$attachmenturl,$toperm); |
} |
} |
return $status; |
return $status; |
} |
} |
Line 598 sub movemsg {
|
Line 624 sub movemsg {
|
&Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}}); |
&Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}}); |
|
|
# Copy status |
# Copy status |
my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]); |
unless ($trgfolder eq 'trash') { |
&Apache::lonnet::put('email_status'.$trgsuffix,{$msgid => $status{$msgid}}); |
my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]); |
# See if was deleted -> becomes "read" in trash |
&Apache::lonnet::put('email_status'.$trgsuffix,{$msgid => $status{$msgid}}); |
my $currentstatus=(&unpackmsgid($status{$msgid}),$srcfolder); |
|
if ($currentstatus eq 'deleted') { |
|
&statuschange($msgid,'read',$trgfolder); |
|
} |
} |
# Delete orginals |
# Delete orginals |
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]); |
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]); |
Line 678 ENDDISHEADER
|
Line 701 ENDDISHEADER
|
&Apache::loncoursedata::CL_FULLNAME(), |
&Apache::loncoursedata::CL_FULLNAME(), |
&Apache::loncoursedata::CL_SECTION()]); |
&Apache::loncoursedata::CL_SECTION()]); |
next if ($status ne 'Active'); |
next if ($status ne 'Active'); |
my $key = 'send_to_&&&'.$section.'&&&'.$student; |
my $key = 'send_to_&&&'.$section.'&&&_'.$student; |
if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } |
if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } |
$r->print('<tr><td><label>'. |
$r->print('<tr><td><label>'. |
qq{<input type="checkbox" name="$key">}.(' 'x2). |
qq{<input type="checkbox" name="$key">}.(' 'x2). |
Line 706 sub discrit {
|
Line 729 sub discrit {
|
$content{'sendername'}.'@'. |
$content{'sendername'}.'@'. |
$content{'senderdomain'}.') '.$content{'time'}. |
$content{'senderdomain'}.') '.$content{'time'}. |
'<br />'.&mt('Subject').': '.$content{'subject'}. |
'<br />'.&mt('Subject').': '.$content{'subject'}. |
'<br /><blockquote>'. |
'<br /><pre>'. |
&Apache::lontexconvert::msgtexconverted($content{'message'}). |
&Apache::lontexconvert::msgtexconverted($content{'message'}). |
'</blockquote><small>'. |
'</pre><small>'. |
&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox'). |
&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox'). |
'</small><br />'. |
'</small><br />'. |
'<input type=submit name="rec_'.$_.'" value="'.&mt('Confirm Receipt').'">'. |
'<input type=submit name="rec_'.$_.'" value="'.&mt('Confirm Receipt').'">'. |
Line 839 TABLEHEAD
|
Line 862 TABLEHEAD
|
foreach my $msg (@newmsgs) { |
foreach my $msg (@newmsgs) { |
$r->print(<<"ENDLINK"); |
$r->print(<<"ENDLINK"); |
<tr bgcolor="#FFBB77"> |
<tr bgcolor="#FFBB77"> |
<td><a href="/adm/email?display=$msg->{'msgid'}">$lt{'op'}</a></td> |
<td><a href="/adm/email?dismode=new&display=$msg->{'msgid'}">$lt{'op'}</a></td> |
ENDLINK |
ENDLINK |
foreach ('sendtime','from','fromdom','shortsub') { |
foreach ('sendtime','from','fromdom','shortsub') { |
$r->print("<td>$msg->{$_}</td>"); |
$r->print("<td>$msg->{$_}</td>"); |
Line 1241 sub disfacetoface {
|
Line 1264 sub disfacetoface {
|
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('. |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('. |
$content{'sendername'}.'@'. |
$content{'sendername'}.'@'. |
$content{'senderdomain'}.') '.$content{'time'}. |
$content{'senderdomain'}.') '.$content{'time'}. |
'<br /><blockquote>'. |
'<br /><pre>'. |
&Apache::lontexconvert::msgtexconverted($content{'message'}). |
&Apache::lontexconvert::msgtexconverted($content{'message'}). |
'</blockquote>'; |
'</pre>'; |
} |
} |
# Check to see if there were any messages. |
# Check to see if there were any messages. |
if ($result eq '') { |
if ($result eq '') { |
Line 1742 sub displaymessage {
|
Line 1765 sub displaymessage {
|
'<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs. |
'<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs. |
'"><b>Delete</b></a></td>'. |
'"><b>Delete</b></a></td>'. |
'<td><a href="/adm/email?'.$sqs. |
'<td><a href="/adm/email?'.$sqs. |
|
($ENV{'form.dismode'} eq 'new'?'&folder=new':''). |
'"><b>'.&mt('Back to Folder Display').'</b></a></td>'); |
'"><b>'.&mt('Back to Folder Display').'</b></a></td>'); |
if ($counter > 0){ |
if ($counter > 0){ |
$r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs. |
$r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs. |
Line 1989 sub handler {
|
Line 2013 sub handler {
|
['display','replyto','forward','markread','markdel','markunread', |
['display','replyto','forward','markread','markdel','markunread', |
'sendreply','compose','sendmail','critical','recname','recdom', |
'sendreply','compose','sendmail','critical','recname','recdom', |
'recordftf','sortedby','block','folder','startdis','interdis', |
'recordftf','sortedby','block','folder','startdis','interdis', |
'showcommentbaseurl']); |
'showcommentbaseurl','dismode']); |
$sqs='&sortedby='.$ENV{'form.sortedby'}; |
$sqs='&sortedby='.$ENV{'form.sortedby'}; |
|
|
# ------------------------------------------------------ They checked for email |
# ------------------------------------------------------ They checked for email |