--- loncom/interface/lonmsgdisplay.pm 2006/12/24 22:13:19 1.59
+++ loncom/interface/lonmsgdisplay.pm 2008/06/06 22:50:41 1.88
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.59 2006/12/24 22:13:19 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.88 2008/06/06 22:50:41 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,12 +33,13 @@ package Apache::lonmsgdisplay;
=head1 NAME
-Apache::lonmsg: supports internal messaging
+Apache::lonmsgdisplay: supports internal messaging
=head1 SYNOPSIS
-lonmsg provides routines for sending messages, receiving messages, and
-a handler to allow users to read, send, and delete messages.
+lonmsgdisplay provides a handler to allow users to read, send,
+and delete messages, and to create and delete message folders,
+and to move messages between folders.
=head1 OVERVIEW
@@ -93,25 +94,6 @@ addresses on their B'.&mt('Course members with current access').'
';
+ $result .= $tmptext;
+ }
+ if ($tmptext = &Apache::lonselstudent::render_student_list($expired_members,
+ "compemail",
+ "expired",
+ \%defaultUsers,
+ 1, "selectedusers",0)
+ ) {
+ $result .= ''.&mt('Course members with expired access').'
';
+ $result .= $tmptext;
+ }
+ if ($tmptext = &Apache::lonselstudent::render_student_list($future_members,
+ "compemail",
+ "future",
+ \%defaultUsers,
+ 1, "selectedusers", 0)
+ ) {
+ $result .= ''.&mt('Course members with future access').'
';
+ $result .= $tmptext;
+ }
return $result;
}
@@ -569,7 +567,7 @@ sub disgroup {
'recipients to select.');
return $result;
} else {
- $result = &mt('Select message recipients from the group members listed below.
');
+ $result = &mt('Select message recipients from the group members listed below.').'
';
my %Sortby = (
active => {},
previous => {},
@@ -743,20 +741,48 @@ sub discrit {
foreach my $key (sort(keys(%what))) {
my %content=&Apache::lonmsg::unpackagemsg($what{$key});
next if ($content{'senderdomain'} eq '');
- $result.='
'.&mt('From').': '.
-&Apache::loncommon::aboutmewrapper(
- &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
-$content{'sendername'}.':'.
- $content{'senderdomain'}.') '.$content{'time'}.
- '
'.&mt('Subject').': '.$content{'subject'}.
- ''.
- &Apache::lontexconvert::msgtexconverted($content{'message'}).
- '
'.
-&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox').
- '
'.
- ''.
- '';
+ $result .= &Apache::lonhtmlcommon::start_pick_box()
+ .&Apache::lonhtmlcommon::row_title(&mt('From'),undef,'LC_oddrow_value')
+ .''.&Apache::loncommon::aboutmewrapper(
+ &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).''
+ .' ('.$content{'sendername'}.':'.$content{'senderdomain'}.')'
+ .&Apache::lonhtmlcommon::row_closure(1)
+ .&Apache::lonhtmlcommon::row_title(&mt('Date'),undef,'LC_evenrow_value')
+ .$content{'time'}
+ .&Apache::lonhtmlcommon::row_closure(1)
+ .&Apache::lonhtmlcommon::row_title(&mt('Subject'),undef,'LC_oddrow_value')
+ .$content{'subject'}
+ .&Apache::lonhtmlcommon::row_closure(1)
+ .&Apache::lonhtmlcommon::row_title(&mt('Message'),undef,'LC_evenrow_value')
+ .''.&Apache::lontexconvert::msgtexconverted($content{'message'}).'
'
+ .&Apache::lonhtmlcommon::row_closure()
+ .&Apache::lonhtmlcommon::row_title('',undef,'LC_oddrow_value')
+ .'
';
}
# Check to see if there were any messages.
if ($result eq '') {
@@ -891,8 +917,7 @@ sub get_course_desc {
sub disall {
my ($r,$folder,$msgstatus)=@_;
- my %saveable = ('folder' => 'scalar',
- 'msgstatus' => 'scalar',
+ my %saveable = ('msgstatus' => 'scalar',
'sortedby' => 'scalar',
'interdis' => 'scalar',
);
@@ -924,28 +949,10 @@ sub disfolder {
nome => 'No messages have been selected to apply ths action to.',
chec => 'Check the checkbox for at least one message.',
);
+ my $jscript = &Apache::loncommon::check_uncheck_jscript();
$r->print(<'.&mt('There are no '.lc($statushash{$msgstatus}).' messages in this folder.').'
');
}
+ if ($numblocked > 0) {
+ $r->print(&blocked_in_folder($numblocked,$startblock,$endblock,
+ \%setters));
+ }
return;
}
my $interdis = $env{'form.interdis'};
@@ -1052,16 +1069,23 @@ ENDDISHEADER
}
my ($dis_name,$dis_domain) = ($fromname,$fromdomain);
if ($folder eq 'sent') {
- if (defined($recv_name) && !defined($recv_domain)) {
- $dis_name = join('
',@{$recv_name});
- $dis_domain = join('
',@{$recv_domain});
+ if (defined($recv_name) && defined($recv_domain)) {
+ if (ref($recv_name) eq 'ARRAY' &&
+ ref($recv_domain) eq 'ARRAY') {
+ $dis_name = join('
',@{$recv_name});
+ $dis_domain = join('
',@{$recv_domain});
+ }
} else {
my $msg_id = &unescape($origID);
my %message = &Apache::lonnet::get('nohist_email'.$suffix,
[$msg_id]);
my %content = &Apache::lonmsg::unpackagemsg($message{$msg_id});
- $dis_name = join('
',@{$content{'recuser'}});
- $dis_domain = join('
',@{$content{'recdomain'}});
+ if (ref($content{'recuser'}) eq 'ARRAY') {
+ $dis_name = join('
',@{$content{'recuser'}});
+ }
+ if (ref($content{'recdomain'}) eq 'ARRAY') {
+ $dis_domain = join('
',@{$content{'recdomain'}});
+ }
}
}
my $localsenttime = &Apache::lonlocal::locallocaltime($sendtime);
@@ -1072,7 +1096,7 @@ ENDDISHEADER
' value="'.$origID.'" />');
foreach my $item ($localsenttime,$dis_name,$dis_domain,$shortsubj) {
$r->print(''.(($status eq 'new')?'':'').
- ''.
+ ''.
$item.(($status eq 'new')?'':'').' ');
}
my $showstatus;
@@ -1097,11 +1121,11 @@ ENDDISHEADER
$r->print('
');
+ return;
+ }
+ $r->print('
'.
- '
'."\n".
- ''."\n".
+ '
'."\n".
+ ''."\n".
' '."\n".
''.&mt('Action').'
'."\n".
- ' ');
+
+ } else {
+ $r->print(&mt('The sender did not designate a reply to address for this message.').'');
+ return;
+ }
+ } else {
+ $r->print(&Apache::loncommon::aboutmewrapper(
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
$content{'sendername'}.':'.
- $content{'senderdomain'}.')'.
- ''.
- ''.
- '');
+ $content{'senderdomain'}.')');
+ $r->print(''.
+ '');
+ }
+ if ($content{'recipid'}) {
+ my @ccs = &retrieve_cc_recips('replying',%content);
+ if (@ccs > 0) {
+ my $replyall = qq|
+
+
+
+
+
+|;
+ my $cclist = join(' ',@ccs);
+ $r->print(''.&mt('Replying to').' ');
+ if ($content{'replytoaddr'}) {
+ my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'});
+ if ($replytoname ne '' && $replytodom ne '') {
+ $r->print(&Apache::loncommon::plainname($replytoname,
+ $replytodom).' ('.$replytoname.':'.
+ $replytodom.')');
+ $r->print(''.
+ ' ');
+ }
+ }
} else {
$r->print(&recipient_input_row($defdom,%lt));
}
@@ -1337,12 +1442,20 @@ $latexHelp.
} elsif ($broadcast ne 'upload') {
$subj_size = '50';
$r->print(&additional_rec_row(\%lt));
+ if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+ || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ '/'.$env{'request.course.sec'})) {
+ $r->print(&reply_to_row(\%lt));
+ }
$r->print(&msg_subject_row($dissub,\%lt,$subj_size));
$r->print(<<"ENDCOMP");
$latexHelp
'.&mt('Reply to other recipients').':
'.$replyall.''.$cclist.'
'); my $escmsgid=&escape($msgid); @@ -1965,15 +2102,33 @@ sub displaymessage { $counter++; } $r->print(''); + + my $see_anonymous; + my $from_student = 0; + if ($env{'request.course.id'} eq $content{'courseid'}) { + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $username = $content{'sendername'}.':'.$content{'senderdomain'}; + my %classlist_entry = + &Apache::lonnet::get('classlist',[$username],$cdom,$cnum); + if (exists($classlist_entry{$username})) { + $from_student = 1; + $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); + } + } + + my $number_of_messages = scalar(@messages); #subtract 1 for last index # start output &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'}); my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'}); # Functions - $r->print('