Diff for /loncom/interface/lonmsg.pm between versions 1.114 and 1.115

version 1.114, 2004/11/11 20:41:53 version 1.115, 2004/11/12 16:22:48
Line 1028  sub compout { Line 1028  sub compout {
     my $dispcrit='';      my $dispcrit='';
     my $dissub='';      my $dissub='';
     my $dismsg='';      my $dismsg='';
       my $disbase='';
     my $func=&mt('Send New');      my $func=&mt('Send New');
     my %lt=&Apache::lonlocal::texthash('us' => 'Username',      my %lt=&Apache::lonlocal::texthash('us' => 'Username',
        'do' => 'Domain',         'do' => 'Domain',
Line 1057  sub compout { Line 1058  sub compout {
  $dissub=&mt('Forwarding').': '.$content{'subject'};   $dissub=&mt('Forwarding').': '.$content{'subject'};
  $dismsg=&mt('Forwarded message from').' '.   $dismsg=&mt('Forwarded message from').' '.
     $content{'sendername'}.' '.&mt('at').' '.$content{'senderdomain'};      $content{'sendername'}.' '.&mt('at').' '.$content{'senderdomain'};
    if ($content{'baseurl'}) {
       $disbase='<input type="hidden" name="baseurl" value="'.&Apache::lonnet::escape($content{'baseurl'}).'" />';
    }
     }      }
     if ($replying) {      if ($replying) {
  %message=&Apache::lonnet::get('nohist_email',[$replying]);   %message=&Apache::lonnet::get('nohist_email',[$replying]);
Line 1070  sub compout { Line 1074  sub compout {
  $dismsg=~s/\r/\n/g;   $dismsg=~s/\r/\n/g;
  $dismsg=~s/\f/\n/g;   $dismsg=~s/\f/\n/g;
  $dismsg=~s/\n+/\n\> /g;   $dismsg=~s/\n+/\n\> /g;
    if ($content{'baseurl'}) {
       $disbase='<input type="hidden" name="baseurl" value="'.&Apache::lonnet::escape($content{'baseurl'}).'" />';
       if ($ENV{'user.adv'}) {
    $disbase='<input type="checkbox" name="storebasecomment" />'.&mt('Store message for re-use').'<br />';
       }
    }
     }      }
     my $citation=&displayresource(%content);      my $citation=&displayresource(%content);
     if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; }      if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; }
Line 1111  $latexHelp Line 1121  $latexHelp
 <textarea name="message" cols="80" rows="15" wrap="hard">$dismsg  <textarea name="message" cols="80" rows="15" wrap="hard">$dismsg
 </textarea></p><br />  </textarea></p><br />
 $dispcrit  $dispcrit
   $disbase
 <input type="submit" name="send" value="$func $lt{'ma'}" />  <input type="submit" name="send" value="$func $lt{'ma'}" />
 <input type="submit" name="cancel" value="$lt{'ca'}" /><hr />  <input type="submit" name="cancel" value="$lt{'ca'}" /><hr />
 $citation  $citation
Line 1735  sub displaymessage { Line 1746  sub displaymessage {
       ($content{'courseid'}?'<br /><b>'.&mt('Course').':</b> '.$courseinfo{'description'}.        ($content{'courseid'}?'<br /><b>'.&mt('Course').':</b> '.$courseinfo{'description'}.
        ($content{'coursesec'}?' ('.&mt('Group/Section').': '.$content{'coursesec'}.')':''):'').         ($content{'coursesec'}?' ('.&mt('Group/Section').': '.$content{'coursesec'}.')':''):'').
       '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.        '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.
         ($content{'baseurl'}?'<br /><b>'.&mt('Refers to').':</b> <a href="'.$content{'baseurl'}.'">'.
          $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')</a>':'').
       '<p><pre>'.        '<p><pre>'.
       &Apache::lontexconvert::msgtexconverted($content{'message'},1).        &Apache::lontexconvert::msgtexconverted($content{'message'},1).
       '</pre><hr />'.&displayresource(%content).'</p>');        '</pre><hr />'.&displayresource(%content).'</p>');
Line 1800  sub printheader { Line 1813  sub printheader {
     &header($r,$title,$baseurl);      &header($r,$title,$baseurl);
 }  }
   
   # ---------------------------------------------------------------- Send an email
   
   sub sendoffmail {
       my ($r)=@_;
       my $sendstatus='';
       if ($ENV{'form.send'}) {
    &printheader($r,'','Messages being sent.');
    $r->rflush();
    my %content=();
    undef %content;
    if ($ENV{'form.forwid'}) {
       my $msgid=$ENV{'form.forwid'};
       my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
       %content=&unpackagemsg($message{$msgid},1);
       &statuschange($msgid,'forwarded');
       $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
    $content{'message'};
    }
    if ($ENV{'form.replyid'}) {
       my $msgid=$ENV{'form.replyid'};
       my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
       %content=&unpackagemsg($message{$msgid},1);
       &statuschange($msgid,'replied');
    }
    my %toaddr=();
    undef %toaddr;
    if ($ENV{'form.sendmode'} eq 'group') {
       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*/,$_);
    if ($txt) {
       $rec=~s/\@/\:/;
       $toaddr{$rec}.=$txt."\n";
    }
       }
    } else {
       $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';
    }
    if ($ENV{'form.additionalrec'}) {
       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'});
       if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }
       my $thismsg;    
       if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
    (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
    $r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': ');
    $thismsg=&user_crit_msg($recuname,$recdomain,
    &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
    $msgtxt,
    $ENV{'form.sendbck'});
       } else {
    $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');
    $thismsg=&user_normal_msg($recuname,$recdomain,
     &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
     $msgtxt,
     $content{'citation'});
    if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) {
       &user_normal_msg_raw(
    $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
    $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
    'Broadcast ['.$recuname.':'.$recdomain.']',
    $msgtxt);
    }
       }
       $r->print($thismsg.'<br />');
       $sendstatus.=' '.$thismsg;
    }
       } else {
    &printheader($r,'','No messages sent.'); 
       }
       if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
    $r->print('<br /><font color="green">'.&mt('Completed.').'</font>');
    if ($ENV{'form.displayedcrit'}) {
       &discrit($r);
    } else {
       &Apache::loncommunicate::menu($r);
    }
       } else {
    $r->print(
     '<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'.
     &mt('Please use the browser "Back" button and correct the recipient addresses')
     );
       }
   }
   
 # ===================================================================== Handler  # ===================================================================== Handler
   
Line 1915  sub handler { Line 2024  sub handler {
     } elsif ($ENV{'form.block'}) {      } elsif ($ENV{'form.block'}) {
         &examblock($r,$ENV{'form.block'});          &examblock($r,$ENV{'form.block'});
     } elsif ($ENV{'form.sendmail'}) {      } elsif ($ENV{'form.sendmail'}) {
  my $sendstatus='';   &sendoffmessage($r);
  if ($ENV{'form.send'}) {  
     &printheader($r,'','Messages being sent.');  
     $r->rflush();  
     my %content=();  
     undef %content;  
     if ($ENV{'form.forwid'}) {  
  my $msgid=$ENV{'form.forwid'};  
  my %message=&Apache::lonnet::get('nohist_email',[$msgid]);  
  %content=&unpackagemsg($message{$msgid},1);  
  &statuschange($msgid,'forwarded');  
  $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".  
     $content{'message'};  
     }  
     if ($ENV{'form.replyid'}) {  
  my $msgid=$ENV{'form.replyid'};  
  my %message=&Apache::lonnet::get('nohist_email',[$msgid]);  
  %content=&unpackagemsg($message{$msgid},1);  
  &statuschange($msgid,'replied');  
     }  
     my %toaddr=();  
     undef %toaddr;  
     if ($ENV{'form.sendmode'} eq 'group') {  
  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*/,$_);  
     if ($txt) {  
  $rec=~s/\@/\:/;  
  $toaddr{$rec}.=$txt."\n";  
     }  
  }  
     } else {  
  $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';  
     }  
     if ($ENV{'form.additionalrec'}) {  
  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'});  
  if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }  
  my $thismsg;      
  if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&   
     (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {  
     $r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': ');  
     $thismsg=&user_crit_msg($recuname,$recdomain,  
     &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),  
     $msgtxt,  
     $ENV{'form.sendbck'});  
  } else {  
     $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');  
     $thismsg=&user_normal_msg($recuname,$recdomain,  
       &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),  
       $msgtxt,  
       $content{'citation'});  
                     if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) {  
                         &user_normal_msg_raw(  
                         $ENV{'course.'.$ENV{'request.course.id'}.'.num'},  
                         $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},  
                         'Broadcast ['.$recuname.':'.$recdomain.']',  
                         $msgtxt);  
                     }  
  }  
  $r->print($thismsg.'<br />');  
  $sendstatus.=' '.$thismsg;  
     }  
  } else {  
     &printheader($r,'','No messages sent.');   
  }  
  if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {  
     $r->print('<br /><font color="green">'.&mt('Completed.').'</font>');  
     if ($ENV{'form.displayedcrit'}) {  
  &discrit($r);  
     } else {  
  &Apache::loncommunicate::menu($r);  
     }  
  } else {  
     $r->print(  
       '<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'.  
       &mt('Please use the browser "Back" button and correct the recipient addresses')  
       );  
  }  
     } elsif ($ENV{'form.newfolder'}) {      } elsif ($ENV{'form.newfolder'}) {
  &printheader($r,'','New Folder');   &printheader($r,'','New Folder');
  &makefolder($ENV{'form.newfolder'});   &makefolder($ENV{'form.newfolder'});

Removed from v.1.114  
changed lines
  Added in v.1.115


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