[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm
www
lon-capa-cvs@mail.lon-capa.org
Sun, 30 Jan 2005 23:32:30 -0000
www Sun Jan 30 18:32:30 2005 EDT
Modified files:
/loncom/interface lonmsg.pm
Log:
* Display Folder from viewing a new message goes back to
New Messages instead of INBOX.
* Notification email includes message text
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.130 loncom/interface/lonmsg.pm:1.131
--- loncom/interface/lonmsg.pm:1.130 Tue Jan 25 10:28:02 2005
+++ loncom/interface/lonmsg.pm Sun Jan 30 18:32:29 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.130 2005/01/25 15:28:02 albertel Exp $
+# $Id: lonmsg.pm,v 1.131 2005/01/30 23:32:29 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -239,9 +239,15 @@
# ==================================================== Send notification emails
sub sendnotification {
- my ($to,$touname,$toudom,$subj,$crit)=@_;
+ my ($to,$touname,$toudom,$subj,$crit,$text)=@_;
my $sender=$ENV{'environment.firstname'}.' '.$ENV{'environment.lastname'};
+ unless ($sender=~/\w/) {
+ $sender=$ENV{'user.name'}.'@'.$ENV{'user.domain'};
+ }
my $critical=($crit?' critical':'');
+ $text=~s/\<\;/\</gs;
+ $text=~s/\>\;/\>/gs;
+ $text=~s/\<\/*[^\>]+\>//gs;
my $url='http://'.
$Apache::lonnet::hostname{&Apache::lonnet::homeserver($touname,$toudom)}.
'/adm/email?username='.$touname.'&domain='.$toudom;
@@ -250,11 +256,15 @@
$subj
+=== Excerpt ============================================================
+$text
+========================================================================
+
Use
$url
-to access this message.
+to access the full message.
ENDMSG
&sendemail($to,'New'.$critical.' message from '.$sender,$body);
}
@@ -351,6 +361,7 @@
my $status='';
my $msgid='undefined';
unless (($message)&&($user)&&($domain)) { $status='empty'; };
+ my $text=$message;
my $homeserver=&Apache::lonnet::homeserver($user,$domain);
if ($homeserver ne 'no_host') {
($msgid,$message)=&packagemsg($subject,$message);
@@ -373,7 +384,8 @@
my %userenv = &Apache::lonnet::get('environment',['critnotification'],
$domain,$user);
if ($userenv{'critnotification'}) {
- &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1);
+ &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1,
+ $text);
}
# Log this
&Apache::lonnet::logthis(
@@ -448,6 +460,7 @@
# Check if allowed missing
my $status='';
my $msgid='undefined';
+ my $text=$message;
unless (($message)&&($user)&&($domain)) { $status='empty'; };
my $homeserver=&Apache::lonnet::homeserver($user,$domain);
if ($homeserver ne 'no_host') {
@@ -474,7 +487,8 @@
my %userenv = &Apache::lonnet::get('environment',['notification'],
$domain,$user);
if ($userenv{'notification'}) {
- &sendnotification($userenv{'notification'},$user,$domain,$subject,0);
+ &sendnotification($userenv{'notification'},$user,$domain,$subject,0,
+ $text);
}
&Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},
$ENV{'user.home'},
@@ -836,7 +850,7 @@
foreach my $msg (@newmsgs) {
$r->print(<<"ENDLINK");
<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
foreach ('sendtime','from','fromdom','shortsub') {
$r->print("<td>$msg->{$_}</td>");
@@ -1739,6 +1753,7 @@
'<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs.
'"><b>Delete</b></a></td>'.
'<td><a href="/adm/email?'.$sqs.
+ ($ENV{'form.dismode'} eq 'new'?'&folder=new':'').
'"><b>'.&mt('Back to Folder Display').'</b></a></td>');
if ($counter > 0){
$r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.
@@ -1986,7 +2001,7 @@
['display','replyto','forward','markread','markdel','markunread',
'sendreply','compose','sendmail','critical','recname','recdom',
'recordftf','sortedby','block','folder','startdis','interdis',
- 'showcommentbaseurl']);
+ 'showcommentbaseurl','dismode']);
$sqs='&sortedby='.$ENV{'form.sortedby'};
# ------------------------------------------------------ They checked for email