--- loncom/interface/lonwhatsnew.pm 2010/09/19 15:05:59 1.98.2.4
+++ loncom/interface/lonwhatsnew.pm 2011/04/15 13:57:18 1.104
@@ -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.104 2011/04/15 13:57:18 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -72,7 +72,6 @@ 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'};
@@ -89,7 +88,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;
}
@@ -144,13 +143,6 @@ 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'
@@ -196,17 +188,10 @@ sub display_main_box {
604800 => 'roles which expired since last week',
86400 => 'roles which expired since yesterday',
);
- my %crslogins = (
- -1 => 'last logins for anyone who has ever logged in',
- 2592000 => 'last logins for users in last 30 days',
- 604800 => 'last logins for users in last 7 days',
- 86400 => 'last logins 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",
@@ -235,9 +220,6 @@ 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);
@@ -263,11 +245,9 @@ sub display_header {
my $scripttag;
unless ($command eq 'chgthreshold' || $command eq 'chginterval' ||
- $command eq 'chgoldroleinterval' ||
- $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') {
+ $command eq 'chgoldroleinterval' || $command eq 'chgnewroleinterval') {
$scripttag = <<"END";
';
}
@@ -348,7 +282,6 @@ function togglelogins() {
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'};
@@ -382,8 +315,6 @@ sub display_actions_box {
my %expired;
my $activecount;
my %activated;
- my %loggedin;
- my $logincount;
my %res_title = ();
my %show = ();
my $needitems = 0;
@@ -412,7 +343,7 @@ sub display_actions_box {
}
my $header = '';
- if (($refpage eq 'start') && (!$custommenu)) {
+ if ($refpage eq 'start') {
if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
&GDBM_READER(),0640)) {
my $furl=&HTML::Entities::encode($bighash{'first_url'},'"<>&');
@@ -421,8 +352,7 @@ sub display_actions_box {
'
';
}
}
- unless ($custommenu) {
- $header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'
+ $header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'
.' '
.&mt('Currently: [_1].',''.$currinit.'')
.' '
@@ -435,8 +365,7 @@ sub display_actions_box {
,'')
.' ';
- $r->print(&Apache::loncommon::head_subbox($header));
- }
+ $r->print(&Apache::loncommon::head_subbox($header));
if ($command eq 'reset') {
$result = &process_reset($cdom,$crs);
@@ -516,20 +445,6 @@ 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;
@@ -544,38 +459,22 @@ 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,$custommenu);
+ &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);
}
- 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'});
- }
+ $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;
- if ($custommenu) {
- @actionorder = ('coursenormalmail','coursecritmail','abovethreshold','newroles','oldroles','crslogin');
- } else {
- @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles');
- }
+ my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles');
foreach my $key (keys(%{$checkallowed})) {
if ($key =~ /_section$/) { next; }
@@ -599,7 +498,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,$custommenu);
+ $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);
@@ -613,10 +512,6 @@ 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'}
');
+ $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.').' '); } @@ -796,14 +679,12 @@ 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 discussion board which has unread posts.') @@ -912,10 +793,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) = @_; if ($$checkallowed{$action}) { - &start_box($r,$show,$headings,$action,$refpage,$action,$custommenu); + &start_box($r,$show,$headings,$action,$refpage,$action); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS &display_handgrade($r,$tograde,$ungraded,$itemserror); @@ -925,7 +806,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); @@ -939,10 +820,6 @@ 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); @@ -953,7 +830,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 +890,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 +964,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 +974,9 @@ sub check_thresholds { if ($resource->handgrade($part) eq 'yes') { next; } + if ($resource->is_anonsurvey($part)) { + next; + } if ($resource->is_survey($part)) { next; } @@ -1145,17 +1025,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 +1041,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, @@ -1265,7 +1133,7 @@ sub process_reset { sub process_update { my ($uname,$udom,$threshold_titles) = @_; - my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').' | |||
'.$$ungraded{$res}{title}.' | '.$$ungraded{$res}{count}.' | ||||||||||||||
'.$lt{'reso'}.' | '. - ''.$lt{'part'}.' | '.$lt{'nust'}.' | |||||||||||||
'.$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.' | '); - } - } - } - } - 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 .= '||||||||||
'.$counts{$role}{$sec}.' | '. - ''.$showrole.' | '. - ''.$sec.' | |||||||||||||
'. - &mt('There are no '.$interval). - ' | '.$showhide.' | '); if (($caller eq 'abovethreshold') && ($$show{$caller})) { - if ($$show{$caller} && !$custommenu) { + if ($$show{$caller}) { $r->print('||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'.$lt{'chth'}.' | @@ -2266,15 +1989,7 @@ sub start_box {'.$lt{'chin'}.' | ||||||||||||||
'.$lt{'chin'}.' | -|||||||||||||||