--- loncom/interface/lonmsgdisplay.pm 2006/08/29 00:12:02 1.40
+++ loncom/interface/lonmsgdisplay.pm 2006/11/29 07:46:39 1.44
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.40 2006/08/29 00:12:02 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.44 2006/11/29 07:46:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -486,8 +486,8 @@ sub discrit {
'';
my %what=&Apache::lonnet::dump('critical');
my $result = '';
- foreach (sort keys %what) {
- my %content=&Apache::lonmsg::unpackagemsg($what{$_});
+ foreach my $key (sort(keys(%what))) {
+ my %content=&Apache::lonmsg::unpackagemsg($what{$key});
next if ($content{'senderdomain'} eq '');
$result.='
'.&mt('From').': '.
&Apache::loncommon::aboutmewrapper(
@@ -500,8 +500,8 @@ $content{'sendername'}.':'.
''.
&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox').
' '.
- ''.
- ''.
+ '';
}
# Check to see if there were any messages.
@@ -649,17 +649,15 @@ sub disnew {
my @msgids = sort(&Apache::lonnet::getkeys('nohist_email'));
my @newmsgs;
my %setters = ();
- my $startblock = 0;
- my $endblock = 0;
my %blocked = ();
my $numblocked = 0;
# Check for blocking of display because of scheduled online exams.
- &blockcheck(\%setters,\$startblock,\$endblock);
+ my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com');
my %status_cache =
&Apache::lonnet::get('email_status',\@msgids);
my %descriptions;
- foreach (@msgids) {
- my $msgid=&escape($_);
+ foreach my $id (@msgids) {
+ my $msgid=&escape($id);
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)=
&Apache::lonmsg::unpackmsgid($msgid,undef,undef,\%status_cache);
if (defined($sendtime) && $sendtime!~/error/) {
@@ -668,7 +666,7 @@ sub disnew {
$sendtime = &Apache::lonlocal::locallocaltime($sendtime);
if ($status eq 'new') {
if ($numsendtime >= $startblock && ($numsendtime <= $endblock && $endblock > 0) ) {
- $blocked{$_} = 'ON';
+ $blocked{$id} = 'ON';
$numblocked ++;
} else {
push @newmsgs, {
@@ -694,8 +692,8 @@ TABLEHEAD
");
+ foreach my $item ('sendtime','from','fromdom','shortsub','course') {
+ $r->print("
$msg->{$item}
");
}
$r->print("
");
}
@@ -715,7 +713,8 @@ ENDLINK
}
$r->print(
&mt('display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams').'.');
- &build_block_table($r,$startblock,$endblock,\%setters);
+ $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -740,10 +739,8 @@ sub disfolder {
my ($r,$folder)=@_;
my %blocked = ();
my %setters = ();
- my $startblock;
- my $endblock;
my $numblocked = 0;
- &blockcheck(\%setters,\$startblock,\$endblock);
+ my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com');
$r->print(<
function checkall() {
@@ -766,7 +763,7 @@ sub disfolder {
ENDDISHEADER
my $fsqs='&folder='.$folder;
- my @temp=sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
+ my @temp=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
my $totalnumber=$#temp+1;
unless ($totalnumber>0) {
$r->print('
'.
$numblocked.' '.&mt('message(s) is/are not viewable because display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams.'));
- &build_block_table($r,$startblock,$endblock,\%setters);
+ $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -1039,7 +1037,7 @@ sub compout {
my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
if ($broadcast ne 'upload') {
$r->print(<<"ENDCOMP");
-
@@ -1077,14 +1075,14 @@ Subject:
The file format for the uploaded portion of the message is:
-username1\@domain1: text
-username2\@domain2: text
-username3\@domain1: text
+username1:domain1: text
+username2:domain2: text
+username3:domain1: text
The messages will be assembled from all lines with the respective
-username\@domain, and appended to the general message text.
+username:domain, and appended to the general message text.
$dispcrit
@@ -1135,8 +1133,8 @@ sub retrieve_instructor_comments {
$env{'course.'.$env{'request.course.id'}.'.num'},
'%255b'.$user.'%253a'.$domain.'%255d');
my $result='';
- foreach (sort(keys(%records))) {
- my %content=&Apache::lonmsg::unpackagemsg($records{$_});
+ foreach my $key (sort(keys(%records))) {
+ my %content=&Apache::lonmsg::unpackagemsg($records{$key});
next if ($content{'senderdomain'} eq '');
next if ($content{'subject'} !~ /^Record/);
# &Apache::lonfeedback::newline_to_br(\$content{'message'});
@@ -1163,8 +1161,8 @@ sub disfacetoface {
$env{'course.'.$env{'request.course.id'}.'.num'},
'%255b'.$user.'%253a'.$domain.'%255d');
my $result='';
- foreach (sort keys %records) {
- my %content=&Apache::lonmsg::unpackagemsg($records{$_});
+ foreach my $key (sort(keys(%records))) {
+ my %content=&Apache::lonmsg::unpackagemsg($records{$key});
next if ($content{'senderdomain'} eq '');
&Apache::lonfeedback::newline_to_br(\$content{'message'});
if ($content{'subject'}=~/^Record/) {
@@ -1311,8 +1309,8 @@ ENDBFORM
sub examblock {
my ($r,$action) = @_;
unless ($env{'request.course.id'}) { return;}
- if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
- && ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ if (!&Apache::lonnet::allowed('dcm',$env{'request.course.id'})
+ && ! &Apache::lonnet::allowed('dcm',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})) {
$r->print('Not allowed');
return;
@@ -1331,6 +1329,7 @@ sub examblock {
'dura' => 'Duration',
'setb' => 'Set by',
'even' => 'Event',
+ 'blck' => 'Blocked?',
'actn' => 'Action',
'star' => 'Start',
'endd' => 'End'
@@ -1387,35 +1386,40 @@ sub blockstore {
my $addtotal = 0;
my %blocking = ();
$r->print('