Diff for /loncom/interface/lonmsgdisplay.pm between versions 1.83 and 1.88

version 1.83, 2007/12/08 00:25:14 version 1.88, 2008/06/06 22:50:41
Line 513  sub discourse { Line 513  sub discourse {
           
     $result .= '<input type="hidden" name="sendmode" value="group" />'."\n";      $result .= '<input type="hidden" name="sendmode" value="group" />'."\n";
   
     $result .= &Apache::lonselstudent::render_student_list($current_members,      my $tmptext;
    "compemail",      if ($tmptext = &Apache::lonselstudent::render_student_list($current_members,
    "current",                                                                 "compemail",
    \%defaultUsers,                                                                 "current",
    1,"selectedusers",1);                                                                 \%defaultUsers,
                                                                  1,"selectedusers",1)
     $result .= &Apache::lonselstudent::render_student_list($expired_members,         ) {
    "compemail",         $result .= '<h2>'.&mt('Course members with current access').'</h2>';
    "expired",         $result .= $tmptext;
    \%defaultUsers,      }
    1, "selectedusers",0);      if ($tmptext = &Apache::lonselstudent::render_student_list($expired_members,
     $result .= &Apache::lonselstudent::render_student_list($future_members,                                                                 "compemail",
    "compemail",                                                                 "expired",
    "future",                                                                 \%defaultUsers,
    \%defaultUsers,                                                                 1, "selectedusers",0)
    1, "selectedusers", 0);         ) {
          $result .= '<h2>'.&mt('Course members with expired access').'</h2>';
          $result .= $tmptext;
       }
       if ($tmptext = &Apache::lonselstudent::render_student_list($future_members,
                                                                  "compemail",
                                                                  "future",
                                                                  \%defaultUsers,
                                                                  1, "selectedusers", 0)
          ) {
          $result .= '<h2>'.&mt('Course members with future access').'</h2>';
          $result .= $tmptext;
       }
     return $result;      return $result;
 }  }
   
Line 555  sub disgroup { Line 567  sub disgroup {
                       'recipients to select.');                        'recipients to select.');
         return $result;          return $result;
     } else {      } else {
         $result = &mt('Select message recipients from the group members listed below.<br />');            $result = &mt('Select message recipients from the group members listed below.').'<br />';  
         my %Sortby = (          my %Sortby = (
                          active   => {},                           active   => {},
                          previous => {},                           previous => {},
Line 729  sub discrit { Line 741  sub discrit {
     foreach my $key (sort(keys(%what))) {      foreach my $key (sort(keys(%what))) {
         my %content=&Apache::lonmsg::unpackagemsg($what{$key});          my %content=&Apache::lonmsg::unpackagemsg($what{$key});
         next if ($content{'senderdomain'} eq '');          next if ($content{'senderdomain'} eq '');
         $result.='<hr />'.&mt('From').': <b>'.          $result .= &Apache::lonhtmlcommon::start_pick_box()
 &Apache::loncommon::aboutmewrapper(                    .&Apache::lonhtmlcommon::row_title(&mt('From'),undef,'LC_oddrow_value')
  &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('.                    .'<b>'.&Apache::loncommon::aboutmewrapper(
 $content{'sendername'}.':'.                     &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b>'
             $content{'senderdomain'}.') '.$content{'time'}.                    .' ('.$content{'sendername'}.':'.$content{'senderdomain'}.')'
             '<br />'.&mt('Subject').': '.$content{'subject'}.                    .&Apache::lonhtmlcommon::row_closure(1)
             '<br /><pre>'.                    .&Apache::lonhtmlcommon::row_title(&mt('Date'),undef,'LC_evenrow_value')
               &Apache::lontexconvert::msgtexconverted($content{'message'}).                    .$content{'time'}
             '</pre><small>';                    .&Apache::lonhtmlcommon::row_closure(1)
                     .&Apache::lonhtmlcommon::row_title(&mt('Subject'),undef,'LC_oddrow_value')
                     .$content{'subject'}
                     .&Apache::lonhtmlcommon::row_closure(1)
                     .&Apache::lonhtmlcommon::row_title(&mt('Message'),undef,'LC_evenrow_value')
                     .'<pre>'.&Apache::lontexconvert::msgtexconverted($content{'message'}).'</pre>'
                     .&Apache::lonhtmlcommon::row_closure()
                     .&Apache::lonhtmlcommon::row_title('',undef,'LC_oddrow_value')
                     .'<div class="LC_warning">';
         my ($rec_button,$reprec_button);          my ($rec_button,$reprec_button);
         $rec_button = &mt('Move to Inbox');          $rec_button = &mt('Move to Inbox');
         if (!$content{'noreplies'}) {          if (!$content{'noreplies'}) {
Line 752  $content{'sendername'}.':'. Line 772  $content{'sendername'}.':'.
         } else {          } else {
             $result .= &mt('Access to other pages will be prevented until you have moved the message to your inbox.');               $result .= &mt('Access to other pages will be prevented until you have moved the message to your inbox.'); 
         }          }
         $result .= '</small><br />'.          $result .= '</div>'
             '<input type="submit" name="rec_'.$key.'" value="'.$rec_button.'" />';                    .&Apache::lonhtmlcommon::row_closure(1)
                     .&Apache::lonhtmlcommon::row_title('',undef,'LC_evenrow_value')
                     .'<input type="submit" name="rec_'.$key.'" value="'.$rec_button.'" />';
         if (!$content{'noreplies'}) {          if (!$content{'noreplies'}) {
             $result .= '<input type="submit" name="reprec_'.$key.'" '.              $result .= '<input type="submit" name="reprec_'.$key.'" '
                   'value="'.$reprec_button.'" />';                        .'value="'.$reprec_button.'" />'
         }          }
           $result .= &Apache::lonhtmlcommon::row_closure(1)
                     .&Apache::lonhtmlcommon::end_pick_box()
                     .'<br />';
     }      }
     # Check to see if there were any messages.      # Check to see if there were any messages.
     if ($result eq '') {      if ($result eq '') {
Line 1194  sub compout { Line 1219  sub compout {
         &printheader($r,'/adm/email?compose=multiforward',          &printheader($r,'/adm/email?compose=multiforward',
              'Forwarding Multiple Messages');               'Forwarding Multiple Messages');
         if ($multiforward > 1) {          if ($multiforward > 1) {
             $r->print(&mt('Each of the <b>[quant,_1,message]</b> you checked              $r->print(&mt('Each of the <b>[quant,_1,message]</b> you checked'
 will be forwarded to the recipient(s) you select below.',$multiforward).'<br />');                           .' will be forwarded to the recipient(s) you select below.',$multiforward)
                       .'<br />');
         } else {          } else {
             $r->print(&mt('The message you checked will be forwarded to the recipient(s) you select below.').'<br />');              $r->print(&mt('The message you checked will be forwarded to the recipient(s) you select below.').'<br />');
         }          }
Line 1209  will be forwarded to the recipient(s) yo Line 1235  will be forwarded to the recipient(s) yo
     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 1223  will be forwarded to the recipient(s) yo Line 1250  will be forwarded to the recipient(s) yo
                                        '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 1417  $latexHelp. Line 1452  $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 1504  ENDREP Line 1542  ENDREP
 sub additional_rec_row {  sub additional_rec_row {
     my ($lt) = @_;      my ($lt) = @_;
     my $cc = &mt('Cc:');      my $cc = &mt('Cc:');
     my $bcc = &mt('Bcc:');       my $bcc = &mt('Bcc:');
       my $exmpl = &mt('username:domain,username:domain,...'); 
     my $output = <<"ENDADD";      my $output = <<"ENDADD";
 <tr><td>$lt->{'ad'} :<br /><tt>username:domain,username:domain, ...  <tr><td>$lt->{'ad'} :<br /><tt>($exmpl)
 </tt></td><td>&nbsp;<span class="LC_nobreak">$cc   </tt></td><td>&nbsp;<span class="LC_nobreak">$cc 
 <input type="text" size="50" name="additionalrec_cc" /></span><br />  <input type="text" size="50" name="additionalrec_cc" /></span><br />
 <span class="LC_nobreak">$bcc <input type="text" size="50" name="additionalrec_bcc" /></span></td></tr>  <span class="LC_nobreak">$bcc <input type="text" size="50" name="additionalrec_bcc" /></span></td></tr>
Line 2390  sub sendoffmail { Line 2429  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 2412  sub sendoffmail { Line 2453  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 2514  sub sendoffmail { Line 2558  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 2540  sub sendoffmail { Line 2595  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 2573  sub sendoffmail { Line 2628  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 2590  sub sendoffmail { Line 2645  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 2598  sub sendoffmail { Line 2653  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 2610  sub sendoffmail { Line 2665  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 2627  sub sendoffmail { Line 2682  sub sendoffmail {
         }          }
             } else {              } else {
         $r->print('<p><span class="LC_error">'.&mt('Could not deliver message').'</span> '.          $r->print('<p><span class="LC_error">'.&mt('Could not deliver message').'</span> '.
           &mt('Please use the browser "Back" button and correct the recipient addresses '."($sendstatus)").'</p>');            &mt('Please use the browser "Back" button and correct the recipient addresses ([_1]).',$sendstatus).'</p>');
             }              }
         }          }
     }      }
Line 2862  sub handler { Line 2917  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 2876  sub handler { Line 2931  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.83  
changed lines
  Added in v.1.88


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