--- loncom/interface/lonmsgdisplay.pm 2006/07/19 10:20:11 1.35.2.3 +++ loncom/interface/lonmsgdisplay.pm 2006/11/29 05:54:34 1.43 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.35.2.3 2006/07/19 10:20:11 albertel Exp $ +# $Id: lonmsgdisplay.pm,v 1.43 2006/11/29 05:54:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -270,12 +270,14 @@ sub discourse { &Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); unshift @$current_members, (@$course_personnel); my %defaultUsers; + + $result .= ''."\n"; - $result = &Apache::lonselstudent::render_student_list($current_members, - "compemail", - "current", - \%defaultUsers, - 1,"selectedusers",1); + $result .= &Apache::lonselstudent::render_student_list($current_members, + "compemail", + "current", + \%defaultUsers, + 1,"selectedusers",1); $result .= &Apache::lonselstudent::render_student_list($expired_members, "compemail", @@ -345,7 +347,7 @@ sub disgroup { foreach my $status (@statustypes) { if (ref($numitems) eq 'HASH') { if ((defined($$numitems{$status})) && ($$numitems{$status})) { - $result.='
$lt{'ad'} username\@domain,username\@domain, ... + $lt{'ad'} | username:domain,username:domain, ...
| $lt{'sb'}: |
@@ -1079,14 +1077,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 @@ -1137,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'}); @@ -1165,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/) { @@ -1389,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) { @@ -1590,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) = @@ -1612,7 +1610,7 @@ sub build_block_table { my ($r,$startblock,$endblock,$setters) = @_; my %lt = &Apache::lonlocal::texthash( 'cacb' => 'Currently active communication blocks', - 'cour' => 'Course', + 'cour' => 'Course/Group', 'dura' => 'Duration', 'blse' => 'Block set by' ); @@ -1792,7 +1790,7 @@ sub header { my $extra = &Apache::loncommon::studentbrowser_javascript(); if ($baseurl) { - $extra .= ""); + foreach my $key (sort(keys(%msgs))) { + $r->print("\n".$msgs{$key}." "); $found=1; } unless ($found) { @@ -1908,9 +1906,10 @@ sub sendoffmail { } } elsif ($env{'form.sendmode'} eq 'upload') { foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) { - my ($rec,$txt)=split(/\s*\:\s*/,$line); + my ($rec,$txt) = ($line =~ /^([^:]+:[^:]+):(.*)$/); if ($txt) { - $rec=~s/\@/\:/; + $rec =~ s/^\s+//; + $rec =~ ~s/\s+$//; $toaddr{$rec}.=$txt."\n"; } } @@ -1920,8 +1919,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}=''; } @@ -2142,12 +2141,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).' '); |