--- loncom/interface/lonwhatsnew.pm 2005/04/07 03:58:02 1.2
+++ loncom/interface/lonwhatsnew.pm 2005/12/05 19:27:53 1.35
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.2 2005/04/07 03:58:02 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.35 2005/12/05 19:27:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -30,13 +30,15 @@ package Apache::lonwhatsnew;
use strict;
use lib qw(/home/httpd/lib/perl);
use Apache::lonnet;
-use Apache::loncommon;
-use Apache::lonhtmlcommon;
+use Apache::loncommon();
+use Apache::lonhtmlcommon();
use Apache::lonlocal;
-use Apache::loncoursedata;
-use Apache::lonnavmaps;
+use Apache::loncoursedata();
+use Apache::lonnavmaps();
+use Apache::lonuserstate;
use Apache::Constants qw(:common :http);
use Time::Local;
+use GDBM_File;
#----------------------------
# handler
@@ -45,22 +47,47 @@ use Time::Local;
sub handler {
my $r = shift;
+ if ($r->header_only) {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ return OK;
+ }
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['command']);
- my $command = $ENV{'form.command'};
-
- if ($command eq '') {
- $command = "info";
+ my $command;
+ if ($env{'form.action'} eq 'reset') {
+ $command = 'reset';
+ } elsif ($env{'form.action'} eq 'update') {
+ $command = 'update';
+ } else {
+ $command = $env{'form.command'};
}
- $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";
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ $r->print(&display_header($command));
+ 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;
}
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ if (($command eq 'chgthreshold') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/whatsnew?command=threshold',
+ text=>"Change thresholds"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Thresholds'));
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/whatsnew',
+ text=>"Display Action Items"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Display'));
+ }
&display_main_box($r,$command);
+ return OK;
}
#------------------------------
@@ -73,63 +100,22 @@ sub display_main_box {
my ($r,$command) = @_;
my $domain=&Apache::loncommon::determinedomain();
my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain);
- $r->print(<
-
-
|
');
- $r->print('Action Items '); - $r->print(' |
');
- $r->print('Current Action Items '); - $r->print(' |
');
- $r->print('Display options '); - $r->print(' |
');
- $r->print('Display options '); - $r->print(' |
');
+ 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,
+ );
+
+ my $timediff = 604800;
+ my %display_settings = &get_display_settings();
+ my $now = time;
+ my %intervals = (
+ -1 => 'since start of course',
+ 2592000 => 'since last month',
+ 604800 => 'since last week',
+ 86400 => 'since yesterday',
+ );
+ my $interval = $intervals{$timediff};
+ if ($timediff == -1) {
+ $timediff = time;
+ }
+ my $starttime = $now - $timediff;
+
+ my %headings = &Apache::lonlocal::texthash(
+ coursediscussion => 'Unread course discussion posts',
+ handgrading => 'Problems requiring handgrading',
+ haserrors => 'Problems with errors',
+ versionchanges => 'Resources in course with version changes '.$interval,
+ coursenormalmail => 'New course message',
+ coursecritmail => 'New critical messages in course',
+ );
-## UNREAD COURSE DISCUSSION POSTS ##
- $r->print(<<"END");
-
'); -## UNGRADED ITEMS ## - $r->print(<
- |
|
New course messages | -|||||
-
|
New critical messages in course | -||||||||
-
|