--- loncom/interface/lonmsgdisplay.pm 2006/04/23 07:13:21 1.11 +++ loncom/interface/lonmsgdisplay.pm 2006/04/25 20:02:30 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.11 2006/04/23 07:13:21 albertel Exp $ +# $Id: lonmsgdisplay.pm,v 1.14 2006/04/25 20:02:30 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -338,7 +338,7 @@ ENDDISHEADER if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } $r->print(''.$sname.'@'.$sdom.''.$section. + $fullname.''.$sname.':'.$sdom.''.$section. ''); } $r->print(''); @@ -359,7 +359,7 @@ sub discrit { $result.='
'.&mt('From').': '. &Apache::loncommon::aboutmewrapper( &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. -$content{'sendername'}.'@'. +$content{'sendername'}.':'. $content{'senderdomain'}.') '.$content{'time'}. '
'.&mt('Subject').': '.$content{'subject'}. '
'.
@@ -867,7 +867,7 @@ sub compout {
 	    $r->print(''.&mt('Replying to').' '.
 		      &Apache::loncommon::aboutmewrapper(
 							 &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
-		      $content{'sendername'}.'@'.
+		      $content{'sendername'}.':'.
 		      $content{'senderdomain'}.')'.
 		      ''.
 		      ''.
@@ -960,7 +960,7 @@ sub retrieve_instructor_comments {
         next if ($content{'subject'} !~ /^Record/);
 	# &Apache::lonfeedback::newline_to_br(\$content{'message'});
 	$result.='Recorded by '.
-            $content{'sendername'}.'@'.$content{'senderdomain'}."\n";
+            $content{'sendername'}.':'.$content{'senderdomain'}."\n";
         $result.=
             &Apache::lontexconvert::msgtexconverted($content{'message'})."\n";
      }
@@ -1018,7 +1018,7 @@ sub disfacetoface {
         $result.=&mt('By').': '.
 &Apache::loncommon::aboutmewrapper(
  &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
-$content{'sendername'}.'@'.
+$content{'sendername'}.':'.
             $content{'senderdomain'}.') '.$content{'time'}.
             '
'.
               &Apache::lontexconvert::msgtexconverted($content{'message'}).
@@ -1232,7 +1232,7 @@ sub blockstore {
         unless ( defined($cancels{$_}) ) {
             my ($newstart,$newend) = &get_dates_from_form($_);
             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_'.$_};
         }
     }
     if ($addtotal + $modtotal > 0) {
@@ -1319,8 +1319,14 @@ END
         my ($start,$end) = split/____/,$_;
         my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
         my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
-        my ($setter,$title) = split/:/,$$records{$_};
-        my ($setuname,$setudom) = split/@/,$setter;
+	my (@data,$setuname,$setudom,$title);
+	@data = split(/:/,$$records{$_},3);
+	if (scalar(@data) eq 2) {
+	    $title = $data[1];
+	    ($setuname,$setudom) = split(/@/,$data[0]);
+	} else {
+	    ($setuname,$setudom,$title) = @data;
+	}
         my $settername = &Apache::loncommon::plainname($setuname,$setudom);
         $r->print(<<"END");
        
@@ -1487,7 +1493,7 @@ END
             $closeblock= &Apache::lonlocal::locallocaltime($closeblock);
             $r->print(''.$courseinfo{'description'}.''.
                       ''.$openblock.' to '.$closeblock.''.
-                      ''.$fullname.' ('.$uname.'@'.$udom.
+                      ''.$fullname.' ('.$uname.':'.$udom.
                       ')');
         }
     }
@@ -1719,17 +1725,17 @@ sub sendoffmail {
 	    %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1);
 	    &statuschange($msgid,'replied',$folder);
 	}
-	my %toaddr=();
-	undef %toaddr;
+
+	my %toaddr;
 	if ($env{'form.sendmode'} eq 'group') {
-	    foreach (keys %env) {
-		if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
+	    foreach my $address (keys(%env)) {
+		if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
 		    $toaddr{$1}='';
 		}
 	    }
 	} elsif ($env{'form.sendmode'} eq 'upload') {
-	    foreach (split(/[\n\r\f]+/,$env{'form.upfile'})) {
-		my ($rec,$txt)=split(/\s*\:\s*/,$_);
+	    foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) {
+		my ($rec,$txt)=split(/\s*\:\s*/,$line);
 		if ($txt) {
 		    $rec=~s/\@/\:/;
 		    $toaddr{$rec}.=$txt."\n";
@@ -1761,33 +1767,43 @@ sub sendoffmail {
             $savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'});
         }
 	
-	foreach (keys %toaddr) {
-	    my ($recuname,$recdomain)=split(/\:/,$_);
+	foreach my $address (sort(keys(%toaddr))) {
+	    my ($recuname,$recdomain)=split(/\:/,$address);
             my $msgtxt = $savemsg;
-	    if ($toaddr{$_}) { $msgtxt.='
'.$toaddr{$_}; } - my $thismsg; + if ($toaddr{$address}) { $msgtxt.='
'.$toaddr{$address}; } + my @thismsg; if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && (&Apache::lonnet::allowed('srm',$env{'request.course.id'}) || &Apache::lonnet::allowed('srm',$env{'request.course.id'}. '/'.$env{'request.course.sec'}))) { - $r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': '); - $thismsg=&Apache::lonmsg::user_crit_msg($recuname,$recdomain,$msgsubj,$msgtxt, - $env{'form.sendbck'},$env{'form.permanent'}, - \$sentmessage{$_}); + $r->print(&mt('Sending critical message').' '.$recuname.':'.$recdomain.': '); + @thismsg= + &Apache::lonmsg::user_crit_msg($recuname,$recdomain, + $msgsubj,$msgtxt, + $env{'form.sendbck'}, + $env{'form.permanent'}, + \$sentmessage{$address}); } else { - $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); - $thismsg=&Apache::lonmsg::user_normal_msg($recuname,$recdomain,$msgsubj,$msgtxt, - $content{'citation'},undef,undef,$env{'form.permanent'},\$sentmessage{$_}); + $r->print(&mt('Sending').' '.$recuname.':'.$recdomain.': '); + @thismsg= + &Apache::lonmsg::user_normal_msg($recuname,$recdomain, + $msgsubj,$msgtxt, + $content{'citation'}, + undef,undef, + $env{'form.permanent'}, + \$sentmessage{$address}); } if (($env{'request.course.id'}) && (($msgtype eq 'critical') || ($env{'form.sendmode'} eq 'group'))) { - $specialmsg_status{$recuname.':'.$recdomain} = $thismsg; - if ($thismsg eq 'ok') { - $numspecial ++; - } + $specialmsg_status{$recuname.':'.$recdomain} = + join(' ',@thismsg); + foreach my $result (@thismsg) { + if ($result eq 'ok') { + $numspecial++; + } + } } - $r->print($thismsg.'
'); - $sendstatus.=' '.$thismsg; + $sendstatus.=' '.join(' ',@thismsg); } if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group') || ($msgtype eq 'critical'))) { @@ -1810,10 +1826,11 @@ sub sendoffmail { } if ($specialresult eq 'ok') { my $record_sent; - my @recusers = (); - my @recudoms = (); - my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) = - split(/\:/,&Apache::lonnet::unescape($specialmsgid)); + my @recusers; + my @recudoms; + my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) = + split(/\:/,&Apache::lonnet::unescape($specialmsgid)); + foreach my $recipient (sort(keys(%toaddr))) { if ($specialmsg_status{$recipient} eq 'ok') { my $usersubj = $subj_prefix.'['.$recipient.']'; @@ -1825,15 +1842,15 @@ sub sendoffmail { &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,$subj_prefix. ' ['.$recipient.']',$msgsubj,undef, undef,undef,undef,$usermsgid,undef,undef,$specialmsgid); - my ($uname,$udom) = split/:/,$recipient; + my ($uname,$udom) = split(/:/,$recipient); push(@recusers,$uname); push(@recudoms,$udom); } } if (@recusers) { my $specialmessage; - my $sentsubj = $subj_prefix.' ('.$numspecial.' sent) '. - $msgsubj; + my $sentsubj = + $subj_prefix.' ('.$numspecial.' sent) '.$msgsubj; $sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); my $sentmsgid = &Apache::lonmsg::buildmsgid($stamp,$sentsubj,$msgname,