Diff for /loncom/interface/lonhelper.pm between versions 1.145 and 1.146

version 1.145, 2006/05/09 21:44:18 version 1.146, 2006/05/09 22:15:30
Line 2282  use Apache::lonnet; Line 2282  use Apache::lonnet;
 #  future...each one gets is own subpage of selection.  #  future...each one gets is own subpage of selection.
 #  This sub renders one of these pages.  #  This sub renders one of these pages.
 #  Parameters:  #  Parameters:
 #     $sections    - Set of sections in the course (hash reference).  
 #     $students    - Students in the section. (ref to array of references  #     $students    - Students in the section. (ref to array of references
 #                    to arrays).  #                    to arrays).
 #     $formprefix  - form path prefix for form element names  #     $formprefix  - form path prefix for form element names
Line 2301  use Apache::lonnet; Line 2300  use Apache::lonnet;
 #     HTML  text to add to the rendering of the helper.  #     HTML  text to add to the rendering of the helper.
 #  #
 sub render_student_list {  sub render_student_list {
     my (      my ($students, $formprefix, $defaultusers,
  $sections, $students, $formprefix, $defaultusers,  
  $multiselect, $resultname, $javascript) = @_;   $multiselect, $resultname, $javascript) = @_;
   
     my $result = "";      my $result = "";
Line 2421  SCRIPT Line 2419  SCRIPT
     # as well as from categories of personnel.      # as well as from categories of personnel.
   
     if ($multiselect) {      if ($multiselect) {
    #  Make a section hash so we can add sections to the choice:
   
    my %sections;
    for my $student (@$students) {
       my $sect = $student->[2];
       if ($sect ne "") {
    $sections{$sect} = 1;
       }
    }
   
  $result .= '<table><tr><td>';   $result .= '<table><tr><td>';
   
  my $size = scalar(keys(%$sections));   my $size = scalar(keys(%sections));
  $size += 3; # We have allstudents allpersonel nosection too.   $size += 3; # We have allstudents allpersonel nosection too.
  if ($size > 5) {    if ($size > 5) { 
     $size = 5;       $size = 5; 
Line 2434  SCRIPT Line 2442  SCRIPT
  $result .= '<option name="allpersonnel">All Course Personnel</option>';   $result .= '<option name="allpersonnel">All Course Personnel</option>';
  $result .= '<option name="nosection">No Section</option>';   $result .= '<option name="nosection">No Section</option>';
  $result .= "\n";   $result .= "\n";
  foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%$sections))) {   foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) {
     $result .= '<option name="'.$sec.'">'.$sec.'</option>'."\n";      $result .= '<option name="'.$sec.'">'.$sec.'</option>'."\n";
  }   }
  $result .= '</td><td valign="top">';   $result .= '</td><td valign="top">';
Line 2651  sub render { Line 2659  sub render {
     }      }
   
   
     # Create a list of the sections that can be used to create the section   
     # selection list boxes:  
     #  
     my %sections;  
     for my $key (@keys) {  
  my $section_name = $classlist->{$key}->[$section];  
  if ($section_name ne "") {  
     $sections{$section_name} = 1;  
  }  
     }  
   
   
     if ($self->{'multichoice'}) {  
   
  #  The variable $choice_widget will have the html to make the choice   
  #  selector.  
  my $size=5;  
  if (scalar(keys(%sections)) < 5) {  
     $size=scalar(keys(%sections));  
  }  
  my $result = '<select multiple name="chosensections" size="'.$size.'">'."\n";  
  foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) {  
     $result .= "<option name=\"$sec\">$sec</option>\n";  
  }  
  $result .= "<option>none</option></select>\n";  
   
   
     }  
   
     #   Current personel      #   Current personel
   
     $result .= &render_student_list(\%sections,      $result .= &render_student_list( $current_members,
   $current_members,       "current",
   "current",       \%defaultUsers,
   \%defaultUsers,       $self->{'multichoice'},
     $self->{'multichoice'},       $self->{'variable'},
     $self->{'variable'},       1);
     1);  
   
   
     # If activeonly is not set then we can also give the expired students:      # If activeonly is not set then we can also give the expired students:
Line 2697  sub render { Line 2676  sub render {
   
  # And future.   # And future.
   
  $result .= &render_student_list(\%sections,   $result .= &render_student_list( $future_members,
       $future_members,   "future",
       "future",   \%defaultUsers,
       \%defaultUsers,   $self->{'multichoice'},
  $self->{'multichoice'},   $self->{'variable'},
  $self->{'variable'},   0);
  0);  
  # Past    # Past 
   
  $result .= &render_student_list(\%sections,   $result .= &render_student_list($expired_members,
       $expired_members,   "past",
       "past",   \%defaultUsers,
       \%defaultUsers,  
  $self->{'multichoice'},   $self->{'multichoice'},
  $self->{'variable'},   $self->{'variable'},
  0);   0);

Removed from v.1.145  
changed lines
  Added in v.1.146


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