Diff for /loncom/interface/lonpickstudent.pm between versions 1.26 and 1.27

version 1.26, 2009/03/01 01:17:20 version 1.27, 2009/04/24 05:28:55
Line 50  sub handler { Line 50  sub handler {
   
     &Apache::loncommon::get_unprocessed_cgi      &Apache::loncommon::get_unprocessed_cgi
         ($ENV{'QUERY_STRING'},['filter','form','unameelement','udomelement',          ($ENV{'QUERY_STRING'},['filter','form','unameelement','udomelement',
        'roles']);         'roles','courseadvonly']);
 # Allowed?  # Allowed?
     my $allowed;      my $allowed;
     my $scope = $env{'request.course.id'};      my $scope = $env{'request.course.id'};
Line 83  FILTER Line 83  FILTER
    <input type="hidden" name="$name" value="$value" />     <input type="hidden" name="$name" value="$value" />
 HIDDEN  HIDDEN
     }      }
     $filtermsg = '<br />'.      unless ($env{'form.courseadvonly'}) {
  &mt('Showing users with a name starting with [_1]',          $filtermsg = '<br />'.
     $filterbutton).'<br />';      &mt('Showing users with a name starting with [_1]',
           $filterbutton).'<br />';
       }
     if ($filter eq '') {      if ($filter eq '') {
  $filter = '.'   $filter = '.'
     }      }
   
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};  
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};  
     my $classlist=&Apache::loncoursedata::get_classlist();  
     my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum);  
     my $now = time;  
     my %allgroups = &Apache::longroup::coursegroups($cdom,$cnum);  
   
 # --------------------------------------- There is such a user, get environment  # --------------------------------------- There is such a user, get environment
   
     $r->print(<<ENDSCRIPT);      $r->print(<<ENDSCRIPT);
Line 138  ENDSCRIPT Line 133  ENDSCRIPT
   
  $r->print('</p>');   $r->print('</p>');
   
           unless ($env{'form.courseadvonly'}) {
   
 # ------------------------------------------------------------------ Students  # ------------------------------------------------------------------ Students
  my $result;      my $result;
  foreach my $user (sort(keys(%$classlist))) {              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     # the following undefs are for 'domain', and 'username' respectively.              my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
     my (undef,undef,$end,$start,$id,$section,$fullname,$status)=              my $classlist=&Apache::loncoursedata::get_classlist();
  @{$classlist->{$user}};              my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum);
     if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) {              my $now = time;
  next;              my %allgroups = &Apache::longroup::coursegroups($cdom,$cnum);
     }  
     if ($user=~/^($LONCAPA::username_re)\:($LONCAPA::domain_re)$/) {      foreach my $user (sort(keys(%$classlist))) {
  my ($uname,$udom)=($1,$2);          # the following undefs are for 'domain', and 'username' respectively.
  if (($uname=~/^$filter/) ||           my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
     ($fullname=~/^$filter/i)) {      @{$classlist->{$user}};
     my $grouplist = '';          if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) {
     foreach my $group (sort(keys(%allgroups))) {      next;
  if (exists($grouplist{$group.':'.$uname.':'.$udom})) {          }
     my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom});          if ($user=~/^($LONCAPA::username_re)\:($LONCAPA::domain_re)$/) {
     if (($end!=0) && ($end<$now)) { next; }      my ($uname,$udom)=($1,$2);
     if (($start!=0) && ($start>$now)) {next; }      if (($uname=~/^$filter/) || ($fullname=~/^$filter/i)) {
     $grouplist .= " $group,";           my $grouplist = '';
  }          foreach my $group (sort(keys(%allgroups))) {
       if (exists($grouplist{$group.':'.$uname.':'.$udom})) {
           my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom});
           if (($end!=0) && ($end<$now)) { next; }
           if (($start!=0) && ($start>$now)) {next; }
           $grouplist .= " $group,"; 
       }
           }
           $grouplist =~ s/,$//;
           $result .=&Apache::loncommon::start_data_table_row().
                 '<td>'.
             '<input type="button" value="'.&mt('Select').'" onClick="gochoose('.
             "'".$uname."','".$udom."')".'" /></td>'.
             '<td><tt>'.$uname.'</tt></td><td> <tt>'.$udom.
             '</tt></td><td>'.
             &Apache::loncommon::aboutmewrapper($fullname,
            $uname,$udom).
             '</td><td>'.$id.'</td><td>'.$section.
             '</td><td>'.$grouplist.'</td>'.
             &Apache::loncommon::end_data_table_row();
     }      }
     $grouplist =~ s/,$//;          }
     $result .=&Apache::loncommon::start_data_table_row().  
       '<td>'.  
       '<input type="button" value="'.&mt('Select').'" onClick="gochoose('.  
       "'".$uname."','".$udom."')".'" /></td>'.  
       '<td><tt>'.$uname.'</tt></td><td> <tt>'.$udom.  
       '</tt></td><td>'.  
       &Apache::loncommon::aboutmewrapper($fullname,  
  $uname,$udom).  
       '</td><td>'.$id.'</td><td>'.$section.  
       '</td><td>'.$grouplist.'</td>'.  
       &Apache::loncommon::end_data_table_row();  
  }  
     }      }
  }      if (!$result) {
  if (!$result) {          $r->print('<p>'.&mt('No students found.').'</p>');
     $r->print('<p>'.&mt('No students found.').'</p>');      } else {
  } else {          $r->print(&Apache::loncommon::start_data_table().
     $r->print(&Apache::loncommon::start_data_table().                &Apache::loncommon::start_data_table_header_row().
       &Apache::loncommon::start_data_table_header_row().            &Apache::loncommon::end_data_table_header_row().
       &Apache::loncommon::end_data_table_header_row().            '<th>&nbsp;</th>'.
       '<th>&nbsp;</th>'.            '<th>'.&mt('username').'</th>'.
       '<th>'.&mt('username').'</th>'.            '<th>'.&mt('domain').'</th>'.
       '<th>'.&mt('domain').'</th>'.            '<th>'.&mt('Name').'</th>'.
       '<th>'.&mt('Name').'</th>'.            '<th>'.&mt('ID').'</th>'.
       '<th>'.&mt('ID').'</th>'.            '<th>'.&mt('section').'</th>'.
       '<th>'.&mt('section').'</th>'.            '<th>'.&mt('active group(s)').'</th>'.
       '<th>'.&mt('active group(s)').'</th>'.            &Apache::loncommon::end_data_table_header_row().
       &Apache::loncommon::end_data_table_header_row().            $result.
       $result.            &Apache::loncommon::end_data_table());
       &Apache::loncommon::end_data_table());      }
  }          }
     } else {      } else {
  $r->print('<h3>'.&mt('Users with Roles Assigned by').' '.   $r->print('<h3>'.&mt('Users with Roles Assigned by').' '.
   &Apache::loncommon::plainname($env{'user.name'},    &Apache::loncommon::plainname($env{'user.name'},

Removed from v.1.26  
changed lines
  Added in v.1.27


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