Diff for /loncom/interface/lonhelper.pm between versions 1.131 and 1.132

version 1.131, 2006/03/02 23:56:55 version 1.132, 2006/03/06 23:32:31
Line 2306  sub render { Line 2306  sub render {
             }               } 
         }          }
     }      }
       function checkexpired()  {
    for (i=0; i<document.forms.helpform.elements.length; i++) {
               if (document.forms.helpform.elements[i].value.indexOf(':Expired') != -1) {
                   document.forms.helpform.elements[i].checked=true;
               } 
           }
       }
     function uncheckexpired() {      function uncheckexpired() {
  for (i=0; i<document.forms.helpform.elements.length; i++) {   for (i=0; i<document.forms.helpform.elements.length; i++) {
             if (document.forms.helpform.elements[i].value.indexOf(':Expired') != -1) {              if (document.forms.helpform.elements[i].value.indexOf(':Expired') != -1) {
Line 2395  BUTTONS Line 2402  BUTTONS
  delete($defaultUsers{''});   delete($defaultUsers{''});
     }      }
     my $choices = [];      my $choices = [];
       my $expired_students = []; # Will hold expired students.
   
     # Load up the non-students, if necessary      # Load up the non-students, if necessary
     if ($self->{'coursepersonnel'}) {      if ($self->{'coursepersonnel'}) {
Line 2479  SECTIONSELECT Line 2487  SECTIONSELECT
   
     # username, fullname, section, type      # username, fullname, section, type
     for (@keys) {      for (@keys) {
  # Filter out inactive students if we've set "activeonly"  
  if (!$self->{'activeonly'} || $classlist->{$_}->[$status] eq   # We split the active students into the choices array and
           # inactive ones into expired_students so that we can put them in 2 separate
    # tables.
   
    if ( $classlist->{$_}->[$status] eq
     'Active') {      'Active') {
     push @$choices, [$_, $classlist->{$_}->[$fullname],       push @$choices, [$_, $classlist->{$_}->[$fullname], 
      $classlist->{$_}->[$section],       $classlist->{$_}->[$section],
      $classlist->{$_}->[$status], 'Student'];       $classlist->{$_}->[$status], 'Student'];
    } else {
       push @$expired_students, [$_, $classlist->{$_}->[$fullname], 
         $classlist->{$_}->[$section],
         $classlist->{$_}->[$status], 'Student'];
  }   }
     }      }
   
Line 2499  SECTIONSELECT Line 2515  SECTIONSELECT
  "<td align='center'><b>".&mt('Username').":".&mt('Domain')."</b></td></tr>";   "<td align='center'><b>".&mt('Username').":".&mt('Domain')."</b></td></tr>";
   
     my $checked = 0;      my $checked = 0;
       #
       # Give the active students and staff:
       #
     for my $choice (@$choices) {      for my $choice (@$choices) {
         $result .= "<tr><td><input type='$type' name='" .          $result .= "<tr><td><input type='$type' name='" .
             $self->{'variable'} . '.forminput' . "'";              $self->{'variable'} . '.forminput' . "'";
Line 2530  SECTIONSELECT Line 2549  SECTIONSELECT
     . HTML::Entities::encode($choice->[0],'<>&"')      . HTML::Entities::encode($choice->[0],'<>&"')
     . "</td></tr>\n";      . "</td></tr>\n";
     }      }
   
     $result .= "</table>\n\n";      $result .= "</table>\n\n";
   
       # If activeonly is not set then we can also give the expired students:
       #
       if (!$self->{'activeonly'} && ((scalar @$expired_students) > 0)) {
    $result .= "<p>Inactive students: </p>\n";
    $result .= <<INACTIVEBUTTONS;
      <table>
                 <tr>
                    <td><input type="button" value="Select expired" onclick="checkexpired();" /> </td>
    <td><input type="button" value="Unselect expired" onclick="uncheckexpired();" /></td>
                 </tr>
              </table>
   INACTIVEBUTTONS
    $result .= "<table>\n";
   
    for my $choice (@$expired_students) {
           $result .= "<tr><td><input type='$type' name='" .
               $self->{'variable'} . '.forminput' . "'";
               
    if (%defaultUsers) {
       my $user=$choice->[0];
       if (exists($defaultUsers{$user})) {
    $result .= " checked='checked' ";
    $checked = 1;
       }
    } elsif (!$self->{'multichoice'} && !$checked) {
               $result .= " checked='checked' ";
               $checked = 1;
           }
           $result .=
               " value='" . HTML::Entities::encode($choice->[0] . ':' 
    .$choice->[2] . ':' 
    .$choice->[1] . ':' 
    .$choice->[3], "<>&\"'")
               . "' /></td><td>"
               . HTML::Entities::encode($choice->[1],'<>&"')
               . "</td><td align='center'>" 
               . HTML::Entities::encode($choice->[2],'<>&"')
               . "</td>\n<td>" 
       . HTML::Entities::encode($choice->[3],'<>&"')
               . "</td>\n<td>" 
       . HTML::Entities::encode($choice->[4],'<>&"')
               . "</td>\n<td>" 
       . HTML::Entities::encode($choice->[0],'<>&"')
       . "</td></tr>\n";    
    }
    $result .= "</table>\n";
   
       }
   
   
   
     return $result;      return $result;
 }  }

Removed from v.1.131  
changed lines
  Added in v.1.132


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