Diff for /loncom/interface/lonmsg.pm between versions 1.158 and 1.164

version 1.158, 2005/11/28 20:14:43 version 1.164, 2005/12/10 00:46:34
Line 97  Right now, this document will cover just Line 97  Right now, this document will cover just
 it is likely you will not need to programmatically read messages,  it is likely you will not need to programmatically read messages,
 since lonmsg already implements that functionality.  since lonmsg already implements that functionality.
   
   The routines used to package messages and unpackage messages are not
   only used by lonmsg when creating/extracting messages for LON-CAPA's
   internal messaging system, but also by lonnotify.pm which is available
   for use by Domain Coordinators to broadcast standard e-mail to specified
   users in their domain.  The XML packaging used in the two cases is very
   similar.  The differences are the use of <recuser>$uname</recuser> and 
   <recdomain>$udom</recdomain> in stored internal messages, compared 
   with <recipient username="$uname:$udom">$email</recipient> in stored
   Domain Coordinator e-mail for the storage of information about 
   recipients of the message/e-mail.
   
 =head1 FUNCTIONS  =head1 FUNCTIONS
   
 =over 4  =over 4
Line 126  my $interdis; Line 137  my $interdis;
   
 sub packagemsg {  sub packagemsg {
     my ($subject,$message,$citation,$baseurl,$attachmenturl,      my ($subject,$message,$citation,$baseurl,$attachmenturl,
  $recuser,$recdomain,$msgid)=@_;   $recuser,$recdomain,$msgid,$type)=@_;
     $message =&HTML::Entities::encode($message,'<>&"');      $message =&HTML::Entities::encode($message,'<>&"');
     $citation=&HTML::Entities::encode($citation,'<>&"');      $citation=&HTML::Entities::encode($citation,'<>&"');
     $subject =&HTML::Entities::encode($subject,'<>&"');      $subject =&HTML::Entities::encode($subject,'<>&"');
Line 142  sub packagemsg { Line 153  sub packagemsg {
                    split(/\:/,&Apache::lonnet::unescape($env{'form.replyid'}));                     split(/\:/,&Apache::lonnet::unescape($env{'form.replyid'}));
         $course_context = $origcid;          $course_context = $origcid;
     }      }
       foreach my $key (keys(%env)) {
           if ($key=~/^form\.(rep)?rec\_(.*)$/) {
               my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$origcid) =
                                       split(/\:/,&Apache::lonnet::unescape($2));
               $course_context = $origcid;
               last;
           }
       }
     unless(defined($course_context)) {      unless(defined($course_context)) {
         $course_context = $env{'request.course.id'};          $course_context = $env{'request.course.id'};
     }      }
     my $now=time;      my $now=time;
     $msgcount++;      $msgcount++;
     my $partsubj=$subject;  
     $partsubj=&Apache::lonnet::escape($partsubj);  
     unless(defined($msgid)) {      unless(defined($msgid)) {
         $msgid=&Apache::lonnet::escape(          $msgid = &buildmsgid($now,$subject,$env{'user.name'},$env{'user.domain'},
            $now.':'.$partsubj.':'.$env{'user.name'}.':'.                              $msgcount,$course_context,$$);
            $env{'user.domain'}.':'.$msgcount.':'.  
            $course_context.':'.$$);  
     }      }
     my $result='<sendername>'.$env{'user.name'}.'</sendername>'.      my $result='<sendername>'.$env{'user.name'}.'</sendername>'.
            '<senderdomain>'.$env{'user.domain'}.'</senderdomain>'.             '<senderdomain>'.$env{'user.domain'}.'</senderdomain>'.
Line 174  sub packagemsg { Line 189  sub packagemsg {
            '<msgid>'.$msgid.'</msgid>';             '<msgid>'.$msgid.'</msgid>';
     if (ref($recuser) eq 'ARRAY') {      if (ref($recuser) eq 'ARRAY') {
         for (my $i=0; $i<@{$recuser}; $i++) {          for (my $i=0; $i<@{$recuser}; $i++) {
             $result .= '<recuser>'.$$recuser[$i].'</recuser>'.              if ($type eq 'dcmail') {
                        '<recdomain>'.$$recdomain[$i].'</recdomain>';                  my ($username,$email) = split(/:/,$$recuser[$i]);
                   $username = &Apache::lonnet::unescape($username);
                   $email = &Apache::lonnet::unescape($email);
                   $username = &HTML::Entities::encode($username,'<>&"');
                   $email = &HTML::Entities::encode($email,'<>&"');
                   $result .= '<recipient username="'.$username.'">'.
                                               $email.'</recipient>';
               } else {
                   $result .= '<recuser>'.$$recuser[$i].'</recuser>'.
                              '<recdomain>'.$$recdomain[$i].'</recdomain>';
               }
         }          }
     } else {      } else {
         $result .= '<recuser>'.$recuser.'</recuser>'.          $result .= '<recuser>'.$recuser.'</recuser>'.
Line 207  sub unpackagemsg { Line 232  sub unpackagemsg {
            my $value=$parser->get_text('/'.$entry);             my $value=$parser->get_text('/'.$entry);
            if (($entry eq 'recuser') || ($entry eq 'recdomain')) {             if (($entry eq 'recuser') || ($entry eq 'recdomain')) {
                push(@{$content{$entry}},$value);                 push(@{$content{$entry}},$value);
              } elsif ($entry eq 'recipient') {
                  my $username = $token->[2]{'username'};
                  $username = &HTML::Entities::decode($username,'<>&"');
                  $content{$entry}{$username} = $value;
            } else {             } else {
                $content{$entry}=$value;                 $content{$entry}=$value;
            }             }
Line 229  sub unpackagemsg { Line 258  sub unpackagemsg {
   
 # ======================================================= Get info out of msgid  # ======================================================= Get info out of msgid
   
   sub buildmsgid {
       my ($now,$subject,$uname,$udom,$msgcount,$course_context,$pid) = @_;
       $subject=&Apache::lonnet::escape($subject);
       return(&Apache::lonnet::escape($now.':'.$subject.':'.$uname.':'.
              $udom.':'.$msgcount.':'.$course_context.':'.$pid));
   }
   
 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)=split(/\:/,      my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$fromcid)=split(/\:/,
                           &Apache::lonnet::unescape($msgid));                            &Apache::lonnet::unescape($msgid));
     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);
           &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 389  sub all_url_author_res_msg { Line 428  sub all_url_author_res_msg {
 # ================================================== Critical message to a user  # ================================================== Critical message to a user
   
 sub user_crit_msg_raw {  sub user_crit_msg_raw {
     my ($user,$domain,$subject,$message,$sendback,$toperm)=@_;      my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage)=@_;
 # Check if allowed missing  # Check if allowed missing
     my $status='';      my $status='';
     my $msgid='undefined';      my $msgid='undefined';
Line 403  sub user_crit_msg_raw { Line 442  sub user_crit_msg_raw {
            'put:'.$domain.':'.$user.':critical:'.             'put:'.$domain.':'.$user.':critical:'.
            &Apache::lonnet::escape($msgid).'='.             &Apache::lonnet::escape($msgid).'='.
            &Apache::lonnet::escape($message),$homeserver);             &Apache::lonnet::escape($message),$homeserver);
        if ($env{'request.course.id'}) {          if (defined($sentmessage)) {
           &user_normal_msg_raw(              $$sentmessage = $message;
             $env{'course.'.$env{'request.course.id'}.'.num'},          }
             $env{'course.'.$env{'request.course.id'}.'.domain'},  
             'Critical ['.$user.':'.$domain.']',  
     $message);  
        }  
     } else {      } else {
        $status='no_host';         $status='no_host';
     }      }
Line 447  sub user_crit_msg_raw { Line 482  sub user_crit_msg_raw {
 =cut  =cut
   
 sub user_crit_msg {  sub user_crit_msg {
     my ($user,$domain,$subject,$message,$sendback,$toperm)=@_;      my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage)=@_;
     my $status='';      my $status='';
     my %userenv = &Apache::lonnet::get('environment',['msgforward'],      my %userenv = &Apache::lonnet::get('environment',['msgforward'],
                                        $domain,$user);                                         $domain,$user);
Line 457  sub user_crit_msg { Line 492  sub user_crit_msg {
  my ($forwuser,$forwdomain)=split(/\:/,$_);   my ($forwuser,$forwdomain)=split(/\:/,$_);
          $status.=           $status.=
    &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message,     &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message,
                 $sendback,$toperm).' ';                  $sendback,$toperm,$sentmessage).' ';
        }         }
     } else {       } else { 
  $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback,$toperm);   $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage);
     }      }
     return $status;      return $status;
 }  }
Line 495  sub user_crit_received { Line 530  sub user_crit_received {
   
 sub user_normal_msg_raw {  sub user_normal_msg_raw {
     my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,      my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
  $toperm,$newid)=@_;   $toperm,$currid,$newid,$sentmessage)=@_;
 # Check if allowed missing  # Check if allowed missing
     my $status='';      my $status='';
     my $msgid='undefined';      my $msgid='undefined';
Line 504  sub user_normal_msg_raw { Line 539  sub user_normal_msg_raw {
     my $homeserver=&Apache::lonnet::homeserver($user,$domain);      my $homeserver=&Apache::lonnet::homeserver($user,$domain);
     if ($homeserver ne 'no_host') {      if ($homeserver ne 'no_host') {
        ($msgid,$message)=&packagemsg($subject,$message,$citation,$baseurl,         ($msgid,$message)=&packagemsg($subject,$message,$citation,$baseurl,
                                      $attachmenturl,$user,$domain);                                       $attachmenturl,$user,$domain,$currid);
 # Store in user folder  # Store in user folder
        $status=&Apache::lonnet::critical(         $status=&Apache::lonnet::critical(
            'put:'.$domain.':'.$user.':nohist_email:'.             'put:'.$domain.':'.$user.':nohist_email:'.
Line 513  sub user_normal_msg_raw { Line 548  sub user_normal_msg_raw {
 # Save new message received time  # Save new message received time
        &Apache::lonnet::put         &Apache::lonnet::put
                          ('email_status',{'recnewemail'=>time},$domain,$user);                           ('email_status',{'recnewemail'=>time},$domain,$user);
 # Into sent-mail folder unless a broadcast message  # Into sent-mail folder unless a broadcast message or critical message
        unless (($env{'request.course.id'}) && ($env{'form.sendmode'} eq 'group')) {         unless (($env{'request.course.id'}) && 
                  (($env{'form.sendmode'} eq 'group')  || 
                  (($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&
                  (&Apache::lonnet::allowed('srm',$env{'request.course.id'})))) {
            $status .= &store_sent_mail($msgid,$message);             $status .= &store_sent_mail($msgid,$message);
        }         }
     } else {      } else {
Line 523  sub user_normal_msg_raw { Line 561  sub user_normal_msg_raw {
     if (defined($newid)) {      if (defined($newid)) {
         $$newid = $msgid;          $$newid = $msgid;
     }      }
       if (defined($sentmessage)) {
           $$sentmessage = $message;
       }
   
 # Notifications  # Notifications
     my %userenv = &Apache::lonnet::get('environment',['notification',      my %userenv = &Apache::lonnet::get('environment',['notification',
                                                       'permanentemail'],                                                        'permanentemail'],
Line 553  sub user_normal_msg_raw { Line 595  sub user_normal_msg_raw {
   
 sub user_normal_msg {  sub user_normal_msg {
     my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,      my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
  $toperm)=@_;   $toperm,$sentmessage)=@_;
     my $status='';      my $status='';
     my %userenv = &Apache::lonnet::get('environment',['msgforward'],      my %userenv = &Apache::lonnet::get('environment',['msgforward'],
                                        $domain,$user);                                         $domain,$user);
Line 563  sub user_normal_msg { Line 605  sub user_normal_msg {
  my ($forwuser,$forwdomain)=split(/\:/,$_);   my ($forwuser,$forwdomain)=split(/\:/,$_);
          $status.=           $status.=
   &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message,    &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message,
        $citation,$baseurl,$attachmenturl,$toperm).' ';   $citation,$baseurl,$attachmenturl,$toperm,undef,undef,$sentmessage).' ';
        }         }
     } else {       } else { 
  $status=&user_normal_msg_raw($user,$domain,$subject,$message,   $status=&user_normal_msg_raw($user,$domain,$subject,$message,
      $citation,$baseurl,$attachmenturl,$toperm);      $citation,$baseurl,$attachmenturl,$toperm,undef,undef,$sentmessage);
     }      }
     return $status;      return $status;
 }  }
Line 1175  sub compout { Line 1217  sub compout {
  &mt('and return receipt') . '</label>' . $crithelp .    &mt('and return receipt') . '</label>' . $crithelp . 
  '</p><p><label><input type="checkbox" name="permanent" /> '.   '</p><p><label><input type="checkbox" name="permanent" /> '.
 &mt('Send copy to permanent email address (if known)').'</label></p>'.  &mt('Send copy to permanent email address (if known)').'</label></p>'.
 '<p><label><input type="checkbox" name="rsspost" /> '.  '<!-- <p><label><input type="checkbox" name="rsspost" /> '.
   &mt('Include in course RSS newsfeed').'</label></p>';      }    &mt('Include in course RSS newsfeed').'</label></p>-->';      }
     my %message;      my %message;
     my %content;      my %content;
     my $defdom=$env{'user.domain'};      my $defdom=$env{'user.domain'};
Line 1346  sub disfacetoface { Line 1388  sub disfacetoface {
     $result.='<h3>'.&mt('Record').'</h3>';      $result.='<h3>'.&mt('Record').'</h3>';
         } elsif ($content{'subject'}=~/^Broadcast/) {          } elsif ($content{'subject'}=~/^Broadcast/) {
             $result .='<h3>'.&mt('Broadcast Message').'</h3>';              $result .='<h3>'.&mt('Broadcast Message').'</h3>';
               if ($content{'subject'}=~/^Broadcast\./) {
                   %content=&unpackagemsg($content{'message'});
                   $content{'message'}=
                       '<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br />'.
                       $content{'message'};
               }    
         } else {          } else {
             $result.='<h3>'.&mt('Critical Message').'</h3>';              $result.='<h3>'.&mt('Critical Message').'</h3>';
             %content=&unpackagemsg($content{'message'});              %content=&unpackagemsg($content{'message'});
Line 1421  ENDTREC Line 1469  ENDTREC
         ($env{'form.recdomain'}) && ($env{'form.recuname'})) {          ($env{'form.recdomain'}) && ($env{'form.recuname'})) {
         chomp($env{'form.newrecord'});          chomp($env{'form.newrecord'});
         if ($env{'form.newrecord'}) {          if ($env{'form.newrecord'}) {
              my $recordtxt = $env{'form.newrecord'};
            &user_normal_msg_raw(             &user_normal_msg_raw(
             $env{'course.'.$env{'request.course.id'}.'.num'},              $env{'course.'.$env{'request.course.id'}.'.num'},
             $env{'course.'.$env{'request.course.id'}.'.domain'},              $env{'course.'.$env{'request.course.id'}.'.domain'},
             &mt('Record').              &mt('Record').
      ' ['.$env{'form.recuname'}.':'.$env{'form.recdomain'}.']',       ' ['.$env{'form.recuname'}.':'.$env{'form.recdomain'}.']',
     $env{'form.newrecord'});      $recordtxt);
         }          }
         $r->print('<h3>'.&Apache::loncommon::plainname($env{'form.recuname'},          $r->print('<h3>'.&Apache::loncommon::plainname($env{'form.recuname'},
      $env{'form.recdomain'}).'</h3>');       $env{'form.recdomain'}).'</h3>');
Line 2017  sub sendoffmail { Line 2066  sub sendoffmail {
     my ($r,$folder)=@_;      my ($r,$folder)=@_;
     my $suffix=&foldersuffix($folder);      my $suffix=&foldersuffix($folder);
     my $sendstatus='';      my $sendstatus='';
     my %broadcast_status;      my %specialmsg_status;
     my $numbroadcast = 0;      my $numspecial = 0;
     if ($env{'form.send'}) {      if ($env{'form.send'}) {
  &printheader($r,'','Messages being sent.');   &printheader($r,'','Messages being sent.');
  $r->rflush();   $r->rflush();
Line 2064  sub sendoffmail { Line 2113  sub sendoffmail {
     }      }
  }   }
   
         my $basicmsg;          my $savemsg;
         my $msgtype;          my $msgtype;
           my %sentmessage;
         if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&          if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&
             (&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) {              (&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) {
             $basicmsg=&Apache::lonfeedback::clear_out_html($env{'form.message'},1);              $savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'},1);
             $msgtype = '(critical)';              $msgtype = 'critical';
         } else {          } else {
             $basicmsg=&Apache::lonfeedback::clear_out_html($env{'form.message'});              $savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'});
         }          }
   
  foreach (keys %toaddr) {   foreach (keys %toaddr) {
     my ($recuname,$recdomain)=split(/\:/,$_);      my ($recuname,$recdomain)=split(/\:/,$_);
             my $msgtxt = $basicmsg;              my $msgtxt = $savemsg;
     if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }      if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }
     my $thismsg;      my $thismsg;
     if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&       if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && 
Line 2085  sub sendoffmail { Line 2135  sub sendoffmail {
  $thismsg=&user_crit_msg($recuname,$recdomain,   $thismsg=&user_crit_msg($recuname,$recdomain,
  &Apache::lonfeedback::clear_out_html($env{'form.subject'}),   &Apache::lonfeedback::clear_out_html($env{'form.subject'}),
  $msgtxt,   $msgtxt,
  $env{'form.sendbck'},$env{'form.permanent'});   $env{'form.sendbck'},$env{'form.permanent'},\$sentmessage{$_});
     } else {      } else {
  $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');   $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');
  $thismsg=&user_normal_msg($recuname,$recdomain,   $thismsg=&user_normal_msg($recuname,$recdomain,
   &Apache::lonfeedback::clear_out_html($env{'form.subject'}),    &Apache::lonfeedback::clear_out_html($env{'form.subject'}),
   $msgtxt,    $msgtxt,
   $content{'citation'},undef,undef,$env{'form.permanent'});    $content{'citation'},undef,undef,$env{'form.permanent'},\$sentmessage{$_});
             }              }
     if (($env{'request.course.id'}) &&       if (($env{'request.course.id'}) && (($msgtype eq 'critical') || 
                                          ($env{'form.sendmode'} eq 'group')) {                                           ($env{'form.sendmode'} eq 'group'))) {
         $broadcast_status{$recuname.':'.$recdomain}  = $thismsg;          $specialmsg_status{$recuname.':'.$recdomain}  = $thismsg;
                 if ($thismsg eq 'ok') {                  if ($thismsg eq 'ok') {
                     $numbroadcast ++;                      $numspecial ++;
                 }                  }
     }      }
     $r->print($thismsg.'<br />');      $r->print($thismsg.'<br />');
     $sendstatus.=' '.$thismsg;      $sendstatus.=' '.$thismsg;
  }   }
         if (($env{'request.course.id'}) && ($env{'form.sendmode'} eq 'group')) {          if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group')
                                                 || ($msgtype eq 'critical'))) {
             my $subj_prefix;              my $subj_prefix;
             if ($msgtype eq 'critical') {              if ($msgtype eq 'critical') {
                 $subj_prefix = 'Critical broadcast';                  $subj_prefix = 'Critical.';
             } else {              } else {
                 $subj_prefix = 'Broadcast';                  $subj_prefix = 'Broadcast.';
             }              }
             my ($broadmsgid,$broadresult);              my ($specialmsgid,$specialresult);
             if ($numbroadcast) {              my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
                 $broadresult = &user_normal_msg_raw(              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                     $env{'course.'.$env{'request.course.id'}.'.num'},              my $course_str = &Apache::lonnet::escape('['.$cnum.':'.$cdom.']');
                     $env{'course.'.$env{'request.course.id'}.'.domain'},                $subj_prefix.' to: '.$env{'course.'.$env{'request.course.id'}.'.description'}.  
                     ' ('.$numbroadcast.' sent)',$basicmsg,undef,undef,undef,              if ($numspecial) {
                     undef,\$broadmsgid);                  $specialresult = &user_normal_msg_raw($cnum,$cdom,$subj_prefix.
                       ' '.$course_str,$savemsg,undef,undef,undef,
                       undef,undef,\$specialmsgid);
                   $specialmsgid = &Apache::lonnet::unescape($specialmsgid);
             }              }
             if ($broadresult eq 'ok') {              if ($specialresult eq 'ok') {
                 my $record_sent;                  my $record_sent;
                 my @recusers = ();                  my @recusers = ();
                 my @recudoms = ();                  my @recudoms = ();
                   my ($stamp,$msgsubj,$msgname,$msgdom,$msgcount,$context,$pid) = 
                               split(/\:/,&Apache::lonnet::unescape($specialmsgid));
                 foreach my $recipient (sort(keys(%toaddr))) {                  foreach my $recipient (sort(keys(%toaddr))) {
                     if ($broadcast_status{$recipient} eq 'ok') {                      if ($specialmsg_status{$recipient} eq 'ok') {
                           my $usersubj = $subj_prefix.'['.$recipient.']';
                           my $usermsgid = &buildmsgid($stamp,$usersubj,$msgname,
                                                 $msgdom,$msgcount,$context,$pid);
                           &user_normal_msg_raw($cnum,$cdom,$subj_prefix.
                           ' ['.$recipient.']',$sentmessage{$recipient},
                           undef,undef,undef,undef,$usermsgid);
                         my ($uname,$udom) = split/:/,$recipient;                          my ($uname,$udom) = split/:/,$recipient;
                         push(@recusers,$uname);                          push(@recusers,$uname);
                         push(@recudoms,$udom);                          push(@recudoms,$udom);
                     }                      }
                 }                  }
                 if (@recusers) {                  if (@recusers) {
                     my $broadmessage;                      my $specialmessage;
                     ($broadmsgid,$broadmessage)=&packagemsg(&Apache::lonfeedback::clear_out_html($env{'form.subject'}),$basicmsg,undef,undef,undef,\@recusers,\@recudoms,$broadmsgid);                      my $sentsubj = $subj_prefix.' ('.$numspecial.' sent) '.
                     $record_sent = &store_sent_mail($broadmsgid,$broadmessage);                      &Apache::lonfeedback::clear_out_html($env{'form.subject'});
                       $sentsubj = &HTML::Entities::encode($sentsubj,'<>&"');
                       my $sentmsgid = &buildmsgid($stamp,$sentsubj,$msgname,
                                                 $msgdom,$msgcount,$context,$pid);
                       ($specialmsgid,$specialmessage) =
                            &packagemsg(&Apache::lonfeedback::clear_out_html(
                                $env{'form.subject'}),$savemsg,undef,undef,undef,
                                               \@recusers,\@recudoms,$sentmsgid);
                       $record_sent = &store_sent_mail($specialmsgid,$specialmessage);
                 }                  }
             } else {              } else {
                 &Apache::lonnet::logthis('Failed to create record of broadcast in '.$env{'course.'.$env{'request.course.id'}.'.num'}.' at '.$env{'course.'.$env{'request.course.id'}.'.domain'}.' - no msgid generated');                  &Apache::lonnet::logthis('Failed to create record of critical message or broadcast in '.$env{'course.'.$env{'request.course.id'}.'.num'}.' at '.$env{'course.'.$env{'request.course.id'}.'.domain'}.' - no msgid generated');
             }              }
         }          }
     } else {      } else {

Removed from v.1.158  
changed lines
  Added in v.1.164


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