--- loncom/interface/lonmsg.pm 2004/12/15 01:17:09 1.124
+++ loncom/interface/lonmsg.pm 2005/01/30 23:32:29 1.131
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.124 2004/12/15 01:17:09 www 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 @@ sub sendemail {
# ==================================================== 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;
my $url='http://'.
$Apache::lonnet::hostname{&Apache::lonnet::homeserver($touname,$toudom)}.
'/adm/email?username='.$touname.'&domain='.$toudom;
@@ -250,11 +256,15 @@ You received a$critical message from $se
$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 @@ sub user_crit_msg_raw {
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 @@ sub user_crit_msg_raw {
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 @@ sub user_normal_msg_raw {
# 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 @@ sub user_normal_msg_raw {
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'},
@@ -527,9 +541,11 @@ sub folderlist {
'critical' => &mt('Critical'),
'sent' => &mt('Sent Messages'),
map { $_ => $_ } @allfolders)).
- ' '.&mt('Show').' '.
- &Apache::loncommon::select_form($interdis,'interdis',
-(' 10' => '10', ' 20' => '20', ' 50' => '50', '100' => '100', '200' => '200')).
+ ' '.&mt('Show').
+ ''.
'
'.
''.
($folder=~/^(new|critical)/?'':'');
@@ -588,7 +604,6 @@ sub makefolder {
sub movemsg {
my ($msgid,$srcfolder,$trgfolder)=@_;
- my $unmsgid=&Apache::lonnet::unescape($msgid);
my $srcsuffix=&foldersuffix($srcfolder);
my $trgsuffix=&foldersuffix($trgfolder);
@@ -597,16 +612,13 @@ sub movemsg {
&Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}});
# Copy status
- my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$unmsgid]);
- &Apache::lonnet::put('email_status'.$trgsuffix,{$unmsgid => $status{$unmsgid}});
-# See if was deleted -> becomes "read" in trash
- my $currentstatus=(&unpackmsgid($status{$unmsgid}),$srcfolder);
- if ($currentstatus eq 'deleted') {
- &statuschange($msgid,'read',$trgfolder);
+ unless ($trgfolder eq 'trash') {
+ my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]);
+ &Apache::lonnet::put('email_status'.$trgsuffix,{$msgid => $status{$msgid}});
}
# Delete orginals
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]);
- &Apache::lonnet::del('email_status'.$srcsuffix,[$unmsgid]);
+ &Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]);
}
# ======================================================= Display a course list
@@ -677,7 +689,7 @@ ENDDISHEADER
&Apache::loncoursedata::CL_FULLNAME(),
&Apache::loncoursedata::CL_SECTION()]);
next if ($status ne 'Active');
- my $key = 'send_to_&&&'.$section.'&&&'.$student;
+ my $key = 'send_to_&&&'.$section.'&&&_'.$student;
if (! defined($fullname) || $fullname eq '') { $fullname = $sname; }
$r->print('
'. + $r->print("\n
". ''.&mt('Check All').' '. ''.&mt('Uncheck All').'
'. ''); @@ -997,7 +1012,8 @@ ENDDISHEADER &Apache::loncommon::select_form('','movetofolder', ( map { $_ => $_ } @allfolders)) ); - $r->print(''); + my $postedstartdis=$startdis+1; + $r->print(''); if ($numblocked > 0) { my $beginblock = &Apache::lonlocal::locallocaltime($startblock); my $finishblock = &Apache::lonlocal::locallocaltime($endblock); @@ -1236,9 +1252,9 @@ sub disfacetoface { &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. $content{'sendername'}.'@'. $content{'senderdomain'}.') '.$content{'time'}. - ''. + ''; + ''; } # Check to see if there were any messages. if ($result eq '') { @@ -1736,9 +1752,9 @@ sub displaymessage { '">'.&mt('Mark Unread').''. ''. &Apache::lontexconvert::msgtexconverted($content{'message'}). - '