--- loncom/interface/lonwhatsnew.pm 2009/02/04 13:03:44 1.85 +++ loncom/interface/lonwhatsnew.pm 2010/08/10 03:28:53 1.98.2.3 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.85 2009/02/04 13:03:44 schafran Exp $ +# $Id: lonwhatsnew.pm,v 1.98.2.3 2010/08/10 03:28:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,6 +42,7 @@ use Time::Local; use GDBM_File; use lib '/home/httpd/lib/perl/'; use LONCAPA; +use HTML::Entities; #---------------------------- # handler @@ -71,6 +72,7 @@ sub handler { ['mdc','versionchanges',0], ['vcl','newroles',1], ['vcl','oldroles',1], + ['whn','crslogin',1], ) { my ($perm,$key,$check_section) = @{ $perm_check }; my $scope = $env{'request.course.id'}; @@ -99,7 +101,7 @@ sub handler { &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/whatsnew', - text=>"Display Action Items"}); + text=>"What's New?"}); if (($command eq 'chgthreshold') && $checkallowed{'abovethreshold'}) { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage, @@ -142,6 +144,13 @@ sub handler { $r->print(&Apache::lonhtmlcommon::breadcrumbs ("What's New?",#'Course_Action_Items_Intervals' )); + } elsif ($command eq 'chgcrslogininterval' && $checkallowed{'crslogin'}) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew?command=chgcrslogininterval&refpage='.$refpage, + text=>"Change interval"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + ("What's New?",#'Course_Action_Items_Intervals' + )); } else { $r->print(&Apache::lonhtmlcommon::breadcrumbs ("What's New?",#'Course_Action_Items_Display' @@ -187,14 +196,21 @@ sub display_main_box { 604800 => 'roles which expired since last week', 86400 => 'roles which expired since yesterday', ); + my %crslogins = ( + -1 => 'last login for anyone who has ever logged in', + 2592000 => 'last login for users in last 30 days', + 604800 => 'last login for users in last 7 days', + 86400 => 'last login for users in last 24 hours', + ); my %interval_titles = ( versions => \%versions, newroles => \%newroles, oldroles => \%oldroles, + crslogin => \%crslogins, ); my %initpage = &Apache::lonlocal::texthash ( firstres => "first resource in the $lctype", - whatsnew => "what's new? page", + whatsnew => "What's New Page", userpref => 'your general user preferences', coursespecific => "specific setting for this $lctype", ); @@ -219,6 +235,9 @@ sub display_main_box { } elsif (($command eq 'chgoldroleinterval') && $checkallowed->{'oldroles'}) { &display_interval_config($r,$refpage,\%interval_titles,'oldroles'); + } elsif (($command eq 'chgcrslogininterval') + && $checkallowed->{'crslogin'}) { + &display_interval_config($r,$refpage,\%interval_titles,'crslogin'); } else { &display_actions_box($r,$command,$refpage,\%threshold_titles, \%interval_titles,\%initpage,$cdom,$crs,$checkallowed); @@ -244,9 +263,11 @@ sub display_header { my $scripttag; unless ($command eq 'chgthreshold' || $command eq 'chginterval' || - $command eq 'chgoldroleinterval' || $command eq 'chgnewroleinterval') { + $command eq 'chgoldroleinterval' || + $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') { $scripttag = <<"END"; '; } my $course_type=&Apache::loncommon::course_type(); - return &Apache::loncommon::start_page($course_type.' Action Items', + return &Apache::loncommon::start_page("What's New?", $scripttag); } @@ -281,6 +348,7 @@ END sub display_actions_box { my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage, $cdom,$crs,$checkallowed) = @_; + my $custommenu = &Apache::loncommon::needs_gci_custom(); my $udom = $env{'user.domain'}; my $uname = $env{'user.name'}; my $cid = $env{'request.course.id'}; @@ -288,7 +356,7 @@ sub display_actions_box { my $lctype = lc($crstype); my %stulabel = ( 'Course' => 'students', - 'Group' => 'members', + 'Community' => 'members', ); my %lt = &Apache::lonlocal::texthash( 'yacc' => 'You are accessing an invalid course', @@ -314,6 +382,8 @@ sub display_actions_box { my %expired; my $activecount; my %activated; + my %loggedin; + my $logincount; my %res_title = (); my %show = (); my $needitems = 0; @@ -327,7 +397,7 @@ sub display_actions_box { my %threshold = (); my %pagedesc = &Apache::lonlocal::texthash ( firstres => 'First resource', - whatsnew => "What's New? page", + whatsnew => "What's New Page", userpref => 'user preference', coursespecific => $lctype.' only', default => 'default', @@ -341,27 +411,32 @@ sub display_actions_box { return; } - if ($refpage eq 'start') { + my $header = ''; + if (($refpage eq 'start') && (!$custommenu)) { if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { - my $furl=$bighash{'first_url'}; + my $furl=&HTML::Entities::encode($bighash{'first_url'},'"<>&'); untie(%bighash); - $r->print(''.$lt{'gtfr'}. - '
'); + $header .= ''.$lt{'gtfr'}. + '
'; } } - $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype).'.' + unless ($custommenu) { + $header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.' .' ' .&mt('Currently: [_1].',''.$currinit.'') .'  ' - .&mt('[_1]Change[_2] for just [_3]this course[_4] or for all [_5]your courses[_6].' + .&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].' ,'' ,'' ,'' ,'' ,'' ,'') - .'

'); + .' '; + + $r->print(&Apache::loncommon::head_subbox($header)); + } if ($command eq 'reset') { $result = &process_reset($cdom,$crs); @@ -378,12 +453,14 @@ sub display_actions_box { unless ($store_result eq 'ok') { &Apache::lonnet::logthis('Error saving whatsnew settings: '. $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); - $result .= &mt('Unable to save visibility settings due to [_1]', - $store_result); + $result .= '' + .&mt('Unable to save visibility settings due to [_1]', + $store_result) + .''; } if ($result) { - $r->print($result.'
'); + $r->print($result.'
'); } $r->rflush(); @@ -439,6 +516,20 @@ sub display_actions_box { $headings{'newroles'} = &mt('Roles for which access to '.$lctype.' has become available since yesterday'); } + $timediff{'crslogin'} = $display_settings{$cid.':crslogininterval'}; + unless (defined($timediff{'crslogin'})) { $timediff{'crslogin'} = 604800; } + $interval{'crslogin'} = $interval_titles->{'crslogin'}->{$timediff{'crslogin'}}; + + if ($timediff{'crslogin'} == -1) { + $headings{'crslogin'} = &mt('Last login for anyone who has ever logged in'); + } elsif ($timediff{'crslogin'} == 2592000) { + $headings{'crslogin'} = &mt('Last login for users in last 30 days'); + } elsif ($timediff{'crslogin'} == 604800) { + $headings{'crslogin'} = &mt('Last login for users in last 7 days'); + } elsif ($timediff{'crslogin'} == 86400) { + $headings{'crslogin'} = &mt('Last login for users in last 24 hours'); + } + my $now = time; if ($timediff{'versions'} == -1) { $timediff{'versions'} = time; @@ -453,22 +544,38 @@ sub display_actions_box { if ($timediff{'oldroles'} == -1) { $timediff{'oldroles'} = time; } + my $expiredstart = $now - $timediff{'oldroles'}; + if ($timediff{'crslogin'} == -1) { + $timediff{'crslogin'} = time; + } + + my $crsloginstart = $now - $timediff{'crslogin'}; + my $countunread = $display_settings{$cid.':countunread'}; unless (defined($countunread)) { $countunread = 'on'; } if ($$checkallowed{'abovethreshold'}) { - &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs); + &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu); } - $headings{'abovethreshold'} = - &mt('(Problems with av. attempts ≥ [_1] or deg. difficulty ≥ [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions ≥ [_4]', - $threshold{'av_attempts'},$threshold{'degdiff'}, - '
',$threshold{'numstudents'}); + if ($custommenu) { + $headings{'abovethreshold'} = &mt('Questions with submissions'); + } else { + $headings{'abovethreshold'} = + &mt('(Problems with av. attempts ≥ [_1] or deg. difficulty ≥ [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions ≥ [_4]', + $threshold{'av_attempts'},$threshold{'degdiff'}, + '
',$threshold{'numstudents'}); + } - my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles'); + my @actionorder; + if ($custommenu) { + @actionorder = ('coursenormalmail','coursecritmail','abovethreshold','newroles','oldroles','crslogin'); + } else { + @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles'); + } foreach my $key (keys(%{$checkallowed})) { if ($key =~ /_section$/) { next; } @@ -492,7 +599,7 @@ sub display_actions_box { my $itemserror; if ($needitems) { - $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread); + $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$custommenu); } if ($show{'coursenormalmail'}) { $msgcount = &getnormalmail(\@newmsgs); @@ -506,6 +613,10 @@ sub display_actions_box { if ($show{'newroles'}) { $activecount = &getactivated(\%activated,$activatedstart,'active'); } + if ($show{'crslogin'}) { + $logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart); + } + $r->print(qq|$lt{'hial'}   $lt{'shal'}
\n|); @@ -516,7 +627,11 @@ sub display_actions_box { } } - $r->print('
'; } - $$triggered{$symb}{text}[$partcount] .= ' - - - - - '; + if ($custommenu) { + $$triggered{$symb}{text}[$partcount] .= ' + '; + } else { + $$triggered{$symb}{text}[$partcount] .= ' + + + + + '; + } $partcount ++; } $$triggered{$symb}{numparts} = $partcount; @@ -1032,7 +1166,14 @@ sub check_thresholds { sub get_curr_thresholds { - my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_; + my ($threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu) = @_; + if ($custommenu) { + %$threshold = (av_attempts => 0, + degdiff => 0.00000000000000, + numstudents => 1 + ); + return; + } # set default values %$threshold = (av_attempts => 2, degdiff => 0.5, @@ -1161,9 +1302,9 @@ sub getnormalmail { if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { if (defined($sendtime) && $sendtime!~/error/) { my $numsendtime = $sendtime; - $sendtime = &Apache::lonlocal::locallocaltime($sendtime); if ($status eq 'new') { - $msgcount ++; + $sendtime = &Apache::lonlocal::locallocaltime($sendtime); + $msgcount ++; if ($shortsubj eq '') { $shortsubj = &mt('No subject'); } @@ -1411,6 +1552,39 @@ sub getrolechanges { return $rolechgcount; } +sub getloggedin { + my ($cdom,$crs,$lastlogins,$starttime) = @_; + my $context = 'course'; + my ($permission,$allowed) = + &Apache::lonuserutils::get_permission($context); + my $viewablesec = &Apache::lonuserutils::viewable_section($permission); + my %crslogins=&Apache::lonnet::dump('nohist_crslastlogin',$cdom,$crs); + my $logincount = 0; + my ($tmp) = keys(%crslogins); + unless ($tmp =~ /^(con_lost|error|no_such_host)/i) { + if (keys(%crslogins) > 0) { + foreach my $key (keys(%crslogins)) { + my ($uname,$udom,$section,$role) = split(/:/,$key); + my $eventtime = $crslogins{$key}; + if ($eventtime > $starttime) { + if (($viewablesec ne '') && ($section ne '')) { + next if ($viewablesec ne $section); + } + my %chginfo = ( + 'section' => $section, + 'uname' => $uname, + 'udom' => $udom, + 'role' => $role, + ); + $logincount ++; + push (@{$lastlogins->{$eventtime}},\%chginfo); + } + } + } + } + return $logincount; +} + sub checkversions { my ($cdom,$crs,$navmap,$changed,$starttime) = @_; my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs); @@ -1511,7 +1685,7 @@ sub display_haserrors { } sub display_abovethreshold { - my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; + my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$custommenu) = @_; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', part => 'Part', @@ -1525,16 +1699,35 @@ sub display_abovethreshold { ); if (@{$warnings} > 0) { @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; - $r->print(''. + 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(''. + ''. + ''); + } else { + $r->print(''. ' '."\n". ' '. "\n"); - $r->print(''. - ''. - ''. - ''. - ''); + $r->print(''. + ''. + ''. + ''. + ''); + } my $row; foreach my $res (@{$warnings}) { $row++; @@ -1566,7 +1759,9 @@ sub display_abovethreshold { } } } - $r->print(''); + unless ($custommenu) { + $r->print(''); + } } elsif ($itemserror) { $r->print(''); } else { @@ -1667,6 +1862,92 @@ sub display_rolechanges { } return; } + +sub display_crslogins { + my ($r,$logincount,$loggedin,$interval,$crstype) = @_; + my %lt = &Apache::lonlocal::texthash( + 'user' => 'User', + 'role' => 'Role', + 'sec' => 'Section', + 'number' => 'Total number of logins', + ); + if ($logincount) { + + my $hdr = ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''); + } + } + } + } + my $table; + foreach my $person (sort(keys(%bylastname))) { + if (ref($bylastname{$person}) eq 'ARRAY') { + foreach my $item (@{$bylastname{$person}}) { + $numlogin ++; + my $css_class = $numlogin%2?' class="LC_odd_row"':''; + $table .= ''; + } + } + } + my $numrow = 0; + foreach my $role (sort(keys(%counts))) { + my $showrole = &Apache::lonnet::plaintext($role,$crstype); + if (ref($counts{$role}) eq 'HASH') { + foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) { + $numrow ++; + my $css_class = $numrow%2?' class="LC_odd_row"':''; + $table .= ''. + ''. + ''. + ''; + } + } + } + $r->print($hdr.''.$table); + } + } else { + $r->print(''); + } + return; +} sub display_coursediscussion { my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_; @@ -1828,6 +2109,8 @@ sub store_interval_setting { $interval_settings{$cid.':oldroleinterval'} = $env{'form.interval'}; } elsif ($context eq 'newroles') { $interval_settings{$cid.':newroleinterval'} = $env{'form.interval'}; + } elsif ($context eq 'crslogin') { + $interval_settings{$cid.':crslogininterval'} = $env{'form.interval'}; } else { $interval_settings{$cid.':interval'} = $env{'form.interval'}; } @@ -1924,7 +2207,7 @@ sub store_courseinit_setting { } sub start_box { - my ($r,$show,$heading,$caller,$refpage) = @_; + my ($r,$show,$heading,$caller,$refpage,$action,$custommenu) = @_; my %lt = &Apache::lonlocal::texthash( chth => 'Change thresholds?', chin => 'Change interval?', @@ -1949,41 +2232,49 @@ sub start_box { '); if (($caller eq 'abovethreshold') && ($$show{$caller})) { - if ($$show{$caller}) { + if ($$show{$caller} && !$custommenu) { $r->print(' - + '); } } elsif (($caller eq 'versionchanges') && ($$show{$caller})) { if ($$show{$caller}) { $r->print(' - + '); } } elsif ($caller eq 'coursediscussion') { if ($$show{$caller}) { $r->print(' - + '); } } elsif (($caller eq 'newroles') && ($$show{$caller})) { if ($$show{$caller}) { $r->print(' - + '); } } elsif (($caller eq 'oldroles') && ($$show{$caller})) { if ($$show{$caller}) { $r->print(' - + + '); + } + } elsif (($caller eq 'crslogin') && ($$show{$caller})) { + if ($$show{$caller}) { + $r->print(' + + '); } } + $r->print('
'); + $r->print(''); + unless($custommenu) { + $r->print(''); + } + $r->print('
'); my $displayed = 0; my $totalboxes = 0; @@ -529,12 +644,15 @@ sub display_actions_box { } my $halfway = 4; # my $halfway = int($totalboxes/2) + $totalboxes%2; + if ($custommenu) { + $halfway = 3; + } foreach my $actionitem (@actionorder) { if ($$checkallowed{$actionitem}) { if ($displayed == $halfway) { $r->print(' '); } - &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror); + &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount,$custommenu); $displayed ++; } } @@ -543,6 +661,9 @@ sub display_actions_box {
'); + if ($custommenu) { + $r->print("\n"); + } } #------------------------------- @@ -594,7 +715,7 @@ sub display_threshold_config { &Apache::loncommon::end_data_table_row()); } $r->print(&Apache::loncommon::end_data_table()."\n". - '
+ '
'); @@ -622,6 +743,8 @@ sub display_interval_config { $r->print('
'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' expired.').'
'); } elsif ($context eq 'newroles') { $r->print('
'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').'
'); + } elsif ($context eq 'crslogin') { + $r->print('
'.&mt('Choose the time window to use to display the last login by a user in the '.$lctype).'
'); } else { $r->print('
'.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').'
'); } @@ -650,7 +773,7 @@ sub display_interval_config { } $r->print('   '); + &mt('Save').'" />'); return; } @@ -673,17 +796,19 @@ sub display_discussion_config { 'off' => 'on', ); $r->print(''); $r->print('
' - .&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.') + .&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 'What's New?' page by a few seconds.") + .&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.'.') ); @@ -725,7 +850,7 @@ sub courseinit_config { 'anis' => 'and is set to display', 'padc' => 'Page display controlled by', 'chce' => 'Choose '.$lctype.' entry', - 'moce' => 'Modify '.$lctype.' entry', + 'moce' => 'Save', ); $r->print(<<"END");
$lt{'chwp'} @@ -787,10 +912,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) = @_; + $crstype,$itemserror,$loggedin,$logincount,$custommenu) = @_; if ($$checkallowed{$action}) { - &start_box($r,$show,$headings,$action,$refpage,$action); + &start_box($r,$show,$headings,$action,$refpage,$action,$custommenu); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS &display_handgrade($r,$tograde,$ungraded,$itemserror); @@ -800,7 +925,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); + $res_title,$itemserror,$custommenu); } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION &display_coursediscussion($r,$newdiscussions,$unread, $countunread,$res_title,$itemserror); @@ -814,6 +939,10 @@ sub display_launcher { } elsif ($action eq 'oldroles') { # EXPIRED ROLES &display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'}, $crstype); + } elsif ($action eq 'crslogin') { #LAST LOGIN + &display_crslogins($r,$logincount,$loggedin,$interval->{'crslogin'}, + $crstype); + } } &end_box($r); @@ -824,7 +953,7 @@ sub display_launcher { sub getitems { my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, - $starttime,$countunread) = @_; + $starttime,$countunread,$custommenu) = @_; 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].','','').'
'; @@ -884,7 +1013,7 @@ sub getitems { # Maxtries and degree of difficulty for problem parts, unless handgradeable if ($$show{'abovethreshold'}) { &check_thresholds($resource,$symb,\%resourcetracker, - $triggered,$threshold,$warnings); + $triggered,$threshold,$warnings,$custommenu); } } @@ -958,7 +1087,7 @@ sub check_bombed { } sub check_thresholds { - my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_; + my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,$custommenu) = @_; # Compile maxtries and degree of difficulty for problem parts, unless handgradeable my @parts = @{$resource->parts()}; my %stats; @@ -1016,12 +1145,17 @@ sub check_thresholds { $$triggered{$symb}{text}[$partcount] = '
'.&mt('single part').''.$stats{$part}{users}.''.$stats{$part}{attempts}.''.$stats{$part}{degdiff}.''.$lastreset{$part}.''.$stats{$part}{users}.''.$stats{$part}{users}.''.$stats{$part}{attempts}.''.$stats{$part}{degdiff}.''.$lastreset{$part}.'
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.'
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.''.$lt{'avat'}.''.$lt{'dedi'}.''.$lt{'lare'}.''. - $lt{'reco'}.'
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.''.$lt{'avat'}.''.$lt{'dedi'}.''.$lt{'lare'}.''. + $lt{'reco'}.'


'.$itemserror.'
'.$lt{'number'}.''.$lt{'role'}.''.$lt{'sec'}; + my (%bylastname,%counts); + if (ref($loggedin) eq 'HASH') { + my @logins = sort { $b <=> $a } (keys(%{$loggedin})); + my $numlogin = 0; + foreach my $item (@logins) { + if (ref($loggedin->{$item}) eq 'ARRAY') { + foreach my $user (@{$loggedin->{$item}}) { + if (ref($user) eq 'HASH') { + my $section; + my $role = + &Apache::lonnet::plaintext($user->{'role'},$crstype); + my $status = &mt($user->{'status'}); + if ($user->{'section'} eq '') { + $section = &mt('none'); + } else { + $section = $user->{'section'}; + } + $counts{$user->{'role'}}{$section} ++; + my $uname = $user->{'uname'}; + my $udom = $user->{'udom'}; + my $fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); + my $link = + &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); + push(@{$bylastname{$fullname}}, + ''.$link.''.$role.''.$section.'
'.$counts{$role}{$sec}.''.$showrole.''.$sec.'
'. + &mt('There are no '.$interval). + '
'.$showhide.'
'.$lt{'chth'}.''.$lt{'chth'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chop'}.''.$lt{'chop'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chin'}.'