Diff for /loncom/interface/lonmsg.pm between versions 1.68 and 1.71

version 1.68, 2003/10/15 20:34:37 version 1.71, 2003/12/05 22:14:15
Line 270  sub author_res_msg { Line 270  sub author_res_msg {
     my ($filename,$message)=@_;      my ($filename,$message)=@_;
     unless ($message) { return 'empty'; }      unless ($message) { return 'empty'; }
     $filename=&Apache::lonnet::declutter($filename);      $filename=&Apache::lonnet::declutter($filename);
     my ($domain,$author,@dummy)=split(/\//,$filename);      my ($domain,$author)=split(/\//,$filename);
     my $homeserver=&Apache::lonnet::homeserver($author,$domain);      my $homeserver=&Apache::lonnet::homeserver($author,$domain);
     if ($homeserver ne 'no_host') {      if ($homeserver ne 'no_host') {
        my $id=unpack("%32C*",$message);         my $id=unpack("%32C*",$message);
        my $msgid;         my $msgid;
        ($msgid,$message)=&packagemsg($filename,$message);         ($msgid,$message)=&packagemsg("Error: [$filename]",$message);
          #FIXME this should be nohist_res_msg, we need to provide an interface 
          #      to this hash BUG#2444
          #return &Apache::lonnet::reply('put:'.$domain.':'.$author.
          #  ':nohist_res_msg:'.
          #   &Apache::lonnet::escape($filename.'_'.$id).'='.
          #   &Apache::lonnet::escape($message),$homeserver);
        return &Apache::lonnet::reply('put:'.$domain.':'.$author.         return &Apache::lonnet::reply('put:'.$domain.':'.$author.
          ':nohist_res_msgs:'.     ':nohist_email:'.
           &Apache::lonnet::escape($filename.'_'.$id).'='.             &Apache::lonnet::escape($msgid).'='.
           &Apache::lonnet::escape($message),$homeserver);             &Apache::lonnet::escape($message),$homeserver);
     }      }
     return 'no_host';      return 'no_host';
 }  }
Line 607  $content{'sendername'}.'@'. Line 613  $content{'sendername'}.'@'.
  '<input type=checkbox name=sendbck> '.&mt('Send as critical message').' ' .   '<input type=checkbox name=sendbck> '.&mt('Send as critical message').' ' .
  &mt('and return receipt') . $crithelp . '<p>';   &mt('and return receipt') . $crithelp . '<p>';
       }        }
       my %lt=&Apache::lonlocal::texthash(
      'to' => 'To',
      'sb' => 'Subject',
      'sr' => 'Send Reply',
      'ca' => 'Cancel'
      );
       $r->print(<<"ENDREPLY");        $r->print(<<"ENDREPLY");
 <form action="/adm/email" method=post>  <form action="/adm/email" method="post">
 <input type=hidden name=sendreply value="$msgid">  <input type="hidden" name="sendreply" value="$msgid">
 To: $torepl<br />  $lt{'to'}: $torepl<br />
 Subject: <input type=text size=50 name=subject value="$subject"><p>  $lt{'sb'}: <input type="text" size=50 name="subject" value="$subject"><p>
 <textarea name=message cols=84 rows=10 wrap=hard>  <textarea name="message" cols="84" rows="10" wrap="hard">
 $quotemsg  $quotemsg
 </textarea><p>  </textarea></p><br />
 $dispcrit  $dispcrit
 <input type=submit value="Send Reply">  <input type="submit" name="send" value="$lt{'sr'}" />
   <input type="submit" name="cancel" value="$lt{'ca'}"/ >
 </form>  </form>
 ENDREPLY  ENDREPLY
 }  }
Line 764  sub compout { Line 777  sub compout {
     my $dissub='';      my $dissub='';
     my $dismsg='';      my $dismsg='';
     my $func=&mt('Send New');      my $func=&mt('Send New');
       if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {      my %lt=&Apache::lonlocal::texthash('us' => 'Username',
          'do' => 'Domain',
          'ad' => 'Additional Recipients',
          'sb' => 'Subject',
          'ca' => 'Cancel',
          'ma' => 'Mail');
   
       if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
  my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message");   my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message");
          $dispcrit=           $dispcrit=
  '<input type=checkbox name=critmsg> '.&mt('Send as critical message').' ' . $crithelp .    '<input type="checkbox" name="critmsg"> '.&mt('Send as critical message').' ' . $crithelp . 
  '<br>'.   '<br>'.
  '<input type=checkbox name=sendbck> '.&mt('Send as critical message').'  ' .   '<input type="checkbox" name="sendbck"> '.&mt('Send as critical message').'  ' .
  &mt('and return receipt') . $crithelp . '<p>';   &mt('and return receipt') . $crithelp . '<p>';
       }        }
     if ($forwarding) {      if ($forwarding) {
        $dispcrit.='<input type=hidden name=forwid value="'.         $dispcrit.='<input type="hidden" name="forwid" value="'.
    $forwarding.'">';     $forwarding.'">';
        $func=&mt('Forward');         $func=&mt('Forward');
       my %message=&Apache::lonnet::get('nohist_email',[$forwarding]);        my %message=&Apache::lonnet::get('nohist_email',[$forwarding]);
Line 796  sub compout { Line 816  sub compout {
     ('compemail','recuname','recdomain');      ('compemail','recuname','recdomain');
        $r->print(<<"ENDREC");         $r->print(<<"ENDREC");
 <table>  <table>
 <tr><td>Username:</td><td><input type=text size=12 name=recuname value="$ENV{'form.recname'}"></td><td rowspan="2">$selectlink</td></tr>  <tr><td>$lt{'us'}:</td><td><input type="text" size="12" name="recuname" value="$ENV{'form.recname'}"></td><td rowspan="2">$selectlink</td></tr>
 <tr><td>Domain:</td>  <tr><td>$lt{'do'}:</td>
 <td>$domform</td></tr>  <td>$domform</td></tr>
 ENDREC  ENDREC
     }      }
     my $latexHelp = Apache::loncommon::helpLatexCheatsheet();      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>$lt{'ad'}<br /><tt>username\@domain,username\@domain, ...
 </tt></td><td>  </tt></td><td>
 <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>$lt{'sb'}:</td><td><input type="text" size="50" name="subject" value="$dissub">
 </td></tr></table>  </td></tr></table>
 $latexHelp  $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><br />
 $dispcrit  $dispcrit
 <input type=submit value="$func Mail">  <input type="submit" name="send" value="$func $lt{'ma'}" />
   <input type="submit" name="cancel" value="$lt{'ca'}" />
 ENDCOMP  ENDCOMP
     } else { # $broadcast is 'upload'      } else { # $broadcast is 'upload'
  $r->print(<<ENDUPLOAD);   $r->print(<<ENDUPLOAD);
Line 866  sub disfacetoface { Line 887  sub disfacetoface {
         next if ($content{'senderdomain'} eq '');          next if ($content{'senderdomain'} eq '');
         $content{'message'}=~s/\n/\<br\>/g;          $content{'message'}=~s/\n/\<br\>/g;
         if ($content{'subject'}=~/^Record/) {          if ($content{'subject'}=~/^Record/) {
     $result.='<h3>Record</h3>';      $result.='<h3>'.&mt('Record').'</h3>';
         } else {          } else {
             $result.='<h3>Sent Message</h3>';              $result.='<h3>'.&mt('Sent Message').'</h3>';
             %content=&unpackagemsg($content{'message'});              %content=&unpackagemsg($content{'message'});
             $content{'message'}=              $content{'message'}=
                 '<b>Subject: '.$content{'subject'}.'</b><br />'.                  '<b>Subject: '.$content{'subject'}.'</b><br />'.
  $content{'message'};   $content{'message'};
         }          }
         $result.='By: <b>'.          $result.=&mt('By').': <b>'.
 &Apache::loncommon::aboutmewrapper(  &Apache::loncommon::aboutmewrapper(
  &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('.   &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('.
 $content{'sendername'}.'@'.  $content{'sendername'}.'@'.
Line 1038  $content{'sendername'},$content{'senderd Line 1059  $content{'sendername'},$content{'senderd
   } elsif ($ENV{'form.replyto'}) {    } elsif ($ENV{'form.replyto'}) {
       &comprep($r,$ENV{'form.replyto'});        &comprep($r,$ENV{'form.replyto'});
   } elsif ($ENV{'form.sendreply'}) {    } elsif ($ENV{'form.sendreply'}) {
       my $msgid=$ENV{'form.sendreply'};        if ($ENV{'form.send'}) {
       my %message=&Apache::lonnet::get('nohist_email',[$msgid]);    my $msgid=$ENV{'form.sendreply'};
       my %content=&unpackagemsg($message{$msgid},1);    my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
       &statuschange($msgid,'replied');    my %content=&unpackagemsg($message{$msgid},1);
       if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&     &statuschange($msgid,'replied');
           (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {    if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
          $r->print(&mt('Sending critical').': '.        (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
                 &user_crit_msg($content{'sendername'},        $r->print(&mt('Sending critical message').': '.
                                  $content{'senderdomain'},   &user_crit_msg($content{'sendername'},
                                  &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),         $content{'senderdomain'},
                                  &Apache::lonfeedback::clear_out_html($ENV{'form.message'}),         &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
                                  $ENV{'form.sendbck'}));         &Apache::lonfeedback::clear_out_html($ENV{'form.message'}),
       } else {         $ENV{'form.sendbck'}));
          $r->print(&mt('Sending').': '.&user_normal_msg($content{'sendername'},    } else {
                                  $content{'senderdomain'},        $r->print(&mt('Sending').': '.&user_normal_msg($content{'sendername'},
                                  &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),       $content{'senderdomain'},
                                  &Apache::lonfeedback::clear_out_html($ENV{'form.message'})));       &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
        &Apache::lonfeedback::clear_out_html($ENV{'form.message'})));
     }
       }        }
       if ($ENV{'form.displayedcrit'}) {        if ($ENV{'form.displayedcrit'}) {
           &discrit($r);            &discrit($r);
Line 1101  $content{'sendername'},$content{'senderd Line 1124  $content{'sendername'},$content{'senderd
   } elsif ($ENV{'form.recordftf'}) {    } elsif ($ENV{'form.recordftf'}) {
       &facetoface($r,$ENV{'form.recordftf'});        &facetoface($r,$ENV{'form.recordftf'});
   } elsif ($ENV{'form.sendmail'}) {    } elsif ($ENV{'form.sendmail'}) {
       my %content=();        my $sendstatus='';
       undef %content;        if ($ENV{'form.send'}) {
       if ($ENV{'form.forwid'}) {    my %content=();
         my $msgid=$ENV{'form.forwid'};    undef %content;
         my %message=&Apache::lonnet::get('nohist_email',[$msgid]);    if ($ENV{'form.forwid'}) {
         %content=&unpackagemsg($message{$msgid},1);        my $msgid=$ENV{'form.forwid'};
         &statuschange($msgid,'forwarded');        my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
         $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".        %content=&unpackagemsg($message{$msgid},1);
                        $content{'message'};        &statuschange($msgid,'forwarded');
       }        $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
       my %toaddr=();    $content{'message'};
       undef %toaddr;    }
       if ($ENV{'form.sendmode'} eq 'group') {    my %toaddr=();
           foreach (keys %ENV) {    undef %toaddr;
       if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {    if ($ENV{'form.sendmode'} eq 'group') {
   $toaddr{$1}='';        foreach (keys %ENV) {
               }    if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
           }        $toaddr{$1}='';
       } elsif ($ENV{'form.sendmode'} eq 'upload') {    }
           foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) {        }
               my ($rec,$txt)=split(/\s*\:\s*/,$_);    } elsif ($ENV{'form.sendmode'} eq 'upload') {
               if ($txt) {        foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) {
   $rec=~s/\@/\:/;    my ($rec,$txt)=split(/\s*\:\s*/,$_);
                   $toaddr{$rec}.=$txt."\n";    if ($txt) {
               }        $rec=~s/\@/\:/;
           }        $toaddr{$rec}.=$txt."\n";
       } else {    }
   $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';        }
       }    } else {
       if ($ENV{'form.additionalrec'}) {        $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';
   foreach (split(/\,/,$ENV{'form.additionalrec'})) {    }
               my ($auname,$audom)=split(/\@/,$_);    if ($ENV{'form.additionalrec'}) {
               $toaddr{$auname.':'.$audom}='';        foreach (split(/\,/,$ENV{'form.additionalrec'})) {
           }    my ($auname,$audom)=split(/\@/,$_);
       }    $toaddr{$auname.':'.$audom}='';
     foreach (keys %toaddr) {        }
       my ($recuname,$recdomain)=split(/\:/,$_);    }
       my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'});    foreach (keys %toaddr) {
       if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; }            my ($recuname,$recdomain)=split(/\:/,$_);
       if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&         my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'});
           (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {        if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; }    
          $r->print('Sending critical: '.        if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
                 &user_crit_msg($recuname,$recdomain,    (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
                &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),    $r->print(&mt('Sending critical message').' ...');
                                  $msgtxt,                    $sendstatus.=' '.&user_crit_msg($recuname,$recdomain,
                                  $ENV{'form.sendbck'}));     &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
      $msgtxt,
      $ENV{'form.sendbck'});
         } else {
     $r->print(&mt('Sending').' ...');
                     $sendstatus.=' '.&user_normal_msg($recuname,$recdomain,
                            &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
    $msgtxt,
    $content{'citation'});
         }
         $r->print('<br />');
     }
         }
         if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
     if ($ENV{'form.displayedcrit'}) {
         &discrit($r);
     } else {
         &disall($r);
     }
       } else {        } else {
          $r->print('Sending: '.&user_normal_msg($recuname,$recdomain,    $r->print(
               &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),    '<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'.
                                  $msgtxt,    &mt('Please use the browser "Back" button and correct the recipient addresses')
                                  $content{'citation'}));      );
       }  
       $r->print('<br>');  
     }  
       if ($ENV{'form.displayedcrit'}) {  
           &discrit($r);  
       } else {  
   &disall($r);  
       }        }
   } else {    } else {
       &disall($r);        &disall($r);

Removed from v.1.68  
changed lines
  Added in v.1.71


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