--- loncom/interface/lonwhatsnew.pm 2010/09/19 15:05:59 1.98.2.4 +++ loncom/interface/lonwhatsnew.pm 2015/07/21 21:26:32 1.118 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.98.2.4 2010/09/19 15:05:59 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.118 2015/07/21 21:26:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -89,7 +89,7 @@ sub handler { if ( ! $env{'request.course.fn'} || ! $checkallowed{'whatsnew'}) { # Not in a course, or no whn priv in course - $env{'user.error.msg'}="/adm/whatsnew::whn:0:0:Cannot display what's new page"; + $env{'user.error.msg'}="/adm/whatsnew:whn:0:0:Cannot display what's new page"; return HTTP_NOT_ACCEPTABLE; } @@ -237,7 +237,7 @@ sub display_main_box { &display_interval_config($r,$refpage,\%interval_titles,'oldroles'); } elsif (($command eq 'chgcrslogininterval') && $checkallowed->{'crslogin'}) { - &display_interval_config($r,$refpage,\%interval_titles,'crslogin'); + &display_interval_config($r,$refpage,\%interval_titles,'crslogin'); } else { &display_actions_box($r,$command,$refpage,\%threshold_titles, \%interval_titles,\%initpage,$cdom,$crs,$checkallowed); @@ -263,7 +263,7 @@ sub display_header { my $scripttag; unless ($command eq 'chgthreshold' || $command eq 'chginterval' || - $command eq 'chgoldroleinterval' || + $command eq 'chgoldroleinterval' || $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') { $scripttag = <<"END"; '); $r->print('
' .&mt('Choose whether or not to display a count of the number of new posts for each resource or discussion board which has unread posts.') .'
' .&mt("This can increase the time taken to gather data for the [_1]What's New Page[_2] by a few seconds.",'','') .'  ' - .&mt('Currently set to [_1].',''.$current.'.') + .&mt('Currently set to [_1].',''.$current.'') ); $r->print('

@@ -912,10 +901,10 @@ sub display_launcher { $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered, $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs, $interval,$countunread,$expired,$expirecount,$activated,$activecount, - $crstype,$itemserror,$loggedin,$logincount,$custommenu) = @_; + $crstype,$itemserror,$loggedin,$logincount,$classlist) = @_; if ($$checkallowed{$action}) { - &start_box($r,$show,$headings,$action,$refpage,$action,$custommenu); + &start_box($r,$show,$headings,$action,$refpage); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS &display_handgrade($r,$tograde,$ungraded,$itemserror); @@ -925,7 +914,7 @@ sub display_launcher { &display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror); } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS &display_abovethreshold($r,$refpage,$warnings,$triggered, - $res_title,$itemserror,$custommenu); + $res_title,$itemserror); } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION &display_coursediscussion($r,$newdiscussions,$unread, $countunread,$res_title,$itemserror); @@ -935,14 +924,13 @@ sub display_launcher { &display_coursecritmail($r,$critmsgcount,$critmsgs); } elsif ($action eq 'newroles') { # ACTIVATED ROLES &display_rolechanges($r,$activecount,$activated,$interval->{'newroles'}, - $crstype); + $crstype,$classlist); } elsif ($action eq 'oldroles') { # EXPIRED ROLES &display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'}, - $crstype); + $crstype,$classlist); } elsif ($action eq 'crslogin') { #LAST LOGIN &display_crslogins($r,$logincount,$loggedin,$interval->{'crslogin'}, - $crstype); - + $crstype,$classlist); } } &end_box($r); @@ -953,7 +941,7 @@ sub display_launcher { sub getitems { my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, - $starttime,$countunread,$custommenu) = @_; + $starttime,$countunread) = @_; my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { my $itemserror = ''.&mt('An error occurred retrieving information about the course.').'
'.&mt('It is recommended that you [_1]re-select the course[_2].','','').'
'; @@ -1013,7 +1001,7 @@ sub getitems { # Maxtries and degree of difficulty for problem parts, unless handgradeable if ($$show{'abovethreshold'}) { &check_thresholds($resource,$symb,\%resourcetracker, - $triggered,$threshold,$warnings,$custommenu); + $triggered,$threshold,$warnings); } } @@ -1087,7 +1075,7 @@ sub check_bombed { } sub check_thresholds { - my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,$custommenu) = @_; + my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_; # Compile maxtries and degree of difficulty for problem parts, unless handgradeable my @parts = @{$resource->parts()}; my %stats; @@ -1097,6 +1085,9 @@ sub check_thresholds { if ($resource->handgrade($part) eq 'yes') { next; } + if ($resource->is_anonsurvey($part)) { + next; + } if ($resource->is_survey($part)) { next; } @@ -1119,6 +1110,7 @@ sub check_thresholds { $av_attempts = $attempts/$users; $av_attempts = sprintf("%.2f",$av_attempts); } + &Apache::lonnet::statslog($symb,$part,$users,$av_attempts,$degdiff); if ((($degdiff ne '' && $degdiff >= $$threshold{'degdiff'}) || ($av_attempts ne '' && $av_attempts >= $$threshold{'av_attempts'})) && ($users >= $$threshold{'numstudents'})) { $stats{$part}{degdiff} = $degdiff; $stats{$part}{attempts} = $av_attempts; @@ -1145,17 +1137,12 @@ sub check_thresholds { $$triggered{$symb}{text}[$partcount] = ' '.&mt('single part').''; } - if ($custommenu) { - $$triggered{$symb}{text}[$partcount] .= ' - '.$stats{$part}{users}.''; - } else { - $$triggered{$symb}{text}[$partcount] .= ' - '.$stats{$part}{users}.' - '.$stats{$part}{attempts}.' - '.$stats{$part}{degdiff}.' - '.$lastreset{$part}.' - '; - } + $$triggered{$symb}{text}[$partcount] .= ' + '.$stats{$part}{users}.' + '.$stats{$part}{attempts}.' + '.$stats{$part}{degdiff}.' + '.$lastreset{$part}.' + '; $partcount ++; } $$triggered{$symb}{numparts} = $partcount; @@ -1166,14 +1153,7 @@ sub check_thresholds { sub get_curr_thresholds { - my ($threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu) = @_; - if ($custommenu) { - %$threshold = (av_attempts => 0, - degdiff => 0.00000000000000, - numstudents => 1 - ); - return; - } + my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_; # set default values %$threshold = (av_attempts => 2, degdiff => 0.5, @@ -1184,7 +1164,7 @@ sub get_curr_thresholds { my $thresholdcount = 0; my ($tmp) = %thresholdsettings; unless ($tmp =~ /^(con_lost|error|no_such_host)/i) { - foreach my $item (keys %{$threshold}) { + foreach my $item (keys(%{$threshold})) { if (exists($thresholdsettings{$cid.':threshold_'.$item})) { $$threshold{$item} = $thresholdsettings{$cid.':threshold_'.$item}; @@ -1199,7 +1179,7 @@ sub get_curr_thresholds { $cdom,$crs,'internal.threshold'); my ($temp) = %coursesettings; unless ($temp =~ /^(con_lost|error|no_such_host)/i) { - foreach my $item (keys %{$threshold}) { + foreach my $item (keys(%{$threshold})) { unless (exists($thresholdsettings{$cid.':threshold_'.$item})) { if (exists($coursesettings{'internal.threshold_'.$item})) { $$threshold{$item} = @@ -1265,10 +1245,14 @@ sub process_reset { sub process_update { my ($uname,$udom,$threshold_titles) = @_; - my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').'
'; - foreach (keys %env) { - next if ($_!~/^form\.(.+)\_setparmval$/); - my $name = $1; + my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').'

'; + foreach my $key (keys(%env)) { + my $name; + if ($key =~/^form\.(.+)\_setparmval$/) { + $name = $1; + } else { + next; + } my $value = $env{'form.'.$name.'_value'}; if ($name && defined($value) && ($value ne '')) { my $put_result = &Apache::lonnet::put('nohist_whatsnew', @@ -1276,45 +1260,51 @@ sub process_update { my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/); if ($put_result eq 'ok') { - $setoutput.=&mt('Set threshold for [_1] to [_2]', + $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Set threshold for [_1] to [_2]', ''.$$threshold_titles{$shortname}.'', - ''.$value.'').'
'; + ''.$value.'').'
'); } else { - $setoutput.=&mt('Unable to set threshold for [_1] to [_2] due to [_3].', + $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set threshold for [_1] to [_2] due to [_3].', ''.$name.'',''.$value.'', - ''.$put_result.'').'
'; + ''.$put_result.'').'
',1); } } } - return $setoutput; + return &Apache::loncommon::confirmwrapper($setoutput); } sub getnormalmail { my ($newmsgs) = @_; -# Check for unread mail in course +# Check for unread messages in user's INBOX (which were sent in context of current course). my $msgcount = 0; - - my @messages = sort(&Apache::lonnet::getkeys('nohist_email')); - foreach my $message (@messages) { - my $msgid=&escape($message); - my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= - &Apache::lonmsg::unpackmsgid($msgid); - if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { - if (defined($sendtime) && $sendtime!~/error/) { - my $numsendtime = $sendtime; - if ($status eq 'new') { - $sendtime = &Apache::lonlocal::locallocaltime($sendtime); - $msgcount ++; - if ($shortsubj eq '') { - $shortsubj = &mt('No subject'); + my @messages = &Apache::lonnet::getkeys('nohist_email'); + return $msgcount if (!@messages); + my %emailstatus = &Apache::lonnet::dump('email_status'); + foreach my $msgid (sort(@messages)) { + if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) { + my $skipstatus; + if ($emailstatus{$msgid} eq 'new') { + $skipstatus = 1; + } + my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= + &Apache::lonmsg::unpackmsgid($msgid,undef,$skipstatus,undef, + $env{'request.course.id'}); + if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { + if (defined($sendtime) && $sendtime!~/error/) { + if (($emailstatus{$msgid} eq 'new') || ($status eq 'new')) { + $sendtime = &Apache::lonlocal::locallocaltime($sendtime); + $msgcount ++; + if ($shortsubj eq '') { + $shortsubj = &mt('No subject'); + } + push(@{$newmsgs}, { + msgid => $msgid, + sendtime => $sendtime, + shortsub => $shortsubj, + from => $fromname, + fromdom => $fromdom + }); } - push(@{$newmsgs}, { - msgid => $msgid, - sendtime => $sendtime, - shortsub => $shortsubj, - from => $fromname, - fromdom => $fromdom - }); } } } @@ -1324,16 +1314,16 @@ sub getnormalmail { sub getcritmail { my ($critmsgs) = @_; -# Check for critical messages in course +# Check for critical messages which were sent in context of current course. my %what=&Apache::lonnet::dump('critical'); my $result = ''; my $critmsgcount = 0; foreach my $msgid (sort(keys(%what))) { my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= - &Apache::lonmsg::unpackmsgid($msgid); + &Apache::lonmsg::unpackmsgid($msgid,undef,1,undef, + $env{'request.course.id'}); if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { if (defined($sendtime) && $sendtime!~/error/) { - my $numsendtime = $sendtime; $sendtime = &Apache::lonlocal::locallocaltime($sendtime); $critmsgcount ++; if ($shortsubj eq '') { @@ -1353,13 +1343,13 @@ sub getcritmail { } sub getexpired { - my ($rolechgs,$rolechgtime,$status) = @_; - my $expirecount = &getrolechanges($rolechgs,$rolechgtime,$status); + my ($rolechgs,$rolechgtime,$status,$classlist) = @_; + my $expirecount = &getrolechanges($rolechgs,$rolechgtime,$status,$classlist); return $expirecount; } sub getactivated { - my ($rolechgs,$rolechgtime,$status) = @_; + my ($rolechgs,$rolechgtime,$status,$classlist) = @_; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $now = time(); @@ -1371,28 +1361,26 @@ sub getactivated { my (%stucounted,%advcounted); my $activatedcount = 0; if (keys(%changes) > 0) { - foreach my $chg (sort { $b <=> $a } (keys(%changes))) { + foreach my $chg (keys(%changes)) { if (ref($changes{$chg}) eq 'HASH') { - my $timestamp = $changes{$chg}{'exe_time'}; - if ($timestamp) { - if ($rolechgtime > 0) { - if ($timestamp < $rolechgtime) { - last; - } - } + next if ($changes{$chg}{'delflag'}); + if ($rolechgtime > 0) { + next if ($changes{$chg}{'exe_time'} < $rolechgtime); + } + if ($changes{$chg}{'exe_time'}) { + my $timestamp = $changes{$chg}{'exe_time'}; if (ref($changes{$chg}{'logentry'}) eq 'HASH') { - next if ($changes{$chg}{'delflag'}); - my $start = $changes{$chg}{'logentry'}{'start'}; my $end = $changes{$chg}{'logentry'}{'end'}; - my $section = $changes{$chg}{'logentry'}{'section'}; - my $role = $changes{$chg}{'logentry'}{'role'}; - my $uname = $changes{$chg}{'uname'}; - my $udom = $changes{$chg}{'udom'}; next if ($end && $end <= $now); + my $start = $changes{$chg}{'logentry'}{'start'}; + next if ($start >= $timestamp); + my $section = $changes{$chg}{'logentry'}{'section'}; if (($viewablesec ne '') && ($section ne '')) { next if ($viewablesec ne $section); } - next if ($start >= $timestamp); + my $role = $changes{$chg}{'logentry'}{'role'}; + my $uname = $changes{$chg}{'uname'}; + my $udom = $changes{$chg}{'udom'}; if ($role eq 'st') { $stucounted{$uname.':'.$udom.':'.$section} = $start.':'.$end; } else { @@ -1412,12 +1400,13 @@ sub getactivated { } } } - $activatedcount += &getrolechanges($rolechgs,$rolechgtime,$status,\%stucounted,\%advcounted); + $activatedcount += &getrolechanges($rolechgs,$rolechgtime,$status,$classlist,\%stucounted, + \%advcounted); return $activatedcount; } sub getrolechanges { - my ($rolechgs,$rolechgtime,$status,$stucountref,$advcountref) = @_; + my ($rolechgs,$rolechgtime,$status,$classlist,$stucountref,$advcountref) = @_; my (%stucounted,%advcounted); if (ref($stucountref) eq 'HASH') { %stucounted = %{$stucountref}; @@ -1435,63 +1424,64 @@ sub getrolechanges { my ($permission,$allowed) = &Apache::lonuserutils::get_permission($context); my $viewablesec = &Apache::lonuserutils::viewable_section($permission); - my $classlist = &Apache::loncoursedata::get_classlist(); my $secidx = &Apache::loncoursedata::CL_SECTION(); my $startidx = &Apache::loncoursedata::CL_START(); my $endidx = &Apache::loncoursedata::CL_END(); my $rolechgcount = 0; - foreach my $key (keys(%{$classlist})) { - my ($userstatus,$eventtime); - my $student = $classlist->{$key}; - if (ref($student) eq 'ARRAY') { - my $start = $student->[$startidx]; - my $end = $student->[$endidx]; - my $sec = $student->[$secidx]; - my ($stuname,$studom) = split(/:/,$key); - if ($status eq 'active') { - if (exists($stucounted{$key.':'.$sec})) { - next; + if (ref($classlist) eq 'HASH') { + foreach my $key (keys(%{$classlist})) { + my ($userstatus,$eventtime); + my $student = $classlist->{$key}; + if (ref($student) eq 'ARRAY') { + my $start = $student->[$startidx]; + my $end = $student->[$endidx]; + my $sec = $student->[$secidx]; + my ($stuname,$studom) = split(/:/,$key); + if ($status eq 'active') { + if (exists($stucounted{$key.':'.$sec})) { + next; + } } - } - if (($end == 0) || ($end > $start)) { - if ($start <= $now) { - if ($end && $end < $now) { - if ($rolechgtime > 0) { - if ($end > $rolechgtime) { + if (($end == 0) || ($end > $start)) { + if ($start <= $now) { + if ($end && $end < $now) { + if ($rolechgtime > 0) { + if ($end > $rolechgtime) { + $userstatus = 'previous'; + } + } else { $userstatus = 'previous'; } } else { - $userstatus = 'previous'; - } - } else { - if ($rolechgtime > 0) { - if ($start >= $rolechgtime) { + if ($rolechgtime > 0) { + if ($start >= $rolechgtime) { + $userstatus = 'active'; + } + } else { $userstatus = 'active'; } - } else { - $userstatus = 'active'; } } } + next if ($userstatus ne $status); + if ($status eq 'active') { + $eventtime = $start; + } else { + $eventtime = $end; + } + if (($viewablesec ne '') && ($sec ne '')) { + next if ($viewablesec ne $sec); + } + my %chginfo = ( + 'section' => $sec, + 'uname' => $stuname, + 'udom' => $studom, + 'role' => 'st', + 'status' => $userstatus, + ); + $rolechgcount ++; + push(@{$rolechgs->{$eventtime}},\%chginfo); } - next if ($userstatus ne $status); - if ($status eq 'active') { - $eventtime = $start; - } else { - $eventtime = $end; - } - if (($viewablesec ne '') && ($sec ne '')) { - next if ($viewablesec ne $sec); - } - my %chginfo = ( - 'section' => $sec, - 'uname' => $stuname, - 'udom' => $studom, - 'role' => 'st', - 'status' => $userstatus, - ); - $rolechgcount ++; - push (@{$rolechgs->{$eventtime}},\%chginfo); } } my %advrolehash = &Apache::lonnet::get_my_roles($cnum,$cdom,undef, @@ -1583,7 +1573,7 @@ sub getloggedin { } } return $logincount; -} +} sub checkversions { my ($cdom,$crs,$navmap,$changed,$starttime) = @_; @@ -1601,7 +1591,7 @@ sub checkversions { 'lastrevisiondate'); $revdate = &Apache::lonlocal::locallocaltime($revdate); my $linkurl=&Apache::lonnet::clutter($key); - my $usedversion=$navmap->usedVersion('version_'.$linkurl); + my $usedversion=$navmap->usedVersion($linkurl); my @resources = $navmap->getResourceByUrl($linkurl,1); if (($usedversion) && ($usedversion ne 'mostrecent')) { $version = $usedversion; @@ -1640,13 +1630,13 @@ sub display_handgrade { foreach my $res (@{$tograde}) { $rowNum ++; my $css_class = $rowNum%2?' class="LC_odd_row"':''; - my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); - my $linkurl=&Apache::lonnet::clutter($url); - $linkurl .= '?symb='.&escape($res); + my $linkurl='/adm/grades'; if ($$ungraded{$res}{'enclink'}) { - $linkurl = - $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'}; - } + $linkurl.='?symb='.$$ungraded{$res}{'encsymb'}; + } else { + $linkurl.='?symb='.&escape($res); + } + $linkurl.='&command=ungraded'; $r->print(''.$$ungraded{$res}{title}.''.$$ungraded{$res}{count}.''); } } elsif ($itemserror) { @@ -1685,7 +1675,7 @@ sub display_haserrors { } sub display_abovethreshold { - my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$custommenu) = @_; + my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', part => 'Part', @@ -1699,35 +1689,13 @@ sub display_abovethreshold { ); if (@{$warnings} > 0) { @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; - if ($custommenu) { - my (%bynum,@overthresh); - foreach my $item (@{$warnings}) { - my ($probnum) = ($res_title->{$item} =~ /^Problem\s+(\d+)$/); - if ($probnum ne '') { - $bynum{$probnum} = $item; - } - } - foreach my $num (sort { $a <=> $b } keys(%bynum)) { - push(@overthresh,$bynum{$num}); - } - @{$warnings} = @overthresh; - } - if ($custommenu) { - $r->print(''. - ''.$lt{'reso'}.''. - ''.$lt{'part'}.''.$lt{'nust'}.''); - } else { - $r->print(''. - ' '."\n". - ' '. - "\n"); - $r->print(''. - ''.$lt{'reso'}.''. - ''.$lt{'part'}.''.$lt{'nust'}.''. - ''.$lt{'avat'}.''.$lt{'dedi'}.''. - ''.$lt{'lare'}.''. - $lt{'reco'}.''); - } + $r->print(''. + ''.$lt{'reso'}. + ''. + ''.$lt{'part'}.''.$lt{'nust'}.''. + ''.$lt{'avat'}.''.$lt{'dedi'}.''. + ''.$lt{'lare'}.''. + $lt{'reco'}.''); my $row; foreach my $res (@{$warnings}) { $row++; @@ -1753,15 +1721,13 @@ sub display_abovethreshold { if (ref($$triggered{$res}{text}) eq 'ARRAY') { if (@{$$triggered{$res}{text}} > 1) { for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) { - $r->print(''. + $r->print(''. $$triggered{$res}{text}[$i].''); } } } } - unless ($custommenu) { - $r->print('
'); - } + $r->print('
'); } elsif ($itemserror) { $r->print(''.$itemserror.''); } else { @@ -1807,7 +1773,7 @@ sub display_versionchanges { } sub display_rolechanges { - my ($r,$chgcount,$changed,$interval,$crstype) = @_; + my ($r,$chgcount,$changed,$interval,$crstype,$classlist) = @_; my $now = time(); my %lt = &Apache::lonlocal::texthash( 'user' => 'User', @@ -1826,6 +1792,7 @@ sub display_rolechanges { if (ref($changed) eq 'HASH') { my @changes = sort { $b <=> $a } (keys(%{$changed})); my $changenum = 0; + my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME(); foreach my $item (@changes) { if (ref($changed->{$item}) eq 'ARRAY') { foreach my $chg (@{$changed->{$item}}) { @@ -1843,8 +1810,14 @@ sub display_rolechanges { my $udom = $chg->{'udom'}; $changenum ++; my $css_class = $changenum%2?' class="LC_odd_row"':''; + my $fullname; + if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { + $fullname = $classlist->{$uname.':'.$udom}->[$fullnameidx]; + } else { + $fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); + } my $link = - &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom); + &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); $r->print(''. ''.&Apache::lonlocal::locallocaltime($item).''. ''.$link.''. @@ -1864,7 +1837,8 @@ sub display_rolechanges { } sub display_crslogins { - my ($r,$logincount,$loggedin,$interval,$crstype) = @_; + my ($r,$logincount,$loggedin,$interval,$crstype,$classlist) = @_; + return unless (ref($classlist) eq 'HASH'); my %lt = &Apache::lonlocal::texthash( 'user' => 'User', 'role' => 'Role', @@ -1872,7 +1846,7 @@ sub display_crslogins { 'number' => 'Total number of logins', ); if ($logincount) { - + my $hdr = ''. ''.$lt{'user'}.''. ''.$lt{'role'}.''. @@ -1885,6 +1859,7 @@ sub display_crslogins { if (ref($loggedin) eq 'HASH') { my @logins = sort { $b <=> $a } (keys(%{$loggedin})); my $numlogin = 0; + my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME(); foreach my $item (@logins) { if (ref($loggedin->{$item}) eq 'ARRAY') { foreach my $user (@{$loggedin->{$item}}) { @@ -1901,7 +1876,12 @@ sub display_crslogins { $counts{$user->{'role'}}{$section} ++; my $uname = $user->{'uname'}; my $udom = $user->{'udom'}; - my $fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); + my $fullname; + if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { + $fullname = $classlist->{$uname.':'.$udom}->[$fullnameidx]; + } else { + $fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); + } my $link = &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); push(@{$bylastname{$fullname}}, @@ -1914,18 +1894,18 @@ sub display_crslogins { } my $table; foreach my $person (sort(keys(%bylastname))) { - if (ref($bylastname{$person}) eq 'ARRAY') { - foreach my $item (@{$bylastname{$person}}) { + if (ref($bylastname{$person}) eq 'ARRAY') { + foreach my $item (@{$bylastname{$person}}) { $numlogin ++; my $css_class = $numlogin%2?' class="LC_odd_row"':''; - $table .= '