--- loncom/interface/lonmsg.pm 2004/05/03 19:10:39 1.98
+++ loncom/interface/lonmsg.pm 2004/09/28 14:12:40 1.109
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.98 2004/05/03 19:10:39 sakharuk Exp $
+# $Id: lonmsg.pm,v 1.109 2004/09/28 14:12:40 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -74,6 +74,18 @@ email program, so they have full access
interface, or other features they may wish to use in response to the
student's query.
+=item * B: LON-CAPA can block display of e-mails that are
+sent to a student during an online exam. A course coordinator or
+instructor can set an open and close date/time for scheduled online
+exams in a course. If a user uses the LON-CAPA internal messaging
+system to display e-mails during the scheduled blocking event,
+display of all e-mail sent during the blocking period will be
+suppressed, and a message of explanation, including details of the
+currently active blocking periods will be displayed instead. A user
+who has a course coordinator or instructor role in a course will be
+unaffected by any blocking periods for the course, unless the user
+also has a student role in the course, AND has selected the student role.
+
=back
Users can ask LON-CAPA to forward messages to conventional e-mail
@@ -105,11 +117,14 @@ use Apache::loncommunicate;
# Querystring component with sorting type
my $sqs;
+my $startdis;
+my $interdis;
# ===================================================================== Package
sub packagemsg {
- my ($subject,$message,$citation,$baseurl,$attachmenturl)=@_;
+ my ($subject,$message,$citation,$baseurl,$attachmenturl,
+ $recuser,$recdomain)=@_;
$message =&HTML::Entities::encode($message,'<>&"');
$citation=&HTML::Entities::encode($citation,'<>&"');
$subject =&HTML::Entities::encode($subject,'<>&"');
@@ -144,6 +159,8 @@ sub packagemsg {
''.$ENV{'request.role'}.''.
''.$ENV{'request.filename'}.''.
''.$msgid.''.
+ ''.$recuser.''.
+ ''.$recdomain.''.
''.$message.'';
if (defined($citation)) {
$result.=''.$citation.'';
@@ -172,13 +189,15 @@ sub unpackagemsg {
}
}
if ($content{'attachmenturl'}) {
- my ($fname,$ft)=($content{'attachmenturl'}=~/\/(\w+)\.(\w+)$/);
+ my ($fname)=($content{'attachmenturl'}=~m|/([^/]+)$|);
if ($notoken) {
- $content{'message'}.='
'.
&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox').
@@ -611,25 +705,35 @@ $content{'sendername'}.'@'.
# Check to see if there were any messages.
if ($result eq '') {
$result = "
".&mt('You have no critical messages.')."
".
- ''.&mt('Select a course').'';
+ ''.&mt('Select a course').' '.
+ ''.&mt('Communicate').'';
} else {
$r->print($header);
}
$r->print($result);
- $r->print('');
+ $r->print('');
}
sub sortedmessages {
- my @messages = &Apache::lonnet::getkeys('nohist_email');
+ my ($blocked,$startblock,$endblock,$numblocked,$folder) = @_;
+ my $suffix=&foldersuffix($folder);
+ my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix);
#unpack the varibles and repack into temp for sorting
my @temp;
foreach (@messages) {
my $msgid=&Apache::lonnet::escape($_);
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
- &Apache::lonmsg::unpackmsgid($msgid);
+ &Apache::lonmsg::unpackmsgid($msgid,$folder);
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,
$msgid);
- push @temp ,\@temp1;
+ # Check whether message was sent during blocking period.
+ if ($sendtime >= $startblock && ($sendtime <= $endblock && $endblock > 0) ) {
+ my $escid = &Apache::lonnet::unescape($msgid);
+ $$blocked{$escid} = 'ON';
+ $$numblocked ++;
+ } else {
+ push @temp ,\@temp1;
+ }
}
#default sort
@temp = sort {$a->[0] <=> $b->[0]} @temp;
@@ -669,8 +773,14 @@ sub sortedmessages {
# ======================================================== Display all messages
sub disall {
- my $r=shift;
- $r->print(<print(<
function checkall() {
for (i=0; i
ENDDISHEADER
- $r->print('