Diff for /loncom/interface/lonmsgdisplay.pm between versions 1.85 and 1.86

version 1.85, 2008/02/22 18:08:35 version 1.86, 2008/06/06 05:24:28
Line 1210  sub compout { Line 1210  sub compout {
     my $dissub='';      my $dissub='';
     my $dismsg='';      my $dismsg='';
     my $disbase='';      my $disbase='';
       my $attachrow;
     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 1224  sub compout { Line 1225  sub compout {
                                        'gmt' => 'General message text',                                         'gmt' => 'General message text',
                                        'tff' => 'The file format for the uploaded portion of the message is',                                         'tff' => 'The file format for the uploaded portion of the message is',
                                        'uas' => 'Upload and Send',                                         'uas' => 'Upload and Send',
                                          'atta' => 'Attachment',
                                       );                                        );
       my %attachmax = (
                        text => '(128 KB max size)',
                        num  => 131072,
                       );
       if (!$forwarding && !$multiforward) {
           $attachrow = '<br />'.$lt{'atta'}.' '.$attachmax{'text'}.': <input type="file" name="attachment" />';
       }
     if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})      if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
  || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.   || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
     '/'.$env{'request.course.sec'})) {      '/'.$env{'request.course.sec'})) {
Line 1418  $latexHelp. Line 1427  $latexHelp.
 </table>  </table>
 $latexHelp  $latexHelp
 <textarea name="message" id="message" cols="80" rows="15" wrap="hard">$dismsg  <textarea name="message" id="message" cols="80" rows="15" wrap="hard">$dismsg
 </textarea></p><br />  </textarea>
   $attachrow
   </p>
   <br />
 $dispcrit  $dispcrit
 $disbase  $disbase
 ENDCOMP  ENDCOMP
Line 2392  sub sendoffmail { Line 2404  sub sendoffmail {
     my %msg_status;      my %msg_status;
     my $numsent = 0;      my $numsent = 0;
     my $nosentstore = 1;      my $nosentstore = 1;
       my $attachmenturl;
       my $now = time;
     my ($cdom,$cnum,$group);      my ($cdom,$cnum,$group);
     if (exists($env{'form.group'})) {      if (exists($env{'form.group'})) {
         $group = $env{'form.group'};          $group = $env{'form.group'};
Line 2414  sub sendoffmail { Line 2428  sub sendoffmail {
  if ($env{'form.forwid'}) {   if ($env{'form.forwid'}) {
     my $msgid=$env{'form.forwid'};      my $msgid=$env{'form.forwid'};
     my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);      my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);
     %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1);      %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1,1);
     &statuschange($msgid,'forwarded',$folder);      &statuschange($msgid,'forwarded',$folder);
     $env{'form.message'}.="\n\n-- Forwarded message --\n\n".              if ($content{'attachmenturl'} ne '') {
  $content{'message'};                  $attachmenturl = $content{'attachmenturl'};
               }
       $env{'form.message'} .= "\n\n-- Forwarded message --\n\n".
                       $content{'message'};
  }   }
  if ($env{'form.replyid'}) {   if ($env{'form.replyid'}) {
     my $msgid=$env{'form.replyid'};      my $msgid=$env{'form.replyid'};
Line 2516  sub sendoffmail { Line 2533  sub sendoffmail {
                                        $env{'user.domain'},\%reciphash);                                         $env{'user.domain'},\%reciphash);
         if ($recipstatus ne 'ok') {          if ($recipstatus ne 'ok') {
             &Apache::lonnet::logthis('Failed to store Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'});              &Apache::lonnet::logthis('Failed to store Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'});
         }            }
           if ($env{'form.attachment'}) {
               if (length($env{'form.attachment'})<131072) {
                   $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now);
               } else {
                   $r->print('<p><span class="LC_warning">'.&mt('Attachment not included - exceeded permitted length').'</span><br /></p>');
               }
           } elsif ($env{'form.multiforward'}) {
               if ($env{'form.attachmenturl'} ne '') {
                   $attachmenturl = $env{'form.attachmenturl'};
               }
           }
         my @recusers;          my @recusers;
         my @recudoms;          my @recudoms;
  foreach my $address (sort(keys(%toaddr))) {   foreach my $address (sort(keys(%toaddr))) {
Line 2542  sub sendoffmail { Line 2570  sub sendoffmail {
     &Apache::lonmsg::user_normal_msg($recuname,$recdomain,      &Apache::lonmsg::user_normal_msg($recuname,$recdomain,
      $msgsubj,$msgtxt,       $msgsubj,$msgtxt,
      $content{'citation'},       $content{'citation'},
      undef,undef,       undef,$attachmenturl,
      $env{'form.permanent'},       $env{'form.permanent'},
      \$sentmessage{$address},       \$sentmessage{$address},
                                                      undef,undef,undef,                                                       undef,undef,undef,
Line 2575  sub sendoffmail { Line 2603  sub sendoffmail {
                 $specialresult =                   $specialresult = 
                     &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,                      &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,
                         $subj_prefix.' '.$course_str,$savemsg,undef,undef,                          $subj_prefix.' '.$course_str,$savemsg,undef,undef,
                         undef,undef,undef,\$specialmsgid,undef,undef,undef,                          $attachmenturl,undef,undef,\$specialmsgid,undef,undef,undef,
                         undef,undef,1);                          undef,undef,1);
                 $specialmsgid = &unescape($specialmsgid);                  $specialmsgid = &unescape($specialmsgid);
                 if ($specialresult eq 'ok') {                  if ($specialresult eq 'ok') {
Line 2592  sub sendoffmail { Line 2620  sub sendoffmail {
     $pid);      $pid);
                             &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,                              &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,
                                 $subj_prefix.' ['.$recipient.']',$msgsubj,                                  $subj_prefix.' ['.$recipient.']',$msgsubj,
                                 undef,undef,undef,undef,$usermsgid,undef,                                  undef,undef,$attachmenturl,undef,$usermsgid,undef,
                                 undef,$specialmsgid,undef,undef,undef,1);                                  undef,$specialmsgid,undef,undef,undef,1);
                         }                          }
                     }                      }
Line 2600  sub sendoffmail { Line 2628  sub sendoffmail {
                         &Apache::lonmsg::process_sent_mail($msgsubj,                          &Apache::lonmsg::process_sent_mail($msgsubj,
                            $subj_prefix,$numsent,$stamp,$msgname,$msgdom,                             $subj_prefix,$numsent,$stamp,$msgname,$msgdom,
                            $msgcount,$context,$pid,$savemsg,\@recusers,                             $msgcount,$context,$pid,$savemsg,\@recusers,
                            \@recudoms);                             \@recudoms,undef,$attachmenturl);
                     }                      }
                 } else {                  } else {
                     &Apache::lonnet::logthis('Failed to create record of critical, broadcast or archived message in '.$env{'course.'.$env{'request.course.id'}.'.num'}.' '&mt('at').' '.$env{'course.'.$env{'request.course.id'}.'.domain'}.' - no msgid generated');                      &Apache::lonnet::logthis('Failed to create record of critical, broadcast or archived message in '.$env{'course.'.$env{'request.course.id'}.'.num'}.' '&mt('at').' '.$env{'course.'.$env{'request.course.id'}.'.domain'}.' - no msgid generated');
Line 2612  sub sendoffmail { Line 2640  sub sendoffmail {
                 &Apache::lonmsg::process_sent_mail($msgsubj,$subj_prefix,                  &Apache::lonmsg::process_sent_mail($msgsubj,$subj_prefix,
                        $numsent,$stamp,$env{'user.name'},                         $numsent,$stamp,$env{'user.name'},
                        $env{'user.domain'},$msgcount,$context,                         $env{'user.domain'},$msgcount,$context,
                        $$,$savemsg,\@recusers,\@recudoms);                         $$,$savemsg,\@recusers,\@recudoms,undef,$attachmenturl);
             }              }
         }          }
         if (!$env{'form.multiforward'}) {           if (!$env{'form.multiforward'}) { 
Line 2864  sub handler { Line 2892  sub handler {
             foreach my $item (@to_forward) {              foreach my $item (@to_forward) {
                 my $msgid=&unescape($item);                  my $msgid=&unescape($item);
                 my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);                  my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);
                 my %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1);                  my %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1,1);
                 if ($env{'form.showorigsubj'}) {                  if ($env{'form.showorigsubj'}) {
                     $env{'form.subject'} = $fixed_subj.$content{'subject'};                      $env{'form.subject'} = $fixed_subj.$content{'subject'};
                 } else {                  } else {
Line 2878  sub handler { Line 2906  sub handler {
                         &Apache::loncommon::plainname($uname,$udom).' ('.                          &Apache::loncommon::plainname($uname,$udom).' ('.
                                            $uname.':'.$udom.')';                                             $uname.':'.$udom.')';
                 }                  }
                 $env{'form.message'} .= "\n\n-- Forwarded message --\n\n".                  $env{'form.message'}.="\n\n-- Forwarded message --\n\n".
                                         $content{'message'};                                        $content{'message'};
                   $env{'form.attachmenturl'} = $content{'attachmenturl'};
                   $env{'form.multiforwid'} = $item;
                 $fwdcount ++;                  $fwdcount ++;
                 $r->print($fwdcount.': ');                   $r->print($fwdcount.': '); 
                 $sendresult{$msgid} = &sendoffmail($r,$folder);                  $sendresult{$msgid} = &sendoffmail($r,$folder);

Removed from v.1.85  
changed lines
  Added in v.1.86


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