--- loncom/interface/lonmsg.pm 2004/05/17 19:00:45 1.101
+++ loncom/interface/lonmsg.pm 2004/09/09 08:00:12 1.105
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.101 2004/05/17 19:00:45 raeburn Exp $
+# $Id: lonmsg.pm,v 1.105 2004/09/09 08:00:12 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -219,10 +219,14 @@ sub sendemail {
my $msg = new Mail::Send;
$msg->to($to);
$msg->subject('[LON-CAPA] '.$subject);
+ my %oldENV=%ENV;
+ undef(%ENV);
if (my $fh = $msg->open()) {
print $fh $body;
$fh->close;
}
+ %ENV=%oldENV;
+ undef(%oldENV);
}
# ==================================================== Send notification emails
@@ -857,8 +861,8 @@ sub compout {
if ($replying) {
%message=&Apache::lonnet::get('nohist_email',[$replying]);
%content=&unpackagemsg($message{$replying});
- $dispcrit.='';
+ $dispcrit.='';
$func=&mt('Replying to');
$dissub=&mt('Reply').': '.$content{'subject'};
@@ -945,6 +949,31 @@ ENDUPLOAD
# ---------------------------------------------------- Display all face to face
+sub retrieve_instructor_comments {
+ my ($user,$domain)=@_;
+ my $target=$ENV{'form.grade_target'};
+ if (! $ENV{'request.course.id'}) { return; }
+ if (! &Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
+ return;
+ }
+ my %records=&Apache::lonnet::dump('nohist_email',
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
+ '%255b'.$user.'%253a'.$domain.'%255d');
+ my $result='';
+ foreach (sort(keys(%records))) {
+ my %content=&unpackagemsg($records{$_});
+ next if ($content{'senderdomain'} eq '');
+ next if ($content{'subject'} !~ /^Record/);
+ # $content{'message'}=~s/\n/\
/g;
+ $result.='Recorded by '.
+ $content{'sendername'}.'@'.$content{'senderdomain'}."\n";
+ $result.=
+ &Apache::lontexconvert::msgtexconverted($content{'message'})."\n";
+ }
+ return $result;
+}
+
sub disfacetoface {
my ($r,$user,$domain)=@_;
my $target=$ENV{'form.grade_target'};
@@ -963,8 +992,10 @@ sub disfacetoface {
$content{'message'}=~s/\n/\
/g;
if ($content{'subject'}=~/^Record/) {
$result.='
".&mt("No notes, face-to-face discussion records, or critical messages in this course.")."
"); + $r->print("".&mt("No notes, face-to-face discussion records, critical messages, or broadcast messages in this course.")."
"); } else { - $r->print('\textbf{'.&mt("No notes, face-to-face discussion records, or critical messages in this course.").'}\\\\'); + $r->print('\textbf{'.&mt("No notes, face-to-face discussion records, critical messages or broadcast messages in this course.").'}\\\\'); } } else { $r->print($result); @@ -1000,7 +1031,7 @@ sub facetoface { } &printheader($r, '/adm/email?recordftf=query', - "User Notes, Face-to-Face, Critical Messages"); + "User Notes, Face-to-Face, Critical Messages, Broadcast Messages"); # from query string if ($ENV{'form.recname'}) { $ENV{'form.recuname'}=$ENV{'form.recname'}; } @@ -1015,7 +1046,7 @@ sub facetoface { ('stdselect','recuname','recdomain'); my %lt=&Apache::lonlocal::texthash('user' => 'Username', 'dom' => 'Domain', - 'head' => 'User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course', + 'head' => 'User Notes, Records of Face-To-Face Discussions, Critical Messages, and Broadcast Messages in Course', 'subm' => 'Retrieve discussion and message records', 'newr' => 'New Record (record is visible to course faculty and staff)', 'post' => 'Post this Record'); @@ -1623,6 +1654,12 @@ sub handler { $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n". $content{'message'}; } + if ($ENV{'form.replyid'}) { + my $msgid=$ENV{'form.replyid'}; + my %message=&Apache::lonnet::get('nohist_email',[$msgid]); + %content=&unpackagemsg($message{$msgid},1); + &statuschange($msgid,'replied'); + } my %toaddr=(); undef %toaddr; if ($ENV{'form.sendmode'} eq 'group') { @@ -1667,6 +1704,13 @@ sub handler { &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, $content{'citation'}); + if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) { + &user_normal_msg_raw( + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + 'Broadcast ['.$recuname.':'.$recdomain.']', + $msgtxt); + } } $r->print($thismsg.'