Diff for /loncom/interface/lonmsgdisplay.pm between versions 1.58 and 1.65

version 1.58, 2006/12/23 18:27:28 version 1.65, 2007/01/22 21:51:05
Line 774  sub sortedmessages { Line 774  sub sortedmessages {
     my ($blocked,$startblock,$endblock,$numblocked,$folder,$msgstatus) = @_;      my ($blocked,$startblock,$endblock,$numblocked,$folder,$msgstatus) = @_;
     my $suffix=&Apache::lonmsg::foldersuffix($folder);      my $suffix=&Apache::lonmsg::foldersuffix($folder);
     my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix);      my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix);
   
     #unpack the varibles and repack into temp for sorting      #unpack the varibles and repack into temp for sorting
     my @temp;      my @temp;
     my %descriptions;      my %descriptions;
Line 789  sub sortedmessages { Line 788  sub sortedmessages {
   
     foreach my $msgid (@messages) {      foreach my $msgid (@messages) {
  my $esc_msgid=&escape($msgid);   my $esc_msgid=&escape($msgid);
  my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)=   my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,$processid,$symb,$error) =
     &Apache::lonmsg::unpackmsgid($esc_msgid,$folder,undef,      &Apache::lonmsg::unpackmsgid($esc_msgid,$folder,undef,
  \%status_cache);   \%status_cache);
         next if ($msgstatus ne '' && $msgstatus ne $status);          next if ($msgstatus ne '' && $msgstatus ne $status);
Line 925  sub disfolder { Line 924  sub disfolder {
                       nome => 'No messages have been selected to apply ths action to.',                        nome => 'No messages have been selected to apply ths action to.',
                       chec => 'Check the checkbox for at least one message.',                          chec => 'Check the checkbox for at least one message.',  
     );      );
       my $jscript = &Apache::loncommon::check_uncheck_jscript();
     $r->print(<<ENDDISHEADER);      $r->print(<<ENDDISHEADER);
 <script type="text/javascript">  <script type="text/javascript">
     function checkall() {      $jscript
  for (i=0; i<document.forms.disall.delmark.length; i++) {  
     document.forms.disall.delmark[i].checked=true;  
         }  
     }  
   
     function uncheckall() {  
  for (i=0; i<document.forms.disall.delmark.length; i++) {  
     document.forms.disall.delmark[i].checked=false;  
         }  
     }  
     function checkfoldermove() {      function checkfoldermove() {
         if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') {          if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') {
             if (document.disall.movetofolder.options[document.disall.movetofolder.selectedIndex].value == "") {              if (document.disall.movetofolder.options[document.disall.movetofolder.selectedIndex].value == "") {
Line 957  sub disfolder { Line 948  sub disfolder {
             }               } 
         }          }
         var checktotal = 0;          var checktotal = 0;
         for (var i=0; i<document.forms.disall.delmark.length; i++) {          if (document.forms.disall.delmark.length > 0) {
             if (document.forms.disall.delmark[i].checked) {              for (var i=0; i<document.forms.disall.delmark.length; i++) {
                   if (document.forms.disall.delmark[i].checked) {
                       checktotal ++;
                   }
               }
           } else {
               if (document.forms.disall.delmark.checked) {
                 checktotal ++;                  checktotal ++;
             }              }
         }          }   
         if (checktotal == 0) {          if (checktotal == 0) {
             alert("$lt{'nome'}\\n$lt{'chec'}");              alert("$lt{'nome'}\\n$lt{'chec'}");
             return;              return;
Line 983  ENDDISHEADER Line 980  ENDDISHEADER
         } else {           } else { 
             $r->print('<h2>'.&mt('There are no '.lc($statushash{$msgstatus}).' messages in this folder.').'</h2>');              $r->print('<h2>'.&mt('There are no '.lc($statushash{$msgstatus}).' messages in this folder.').'</h2>');
         }          }
           if ($numblocked > 0) {
               $r->print(&blocked_in_folder($numblocked,$startblock,$endblock,
                                            \%setters));
           }
  return;   return;
     }      }
     my $interdis = $env{'form.interdis'};      my $interdis = $env{'form.interdis'};
Line 1073  ENDDISHEADER Line 1074  ENDDISHEADER
                       ' value="'.$origID.'" /></nobr></td>');                        ' value="'.$origID.'" /></nobr></td>');
             foreach my $item ($localsenttime,$dis_name,$dis_domain,$shortsubj) {              foreach my $item ($localsenttime,$dis_name,$dis_domain,$shortsubj) {
                 $r->print('<td>'.(($status eq 'new')?'<b>':'').                  $r->print('<td>'.(($status eq 'new')?'<b>':'').
                           '<a href="/adm/email?display='.$origID.$sqs.$fsqs.'">'.                            '<a href="/adm/email?display='.$origID.$sqs.'">'.
                           $item.(($status eq 'new')?'</b>':'').'</td>');                            $item.(($status eq 'new')?'</b>':'').'</td>');
             }              }
             my $showstatus;              my $showstatus;
Line 1098  ENDDISHEADER Line 1099  ENDDISHEADER
     $r->print('<table border="0" cellspacing="2" cellpadding="2">      $r->print('<table border="0" cellspacing="2" cellpadding="2">
  <tr>   <tr>
   <td>'.    <td>'.
   '<input type="button" onclick="javascript:checkall()" value="'.&mt('Check All').'" /><br />'."\n".    '<input type="button" onclick="javascript:checkAll(document.disall.delmark)" value="'.&mt('Check All').'" /><br />'."\n".
   '<input type="button" onclick="javascript:uncheckall()" 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" onchange="javascript:checkfoldermove()">'."\n");
Line 1139  ENDDISHEADER Line 1140  ENDDISHEADER
     my $postedstartdis=$startdis+1;      my $postedstartdis=$startdis+1;
     $r->print('<input type="hidden" name="folder" value="'.$folder.'" /><input type="hidden" name="startdis" value="'.$postedstartdis.'" /><input type="hidden" name="interdis" value="'.$env{'form.interdis'}.'" /><input type="hidden" name="msgstatus" value="'.$msgstatus.'" ><input type="hidden" name="markedaction" value="" /></form>');      $r->print('<input type="hidden" name="folder" value="'.$folder.'" /><input type="hidden" name="startdis" value="'.$postedstartdis.'" /><input type="hidden" name="interdis" value="'.$env{'form.interdis'}.'" /><input type="hidden" name="msgstatus" value="'.$msgstatus.'" ><input type="hidden" name="markedaction" value="" /></form>');
     if ($numblocked > 0) {      if ($numblocked > 0) {
         my $beginblock = &Apache::lonlocal::locallocaltime($startblock);          $r->print(&blocked_in_folder($numblocked,$startblock,$endblock,
         my $finishblock = &Apache::lonlocal::locallocaltime($endblock);                                       \%setters));
         $r->print('<br /><br />'.  
                   &mt('[quant,_1,message is, messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock));  
         $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,  
                                                         \%setters));  
     }      }
 }  }
   
   sub blocked_in_folder {
       my ($numblocked,$startblock,$endblock,$setters) = @_;
       my $beginblock = &Apache::lonlocal::locallocaltime($startblock);
       my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
       my $output = '<br /><br />'.
                     &mt('[quant,_1,message is, messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock);
       $output .= &Apache::loncommon::build_block_table($startblock,$endblock,
                                                        $setters);
       return $output;
   }
   
 # ============================================================== Compose output  # ============================================================== Compose output
   
 sub compout {  sub compout {
Line 1950  sub displaymessage { Line 1958  sub displaymessage {
         &build_block_table($r,$startblock,$endblock,\%setters);          &build_block_table($r,$startblock,$endblock,\%setters);
         return;          return;
     }      }
     &statuschange($msgid,'read',$folder);      if ($msgstatus eq '') {
           &statuschange($msgid,'read',$folder);
       }
     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});      my %content=&Apache::lonmsg::unpackagemsg($message{$msgid});
   
Line 1989  sub displaymessage { Line 1999  sub displaymessage {
   '"><b>'.&mt('Next').'</b></a></td>');    '"><b>'.&mt('Next').'</b></a></td>');
     }      }
     $r->print('</tr></table>');      $r->print('</tr></table>');
       my $symb;
       if (defined($content{'symb'})) {
           $symb = $content{'symb'};
       } elsif (defined($content{'baseurl'})) {
           $symb=&Apache::lonnet::symbread($content{'baseurl'});
       }
     if ($env{'user.adv'}) {      if ($env{'user.adv'}) {
  $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>');
  my $symb=&Apache::lonnet::symbread($content{'baseurl'});        
  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 2013  sub displaymessage { Line 2028  sub displaymessage {
        ' ('.$content{'recuser'}[$i].' at '.$content{'recdomain'}[$i].') ';         ' ('.$content{'recuser'}[$i].' at '.$content{'recdomain'}[$i].') ';
     }      }
     $tolist = join(', ',@recipients);      $tolist = join(', ',@recipients);
       my ($restitle,$baseurl,$refers_to);
       if (defined($content{'resource_title'})) {
           $restitle = $content{'resource_title'};
       } else {
           if (defined($content{'baseurl'})) {
               $restitle = &Apache::lonnet::gettitle($content{'baseurl'});
           }
       }
       if (defined($content{'baseurl'})) {
           $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'});
       }
     $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'}.      $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'}.
       ($folder ne 'sent'?'<br /><b>'.&mt('From').':</b> '.        ($folder ne 'sent'?'<br /><b>'.&mt('From').':</b> '.
       &Apache::loncommon::aboutmewrapper(        &Apache::loncommon::aboutmewrapper(
Line 2023  sub displaymessage { Line 2049  sub displaymessage {
               $tolist).                $tolist).
       ($content{'courseid'}?'<br /><b>'.&mt($crstype).':</b> '.$courseinfo{'description'}.        ($content{'courseid'}?'<br /><b>'.&mt($crstype).':</b> '.$courseinfo{'description'}.
        ($content{'coursesec'}?' ('.&mt('Section').': '.$content{'coursesec'}.')':''):'').         ($content{'coursesec'}?' ('.&mt('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'}.'">'.      if ($baseurl) {
        $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')</a>':'').          if (defined($content{'courseid'}) && defined($env{'request.course.id'})) {
       '<p><pre>'.              if ($content{'courseid'} eq $env{'request.course.id'}) {
                   my $symblink;
                   my $showsymb = &Apache::lonenc::check_decrypt($symb);
                   my $showurl = &Apache::lonenc::check_decrypt($baseurl);
                   my $encrypturl = &Apache::lonnet::EXT('resource.0.encrypturl',
                                 $showsymb,$env{'user.domain'},$env{'user.name'});
                   if ($symb) {
                       if ($encrypturl =~ /^yes$/i && !$env{'request.role.adv'}) {
                           $showsymb = &Apache::lonenc::check_encrypt($symb);
                       }
                       $symblink = '?symb='.$showsymb;
                   }
                   if ($encrypturl =~ /^yes$/i && !$env{'request.role.adv'}) {
                       $showurl = $baseurl;
                   }
                   $r->print('<br /><b>'.&mt('Refers to').':</b> <a href="'.$showurl.$symblink.'">'.$restitle.'</a>');
                   $refers_to = 1;
               }
           }
           if (!$refers_to) {
               if ($baseurl =~ m-^/enc/-) {
                   if (defined($content{'courseid'})) {
                       if (!$env{'request.course.id'}) {
                           my $unencurl =
                              &Apache::lonenc::unencrypted($baseurl,
                                                           $content{'courseid'});
                           if ($unencurl ne '') {
                               if (&Apache::lonnet::allowed('bre',$unencurl)) {
                                   $r->print('<br /><b>'.&mt('Refers to').
                                             ':</b> <a href="'.$unencurl.'">'.
                                             $restitle.'</a>');
                               }
                           }
                       }
                   }
               } else {
                   if (&Apache::lonnet::allowed('bre',$baseurl)) {
                       $r->print('<br /><b>'.&mt('Refers to').
                                 ':</b> <a href="'.$baseurl.
                                 '">'.$restitle.'</a>');
                   }
               }
           }
       }
       $r->print('<p><pre>'.
       &Apache::lontexconvert::msgtexconverted($content{'message'},1).        &Apache::lontexconvert::msgtexconverted($content{'message'},1).
       '</pre><hr />'.&displayresource(%content).'</p>');        '</pre><hr />'.&displayresource(%content).'</p>');
     return;         return;
 }  }
   
 # =========================================================== Show the citation  # =========================================================== Show the citation
Line 2042  sub displayresource { Line 2112  sub displayresource {
 #  #
     if (($env{'request.course.id'} eq $content{'courseid'})      if (($env{'request.course.id'} eq $content{'courseid'})
      && (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) {       && (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) {
  my $symb=&Apache::lonnet::symbread($content{'baseurl'});          my $symb;
           if (defined($content{'symb'})) {
               $symb = $content{'symb'};
           } else { 
       $symb=&Apache::lonnet::symbread($content{'baseurl'});
           }
 # Could not get a symb, give up  # Could not get a symb, give up
  unless ($symb) { return $content{'citation'}; }   unless ($symb) { return $content{'citation'}; }
 # Have a symb, can render  # Have a symb, can render
Line 2234  sub sendoffmail { Line 2309  sub sendoffmail {
             my $msgtxt = $savemsg;              my $msgtxt = $savemsg;
     if ($toaddr{$address}) { $msgtxt.='<hr />'.$toaddr{$address}; }      if ($toaddr{$address}) { $msgtxt.='<hr />'.$toaddr{$address}; }
     my @thismsg;      my @thismsg;
     if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&       if ($msgtype eq 'critical') {
  (&Apache::lonnet::allowed('srm',$env{'request.course.id'})   $r->print(&mt('Sending critical message').' '.
  || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.                                $recuname.':'.$recdomain.': ');
      '/'.$env{'request.course.sec'}))) {  
  $r->print(&mt('Sending critical message').' '.$recuname.':'.$recdomain.': ');  
  @thismsg=   @thismsg=
     &Apache::lonmsg::user_crit_msg($recuname,$recdomain,      &Apache::lonmsg::user_crit_msg($recuname,$recdomain,
    $msgsubj,$msgtxt,     $msgsubj,$msgtxt,
Line 2260  sub sendoffmail { Line 2333  sub sendoffmail {
         $specialmsg_status{$recuname.':'.$recdomain} =          $specialmsg_status{$recuname.':'.$recdomain} =
     join(' ',@thismsg);      join(' ',@thismsg);
  foreach my $result (@thismsg) {   foreach my $result (@thismsg) {
     if ($result eq 'ok') {      if ($result eq 'ok' || $result eq 'con_delayed') {
  $numspecial++;   $numspecial++;
     }      }
  }   }
Line 2654  sub handler { Line 2727  sub handler {
         my $delresult = &deletefolder($folder);          my $delresult = &deletefolder($folder);
         if ($delresult eq 'ok') {          if ($delresult eq 'ok') {
             $r->print(&mt('Mail folder "[_1]" deleted.',$folder).'<br />');              $r->print(&mt('Mail folder "[_1]" deleted.',$folder).'<br />');
               $env{'form.folder'} = '';
         } else {          } else {
             $r->print(&mt('Deletion failed.').' '.$delresult.'<br />');              $r->print(&mt('Deletion failed.').' '.$delresult.'<br />');
             $showfolder = $folder;              $showfolder = $folder;

Removed from v.1.58  
changed lines
  Added in v.1.65


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