Diff for /loncom/interface/lonmsg.pm between versions 1.52 and 1.55

version 1.52, 2003/03/31 16:34:08 version 1.55, 2003/06/20 14:55:01
Line 52  use Apache::Constants qw(:common); Line 52  use Apache::Constants qw(:common);
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lontexconvert();  use Apache::lontexconvert();
 use HTML::Entities();  use HTML::Entities();
   use Mail::Send;
   
 # ===================================================================== Package  # ===================================================================== Package
   
Line 142  sub unpackmsgid { Line 143  sub unpackmsgid {
     return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid});      return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid});
 }   } 
   
   
   sub sendemail {
       my ($to,$subject,$body)=@_;
       $body=
       "*** This is an automatic message generated by the LON-CAPA system.\n".
       "*** Please do not reply to this address.\n\n".$body;
       my $msg = new Mail::Send;
       $msg->to($to);
       $msg->subject('[LON-CAPA] '.$subject);
       my $fh = $msg->open('smtp',Server => 'localhost');
       print $fh $body;
       $fh->close;
   }
   
   # ==================================================== Send notification emails
   
   sub sendnotification {
       my ($to,$touname,$toudom,$subj,$crit)=@_;
       my $sender=$ENV{'environment.firstname'}.' '.$ENV{'environment.lastname'};
       my $critical=($crit?' critical':'');
       my $url='http://'.
         $Apache::lonnet::hostname{&Apache::lonnet::homeserver($touname,$toudom)}.
         '/adm/email?username='.$touname.'&domain='.$toudom;
       my $body=(<<ENDMSG);
   You received a$critical message from $sender in LON-CAPA. The subject is
   
    $subj
   
   Use
   
    $url
   
   to access this message.
   ENDMSG
       &sendemail($to,'New'.$critical.' message from '.$sender,$body);
   }
 # ============================================================= Check for email  # ============================================================= Check for email
   
 sub newmail {  sub newmail {
Line 199  sub user_crit_msg_raw { Line 236  sub user_crit_msg_raw {
     } else {      } else {
        $status='no_host';         $status='no_host';
     }      }
   # Notifications
       my %userenv = &Apache::lonnet::get('environment',['critnotification'],
                                          $domain,$user);
       if ($userenv{'critnotification'}) {
         &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1);
       }
   # Log this
     &Apache::lonnet::logthis(      &Apache::lonnet::logthis(
       'Sending critical email '.$msgid.        'Sending critical email '.$msgid.
       ', log status: '.        ', log status: '.
Line 277  sub user_normal_msg_raw { Line 321  sub user_normal_msg_raw {
     } else {      } else {
        $status='no_host';         $status='no_host';
     }      }
   # Notifications
       my %userenv = &Apache::lonnet::get('environment',['notification'],
                                          $domain,$user);
       if ($userenv{'notification'}) {
    &sendnotification($userenv{'notification'},$user,$domain,$subject,0);
       }
     &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},      &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},
                          $ENV{'user.home'},                           $ENV{'user.home'},
       'Sending '.$msgid.' to '.$user.' at '.$domain.' with status: '.$status);        'Sending '.$msgid.' to '.$user.' at '.$domain.' with status: '.$status);
Line 566  sub compout { Line 616  sub compout {
 <td>$domform</td></tr>  <td>$domform</td></tr>
 ENDREC  ENDREC
     }      }
       my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
     if ($broadcast ne 'upload') {      if ($broadcast ne 'upload') {
        $r->print(<<"ENDCOMP");         $r->print(<<"ENDCOMP");
 <tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ...  <tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ...
Line 573  ENDREC Line 624  ENDREC
 <input type=text size=50 name=additionalrec></td></tr>  <input type=text size=50 name=additionalrec></td></tr>
 <tr><td>Subject:</td><td><input type=text size=50 name=subject value="$dissub">  <tr><td>Subject:</td><td><input type=text size=50 name=subject value="$dissub">
 </td></tr></table>  </td></tr></table>
   $latexHelp
 <textarea name=message cols=80 rows=10 wrap=hard>$dismsg  <textarea name=message cols=80 rows=10 wrap=hard>$dismsg
 </textarea><p>  </textarea><p>
 $dispcrit  $dispcrit

Removed from v.1.52  
changed lines
  Added in v.1.55


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