--- loncom/interface/lonwhatsnew.pm 2006/03/04 05:59:01 1.51 +++ loncom/interface/lonwhatsnew.pm 2010/09/19 15:05:59 1.98.2.4 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.51 2006/03/04 05:59:01 albertel Exp $ +# $Id: lonwhatsnew.pm,v 1.98.2.4 2010/09/19 15:05:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,9 +36,13 @@ use Apache::lonlocal; use Apache::loncoursedata(); use Apache::lonnavmaps(); use Apache::lonuserstate; +use Apache::lonuserutils; use Apache::Constants qw(:common :http); use Time::Local; use GDBM_File; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; +use HTML::Entities; #---------------------------- # handler @@ -66,6 +70,9 @@ sub handler { ['vgr','abovethreshold',1], ['opa','haserrors',1], ['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'}; @@ -94,38 +101,59 @@ 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, + ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage, text=>"Change thresholds"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Thresholds' + ("What's New?",#'Course_Action_Items_Thresholds' )); } elsif (($command eq 'chginterval') && $checkallowed{'versionchanges'} ) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage, text=>"Change interval"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Intervals' + ("What's New?",#'Course_Action_Items_Intervals' )); } elsif (($command eq 'chgdisc') && $checkallowed{'coursediscussion'}) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage, text=>"Change discussion display"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Intervals' + ("What's New?",#'Course_Action_Items_Intervals' )); } elsif ($command eq 'courseinit') { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage, text=>"Course initialization preference"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Initialization' + ("What's New?",#'Course_Action_Items_Initialization' )); + } elsif ($command eq 'chgoldroleinterval' && $checkallowed{'oldroles'}) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew?command=chgoldroleinterval&refpage='.$refpage, + text=>"Change interval"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + ("What's New?",#'Course_Action_Items_Intervals' + )); + } elsif ($command eq 'chgnewroleinterval' && $checkallowed{'newroles'}) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew?command=chgnewroleinterval&refpage='.$refpage, + text=>"Change interval"}); + $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 - (undef,"What's New?",#'Course_Action_Items_Display' + ("What's New?",#'Course_Action_Items_Display' )); } &display_main_box($r,$command,$refpage,\%checkallowed); @@ -142,7 +170,7 @@ sub display_main_box { my ($r,$command,$refpage,$checkallowed) = @_; my $domain=&Apache::loncommon::determinedomain(); my $function = &Apache::loncommon::get_users_function(); - my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); + my $lctype = lc(&Apache::loncommon::course_type()); $r->print('
');
my %threshold_titles = &Apache::lonlocal::texthash (
@@ -150,45 +178,76 @@ sub display_main_box {
degdiff => 'Degree of difficulty',
numstudents => 'Total number of students with submissions',
);
-
- my %interval_titles = &Apache::lonlocal::texthash (
- -1 => 'since start of course',
- 2592000 => 'since last month',
- 604800 => 'since last week',
- 86400 => 'since yesterday',
+ my %versions = (
+ -1 => "version changes since start of $lctype",
+ 2592000 => 'version changes since last month',
+ 604800 => 'version changes since last week',
+ 86400 => 'version changes since yesterday',
+ );
+ my %newroles = (
+ -1 => "roles which have become active since start of $lctype",
+ 2592000 => 'roles which have become active since last month',
+ 604800 => 'roles which have become active since last week',
+ 86400 => 'roles which have become active since yesterday',
+ );
+ my %oldroles = (
+ -1 => "roles which expired since start of $lctype",
+ 2592000 => 'roles which expired since last month',
+ 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 course',
- whatsnew => "what's new? page",
+ firstres => "first resource in the $lctype",
+ whatsnew => "What's New Page",
userpref => 'your general user preferences',
- coursespecific => 'specific setting for this course',
+ coursespecific => "specific setting for this $lctype",
);
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
if (($command eq 'chgthreshold')
&& $checkallowed->{'abovethreshold'}) {
- &display_threshold_config($r,$refpage,$tabbg,\%threshold_titles,
+ &display_threshold_config($r,$refpage,\%threshold_titles,
$cdom,$crs);
} elsif (($command eq 'chginterval')
&& $checkallowed->{'versionchanges'}) {
- &display_interval_config($r,$refpage,\%interval_titles);
+ &display_interval_config($r,$refpage,\%interval_titles,'versions');
} elsif (($command eq 'chgdisc')
&& $checkallowed->{'coursediscussion'}) {
&display_discussion_config($r,$refpage);
} elsif ($command eq 'courseinit') {
&courseinit_config($r,$refpage,\%initpage);
+ } elsif (($command eq 'chgnewroleinterval')
+ && $checkallowed->{'newroles'}) {
+ &display_interval_config($r,$refpage,\%interval_titles,'newroles');
+ } 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,$tabbg,$command,$refpage,\%threshold_titles,
+ &display_actions_box($r,$command,$refpage,\%threshold_titles,
\%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
}
+ my $end_page = &Apache::loncommon::end_page();
$r->print(< |