Diff for /loncom/interface/lonmsgdisplay.pm between versions 1.29 and 1.35

version 1.29, 2006/05/30 12:46:09 version 1.35, 2006/06/29 13:52:19
Line 217  sub movemsg { Line 217  sub movemsg {
 # Copy message  # Copy message
     my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]);      my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]);
     if (!exists($message{$msgid}) || $message{$msgid} eq '') {      if (!exists($message{$msgid}) || $message{$msgid} eq '') {
  if (&Apache::slotrequest::network_error(%message)) {   if (&Apache::lonnet::error(%message)) {
     return (0,&mt('Message not moved, A network error occurred.'));      return (0,&mt('Message not moved, A network error occurred.'));
  } else {   } else {
     return (0,&mt('Message not moved as the message is no longer in the source folder.'));      return (0,&mt('Message not moved as the message is no longer in the source folder.'));
Line 226  sub movemsg { Line 226  sub movemsg {
   
     my $result =&Apache::lonnet::put('nohist_email'.$trgsuffix,      my $result =&Apache::lonnet::put('nohist_email'.$trgsuffix,
      {$msgid => $message{$msgid}});       {$msgid => $message{$msgid}});
     if (&Apache::slotrequest::network_error($result)) {      if (&Apache::lonnet::error($result)) {
  return (0,&mt('Message not moved, A network error occurred.'));   return (0,&mt('Message not moved, A network error occurred.'));
     }      }
   
Line 234  sub movemsg { Line 234  sub movemsg {
     unless ($trgfolder eq 'trash') {      unless ($trgfolder eq 'trash') {
         my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]);          my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]);
  # a non-existant status is the mark of an unread msg   # a non-existant status is the mark of an unread msg
  if (&Apache::slotrequest::network_error(%status)) {   if (&Apache::lonnet::error(%status)) {
     return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));      return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));
  }   }
  my $result=&Apache::lonnet::put('email_status'.$trgsuffix,   my $result=&Apache::lonnet::put('email_status'.$trgsuffix,
  {$msgid => $status{$msgid}});   {$msgid => $status{$msgid}});
  if (&Apache::slotrequest::network_error($result)) {   if (&Apache::lonnet::error($result)) {
     return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));      return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));
  }   }
     }      }
Line 249  sub movemsg { Line 249  sub movemsg {
  &Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]);   &Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]);
     my $result_del_stat =      my $result_del_stat =
  &Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]);   &Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]);
     if (&Apache::slotrequest::network_error($result_del_msg)) {      if (&Apache::lonnet::error($result_del_msg)) {
  return (0,&mt('Message copied, but unable to delete the original from the source folder.'));   return (0,&mt('Message copied, but unable to delete the original from the source folder.'));
     }      }
     if (&Apache::slotrequest::network_error($result_del_stat)) {      if (&Apache::lonnet::error($result_del_stat)) {
  return (0,&mt('Message copied, but unable to delete the original status from the source folder.'));   return (0,&mt('Message copied, but unable to delete the original status from the source folder.'));
     }      }
   
Line 320  $content{'sendername'}.':'. Line 320  $content{'sendername'}.':'.
     # Check to see if there were any messages.      # Check to see if there were any messages.
     if ($result eq '') {      if ($result eq '') {
         $result = "<h2>".&mt('You have no critical messages.')."</h2>".          $result = "<h2>".&mt('You have no critical messages.')."</h2>".
     '<a href="/adm/roles">'.&mt('Select a course').'</a><br />'.      '<a href="/adm/roles">'.&mt('Select a course or group').'</a><br />'.
             '<a href="/adm/email">'.&mt('Communicate').'</a>';              '<a href="/adm/email">'.&mt('Communicate').'</a>';
     } else {      } else {
         $r->print($header);          $r->print($header);
Line 453  sub disnew { Line 453  sub disnew {
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
        'nm' => 'New Messages',         'nm' => 'New Messages',
        'su' => 'Subject',         'su' => 'Subject',
                                        'co' => 'Course',                                         'co' => 'Course/Group',
        'da' => 'Date',         'da' => 'Date',
        'us' => 'Username',         'us' => 'Username',
        'op' => 'Open',         'op' => 'Open',
Line 571  sub disfolder { Line 571  sub disfolder {
     function uncheckall() {      function uncheckall() {
  for (i=0; i<document.forms.disall.elements.length; i++) {   for (i=0; i<document.forms.disall.elements.length; i++) {
             if               if 
           (document.forms.disall.elements[i].name.indexOf('delmark_')==0) {            (document.forms.disall.elements[i].name.indexof('delmark_')==0) {
       document.forms.disall.elements[i].checked=false;        document.forms.disall.elements[i].checked=false;
             }              }
         }          }
Line 622  ENDDISHEADER Line 622  ENDDISHEADER
     }      }
     $r->print('</th><th>');      $r->print('</th><th>');
     if ($env{'form.sortedby'} eq "revcourse") {      if ($env{'form.sortedby'} eq "revcourse") {
         $r->print('<a href = "?sortedby=course'.$fsqs.'">'.&mt('Course').'</a>');          $r->print('<a href = "?sortedby=course'.$fsqs.'">'.&mt('Course/Group').'</a>');
     } else {      } else {
         $r->print('<a href = "?sortedby=revcourse'.$fsqs.'">'.&mt('Course').'</a>');          $r->print('<a href = "?sortedby=revcourse'.$fsqs.'">'.&mt('Course/Group').'</a>');
     }      }
     $r->print('</th><th>');      $r->print('</th><th>');
     if ($env{'form.sortedby'} eq "revstatus") {      if ($env{'form.sortedby'} eq "revstatus") {
Line 976  $content{'sendername'}.':'. Line 976  $content{'sendername'}.':'.
      }       }
     # Check to see if there were any messages.      # Check to see if there were any messages.
     if ($result eq '') {      if ($result eq '') {
           my $lctype = lc(&Apache::loncommon::course_type());
  if ($target ne 'tex') {    if ($target ne 'tex') { 
     $r->print("<p><b>".&mt("No notes, face-to-face discussion records, critical messages, or broadcast messages in this course.")."</b></p>");      $r->print("<p><b>".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."</b></p>");
  } else {   } else {
     $r->print('\textbf{'.&mt("No notes, face-to-face discussion records, critical messages or broadcast messages in this course.").'}\\\\');      $r->print('\textbf{'.&mt('No notes, face-to-face discussion records, critical messages or broadcast messages in this [_1].',$lctype).'}\\\\');
  }   }
     } else {      } else {
        $r->print($result);         $r->print($result);
Line 1008  sub facetoface { Line 1009  sub facetoface {
  $r->print('Not allowed');   $r->print('Not allowed');
  return;   return;
     }      }
       my $crstype = &Apache::loncommon::course_type();
       my $leaders = ($crstype eq 'Group') ? 'coordinators and leaders'
                                           : 'faculty and staff';
     &printheader($r,      &printheader($r,
  '/adm/email?recordftf=query',   '/adm/email?recordftf=query',
  "User Notes, Face-to-Face, Critical Messages, Broadcast Messages");   "User Notes, Face-to-Face, Critical Messages, Broadcast Messages");
Line 1025  sub facetoface { Line 1029  sub facetoface {
  ('stdselect','recuname','recdomain');   ('stdselect','recuname','recdomain');
     my %lt=&Apache::lonlocal::texthash('user' => 'Username',      my %lt=&Apache::lonlocal::texthash('user' => 'Username',
        'dom' => 'Domain',         'dom' => 'Domain',
        'head' => 'User Notes, Records of Face-To-Face Discussions, Critical Messages, and Broadcast Messages in Course',         'head' => "User Notes, Records of Face-To-Face Discussions, Critical Messages, and Broadcast Messages in $crstype",
        'subm' => 'Retrieve discussion and message records',         'subm' => 'Retrieve discussion and message records',
        'newr' => 'New Record (record is visible to course faculty and staff)',         'newr' => 'New Record (record is visible to '.lc($crstype).' '.$leaders.')',
        'post' => 'Post this Record');         'post' => 'Post this Record');
     $r->print(<<"ENDTREC");      $r->print(<<"ENDTREC");
 <h3>$lt{'head'}</h3>  <h3>$lt{'head'}</h3>
Line 1048  ENDTREC Line 1052  ENDTREC
         ($env{'form.recdomain'}) && ($env{'form.recuname'})) {          ($env{'form.recdomain'}) && ($env{'form.recuname'})) {
         chomp($env{'form.newrecord'});          chomp($env{'form.newrecord'});
         if ($env{'form.newrecord'}) {          if ($env{'form.newrecord'}) {
            my $recordtxt = $env{'form.newrecord'};      &Apache::lonmsg::store_instructor_comment($env{'form.newrecord'},
            &Apache::lonmsg::user_normal_msg_raw(        $env{'form.recuname'},
             $env{'course.'.$env{'request.course.id'}.'.num'},        $env{'form.recdomain'});
             $env{'course.'.$env{'request.course.id'}.'.domain'},  
             &mt('Record').  
      ' ['.$env{'form.recuname'}.':'.$env{'form.recdomain'}.']',  
     $recordtxt);  
         }          }
         $r->print('<h3>'.&Apache::loncommon::plainname($env{'form.recuname'},          $r->print('<h3>'.&Apache::loncommon::plainname($env{'form.recuname'},
      $env{'form.recdomain'}).'</h3>');       $env{'form.recdomain'}).'</h3>');
Line 1086  sub examblock { Line 1086  sub examblock {
  $r->print('Not allowed');   $r->print('Not allowed');
  return;   return;
     }      }
       my $usertype = (&Apache::loncommon::course_type() eq 'Group') ? 'members'
                                                             : 'students';
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
             'comb' => 'Communication Blocking',              'comb' => 'Communication Blocking',
             'cbds' => 'Communication blocking during scheduled exams',              'cbds' => 'Communication blocking during scheduled exams',
             'desc' => 'You can use communication blocking to prevent students enrolled in this course from displaying LON-CAPA messages sent by other students during an online exam. As blocking of communication could potentially interrupt legitimate communication between students who are also both enrolled in a different LON-CAPA course, please be careful that you select the correct start and end times for your scheduled exam when setting or modifying these parameters.',              'desc' => "You can use communication blocking to prevent $usertype enrolled in this course from displaying LON-CAPA messages sent by other $usertype during an online exam. As blocking of communication could potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA course, please be careful that you select the correct start and end times for your scheduled exam when setting or modifying these parameters.",
              'mecb' => 'Modify existing communication blocking periods',               'mecb' => 'Modify existing communication blocking periods',
              'ncbc' => 'No communication blocks currently stored'               'ncbc' => 'No communication blocks currently stored'
     );      );
Line 1377  sub build_block_table { Line 1379  sub build_block_table {
     my ($r,$startblock,$endblock,$setters) = @_;      my ($r,$startblock,$endblock,$setters) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'cacb' => 'Currently active communication blocks',          'cacb' => 'Currently active communication blocks',
         'cour' => 'Course',          'cour' => 'Course/Group',
         'dura' => 'Duration',          'dura' => 'Duration',
         'blse' => 'Block set by'          'blse' => 'Block set by'
     );      );
Line 1421  sub displaymessage { Line 1423  sub displaymessage {
     my $startblock = 0;      my $startblock = 0;
     my $endblock = 0;      my $endblock = 0;
     my $numblocked = 0;      my $numblocked = 0;
       my $crstype = &Apache::loncommon::course_type();
   
 # info to generate "next" and "previous" buttons and check if message is blocked  # info to generate "next" and "previous" buttons and check if message is blocked
     &blockcheck(\%setters,\$startblock,\$endblock);      &blockcheck(\%setters,\$startblock,\$endblock);
     my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);      my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
Line 1502  sub displaymessage { Line 1506  sub displaymessage {
       $content{'sendername'}.' at '.        $content{'sendername'}.' at '.
       $content{'senderdomain'}.') ':'<br /><b>'.&mt('To').':</b> '.        $content{'senderdomain'}.') ':'<br /><b>'.&mt('To').':</b> '.
               $tolist).                $tolist).
       ($content{'courseid'}?'<br /><b>'.&mt('Course').':</b> '.$courseinfo{'description'}.        ($content{'courseid'}?'<br /><b>'.&mt($crstype).':</b> '.$courseinfo{'description'}.
        ($content{'coursesec'}?' ('.&mt('Group/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'}.'">'.        ($content{'baseurl'}?'<br /><b>'.&mt('Refers to').':</b> <a href="'.$content{'baseurl'}.'">'.
        $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')</a>':'').         $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')</a>':'').
Line 1637  sub sendoffmail { Line 1641  sub sendoffmail {
     &statuschange($msgid,'replied',$folder);      &statuschange($msgid,'replied',$folder);
  }   }
   
  my $to = $env{'form.selectedusers.forminput'};   my @to =
       &Apache::loncommon::get_env_multiple('form.selectedusers.forminput');
  my $mode = $env{'form.sendmode'};   my $mode = $env{'form.sendmode'};
   
  my %toaddr;   my %toaddr;
  if ($to) {   if (@to) {
     foreach my $dest (@$to) {      foreach my $dest (@to) {
  my ($user,$domain) = split(/:/, $dest);   my ($user,$domain) = split(/:/, $dest);
  if (($user ne '') && ($domain ne '')) {   if (($user ne '') && ($domain ne '')) {
     my $address = $user.":".$domain; # How the code below expects it.      my $address = $user.":".$domain; # How the code below expects it.

Removed from v.1.29  
changed lines
  Added in v.1.35


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