--- loncom/interface/lonwhatsnew.pm 2008/08/26 01:12:16 1.80 +++ loncom/interface/lonwhatsnew.pm 2010/08/09 23:39:43 1.98.2.2 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.80 2008/08/26 01:12:16 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.98.2.2 2010/08/09 23:39:43 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,7 +263,8 @@ 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 +346,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 +354,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 +380,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 +395,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,25 +409,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('Change for just [_1]this course[_2]' - .' or for all [_3]your courses[_2].' + .&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); @@ -376,12 +451,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(); @@ -437,6 +514,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; @@ -451,8 +542,15 @@ 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'; @@ -466,7 +564,12 @@ sub display_actions_box { $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','newroles','oldroles','crslogin'); + } else { + @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles'); + } foreach my $key (keys(%{$checkallowed})) { if ($key =~ /_section$/) { next; } @@ -488,8 +591,9 @@ sub display_actions_box { } } + my $itemserror; if ($needitems) { - &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); } if ($show{'coursenormalmail'}) { $msgcount = &getnormalmail(\@newmsgs); @@ -503,6 +607,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|); @@ -513,7 +621,7 @@ sub display_actions_box { } } - $r->print('
'); } + } elsif ($itemserror) { + $r->print(''); } else { $r->print(''); } } sub display_haserrors { - my ($r,$bombs,$bombed,$res_title) = @_; + my ($r,$bombs,$bombed,$res_title,$itemserror) = @_; my $bombnum = 0; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', @@ -1486,6 +1649,8 @@ sub display_haserrors { ''); } + } elsif ($itemserror) { + $r->print(''); } else { $r->print(''); } @@ -1493,7 +1658,7 @@ sub display_haserrors { } sub display_abovethreshold { - my ($r,$refpage,$warnings,$triggered,$res_title) = @_; + my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', part => 'Part', @@ -1549,13 +1714,15 @@ sub display_abovethreshold { } } $r->print(''); + } elsif ($itemserror) { + $r->print(''); } else { $r->print(''); } } sub display_versionchanges { - my ($r,$changed,$res_title,$interval) = @_; + my ($r,$changed,$res_title,$interval,$itemserror) = @_; my %lt = &Apache::lonlocal::texthash( 'reso' => 'Resource', 'revd' => 'Last revised', @@ -1582,6 +1749,8 @@ sub display_versionchanges { $$changed{$item}{'current'}.''); } + } elsif ($itemserror) { + $r->print(''); } else { $r->print(''); @@ -1645,9 +1814,93 @@ 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) { + $r->print(''. + ''. + ''. + ''. + ''. + ''. + ''. + ''); + 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}}, + ''. + ''. + ''); + } + } + } + } + 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"':''; + $r->print(''); + } + } + } + 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"':''; + $r->print(''. + ''. + ''. + ''); + } + } + } + $r->print(''); + } + } else { + $r->print(''); + } + return; +} sub display_coursediscussion { - my ($r,$newdiscussions,$unread,$countunread,$res_title) = @_; + my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_; my $lctype = lc(&Apache::loncommon::course_type()); my %lt = &Apache::lonlocal::texthash( 'loca' => 'Location', @@ -1677,7 +1930,7 @@ sub display_coursediscussion { my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb); my $disclink = $feedurl.'?symb='.$$unread{$ressymb}{symb}; if ($feedurl =~ /bulletinboard/) { - $type = 'Bulletin Board'; + $type = 'Discussion Board'; } if ($$unread{$ressymb}{'enclink'}) { $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'}; @@ -1695,6 +1948,8 @@ sub display_coursediscussion { } $r->print("\n"); } + } elsif ($itemserror) { + $r->print(''); } else { $r->print(''); } @@ -1804,6 +2059,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'}; } @@ -1873,9 +2130,10 @@ sub store_courseinit_setting { \%courseinit_settings,$udom,$uname); if ($outcome eq 'ok') { if ($page_control eq 'global preferences') { - $result = &mt("Page displayed after role selection in $lctype now set by user's global preferences."); + $result = &mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'',''); } else { - $result = &mt('Page displayed after role selection in this '.$lctype.' set to [_2]',$lctype,$$initpage{$env{'form.courseinit_page'}}); + $result = &mt('Page displayed after role selection in this '.$lctype.' set to [_1].' + ,''.$$initpage{$env{'form.courseinit_page'}}.''); } } else { &Apache::lonnet::logthis('Error saving whatsnew courseinit '. @@ -1887,8 +2145,10 @@ sub store_courseinit_setting { ''.$page_control.'', ''.$outcome.'.
'); } else { - $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_2] due to [_3].
', - $$initpage{$env{'form.courseinit_page'}},$outcome); + $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' + ,''.$$initpage{$env{'form.courseinit_page'}}.'' + ,''.$outcome.'') + .'
'; } } } @@ -1925,38 +2185,46 @@ sub start_box { if ($$show{$caller}) { $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(' +
'); my $displayed = 0; my $totalboxes = 0; @@ -526,17 +634,20 @@ sub display_actions_box { } my $halfway = 4; # my $halfway = int($totalboxes/2) + $totalboxes%2; + if ($custommenu) { + $halfway = 2; + } 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); + &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); $displayed ++; } } $r->print(' -
'); @@ -591,7 +702,7 @@ sub display_threshold_config { &Apache::loncommon::end_data_table_row()); } $r->print(&Apache::loncommon::end_data_table()."\n". - '
+ '
'); @@ -619,6 +730,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.').'
'); } @@ -647,7 +760,7 @@ sub display_interval_config { } $r->print('   '); + &mt('Save').'" />'); return; } @@ -677,7 +790,13 @@ function toggle_countunread(choice) { document.discussionswitch.submit(); } '); - $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("This can increase the time taken to gather data for the 'What's New?' page by a few seconds.").'  '.&mt("Currently set to $current.")); + $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.'.') + ); $r->print('

@@ -687,9 +806,9 @@ function toggle_countunread(choice) { $r->print('
-         - '. + (' ' x7). + '
'); @@ -716,7 +835,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'} @@ -778,23 +897,23 @@ sub display_launcher { $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered, $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs, $interval,$countunread,$expired,$expirecount,$activated,$activecount, - $crstype) = @_; + $crstype,$itemserror,$loggedin,$logincount) = @_; if ($$checkallowed{$action}) { &start_box($r,$show,$headings,$action,$refpage,$action); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS - &display_handgrade($r,$tograde,$ungraded); + &display_handgrade($r,$tograde,$ungraded,$itemserror); } elsif ($action eq 'haserrors') { # BOMBS - &display_haserrors($r,$bombs,$bombed,$res_title); + &display_haserrors($r,$bombs,$bombed,$res_title,$itemserror); } elsif ($action eq 'versionchanges') { # VERSION CHANGES - &display_versionchanges($r,$changed,$res_title,$interval->{'versions'}); + &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); + $res_title,$itemserror); } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION &display_coursediscussion($r,$newdiscussions,$unread, - $countunread,$res_title); + $countunread,$res_title,$itemserror); } elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES &display_coursenormalmail($r,$msgcount,$newmsgs); } elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES @@ -805,6 +924,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); @@ -817,6 +940,10 @@ sub getitems { $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, $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].','','').'
'; + return $itemserror; + } # force retrieve Resource to seed the part id cache we'll need it later my @allres=$navmap->retrieveResources(undef, sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;}); @@ -875,6 +1002,7 @@ sub getitems { } } + return; } sub check_discussions { @@ -1147,9 +1275,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'); } @@ -1397,6 +1525,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); @@ -1438,7 +1599,7 @@ sub checkversions { } sub display_handgrade { - my ($r,$tograde,$ungraded) = @_; + my ($r,$tograde,$ungraded,$itemserror) = @_; my %lt = &Apache::lonlocal::texthash( 'prna' => 'Problem Name', 'nmun' => 'Number ungraded', @@ -1461,13 +1622,15 @@ sub display_handgrade { } $r->print('
'.$$ungraded{$res}{title}.''.$$ungraded{$res}{count}.'
'.$itemserror.'
'.$lt{'nopr'}.'
'. $$bombed{$bomb}{errorcount}.'
'.$itemserror.'
'.$lt{'noer'}.'

'.$itemserror.'
'.$lt{'nopr'}.'
'. $$changed{$item}{'version'}.'
'.$itemserror.'
' .&mt('No '.$interval).'
'.$lt{'number'}.''.$lt{'role'}.''.$lt{'sec'}.'
'.$link.''.$role.''.$section.'
'.$counts{$role}{$sec}.''.$showrole.''.$sec.'
'. + &mt('There are no '.$interval). + '
'.$itemserror.'
'.$lt{'noun'}.'
'.$lt{'chth'}.''.$lt{'chth'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chop'}.''.$lt{'chop'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chin'}.'