Diff for /loncom/interface/lonuserutils.pm between versions 1.42 and 1.46

version 1.42, 2008/01/05 05:22:42 version 1.46, 2008/01/06 05:32:43
Line 1307  sub print_userlist { Line 1307  sub print_userlist {
     }      }
     $r->rflush();      $r->rflush();
     if ($context eq 'course') {      if ($context eq 'course') {
         my $classlist = &Apache::loncoursedata::get_classlist();          if (($env{'form.showrole'} eq 'st') || ($env{'form.showrole'} eq 'Any')) { 
         my $secidx = &Apache::loncoursedata::CL_SECTION();              my $classlist = &Apache::loncoursedata::get_classlist();
         my $viewablesec = &viewable_section($permission);              %userlist = %{$classlist};
         foreach my $student (keys(%{$classlist})) {          }
             my $section = $classlist->{$student}[$secidx];          if ($env{'form.showrole'} ne 'st') {
             if ($viewablesec ne '') {              my $showroles;
                 if ($section ne $viewablesec) {              if ($env{'form.showrole'} ne 'Any') {
                     next;                  $showroles = [$env{'form.showrole'}];
                 } else {  
                     $userlist{$student} = $classlist->{$student};  
                 }  
             } else {              } else {
                 $userlist{$student} = $classlist->{$student};                  $showroles = undef;
             }              }
               my $withsec = 1;
               my $hidepriv = 1;
               my %advrolehash = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,
                                 \@statuses,$showroles,undef,$withsec,$hidepriv);
               &gather_userinfo($context,$format,\%userlist,$indexhash,\%userinfo,
                                \%advrolehash,$permission);
         }          }
         my $showroles;  
         if ($env{'form.showrole'} ne 'Any') {  
             $showroles = [$env{'form.showrole'}];  
         } else {  
             $showroles = undef;  
         }  
         my $withsec = 1;  
         my $hidepriv = 1;  
         my %advrolehash = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,  
                                     \@statuses,$showroles,undef,$withsec,$hidepriv);  
         &gather_userinfo($context,$format,\%userlist,$indexhash,\%userinfo,  
                          \%advrolehash,$permission);  
     } else {      } else {
         my (%cstr_roles,%dom_roles);          my (%cstr_roles,%dom_roles);
         if ($context eq 'author') {          if ($context eq 'author') {
Line 1799  sub make_keylist_array { Line 1790  sub make_keylist_array {
     $index->{'email'} = &Apache::loncoursedata::CL_PERMANENTEMAIL();      $index->{'email'} = &Apache::loncoursedata::CL_PERMANENTEMAIL();
     $index->{'role'} = &Apache::loncoursedata::CL_ROLE();      $index->{'role'} = &Apache::loncoursedata::CL_ROLE();
     $index->{'extent'} = &Apache::loncoursedata::CL_EXTENT();      $index->{'extent'} = &Apache::loncoursedata::CL_EXTENT();
       $index->{'photo'} = &Apache::loncoursedata::CL_PHOTO();
     foreach my $key (keys(%{$index})) {      foreach my $key (keys(%{$index})) {
         $keylist->[$index->{$key}] = $key;          $keylist->[$index->{$key}] = $key;
     }      }
Line 2272  END Line 2264  END
     # Get groups, role, permanent e-mail so we can sort on them if      # Get groups, role, permanent e-mail so we can sort on them if
     # necessary.      # necessary.
     foreach my $user (keys(%{$userlist})) {      foreach my $user (keys(%{$userlist})) {
           if ($user eq '' ) {
               delete($userlist->{$user});
               next;
           }
         if ($context eq 'domain' &&  $user eq $env{'request.role.domain'}.'-domainconfig:'.$env{'request.role.domain'}) {          if ($context eq 'domain' &&  $user eq $env{'request.role.domain'}.'-domainconfig:'.$env{'request.role.domain'}) {
             delete($userlist->{$user});              delete($userlist->{$user});
             next;              next;
Line 2317  END Line 2313  END
             }              }
             if ($mode ne 'autoenroll') {              if ($mode ne 'autoenroll') {
                 my $section = $userlist->{$user}->[$index{'section'}];                  my $section = $userlist->{$user}->[$index{'section'}];
                   if (($env{'request.course.sec'} ne '') && 
                       ($section ne $env{'request.course.sec'})) {
                       if ($role eq 'st') {
                           delete($userlist->{$user});
                           next;
                       }
                   }
                 if ($secfilter eq 'none') {                  if ($secfilter eq 'none') {
                     if ($section ne '') {                      if ($section ne '') {
                         delete($userlist->{$user});                          delete($userlist->{$user});
Line 2339  END Line 2342  END
                         next;                          next;
                     }                      }
                 }                  }
                   if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
                       if (($displayphotos eq 'on') && ($role eq 'st')) {
                           $userlist->{$user}->[$index{'photo'}] =
                               &Apache::lonnet::retrievestudentphoto($udom,$uname,
                                                                   'gif','thumbnail');
                       }
                   }
             }              }
         }          }
         my %emails   = &Apache::loncommon::getemails($uname,$udom);          my %emails   = &Apache::loncommon::getemails($uname,$udom);
Line 2470  END Line 2480  END
                         $r->print('    <td>&nbsp;</td>  ');                          $r->print('    <td>&nbsp;</td>  ');
                     }                      }
                     if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {                      if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
                         if ($displayphotos eq 'on' && $sdata->[$index{'role'}] eq 'st') {                          if ($displayphotos eq 'on' && $role eq 'st' && $in{'photo'} ne '') {
                             my $imgurl =                              $r->print('    <td align="right"><a href="javascript:photowindow('."'".&Apache::lonnet::studentphoto($in{'domain'},$in{'username'},'jpg')."'".')"><img src="'.$in{'photo'}.'" border="1"></a></td>');
                         &Apache::lonnet::retrievestudentphoto($in{'domain'},$in{'username'},  
                                                           'gif','thumbnail');  
                             $r->print('    <td align="right"><a href="javascript:photowindow('."'".&Apache::lonnet::studentphoto($in{'domain'},$in{'username'},'jpg')."'".')"><img src="'.$imgurl.'" border="1"></a></td>');  
                         } else {                          } else {
                             $r->print('    <td>&nbsp;</td>  ');                              $r->print('    <td>&nbsp;</td>  ');
                         }                          }

Removed from v.1.42  
changed lines
  Added in v.1.46


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