--- loncom/interface/lonmsg.pm 2002/07/29 22:17:05 1.36
+++ loncom/interface/lonmsg.pm 2002/12/27 14:59:42 1.44
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.36 2002/07/29 22:17:05 www Exp $
+# $Id: lonmsg.pm,v 1.44 2002/12/27 14:59:42 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -119,6 +119,17 @@ sub unpackmsgid {
return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid});
}
+# ============================================================= Check for email
+
+sub newmail {
+ if ((time-$ENV{'user.mailcheck.time'})>300) {
+ my %what=&Apache::lonnet::get('email_status',['recnewemail']);
+ &Apache::lonnet::appenv('user.mailcheck.time'=>time);
+ if ($what{'recnewemail'}>0) { return 1; }
+ }
+ return 0;
+}
+
# =============================== Automated message to the author of a resource
sub author_res_msg {
@@ -141,7 +152,7 @@ sub author_res_msg {
# ================================================== Critical message to a user
-sub user_crit_msg {
+sub user_crit_msg_raw {
my ($user,$domain,$subject,$message,$sendback)=@_;
# Check if allowed missing
my $status='';
@@ -168,6 +179,27 @@ sub user_crit_msg {
return $status;
}
+# New routine that respects "forward" and calls old routine
+
+sub user_crit_msg {
+ my ($user,$domain,$subject,$message,$sendback)=@_;
+ my $status='';
+ my %userenv = &Apache::lonnet::get('environment',['msgforward'],
+ $domain,$user);
+ my $msgforward=$userenv{'msgforward'};
+ if ($msgforward) {
+ foreach (split(/\,/,$msgforward)) {
+ my ($forwuser,$forwdomain)=split(/\:/,$_);
+ $status.=
+ &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message,
+ $sendback).' ';
+ }
+ } else {
+ $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback);
+ }
+ return $status;
+}
+
# =================================================== Critical message received
sub user_crit_received {
@@ -178,9 +210,10 @@ sub user_crit_received {
&user_normal_msg($contents{'sendername'},$contents{'senderdomain'},
'Receipt: '.$ENV{'user.name'}.' at '.$ENV{'user.domain'},
'User '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}.
- ' acknowledged receipt of message "'.
- $contents{'subject'}.'" dated '.$contents{'time'}.".\n\n"
- .'Message ID: '.$contents{'msgid'}):'no msg req');
+ ' acknowledged receipt of message'."\n".' "'.
+ $contents{'subject'}.'"'."\n".'dated '.
+ $contents{'time'}.".\n"
+ ):'no msg req');
$status.=' trans: '.
&Apache::lonnet::put(
'nohist_email',{$contents{'msgid'} => $message{$msgid}});
@@ -195,7 +228,7 @@ sub user_crit_received {
# ======================================================== Normal communication
-sub user_normal_msg {
+sub user_normal_msg_raw {
my ($user,$domain,$subject,$message,$citation)=@_;
# Check if allowed missing
my $status='';
@@ -208,6 +241,8 @@ sub user_normal_msg {
'put:'.$domain.':'.$user.':nohist_email:'.
&Apache::lonnet::escape($msgid).'='.
&Apache::lonnet::escape($message),$homeserver);
+ &Apache::lonnet::put
+ ('email_status',{'recnewemail'=>time},$domain,$user);
} else {
$status='no_host';
}
@@ -217,6 +252,29 @@ sub user_normal_msg {
return $status;
}
+# New routine that respects "forward" and calls old routine
+
+sub user_normal_msg {
+ my ($user,$domain,$subject,$message,$citation)=@_;
+ my $status='';
+ my %userenv = &Apache::lonnet::get('environment',['msgforward'],
+ $domain,$user);
+ my $msgforward=$userenv{'msgforward'};
+ if ($msgforward) {
+ foreach (split(/\,/,$msgforward)) {
+ my ($forwuser,$forwdomain)=split(/\:/,$_);
+ $status.=
+ &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message,
+ $citation).' ';
+ }
+ } else {
+ $status=
+ &user_normal_msg_raw($user,$domain,$subject,$message,$citation);
+ }
+ return $status;
+}
+
+
# =============================================================== Status Change
sub statuschange {
@@ -314,9 +372,12 @@ sub discrit {
my %content=&unpackagemsg($what{$_});
next if ($content{'senderdomain'} eq '');
$content{'message'}=~s/\n/\
/g;
- $result.='
'. &Apache::lontexconvert::msgtexconverted($content{'message'}). ''. @@ -358,7 +419,7 @@ sub comprep { +ENDBFORM + } +} + # ===================================================================== Handler sub handler { @@ -532,22 +638,27 @@ sub handler { # --------------------------- Get query string for limited number of parameters &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['display','replyto','forward','markread','markdel','markunread', - 'sendreply','compose','sendmail','critical']); + 'sendreply','compose','sendmail','critical','recname','recdom', + 'recordftf']); +# ------------------------------------------------------ They checked for email + &Apache::lonnet::put('email_status',{'recnewemail'=>0}); # --------------------------------------------------------------- Render Output - $r->print('
'. '
Functions: | '. 'Forward | '. 'Mark Unread | '. + 'Delete | '. 'Display all Messages | '. '
'. &Apache::lontexconvert::msgtexconverted($content{'message'}). @@ -623,6 +736,8 @@ sub handler { &disall($r); } elsif ($ENV{'form.compose'}) { &compout($r,'',$ENV{'form.compose'}); + } elsif ($ENV{'form.recordftf'}) { + &facetoface($r,$ENV{'form.recordftf'}); } elsif ($ENV{'form.sendmail'}) { my %content=(); undef %content;