Diff for /loncom/interface/lonmsg.pm between versions 1.192 and 1.194

version 1.192, 2006/12/27 18:00:00 version 1.194, 2006/12/28 18:47:15
Line 246  sub sendemail { Line 246  sub sendemail {
 # ==================================================== Send notification emails  # ==================================================== Send notification emails
   
 sub sendnotification {  sub sendnotification {
     my ($to,$touname,$toudom,$subj,$crit,$text)=@_;      my ($to,$touname,$toudom,$subj,$crit,$text,$msgid)=@_;
     my $sender=$env{'environment.firstname'}.' '.$env{'environment.lastname'};      my $sender=$env{'environment.firstname'}.' '.$env{'environment.lastname'};
     unless ($sender=~/\w/) {       unless ($sender=~/\w/) { 
  $sender=$env{'user.name'}.'@'.$env{'user.domain'};   $sender=$env{'user.name'}.'@'.$env{'user.domain'};
Line 258  sub sendnotification { Line 258  sub sendnotification {
     my $url='http://'.      my $url='http://'.
       $Apache::lonnet::hostname{&Apache::lonnet::homeserver($touname,$toudom)}.        $Apache::lonnet::hostname{&Apache::lonnet::homeserver($touname,$toudom)}.
       '/adm/email?username='.$touname.'&domain='.$toudom;        '/adm/email?username='.$touname.'&domain='.$toudom;
     my $body=(<<ENDMSG);      my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,
 You received a$critical message from $sender in LON-CAPA. The subject is          $symb,$error) = &Apache::lonmsg::unpackmsgid($msgid);
       my $coursetext;
       if ($fromcid ne '') {
           $coursetext = "\n".&mt('Course').': ';
           if ($env{'course.'.$fromcid.'.description'} ne '') {
               $coursetext .= $env{'course.'.$fromcid.'.description'};
           } else {
               my %coursehash = &Apache::lonnet::coursedescription($fromcid,);
               if ($coursehash{'description'} ne '') {
                   $coursetext .= $coursehash{'description'};
               }
           }
           $coursetext .= "\n\n";
       }
       my $body = $coursetext. 
                  &mt('You received a[_1] message from '.$sender.' in LON-CAPA.',$critical).' '.&mt("The subject is 
   
  $subj   $subj
   
 === Excerpt ============================================================  ")."\n".
   '=== '.&mt('Excerpt')." ============================================================
 $text  $text
 ========================================================================  ========================================================================
   
 Use  ".&mt("Use 
   
  $url   $url
   
 to access the full message.  to access the full message.");
 ENDMSG  
     &sendemail($to,'New'.$critical.' message from '.$sender,$body);      &sendemail($to,'New'.$critical.' message from '.$sender,$body);
 }  }
 # ============================================================= Check for email  # ============================================================= Check for email
Line 407  sub user_crit_msg_raw { Line 422  sub user_crit_msg_raw {
         if (defined($sentmessage)) {          if (defined($sentmessage)) {
             $$sentmessage = $packed_message;              $$sentmessage = $packed_message;
         }          }
         (undef,my $packed_message_no_citation) =          if ($env{'request.course.id'} eq '') {
               (undef,my $packed_message_no_citation) =
             &packagemsg($subject,$message,undef,undef,undef,$user,$domain,              &packagemsg($subject,$message,undef,undef,undef,$user,$domain,
                         $msgid);                          $msgid);
         $status .= &store_sent_mail($msgid,$packed_message_no_citation);              if ($status eq 'ok' || $status eq 'con_delayed') {
                   &store_sent_mail($msgid,$packed_message_no_citation);
               }
           }
     } else {      } else {
        $status='no_host';         $status='no_host';
     }      }
Line 419  sub user_crit_msg_raw { Line 438  sub user_crit_msg_raw {
     my %userenv = &Apache::loncommon::getemails($user,$domain);      my %userenv = &Apache::loncommon::getemails($user,$domain);
     if ($userenv{'critnotification'}) {      if ($userenv{'critnotification'}) {
       &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1,        &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1,
  $text);   $text,$msgid);
     }      }
     if ($toperm && $userenv{'permanentemail'}) {      if ($toperm && $userenv{'permanentemail'}) {
       &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,1,        &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,1,
  $text);   $text,$msgid);
     }      }
 # Log this  # Log this
     &Apache::lonnet::logthis(      &Apache::lonnet::logthis(
Line 540  sub user_normal_msg_raw { Line 559  sub user_normal_msg_raw {
            (undef,my $packed_message_no_citation) =             (undef,my $packed_message_no_citation) =
                &packagemsg($subject,$message,undef,$baseurl,$attachmenturl,                 &packagemsg($subject,$message,undef,$baseurl,$attachmenturl,
                            $user,$domain,$currid,undef,$crsmsgid,$symb,$error);                             $user,$domain,$currid,undef,$crsmsgid,$symb,$error);
            $status .= &store_sent_mail($msgid,$packed_message_no_citation);             if ($status eq 'ok' || $status eq 'con_delayed') {
                  &store_sent_mail($msgid,$packed_message_no_citation);
              }
        }         }
     } else {      } else {
        $status='no_host';         $status='no_host';
Line 558  sub user_normal_msg_raw { Line 579  sub user_normal_msg_raw {
                                        $domain,$user);                                         $domain,$user);
     if ($userenv{'notification'}) {      if ($userenv{'notification'}) {
  &sendnotification($userenv{'notification'},$user,$domain,$subject,0,   &sendnotification($userenv{'notification'},$user,$domain,$subject,0,
   $text);    $text,$msgid);
     }      }
     if ($toperm && $userenv{'permanentemail'}) {      if ($toperm && $userenv{'permanentemail'}) {
  &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,0,   &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,0,
   $text);    $text,$msgid);
     }      }
     &Apache::lonnet::log($env{'user.domain'},$env{'user.name'},      &Apache::lonnet::log($env{'user.domain'},$env{'user.name'},
                          $env{'user.home'},                           $env{'user.home'},

Removed from v.1.192  
changed lines
  Added in v.1.194


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