Diff for /loncom/interface/lonmsg.pm between versions 1.130 and 1.131

version 1.130, 2005/01/25 15:28:02 version 1.131, 2005/01/30 23:32:29
Line 239  sub sendemail { Line 239  sub sendemail {
 # ==================================================== Send notification emails  # ==================================================== Send notification emails
   
 sub sendnotification {  sub sendnotification {
     my ($to,$touname,$toudom,$subj,$crit)=@_;      my ($to,$touname,$toudom,$subj,$crit,$text)=@_;
     my $sender=$ENV{'environment.firstname'}.' '.$ENV{'environment.lastname'};      my $sender=$ENV{'environment.firstname'}.' '.$ENV{'environment.lastname'};
       unless ($sender=~/\w/) { 
    $sender=$ENV{'user.name'}.'@'.$ENV{'user.domain'};
       }
     my $critical=($crit?' critical':'');      my $critical=($crit?' critical':'');
       $text=~s/\&lt\;/\</gs;
       $text=~s/\&gt\;/\>/gs;
       $text=~s/\<\/*[^\>]+\>//gs;
     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;
Line 250  You received a$critical message from $se Line 256  You received a$critical message from $se
   
  $subj   $subj
   
   === Excerpt ============================================================
   $text
   ========================================================================
   
 Use  Use
   
  $url   $url
   
 to access this message.  to access the full message.
 ENDMSG  ENDMSG
     &sendemail($to,'New'.$critical.' message from '.$sender,$body);      &sendemail($to,'New'.$critical.' message from '.$sender,$body);
 }  }
Line 351  sub user_crit_msg_raw { Line 361  sub user_crit_msg_raw {
     my $status='';      my $status='';
     my $msgid='undefined';      my $msgid='undefined';
     unless (($message)&&($user)&&($domain)) { $status='empty'; };      unless (($message)&&($user)&&($domain)) { $status='empty'; };
       my $text=$message;
     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);         ($msgid,$message)=&packagemsg($subject,$message);
Line 373  sub user_crit_msg_raw { Line 384  sub user_crit_msg_raw {
     my %userenv = &Apache::lonnet::get('environment',['critnotification'],      my %userenv = &Apache::lonnet::get('environment',['critnotification'],
                                        $domain,$user);                                         $domain,$user);
     if ($userenv{'critnotification'}) {      if ($userenv{'critnotification'}) {
       &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1);        &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1,
    $text);
     }      }
 # Log this  # Log this
     &Apache::lonnet::logthis(      &Apache::lonnet::logthis(
Line 448  sub user_normal_msg_raw { Line 460  sub user_normal_msg_raw {
 # Check if allowed missing  # Check if allowed missing
     my $status='';      my $status='';
     my $msgid='undefined';      my $msgid='undefined';
       my $text=$message;
     unless (($message)&&($user)&&($domain)) { $status='empty'; };      unless (($message)&&($user)&&($domain)) { $status='empty'; };
     my $homeserver=&Apache::lonnet::homeserver($user,$domain);      my $homeserver=&Apache::lonnet::homeserver($user,$domain);
     if ($homeserver ne 'no_host') {      if ($homeserver ne 'no_host') {
Line 474  sub user_normal_msg_raw { Line 487  sub user_normal_msg_raw {
     my %userenv = &Apache::lonnet::get('environment',['notification'],      my %userenv = &Apache::lonnet::get('environment',['notification'],
                                        $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);
     }      }
     &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},      &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},
                          $ENV{'user.home'},                           $ENV{'user.home'},
Line 836  TABLEHEAD Line 850  TABLEHEAD
         foreach my $msg (@newmsgs) {          foreach my $msg (@newmsgs) {
             $r->print(<<"ENDLINK");              $r->print(<<"ENDLINK");
 <tr bgcolor="#FFBB77">  <tr bgcolor="#FFBB77">
 <td><a href="/adm/email?display=$msg->{'msgid'}">$lt{'op'}</a></td>  <td><a href="/adm/email?dismode=new&display=$msg->{'msgid'}">$lt{'op'}</a></td>
 ENDLINK  ENDLINK
             foreach ('sendtime','from','fromdom','shortsub') {              foreach ('sendtime','from','fromdom','shortsub') {
                 $r->print("<td>$msg->{$_}</td>");                  $r->print("<td>$msg->{$_}</td>");
Line 1739  sub displaymessage { Line 1753  sub displaymessage {
       '<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs.        '<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs.
       '"><b>Delete</b></a></td>'.        '"><b>Delete</b></a></td>'.
       '<td><a href="/adm/email?'.$sqs.        '<td><a href="/adm/email?'.$sqs.
         ($ENV{'form.dismode'} eq 'new'?'&folder=new':'').
       '"><b>'.&mt('Back to Folder Display').'</b></a></td>');        '"><b>'.&mt('Back to Folder Display').'</b></a></td>');
     if ($counter > 0){      if ($counter > 0){
  $r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.   $r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.
Line 1986  sub handler { Line 2001  sub handler {
         ['display','replyto','forward','markread','markdel','markunread',          ['display','replyto','forward','markread','markdel','markunread',
          'sendreply','compose','sendmail','critical','recname','recdom',           'sendreply','compose','sendmail','critical','recname','recdom',
          'recordftf','sortedby','block','folder','startdis','interdis',           'recordftf','sortedby','block','folder','startdis','interdis',
  'showcommentbaseurl']);   'showcommentbaseurl','dismode']);
     $sqs='&sortedby='.$ENV{'form.sortedby'};      $sqs='&sortedby='.$ENV{'form.sortedby'};
   
 # ------------------------------------------------------ They checked for email  # ------------------------------------------------------ They checked for email

Removed from v.1.130  
changed lines
  Added in v.1.131


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