--- loncom/interface/lonmsgdisplay.pm 2006/08/29 00:12:02 1.40
+++ loncom/interface/lonmsgdisplay.pm 2006/11/23 16:40:17 1.42
@@ -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.42 2006/11/23 16:40:17 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.
@@ -658,8 +658,8 @@ sub disnew {
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 +668,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 +694,8 @@ TABLEHEAD
");
+ foreach my $item ('sendtime','from','fromdom','shortsub','course') {
+ $r->print("
$msg->{$item}
");
}
$r->print("
");
}
@@ -766,7 +766,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('
'.&mt('Empty Folder').'
');
@@ -1135,8 +1135,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 +1163,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/) {
@@ -1387,35 +1387,35 @@ sub blockstore {
my $addtotal = 0;
my %blocking = ();
$r->print('
'.$lt{'head'}.'
');
- foreach (keys %env) {
- if ($_ =~ m/^form\.modify_(\w+)$/) {
+ foreach my $envkey (keys(%env)) {
+ if ($envkey =~ m/^form\.modify_(\w+)$/) {
$adds{$1} = $1;
$removals{$1} = $1;
$modtotal ++;
- } elsif ($_ =~ m/^form\.cancel_(\d+)$/) {
+ } elsif ($envkey =~ m/^form\.cancel_(\d+)$/) {
$cancels{$1} = $1;
unless ( defined($removals{$1}) ) {
$removals{$1} = $1;
$canceltotal ++;
}
- } elsif ($_ =~ m/^form\.add_(\d+)$/) {
+ } elsif ($envkey =~ m/^form\.add_(\d+)$/) {
$adds{$1} = $1;
$addtotal ++;
}
}
- foreach (keys %removals) {
- my $hashkey = $env{'form.key_'.$_};
+ foreach my $key (keys(%removals)) {
+ my $hashkey = $env{'form.key_'.$key};
&Apache::lonnet::del('comm_block',["$hashkey"],
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'}
);
}
- foreach (keys %adds) {
- unless ( defined($cancels{$_}) ) {
- my ($newstart,$newend) = &get_dates_from_form($_);
+ foreach my $key (keys(%adds)) {
+ unless ( defined($cancels{$key}) ) {
+ my ($newstart,$newend) = &get_dates_from_form($key);
my $newkey = $newstart.'____'.$newend;
- $blocking{$newkey} = $env{'user.name'}.':'.$env{'user.domain'}.':'.$env{'form.title_'.$_};
+ $blocking{$newkey} = $env{'user.name'}.':'.$env{'user.domain'}.':'.$env{'form.title_'.$key};
}
}
if ($addtotal + $modtotal > 0) {
@@ -1588,7 +1588,7 @@ sub blockcheck {
$setters->{$course}{'staff'} = [];
$setters->{$course}{'times'} = [];
my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum);
- foreach my $record (keys %records) {
+ foreach my $record (keys(%records)) {
my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/);
if ($start <= time && $end >= time) {
my ($staff_name,$staff_dom,$title) =
@@ -1790,7 +1790,7 @@ sub header {
my $extra = &Apache::loncommon::studentbrowser_javascript();
if ($baseurl) {
- $extra .= "";
+ $extra .= "";
}
$r->print(&Apache::loncommon::start_page('Communication and Messages',
$extra));
@@ -1814,9 +1814,9 @@ sub storecomment {
my ($r)=@_;
my $msgtxt=&Apache::lonfeedback::clear_out_html($env{'form.message'});
my $cleanmsgtxt='';
- foreach (split(/[\n\r]/,$msgtxt)) {
- unless ($_=~/^\s*(\>|\>\;)/) {
- $cleanmsgtxt.=$_."\n";
+ foreach my $line (split(/[\n\r]/,$msgtxt)) {
+ unless ($line=~/^\s*(\>|\>\;)/) {
+ $cleanmsgtxt.=$line."\n";
}
}
my $key=&escape($env{'form.baseurl'}).'___'.time;
@@ -1833,8 +1833,8 @@ sub storedcommentlisting {
$r->print(&mt('No stored comments yet.'));
} else {
my $found=0;
- foreach (sort keys %msgs) {
- $r->print("\n".$msgs{$_}."");
+ foreach my $key (sort(keys(%msgs))) {
+ $r->print("\n".$msgs{$key}."");
$found=1;
}
unless ($found) {
@@ -1918,8 +1918,8 @@ sub sendoffmail {
}
}
if ($env{'form.additionalrec'}) {
- foreach (split(/\,/,$env{'form.additionalrec'})) {
- my ($auname,$audom)=split(/\@/,$_);
+ foreach my $rec (split(/\,/,$env{'form.additionalrec'})) {
+ my ($auname,$audom)=split(/\@/,$rec);
if (($auname ne "") && ($audom ne "")) {
$toaddr{$auname.':'.$audom}='';
}
@@ -2140,12 +2140,12 @@ sub handler {
} elsif ($env{'form.confirm'}) {
&printheader($r,'','Confirmed Receipt');
my $replying = 0;
- foreach (keys %env) {
- if ($_=~/^form\.rec\_(.*)$/) {
+ foreach my $envkey (keys(%env)) {
+ if ($envkey=~/^form\.rec\_(.*)$/) {
$r->print(''.&mt('Confirming Receipt').': '.
&Apache::lonmsg::user_crit_received($1).' ');
}
- if ($_=~/^form\.reprec\_(.*)$/) {
+ if ($envkey=~/^form\.reprec\_(.*)$/) {
my $msgid=$1;
$r->print(''.&mt('Confirming Receipt').': '.
&Apache::lonmsg::user_crit_received($msgid).' ');