--- loncom/interface/lonwhatsnew.pm 2016/11/05 13:37:49 1.121 +++ loncom/interface/lonwhatsnew.pm 2025/03/22 21:18:30 1.132 @@ -1,5 +1,7 @@ +# The LearningOnline Network +# What's New in a course # -# $Id: lonwhatsnew.pm,v 1.121 2016/11/05 13:37:49 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.132 2025/03/22 21:18:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -87,10 +89,11 @@ sub handler { ['mgr','handgrading',1], ['vgr','abovethreshold',1], ['vgr','haserrors',1], - ['whn','versionchanges',0], + ['whn','versionchanges',1], ['vcl','newroles',1], ['vcl','oldroles',1], ['whn','crslogin',1], + ['vcl','sessions',1], ['mgr','resetcounters',1], ) { my ($perm,$key,$check_section) = @{ $perm_check }; @@ -115,7 +118,23 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - $r->print(&display_header($command,\%checkallowed)); + my $udom = $env{'user.domain'}; + my $uname = $env{'user.name'}; + my $cid = $env{'request.course.id'}; + my $store_result = &store_display_settings($uname,$udom,$cid,\%checkallowed); + my $store_error; + + unless ($store_result eq 'ok') { + my $lctype = lc(&Apache::loncommon::course_type()); + &Apache::lonnet::logthis('Error saving whatsnew settings: '. + $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); + $store_error = '' + .&mt('Unable to save visibility settings due to [_1]', + $store_result) + .''; + } + + $r->print(&display_header($command,$uname,$udom,$cid,\%checkallowed)); &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb @@ -170,12 +189,19 @@ sub handler { $r->print(&Apache::lonhtmlcommon::breadcrumbs ("What's New?",#'Course_Action_Items_Intervals' )); + } elsif ($command eq 'chgsessionlimit' && $checkallowed{'sessions'}) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew?command=chgsessionlimit&refpage='.$refpage, + text=>"Change session range"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + ("What's New?",#'Course_Action_Items_Sessions' + )); } else { $r->print(&Apache::lonhtmlcommon::breadcrumbs ("What's New?",#'Course_Action_Items_Display' )); } - &display_main_box($r,$command,$refpage,\%checkallowed,$cdom,$crs); + &display_main_box($r,$command,$refpage,\%checkallowed,$cdom,$crs,$store_error); return OK; } @@ -186,11 +212,10 @@ sub handler { #------------------------------ sub display_main_box { - my ($r,$command,$refpage,$checkallowed,$cdom,$crs) = @_; + my ($r,$command,$refpage,$checkallowed,$cdom,$crs,$store_error) = @_; my $domain=&Apache::loncommon::determinedomain(); my $function = &Apache::loncommon::get_users_function(); my $lctype = lc(&Apache::loncommon::course_type()); - $r->print('
');
my %threshold_titles = &Apache::lonlocal::texthash (
av_attempts => 'Average number of attempts',
@@ -221,18 +246,27 @@ sub display_main_box {
604800 => 'last logins for users in last 7 days',
86400 => 'last logins for users in last 24 hours',
);
+ my %sessions = (
+ 300 => 'course sessions active in the last 5 minutes',
+ 600 => 'course sessions active in the last 10 minutes',
+ 1800 => 'course sessions active in the last 30 minutes',
+ 7200 => 'course sessions active in the last 2 hours',
+ -7200 => 'course sessions with last activity more than 2 hours ago',
+ );
my %interval_titles = (
versions => \%versions,
newroles => \%newroles,
oldroles => \%oldroles,
crslogin => \%crslogins,
+ sessions => \%sessions,
);
- my %initpage = &Apache::lonlocal::texthash (
+ my %initpage = (
firstres => "first resource in the $lctype",
whatsnew => "What's New Page",
userpref => 'your general user preferences',
coursespecific => "specific setting for this $lctype",
);
+ $r->print(' ');
if (($command eq 'chgthreshold')
&& $checkallowed->{'abovethreshold'}) {
@@ -254,17 +288,16 @@ sub display_main_box {
} elsif (($command eq 'chgcrslogininterval')
&& $checkallowed->{'crslogin'}) {
&display_interval_config($r,$refpage,\%interval_titles,'crslogin');
+ } elsif (($command eq 'chgsessionlimit')
+ && $checkallowed->{'sessions'}) {
+ &display_interval_config($r,$refpage,\%interval_titles,'sessions');
} else {
&display_actions_box($r,$command,$refpage,\%threshold_titles,
- \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
+ \%interval_titles,\%initpage,$cdom,$crs,
+ $checkallowed,$store_error);
}
my $end_page = &Apache::loncommon::end_page();
- $r->print(< |