--- loncom/interface/lonuserutils.pm 2008/01/05 15:19:32 1.43 +++ loncom/interface/lonuserutils.pm 2008/01/06 05:32:43 1.46 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.43 2008/01/05 15:19:32 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.46 2008/01/06 05:32:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1307,8 +1307,10 @@ sub print_userlist { } $r->rflush(); if ($context eq 'course') { - my $classlist = &Apache::loncoursedata::get_classlist(); - %userlist = %{$classlist}; + if (($env{'form.showrole'} eq 'st') || ($env{'form.showrole'} eq 'Any')) { + my $classlist = &Apache::loncoursedata::get_classlist(); + %userlist = %{$classlist}; + } if ($env{'form.showrole'} ne 'st') { my $showroles; if ($env{'form.showrole'} ne 'Any') { @@ -1788,6 +1790,7 @@ sub make_keylist_array { $index->{'email'} = &Apache::loncoursedata::CL_PERMANENTEMAIL(); $index->{'role'} = &Apache::loncoursedata::CL_ROLE(); $index->{'extent'} = &Apache::loncoursedata::CL_EXTENT(); + $index->{'photo'} = &Apache::loncoursedata::CL_PHOTO(); foreach my $key (keys(%{$index})) { $keylist->[$index->{$key}] = $key; } @@ -2339,6 +2342,13 @@ END 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); @@ -2470,11 +2480,8 @@ END $r->print('   '); } if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) { - if ($displayphotos eq 'on' && $sdata->[$index{'role'}] eq 'st') { - my $imgurl = - &Apache::lonnet::retrievestudentphoto($in{'domain'},$in{'username'}, - 'gif','thumbnail'); - $r->print(' '); + if ($displayphotos eq 'on' && $role eq 'st' && $in{'photo'} ne '') { + $r->print(' '); } else { $r->print('   '); }