Diff for /loncom/interface/lonmsg.pm between versions 1.162 and 1.167

version 1.162, 2005/12/09 20:54:26 version 1.167, 2006/01/03 04:17:02
Line 105  users in their domain.  The XML packagin Line 105  users in their domain.  The XML packagin
 similar.  The differences are the use of <recuser>$uname</recuser> and   similar.  The differences are the use of <recuser>$uname</recuser> and 
 <recdomain>$udom</recdomain> in stored internal messages, compared   <recdomain>$udom</recdomain> in stored internal messages, compared 
 with <recipient username="$uname:$udom">$email</recipient> in stored  with <recipient username="$uname:$udom">$email</recipient> in stored
 Domain Coordinator e-mail for teh storage of information about   Domain Coordinator e-mail for the storage of information about 
 recipients of the message/e-mail.  recipients of the message/e-mail.
   
 =head1 FUNCTIONS  =head1 FUNCTIONS
Line 266  sub buildmsgid { Line 266  sub buildmsgid {
 }  }
   
 sub unpackmsgid {  sub unpackmsgid {
     my ($msgid,$folder)=@_;      my ($msgid,$folder,$skipstatus)=@_;
     $msgid=&Apache::lonnet::unescape($msgid);      $msgid=&Apache::lonnet::unescape($msgid);
     my $suffix=&foldersuffix($folder);      my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$fromcid,
     my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$fromcid)=split(/\:/,                       $processid)=split(/\:/,&Apache::lonnet::unescape($msgid));
                           &Apache::lonnet::unescape($msgid));      if (!defined($processid)) { $fromcid = ''; }
     my %status=&Apache::lonnet::get('email_status'.$suffix,[$msgid]);      my %status=();
     if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }      unless ($skipstatus) {
     unless ($status{$msgid}) { $status{$msgid}='new'; }          my $suffix=&foldersuffix($folder);
           %status=&Apache::lonnet::get('email_status'.$suffix,[$msgid]);
           if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
           unless ($status{$msgid}) { $status{$msgid}='new'; }
       }
     return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid},$fromcid);      return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid},$fromcid);
 }  }
   
Line 853  sub sortedmessages { Line 857  sub sortedmessages {
     my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix);      my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix);
     #unpack the varibles and repack into temp for sorting      #unpack the varibles and repack into temp for sorting
     my @temp;      my @temp;
       my %descriptions;
     foreach (@messages) {      foreach (@messages) {
  my $msgid=&Apache::lonnet::escape($_);   my $msgid=&Apache::lonnet::escape($_);
  my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)=   my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)=
     &Apache::lonmsg::unpackmsgid($msgid,$folder);      &Apache::lonmsg::unpackmsgid($msgid,$folder);
         my $description = &get_course_desc($fromcid);          my $description = &get_course_desc($fromcid,\%descriptions);
  my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,   my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,
      $msgid,$description);       $msgid,$description);
         # Check whether message was sent during blocking period.          # Check whether message was sent during blocking period.
Line 911  sub sortedmessages { Line 916  sub sortedmessages {
 }  }
   
 sub get_course_desc {  sub get_course_desc {
     my ($fromcid) = @_;      my ($fromcid,$descriptions) = @_;
     my $description;       my $description;
     if (defined($env{'course.'.$fromcid.'.description'})) {      if (!$fromcid) {
        $description = $env{'course.'.$fromcid.'.description'};          return $description;
     } else {      } else {
        my %courseinfo=&Apache::lonnet::coursedescription($fromcid);          if (defined($$descriptions{$fromcid})) {
         $description = $courseinfo{'description'};              $description = $$descriptions{$fromcid};
           } else {
               if (defined($env{'course.'.$fromcid.'.description'})) {
                   $description = $env{'course.'.$fromcid.'.description'};
               } else {
                   my %courseinfo=&Apache::lonnet::coursedescription($fromcid);                $description = $courseinfo{'description'};
                   $description = $courseinfo{'description'};
               }
               $$descriptions{$fromcid} = $description;
           }
           return $description;
     }      }
     return $description;  
 }  }
   
 # ======================================================== Display new messages  # ======================================================== Display new messages
Line 948  sub disnew { Line 962  sub disnew {
     my $numblocked = 0;      my $numblocked = 0;
     # Check for blocking of display because of scheduled online exams.      # Check for blocking of display because of scheduled online exams.
     &blockcheck(\%setters,\$startblock,\$endblock);      &blockcheck(\%setters,\$startblock,\$endblock);
       my %descriptions;
     foreach (@msgids) {      foreach (@msgids) {
         my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)=          my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)=
     &Apache::lonmsg::unpackmsgid($_);      &Apache::lonmsg::unpackmsgid($_);
         if (defined($sendtime) && $sendtime!~/error/) {          if (defined($sendtime) && $sendtime!~/error/) {
             my $description = &get_course_desc($fromcid);              my $description = &get_course_desc($fromcid,\%descriptions);
             my $numsendtime = $sendtime;              my $numsendtime = $sendtime;
             $sendtime = &Apache::lonlocal::locallocaltime($sendtime);              $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
             if ($status eq 'new') {              if ($status eq 'new') {

Removed from v.1.162  
changed lines
  Added in v.1.167


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>