Diff for /loncom/interface/lonmsgdisplay.pm between versions 1.73 and 1.87

version 1.73, 2007/05/02 19:56:34 version 1.87, 2008/06/06 17:46:15
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 737  $content{'sendername'}.':'. Line 749  $content{'sendername'}.':'.
             '<br />'.&mt('Subject').': '.$content{'subject'}.              '<br />'.&mt('Subject').': '.$content{'subject'}.
             '<br /><pre>'.              '<br /><pre>'.
               &Apache::lontexconvert::msgtexconverted($content{'message'}).                &Apache::lontexconvert::msgtexconverted($content{'message'}).
             '</pre><small>'.              '</pre><div class="LC_error">';
 &mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox').          my ($rec_button,$reprec_button);
             '</small><br />'.          $rec_button = &mt('Move to Inbox');
             '<input type="submit" name="rec_'.$key.'" value="'.&mt('Confirm Receipt').'" />'.          if (!$content{'noreplies'}) {
             '<input type="submit" name="reprec_'.$key.'" '.              $reprec_button = &mt('Move to Inbox/Compose reply');
                   'value="'.&mt('Confirm Receipt and Reply').'" />';          }
           if ($content{'sendback'}) {
               $rec_button = &mt('Confirm Receipt');
               if (!$content{'noreplies'}) {
                   $reprec_button = &mt('Confirm Receipt and Reply');
               }
               $result .= &mt('You have to confirm that you have received this message before you can view other pages. After confirmation, this message will be moved to your regular inbox');
           } else {
               $result .= &mt('Access to other pages will be prevented until you have moved the message to your inbox.'); 
           }
           $result .= '</div><br />'.
               '<input type="submit" name="rec_'.$key.'" value="'.$rec_button.'" />';
           if (!$content{'noreplies'}) {
               $result .= '<input type="submit" name="reprec_'.$key.'" '.
                     'value="'.$reprec_button.'" />';
           }
     }      }
     # Check to see if there were any messages.      # Check to see if there were any messages.
     if ($result eq '') {      if ($result eq '') {
Line 877  sub get_course_desc { Line 904  sub get_course_desc {
   
 sub disall {  sub disall {
     my ($r,$folder,$msgstatus)=@_;      my ($r,$folder,$msgstatus)=@_;
     my %saveable = ('folder'    => 'scalar',      my %saveable = ('msgstatus' => 'scalar',
     'msgstatus' => 'scalar',  
     'sortedby'  => 'scalar',      'sortedby'  => 'scalar',
     'interdis'  => 'scalar',      'interdis'  => 'scalar',
     );      );
Line 915  sub disfolder { Line 941  sub disfolder {
 <script type="text/javascript">  <script type="text/javascript">
     $jscript      $jscript
   
     function checkfoldermove() {  
         if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') {  
             if (document.disall.movetofolder.options[document.disall.movetofolder.selectedIndex].value == "") {  
                 alert("$lt{'sede'}");  
                 return;  
             }  
         }  
         return;   
     }  
   
     function validate_checkedaction() {      function validate_checkedaction() {
         document.disall.markedaction.value = document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value;          document.disall.markedaction.value = document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value;
         if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') {          if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') {
Line 1096  ENDDISHEADER Line 1112  ENDDISHEADER
   '<input type="button" onclick="javascript:uncheckAll(document.disall.delmark)" value="'.&mt('Uncheck All').'" />'."\n".    '<input type="button" onclick="javascript:uncheckAll(document.disall.delmark)" value="'.&mt('Uncheck All').'" />'."\n".
   '<input type="hidden" name="sortedby" value="'.$env{'form.sortedby'}.'" /></td><td>&nbsp;</td>'."\n".    '<input type="hidden" name="sortedby" value="'.$env{'form.sortedby'}.'" /></td><td>&nbsp;</td>'."\n".
   '<td align="center"><b>'.&mt('Action').'</b><br />'."\n".    '<td align="center"><b>'.&mt('Action').'</b><br />'."\n".
   '  <select name="checkedaction" onchange="javascript:checkfoldermove()">'."\n");    '  <select name="checkedaction">'."\n");
   
     if ($folder ne 'trash') {      if ($folder ne 'trash') {
         $r->print('    <option value="markeddel">'.&mt('Delete').'</option>'."\n");          $r->print('    <option value="markeddel">'.&mt('Delete').'</option>'."\n");
Line 1190  sub compout { Line 1206  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 1205  will be forwarded to the recipient(s) yo Line 1222  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',
        'ad'  => 'Additional Recipients',         'ad'  => 'Additional Recipients',
                                          'rt'  => 'Reply to',
                                          'ar'  => 'Allow replies',
        'sb'  => 'Subject',         'sb'  => 'Subject',
        'ca'  => 'Cancel',         'ca'  => 'Cancel',
        'ma'  => 'Mail',         'ma'  => 'Mail',
Line 1217  will be forwarded to the recipient(s) yo Line 1237  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 1319  ENDREPSCRIPT Line 1347  ENDREPSCRIPT
     }       } 
     if (($broadcast ne 'group') && ($broadcast ne 'upload')) {      if (($broadcast ne 'group') && ($broadcast ne 'upload')) {
  if ($replying) {   if ($replying) {
     $r->print('<tr><td colspan="2">'.&mt('Replying to').' '.              if ($content{'noreplies'}) {
       &Apache::loncommon::aboutmewrapper(                  $r->print('<tr><td>'.&mt('This message was designated by the sender not to allow replies.').'</td></tr></table></form>');
                   return;
               }
               $r->print('<tr><td colspan="2">'.&mt('Replying to').' ');
               if ($content{'replytoaddr'}) {
                   my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'});
                   if ($replytoname ne '' && $replytodom ne '') {
                       $r->print(&Apache::loncommon::plainname($replytoname,
                                    $replytodom).' ('.$replytoname.':'.
                                    $replytodom.')');
                       $r->print('<input type="hidden" name="recuname" value="'.
                             $replytoname.'" />'.
                             '<input type="hidden" name="recdomain" value="'.
                             $replytodom.'" /></td></tr>');
   
                   } else {
                       $r->print(&mt('The sender did not designate a reply to address for this message.').'</td></tr></table>');
                       return;
                   }
               } else {
           $r->print(&Apache::loncommon::aboutmewrapper(
  &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.   &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
       $content{'sendername'}.':'.        $content{'sendername'}.':'.
       $content{'senderdomain'}.')'.        $content{'senderdomain'}.')');
       '<input type="hidden" name="recuname" value="'.$content{'sendername'}.'" />'.                  $r->print('<input type="hidden" name="recuname" value="'.
       '<input type="hidden" name="recdomain" value="'.$content{'senderdomain'}.'" />'.            $content{'sendername'}.'" />'.
       '</td></tr>');            '<input type="hidden" name="recdomain" value="'.
                             $content{'senderdomain'}.'" /></td></tr>');
               }
             if ($content{'recipid'}) {              if ($content{'recipid'}) {
                 my @ccs = &retrieve_cc_recips('replying',%content);                  my @ccs = &retrieve_cc_recips('replying',%content);
                 if (@ccs > 0) {                  if (@ccs > 0) {
Line 1379  $latexHelp. Line 1429  $latexHelp.
     } elsif ($broadcast ne 'upload') {      } elsif ($broadcast ne 'upload') {
         $subj_size = '50';          $subj_size = '50';
         $r->print(&additional_rec_row(\%lt));          $r->print(&additional_rec_row(\%lt));
           if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
               || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
                                           '/'.$env{'request.course.sec'})) {
               $r->print(&reply_to_row(\%lt));
           }
         $r->print(&msg_subject_row($dissub,\%lt,$subj_size));          $r->print(&msg_subject_row($dissub,\%lt,$subj_size));
         $r->print(<<"ENDCOMP");          $r->print(<<"ENDCOMP");
 </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 1453  sub recipient_input_row { Line 1511  sub recipient_input_row {
       &Apache::loncommon::selectstudent_link('compemail','recuname',        &Apache::loncommon::selectstudent_link('compemail','recuname',
                                              'recdomain');                                               'recdomain');
     my $output = <<"ENDREC";      my $output = <<"ENDREC";
 <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 colspan="2"><span class="LC_nobreak">$lt{'us'}:&nbsp;<input type="text" size="12" name="recuname" value="$env{'form.recname'}" />&nbsp;$lt{'do'}:&nbsp;$domform&nbsp;&nbsp;$selectlink</span></td></tr>
 <tr><td>$lt{'do'}:</td>  
 <td>$domform</td></tr>  
 ENDREC  ENDREC
     return $output;      return $output;
 }  }
   
   sub reply_to_row {
       my ($lt) = @_;
       my $radioyes = &mt('Yes');
       my $radiono = &mt('No');
       my $output = <<"ENDREP";
   <tr><td colspan="2"><span class="LC_nobreak">$lt->{'ar'}:<label><input type="radio" name="can_reply" value="Y" checked="checked" />$radioyes</label>&nbsp;&nbsp;<label><input type="radio" name="can_reply" value="N" />$radiono</label></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="LC_nobreak">$lt->{'rt'}:&nbsp;<input type="text" size="25" name="reply_to_addr" value="$env{'user.name'}:$env{'user.domain'}" /></span></td></tr>
   ENDREP
       return $output;
   }
   
 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="span.LC_nobreak">$cc   </tt></td><td>&nbsp;<span class="LC_nobreak">$cc 
 <input type="text" size="50" name="additionalrec_cc" /></nospan><br />  <input type="text" size="50" name="additionalrec_cc" /></span><br />
 <span class="span.LC_nobreak">$bcc <input type="text" size="50" name="additionalrec_bcc" /></nospan></td></tr>  <span class="LC_nobreak">$bcc <input type="text" size="50" name="additionalrec_bcc" /></span></td></tr>
 ENDADD  ENDADD
     return $output;      return $output;
 }  }
Line 1486  sub submit_button_row { Line 1553  sub submit_button_row {
   
 sub msg_subject_row {  sub msg_subject_row {
     my ($dissub,$lt,$subj_size,$extra) = @_;      my ($dissub,$lt,$subj_size,$extra) = @_;
     my $output = '<tr><td>'.$lt->{'sb'}.':</td><td><input type="text" size="'.      my $output = '<tr><td colspan="2">'.$lt->{'sb'}.':&nbsp;<input type="text" size="'.
                  $subj_size.'" name="subject" value="'.$dissub.'" />'.$extra.                   $subj_size.'" name="subject" value="'.$dissub.'" />'.$extra.
                  '</td></tr>';                   '</td></tr>';
     return $output;      return $output;
Line 2022  sub displaymessage { Line 2089  sub displaymessage {
  $counter++;   $counter++;
     }      }
     $r->print('</pre>');      $r->print('</pre>');
   
       my $see_anonymous;
       my $from_student = 0;
       if ($env{'request.course.id'} eq $content{'courseid'}) {
    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
    my $username = $content{'sendername'}.':'.$content{'senderdomain'};
    my %classlist_entry =
       &Apache::lonnet::get('classlist',[$username],$cdom,$cnum);
    if (exists($classlist_entry{$username})) {
       $from_student = 1;
       $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
    }
       }
   
   
     my $number_of_messages = scalar(@messages); #subtract 1 for last index      my $number_of_messages = scalar(@messages); #subtract 1 for last index
 # start output  # start output
     &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});      &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});
     my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});      my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});
 # Functions  # Functions
     $r->print('<table border="2" width="100%"><tr bgcolor="#FFFFAA"><td>'.&mt('Functions').':</td>'.      $r->print('<table border="2" width="100%"><tr bgcolor="#FFFFAA"><td>'.&mt('Functions').':</td>');
       '<td><a href="/adm/email?replyto='.&escape($msgid).$sqs.      if (!$content{'noreplies'}) {
       '"><b>'.&mt('Reply').'</b></a></td>'.          $r->print('<td><a href="/adm/email?replyto='.&escape($msgid).$sqs.
       '<td><a href="/adm/email?forward='.&escape($msgid).$sqs.            '"><b>'.&mt('Reply').'</b></a></td>');
       }
       $r->print('<td><a href="/adm/email?forward='.&escape($msgid).$sqs.
       '"><b>'.&mt('Forward').'</b></a></td>'.        '"><b>'.&mt('Forward').'</b></a></td>'.
       '<td><a href="/adm/email?markunread='.&escape($msgid).$sqs.        '<td><a href="/adm/email?markunread='.&escape($msgid).$sqs.
       '"><b>'.&mt('Mark Unread').'</b></a></td>'.        '"><b>'.&mt('Mark Unread').'</b></a></td>'.
Line 2054  sub displaymessage { Line 2139  sub displaymessage {
         $symb=&Apache::lonnet::symbread($content{'baseurl'});          $symb=&Apache::lonnet::symbread($content{'baseurl'});
     }      }
     if ($env{'user.adv'}) {      if ($env{'user.adv'}) {
    my $adv_actions;
  $r->print('<table border="2" width="100%"><tr bgcolor="#FFAAAA"><td>'.&mt('Currently available actions (will open extra window)').':</td>');   $r->print('<table border="2" width="100%"><tr bgcolor="#FFAAAA"><td>'.&mt('Currently available actions (will open extra window)').':</td>');
  if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {   if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
  $r->print('<td><b>'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').'</b></td>');   $r->print('<td><b>'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').'</b></td>');
Line 2074  sub displaymessage { Line 2160  sub displaymessage {
                &Apache::loncommon::plainname($content{'recuser'}[$i],                 &Apache::loncommon::plainname($content{'recuser'}[$i],
                                       $content{'recdomain'}[$i]),                                        $content{'recdomain'}[$i]),
                   $content{'recuser'}[$i],$content{'recdomain'}[$i]).                    $content{'recuser'}[$i],$content{'recdomain'}[$i]).
            ' ('.$content{'recuser'}[$i].' at '.$content{'recdomain'}[$i].') ';             ' ('.$content{'recuser'}[$i].' '.&mt('at').' '.$content{'recdomain'}[$i].') ';
         }          }
     }      }
     $tolist = join(', ',@recipients);      $tolist = join(', ',@recipients);
Line 2093  sub displaymessage { Line 2179  sub displaymessage {
     if (defined($content{'baseurl'})) {      if (defined($content{'baseurl'})) {
         $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'});          $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'});
     }      }
     $r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'}));      if ($from_student && $see_anonymous ) {
    $r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'}));
       }
   
     $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'});      $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'});
     if ($folder eq 'sent') {      if ($folder eq 'sent') {
         $r->print('<br /><b>'.&mt('To').':</b> '.$tolist);          $r->print('<br /><b>'.&mt('To').':</b> '.$tolist);
           if ($content{'replytoaddr'}) {
               my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'});
               if ($replytoname ne '' && $replytodom ne '') {
                   $r->print('<br /><b>'.&mt('Reply To').':</b> '.
                             $replytoname.' '.&mt('at').' '.$replytodom);
               }
           }
     } else {      } else {
         $r->print('<br /><b>'.&mt('From').':</b> '.          $r->print('<br /><b>'.&mt('From').':</b> '.
       &Apache::loncommon::aboutmewrapper(        &Apache::loncommon::aboutmewrapper(
  &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),   &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),
  $content{'sendername'},$content{'senderdomain'}).' ('.   $content{'sendername'},$content{'senderdomain'}));
       $content{'sendername'}.' at '.          if ($content{'noreplies'}) {
       $content{'senderdomain'}.') ');              $r->print(' ('.&mt('No replies to sender').')'); 
         if ($cclist) {          } else {
             $r->print('<br /><b>'.&mt('Cc').':</b> '.$cclist);              if ($content{'replytoaddr'}) {
         }                  my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'});
                   if ($replytoname ne '' && $replytodom ne '') {
                       $r->print('<br /><b>'.&mt('Reply To').':</b> '.
                                 $replytoname.' '.&mt('at').' '.$replytodom);
                   }
               } else {
                   $r->print(' ('.$content{'sendername'}.' '.&mt('at').' '.
                             $content{'senderdomain'}.') ');
               }
               if ($cclist) {
                   $r->print('<br /><b>'.&mt('Cc').':</b> '.$cclist);
               }
           } 
     }      }
     if ($content{'courseid'}) {      if ($content{'courseid'}) {
         $r->print('<br /><b>'.&mt($crstype).':</b> '.$courseinfo{'description'});          $r->print('<br /><b>'.&mt($crstype).':</b> '.$courseinfo{'description'});
Line 2182  sub retrieve_cc_recips { Line 2290  sub retrieve_cc_recips {
                      ($ccdom eq $env{'user.domain'}))) {                       ($ccdom eq $env{'user.domain'}))) {
                     my $showcc ='<span class="LC_nobreak">';                      my $showcc ='<span class="LC_nobreak">';
                     if ($context eq 'replying') {                       if ($context eq 'replying') { 
                         $showcc = '<label><input type="checkbox" name="replying_cc" value="'.$cc.'">';                          $showcc = '<label><input type="checkbox" name="replying_cc" value="'.$cc.'" />';
                     }                      }
                     $showcc .= &Apache::loncommon::aboutmewrapper(                      $showcc .= &Apache::loncommon::aboutmewrapper(
                                        &Apache::loncommon::plainname($ccname,                                         &Apache::loncommon::plainname($ccname,
                                          $ccdom),$ccname,$ccdom).'</label></span>';                                           $ccdom),$ccname,$ccdom);
                     push (@ccs,$showcc);      if ($context eq 'replying') {
    $showcc .='</label>';
       }
       $showcc .= '</span>';
       push(@ccs,$showcc);
                 }                  }
             }              }
         }          }
Line 2304  sub sendoffmail { Line 2416  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 2326  sub sendoffmail { Line 2440  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 2428  sub sendoffmail { Line 2545  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 2454  sub sendoffmail { Line 2582  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 2487  sub sendoffmail { Line 2615  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 2504  sub sendoffmail { Line 2632  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 2512  sub sendoffmail { Line 2640  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'}.' 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');
                 }                  }
             } else {              } else {
                 my $stamp = time;                  my $stamp = time;
Line 2524  sub sendoffmail { Line 2652  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 2541  sub sendoffmail { Line 2669  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 2632  sub handler { Line 2760  sub handler {
  &printheader($r,'','Confirmed Receipt');   &printheader($r,'','Confirmed Receipt');
  my $replying = 0;   my $replying = 0;
  foreach my $envkey (keys(%env)) {   foreach my $envkey (keys(%env)) {
     if ($envkey=~/^form\.rec\_(.*)$/) {      if ($envkey=~/^form\.(rep)?rec\_(.*)$/) {
  $r->print('<b>'.&mt('Confirming Receipt').':</b> '.                  my $repchk = $1;
   &Apache::lonmsg::user_crit_received($1).'<br>');          my $msgid = $2;
     }   $r->print('<b>'.&mt('Confirming Receipt').':</b> ');
     if ($envkey=~/^form\.reprec\_(.*)$/) {   my $result = &Apache::lonmsg::user_crit_received($msgid);
  my $msgid=$1;                  if ($result =~ /trans:\s+ok/) {
  $r->print('<b>'.&mt('Confirming Receipt').':</b> '.                      &statuschange($msgid,'read');
   &Apache::lonmsg::user_crit_received($msgid).'<br>');                  }
  &compout($r,'','','',$msgid);                  $r->print($result.'<br />');
  $replying = 1;                  if ($repchk eq 'rep') {
       &compout($r,'','','',$msgid);
       $replying = 1;
                   }
     }      }
  }   }
  if (!$replying) {   if (!$replying) {
Line 2773  sub handler { Line 2904  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 2787  sub handler { Line 2918  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.73  
changed lines
  Added in v.1.87


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