--- loncom/interface/lonwhatsnew.pm 2005/07/15 05:43:42 1.26 +++ loncom/interface/lonwhatsnew.pm 2005/12/15 00:53:29 1.37 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.26 2005/07/15 05:43:42 albertel Exp $ +# $Id: lonwhatsnew.pm,v 1.37 2005/12/15 00:53:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -54,39 +54,49 @@ sub handler { } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['command']); - my $command; - if ($env{'form.action'} eq 'reset') { - $command = 'reset'; - } elsif ($env{'form.action'} eq 'update') { - $command = 'update'; - } else { - $command = $env{'form.command'}; - } + my $command = $env{'form.command'}; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - $r->print(&display_header()); - if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('vsa',$env{'request.course.id'})))) { - # Not in a course, or not allowed to modify parms - $env{'user.error.msg'}="/adm/whatsnew:vsa:0:0:Cannot display student activity"; + if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('bre',$env{'request.course.id'})))) { + # Not in a course, or not allowed to view action items + $env{'user.error.msg'}="/adm/whatsnew:bre:0:0:Cannot display what's new screen"; return HTTP_NOT_ACCEPTABLE; } + my %checkallowed = ( + coursediscussion => &Apache::lonnet::allowed('pch',$env{'request.course.id'}), + handgrading => &Apache::lonnet::allowed('mgr',$env{'request.course.id'}), + abovethreshold => &Apache::lonnet::allowed('vgr',$env{'request.course.id'}), + haserrors => &Apache::lonnet::allowed('opa',$env{'request.course.id'}), + versionchanges => &Apache::lonnet::allowed('opa',$env{'request.course.id'}), + coursenormalmail => 1, + coursecritmail => 1, + ); + + $r->print(&display_header($command,\%checkallowed)); + &Apache::lonhtmlcommon::clear_breadcrumbs(); - if ($command eq 'chgthreshold') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew', + text=>"Display Action Items"}); + if (($command eq 'chgthreshold') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=threshold', + ({href=>'/adm/whatsnew?command=chgthreshold', text=>"Change thresholds"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Thresholds')); - } else { + } elsif (($command eq 'chginterval') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew', - text=>"Display Action Items"}); + ({href=>'/adm/whatsnew?command=chginterval', + text=>"Change interval"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Course Action Items','Course_Action_Items_Intervals')); + } else { $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Display')); } - &display_main_box($r,$command); + &display_main_box($r,$command,\%checkallowed); return OK; } @@ -97,7 +107,7 @@ sub handler { #------------------------------ sub display_main_box { - my ($r,$command) = @_; + my ($r,$command,$checkallowed) = @_; my $domain=&Apache::loncommon::determinedomain(); my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain); $r->print('
');
@@ -107,13 +117,27 @@ sub display_main_box {
degdiff => 'Degree of difficulty',
numstudents => 'Total number of students with submissions',
);
+
+ my %interval_titles = (
+ -1 => 'since start of course',
+ 2592000 => 'since last month',
+ 604800 => 'since last week',
+ 86400 => 'since yesterday',
+ );
+
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
- if ($command eq 'chgthreshold') {
- &display_config_box($r,$command,$tabbg,\%threshold_titles,$cdom,$crs);
+ if (($command eq 'chgthreshold') &&
+ (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
+ &display_threshold_config($r,$command,$tabbg,\%threshold_titles,
+ $cdom,$crs);
+ } elsif (($command eq 'chginterval') &&
+ (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {
+ &display_interval_config($r,\%interval_titles);
} else {
- &display_actions_box($r,$command,\%threshold_titles,$cdom,$crs);
+ &display_actions_box($r,$command,\%threshold_titles,\%interval_titles,
+ $cdom,$crs,$checkallowed);
}
$r->print(< '); + unless ($cid) { + $r->print(' '); return; } + if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', - &GDBM_READER(),0640)) { - my $furl=$bighash{'first_url'}; - $r->print('Go to first resource Change your preferences to suppress display of this screen when accessing courses as Course Coordinator in the future. '); - untie(%bighash); + &GDBM_READER(),0640)) { + my $furl=$bighash{'first_url'}; + $r->print(''.$lt{'gtfr'}. + ''. + ' '.$lt{'chyp'}.' '.$lt{'tsup'}.' '); + untie(%bighash); } - + my $result; - + if ($command eq 'reset') { $result = &process_reset($cdom,$crs); } elsif ($command eq 'update') { $result = &process_update($cdom,$crs,$threshold_titles); + } elsif ($command eq 'newinterval') { + $result = &store_interval_setting($uname,$udom,$cid,$interval_titles); } + + my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed); + + unless ($store_result eq 'ok') { + &Apache::lonnet::logthis('Error storing whatsnew settings: '. + $store_result.' for '.'user '.$uname.':'.$udom.' in course '.$cid); + $result .= &mt('Unable to store visibility settings due to [_1]', + $store_result); + } + if ($result) { $r->print($result.' '); } + $r->rflush(); - &get_curr_thresholds(\%threshold,$cdom,$crs); - &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,%res_title); - my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs); - $r->print('
'); + my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail'); -## BOMBS ## - $r->print(<<"END"); -
'); -# DEGDIFF AND AV. TRIES TRIGGERS - $r->print(<<"END"); -
'); - - $r->print(' | ');
-## UNREAD COURSE DISCUSSION POSTS ##
- $r->print(<<"END");
-
'); -## MESSAGES ## - $r->print(<
- |
|
New critical messages in course | -||||||||||||
-
|
+
|
+