--- loncom/interface/lonmsgdisplay.pm 2007/01/29 20:07:44 1.66
+++ loncom/interface/lonmsgdisplay.pm 2007/05/02 01:33:49 1.72
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.66 2007/01/29 20:07:44 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.72 2007/05/02 01:33:49 albertel 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 screen, but g
are much more useful than traditional email can be made to be, even
with HTML support.
-Right now, this document will cover just how to send a message, since
-it is likely you will not need to programmatically read messages,
-since lonmsg already implements that functionality.
-
-The routines used to package messages and unpackage messages are not
-only used by lonmsg when creating/extracting messages for LON-CAPA's
-internal messaging system, but also by lonnotify.pm which is available
-for use by Domain Coordinators to broadcast standard e-mail to specified
-users in their domain. The XML packaging used in the two cases is very
-similar. The differences are the use of $uname and
-$udom in stored internal messages, compared
-with $email in stored
-Domain Coordinator e-mail for the storage of information about
-recipients of the message/e-mail.
-
-=head1 FUNCTIONS
-
-=over 4
-
=cut
use strict;
@@ -119,6 +101,7 @@ use Apache::lonnet;
use HTML::TokeParser();
use Apache::Constants qw(:common);
use Apache::loncommon();
+use Apache::lonhtmlcommon();
use Apache::lontexconvert();
use HTML::Entities();
use Apache::lonlocal;
@@ -1054,16 +1037,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);
@@ -1196,7 +1186,13 @@ sub compout {
text=>"Display All Messages"});
&printheader($r,'/adm/email?compose=multiforward',
'Forwarding Multiple Messages');
- $r->print(&mt('Each of the [quant,_1,message] you checked will be forwarded to the recipient(s) you select below.',$multiforward).' ');
+ if ($multiforward > 1) {
+ $r->print(&mt('Each of the [quant,_1,message] you checked
+will be forwarded to the recipient(s) you select below.',$multiforward).' ');
+ } else {
+ $r->print(&mt('The message you checked will be forwarded to the recipient(s) you select below.').' ');
+ }
+
} else {
&printheader($r,'/adm/email?compose=upload',
'Distribute from Uploaded File');
@@ -1232,7 +1228,19 @@ sub compout {
&mt('Send copy to permanent email address (if known)').'
'.
'';
- }
+ }
+ if ($broadcast ne 'group') {
+ if (&Apache::lonnet::allowed('dff',$env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('dff',$env{'request.course.id'}.
+ '/'.$env{'request.course.sec'})) {
+
+ $dispcrit.='';
+ }
+ }
+
my %message;
my %content;
my $defdom=$env{'user.domain'};
@@ -1265,7 +1273,7 @@ sub compout {
if ($content{'baseurl'}) {
$disbase='';
if ($env{'user.adv'}) {
- $disbase.='