Diff for /loncom/interface/lonmsgdisplay.pm between versions 1.20 and 1.25

version 1.20, 2006/05/01 05:57:26 version 1.25, 2006/05/17 09:46:01
Line 28 Line 28
   
   
 package Apache::lonmsgdisplay;  package Apache::lonmsgdisplay;
   use     Apache::lonselstudent;
   
 =pod  =pod
   
Line 259  sub movemsg { Line 260  sub movemsg {
 # ======================================================= Display a course list  # ======================================================= Display a course list
   
 sub discourse {  sub discourse {
       my $result;
       my ($course_personnel,
    $current_members,
    $expired_members,
    $future_members) = &Apache::lonselstudent::get_people_in_class();
       unshift @$current_members, (@$course_personnel);
       my %defaultUsers;
   
       $result = &Apache::lonselstudent::render_student_list($current_members,
     "compemail",
     "current",
     \%defaultUsers,
     1,"selectedusers",1);
   
       return $result;
   }
   
   # --------------------------------- No longer needed ..old display course list.
   sub discourse_obsolete {
     my $r=shift;      my $r=shift;
     my $classlist = &Apache::loncoursedata::get_classlist();      my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist();
     my ($classgroups,$studentgroups) =       my ($classgroups,$studentgroups) = 
             &Apache::loncoursedata::get_group_memberships($classlist);   &Apache::loncoursedata::get_group_memberships($classlist,$keylist);
     my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All',      my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All',
             'cfs' => 'Check Section/Group',              'cfs' => 'Check Section/Group',
             'cfn' => 'Uncheck All');              'cfn' => 'Uncheck All');
Line 318  ENDDISHEADER Line 338  ENDDISHEADER
     if (keys(%coursepersonnel) > 0) {      if (keys(%coursepersonnel) > 0) {
         $r->print('<h3>Non-students</h3>');          $r->print('<h3>Non-students</h3>');
         $r->print(&Apache::loncommon::start_data_table());          $r->print(&Apache::loncommon::start_data_table());
         $r->print(&Apache::loncommon::start_data_table_row());          $r->print('<tr><th>Name</th><th>Username:Domain</th><th>Role</th></tr>');
         $r->print('<th>Name</th><th>Username:Domain</th><th>Role</th>');          foreach my $role (sort(keys(%coursepersonnel))) {
         $r->print(&Apache::loncommon::end_data_table_row());              foreach my $user (split(/\,/,$coursepersonnel{$role})) {
         foreach my $role (sort keys %coursepersonnel) {                  my ($puname,$pudom)=split(/\:/,$user);
             foreach (split(/\,/,$coursepersonnel{$role})) {  
                 my ($puname,$pudom)=split(/\:/,$_);  
                 $r->print(&Apache::loncommon::start_data_table_row());                  $r->print(&Apache::loncommon::start_data_table_row());
                 $r->print('<td><label>'.                  $r->print('<td><label>'.
                           '<input type="checkbox" name="send_to_&&&&&&_'.                            '<input type="checkbox" name="send_to_&&&&&&_'.
                           $puname.':'.$pudom.'" /> '.                            $puname.':'.$pudom.'" /> '.
                           &Apache::loncommon::plainname($puname,$pudom).                            &Apache::loncommon::plainname($puname,$pudom).
                           '</label></td>'.                            '</label></td>'.
                           '<td>('.$_.'),</td><td><i>'.$role.'</i></td>');                            '<td>('.$user.'),</td><td><i>'.$role.'</i></td>');
                 $r->print(&Apache::loncommon::end_data_table_row());                  $r->print(&Apache::loncommon::end_data_table_row());
             }              }
         }          }
Line 339  ENDDISHEADER Line 357  ENDDISHEADER
     if (keys(%{$classlist}) > 0) {      if (keys(%{$classlist}) > 0) {
         $r->print('<h3>Students</h3>');          $r->print('<h3>Students</h3>');
         $r->print(&Apache::loncommon::start_data_table());          $r->print(&Apache::loncommon::start_data_table());
         $r->print(&Apache::loncommon::start_data_table_row());          $r->print('<tr><th>Name</th><th>Username:Domain</th><th>Section</th><th>Groups</th></tr>');
         $r->print('<th>Name</th><th>Username:Domain</th><th>Section</th><th>Groups</th>');  
         $r->print(&Apache::loncommon::end_data_table_row());  
         my $sort = sub {          my $sort = sub {
     my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]);      my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]);
     if (!$aname) { $aname=$a; }      if (!$aname) { $aname=$a; }
Line 360  ENDDISHEADER Line 376  ENDDISHEADER
             next if ($status ne 'Active');              next if ($status ne 'Active');
     next if ($env{'request.course.sec'} &&      next if ($env{'request.course.sec'} &&
      $section ne $env{'request.course.sec'});       $section ne $env{'request.course.sec'});
             my @studentsgroups = &Apache::loncoursedata::get_students_groups(              my @studentsgroups = 
                                                $student,$status,$classgroups);   &Apache::loncoursedata::get_students_groups($student,$status,
       $classgroups);
             my $grouplist = join(', ',@studentsgroups);              my $grouplist = join(', ',@studentsgroups);
             my $key = 'send_to_&&&'.$section.'&&&_'.$student;              my $key = 'send_to_&&&'.$section.'&&&_'.$student;
             if (! defined($fullname) || $fullname eq '') {$fullname = $sname;}              if (! defined($fullname) || $fullname eq '') {$fullname = $sname;}
Line 377  ENDDISHEADER Line 394  ENDDISHEADER
                                 $groupcount.'" />');                                  $groupcount.'" />');
                 if (defined($env{'form.group'})) {                  if (defined($env{'form.group'})) {
                     if ($env{'form.group'} eq $group) {                      if ($env{'form.group'} eq $group) {
                         $checked = 'checked=checked';                          $checked = 'checked="checked"';
                     }                      }
                 }                  }
             }              }
Line 904  sub compout { Line 921  sub compout {
     }      }
     my $citation=&displayresource(%content);      my $citation=&displayresource(%content);
     if ($env{'form.recdom'}) { $defdom=$env{'form.recdom'}; }      if ($env{'form.recdom'}) { $defdom=$env{'form.recdom'}; }
       $r->print(      if ($env{'form.text'}) { $dismsg=$env{'form.text'}; }
       if ($env{'form.subject'}) { $dissub=$env{'form.subject'}; }
       $r->print(
                 '<form action="/adm/email"  name="compemail" method="post"'.                  '<form action="/adm/email"  name="compemail" method="post"'.
                 ' enctype="multipart/form-data">'."\n".                  ' enctype="multipart/form-data">'."\n".
                 '<input type="hidden" name="sendmail" value="on" />'."\n".                  '<input type="hidden" name="sendmail" value="on" />'."\n".
Line 979  ENDUPLOAD Line 998  ENDUPLOAD
     }      }
     if ($broadcast eq 'group') {      if ($broadcast eq 'group') {
        &discourse($r);         &discourse($r);
          my $studentsel = &discourse();
          $r->print($studentsel);
     }      }
     $r->print('</form>'.      $r->print('</form>'.
       &Apache::lonfeedback::generate_preview_button('compemail','message').        &Apache::lonfeedback::generate_preview_button('compemail','message').
Line 1357  END Line 1378  END
   
  my ($setuname,$setudom,$title) =    my ($setuname,$setudom,$title) = 
     &parse_block_record($$records{$record});      &parse_block_record($$records{$record});
  $title = &HTML::Entities::encode($title,'"<>');   $title = &HTML::Entities::encode($title,'"<>&');
         my $settername = &Apache::loncommon::plainname($setuname,$setudom);          my $settername = &Apache::loncommon::plainname($setuname,$setudom);
         $r->print(&Apache::loncommon::start_data_table_row());          $r->print(&Apache::loncommon::start_data_table_row());
         $r->print(<<"END");          $r->print(<<"END");
Line 1657  sub header { Line 1678  sub header {
     $r->print(&Apache::loncommon::start_page('Communication and Messages',      $r->print(&Apache::loncommon::start_page('Communication and Messages',
      $extra));       $extra));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs      $r->print(&Apache::lonhtmlcommon::breadcrumbs
       (undef,($title?$title:'Communication and Messages')));        (($title?$title:'Communication and Messages')));
   
 }  }
   
Line 1734  sub sendoffmail { Line 1755  sub sendoffmail {
     &statuschange($msgid,'replied',$folder);      &statuschange($msgid,'replied',$folder);
  }   }
   
    my $to = $env{'form.selectedusers.forminput'};
    my $mode = $env{'form.sendmode'};
   
  my %toaddr;   my %toaddr;
  if ($env{'form.sendmode'} eq 'group') {   if ($to) {
     foreach my $address (keys(%env)) {      foreach my $dest (@$to) {
  if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {   my ($user,$domain) = split /:/, $dest;
     $toaddr{$1}='';   if (($user ne '') && ($domain ne '')) {
       my $address = $user.":".$domain; # How the code below expects it.
       $toaddr{$address} = '';
  }   }
     }      }
    }
   
    if ($env{'form.sendmode'} eq 'group') {
        foreach my $address (keys(%env)) {
    if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
       $toaddr{$1}='';
    }
       }
  } elsif ($env{'form.sendmode'} eq 'upload') {   } elsif ($env{'form.sendmode'} eq 'upload') {
     foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) {      foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) {
  my ($rec,$txt)=split(/\s*\:\s*/,$line);   my ($rec,$txt)=split(/\s*\:\s*/,$line);
Line 1750  sub sendoffmail { Line 1784  sub sendoffmail {
  }   }
     }      }
  } else {   } else {
     $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';      if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) {
    $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
       }
  }   }
  if ($env{'form.additionalrec'}) {   if ($env{'form.additionalrec'}) {
     foreach (split(/\,/,$env{'form.additionalrec'})) {      foreach (split(/\,/,$env{'form.additionalrec'})) {
  my ($auname,$audom)=split(/\@/,$_);   my ($auname,$audom)=split(/\@/,$_);
  $toaddr{$auname.':'.$audom}='';   if (($auname ne "") && ($audom ne "")) {
       $toaddr{$auname.':'.$audom}='';
    }
     }      }
  }   }
   
Line 1884  sub sendoffmail { Line 1922  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').'</p>');    &mt('Please use the browser "Back" button and correct the recipient addresses '."($sendstatus)").'</p>');
     }      }
 }  }
   
Line 1905  sub handler { Line 1943  sub handler {
         ['display','replyto','forward','markread','markdel','markunread',          ['display','replyto','forward','markread','markdel','markunread',
          'sendreply','compose','sendmail','critical','recname','recdom',           'sendreply','compose','sendmail','critical','recname','recdom',
          'recordftf','sortedby','block','folder','startdis','interdis',           'recordftf','sortedby','block','folder','startdis','interdis',
  'showcommentbaseurl','dismode','group']);   'showcommentbaseurl','dismode','group','subject','text']);
     $sqs='&sortedby='.$env{'form.sortedby'};      $sqs='&sortedby='.$env{'form.sortedby'};
   
 # ------------------------------------------------------ They checked for email  # ------------------------------------------------------ They checked for email

Removed from v.1.20  
changed lines
  Added in v.1.25


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