--- loncom/interface/lonwhatsnew.pm 2005/04/07 04:12:31 1.3
+++ loncom/interface/lonwhatsnew.pm 2005/04/11 13:14:00 1.7
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.3 2005/04/07 04:12:31 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.7 2005/04/11 13:14:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,21 +45,42 @@ 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'};
+ my $command = $env{'form.command'};
if ($command eq '') {
$command = "info";
}
+ &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'})))) {
+ 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";
+ $env{'user.error.msg'}="/adm/whatsnew:vsa:0:0:Cannot display student activity";
return HTTP_NOT_ACCEPTABLE;
}
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ if ($command eq 'config') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/whatsnew?command=config',
+ text=>"Configure display"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Config'));
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/whatsnew?command=info',
+ text=>"Display Action Items"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Display'));
+ }
&display_main_box($r,$command);
}
@@ -73,63 +94,32 @@ sub display_main_box {
my ($r,$command) = @_;
my $domain=&Apache::loncommon::determinedomain();
my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain);
- $r->print(<
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Course Action Items |
-
-
- |
-
-
- |
-
-
- |
-
-
-
-
-
-
-END_OF_BLOCK
- &display_nav_box($r,$command);
- $r->print(' | | ');
- $r->print('');
-
+ my $selconfig;
+ my $selinfo;
if ($command eq 'config') {
- &display_config_box($r);
+ $selinfo = 'selected="selected"';
} else {
- &display_actions_box($r);
+ $selconfig = 'selected="selected"';
+ }
+ my $picker = ('
+');
+
+ $r->print('');
+
+ if ($command eq 'config') {
+ &display_config_box($r,$picker);
+ } else {
+ &display_actions_box($r,$picker);
}
$r->print(<
- |
-
- |
-
-
- |
-
-
- |
-
-
|
@@ -138,37 +128,6 @@ END_OF_BLOCK
END_OF_BLOCK
}
-#------------------------------
-# display_nav_box
-#
-# Display the navigation box
-#------------------------------
-
-sub display_nav_box {
- my ($r,$command) = @_;
- $r->print(''."\n");
- if ($command eq "info") {
- $r->print('');
- $r->print('Action Items ');
- $r->print(' |
');
- } else {
- $r->print('');
- $r->print('Current Action Items ');
- $r->print(' |
');
- }
- $r->print(' |
');
- if ($command eq "config") {
- $r->print('');
- $r->print('Display options ');
- $r->print(' |
');
- } else {
- $r->print('');
- $r->print('Display options ');
- $r->print(' |
');
- }
- $r->print('
');
-}
-
#-------------------------------
# display_header
#
@@ -196,7 +155,7 @@ ENDHEAD
#-------------------------------
sub display_actions_box() {
- my $r = shift;
+ my ($r,$picker) = @_;
my $rowColor1 = "#ffffff";
my $rowColor2 = "#eeeeee";
@@ -213,10 +172,10 @@ sub display_actions_box() {
my $domain=&Apache::loncommon::determinedomain();
my $function;
- if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) {
+ if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {
$function='coordinator';
}
- if ($ENV{'request.role'}=~/^(su|dc|ad|li)/) {
+ if ($env{'request.role'}=~/^(su|dc|ad|li)/) {
$function='admin';
}
@@ -226,12 +185,12 @@ sub display_actions_box() {
&getitems(\%unread,\%ungraded,\%bombed,\@newdiscussions,\@tograde,\@bombs);
my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs);
- unless ($ENV{'request.course.id'}) {
+ unless ($env{'request.course.id'}) {
$r->print('
You are accessing an invalid course
');
return;
}
- $r->print('Course Action Items
');
+ $r->print(''.$picker.'
');
## UNREAD COURSE DISCUSSION POSTS ##
$r->print(<<"END");
@@ -247,15 +206,15 @@ sub display_actions_box() {
END
if (@newdiscussions > 0) {
+ $r->print(' | Location | Type | Number of new posts | ');
# @newdiscussions = sort { &cmp_title($a,$b) } @newdiscussions;
my $rowNum = 0;
foreach my $ressymb (@newdiscussions) {
my $forum_title = $unread{$ressymb}{'title'};
- my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb);
- my $feedurl = &Apache::lonnet::clutter($url);
-# backward compatibility (bulletin boards used to be 'wrapped')
- if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {
- $feedurl=~s|^/adm/wrapper||;
+ my $type = 'Resource';
+ my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
+ if ($feedurl =~ /bulletinboard/) {
+ $type = 'Bulletin Board';
}
my $unreadnum = keys(%{$unread{$ressymb}});
$unreadnum = $unreadnum - 2;
@@ -265,7 +224,7 @@ END
} else {
$rowColor = $rowColor2;
}
- $r->print(''.$forum_title.': | '.$unreadnum.' | ');
+ $r->print(''.$forum_title.': | '.$type.' | '.$unreadnum.' | ');
$rowNum ++;
}
}
@@ -287,7 +246,7 @@ END
END
if (@tograde > 0) {
- $r->print('Problem Name | Number ungraded | ');
+ $r->print('Problem Name | Number ungraded | ');
my $rowNum = 0;
foreach my $res (@tograde) {
if ($rowNum %2 == 1) {
@@ -295,14 +254,48 @@ END
} else {
$rowColor = $rowColor2;
}
-
- $r->print(''.$ungraded{$res}{title}.' | '.$ungraded{$res}{count}.' | ');
+ my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
+ my $linkurl=&Apache::lonnet::clutter($url);
+ $linkurl .= '?symb='.&Apache::lonnet::escape($res);
+
+ $r->print(''.$ungraded{$res}{title}.' | '.$ungraded{$res}{count}.' | ');
$rowNum ++;
}
} else {
$r->print(' No problems require handgrading
| ');
}
$r->print('
|
');
+
+## BOMBS ##
+ $r->print(<<"END");
+
+
+
+
+
+ Problems with errors |
+
+
+
+
+END
+ my $bombnum = 0;
+ if (@bombs > 0) {
+# @bombs = sort { &cmp_title($a,$b) } @bombs;
+ foreach my $bomb (@bombs) {
+ if ($bombnum %2 == 1) {
+ $rowColor = $rowColor1;
+ } else {
+ $rowColor = $rowColor2;
+ }
+ $r->print(''.$bombed{$bomb}{errorlink}.' | ');
+ $bombnum ++;
+ }
+ } else {
+ $r->print(' No problems with errors
| ');
+ }
+ $r->print(' | |
');
+
$r->print(' | ');
## MESSAGES ##
@@ -319,6 +312,7 @@ END
END
if ($msgcount > 0) {
+ $r->print(''.&mt('Number').' | '.&mt('Subject').' | '.&mt('Sender').' | '.&mt('Date/Time').' | ');
my $rowNum = 0;
my $mailcount = 1;
foreach my $msg (@newmsgs) {
@@ -327,7 +321,7 @@ END
} else {
$rowColor = $rowColor2;
}
- $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
+ $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
$rowNum ++;
$mailcount ++;
}
@@ -350,6 +344,7 @@ END
END
if ($critmsgcount > 0) {
+ $r->print('Number | Subject | Sender | Date/Time | ');
my $rowNum = 0;
my $mailcount = 1;
foreach my $msg (@critmsgs) {
@@ -358,7 +353,7 @@ END
} else {
$rowColor = $rowColor2;
}
- $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
+ $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
$rowNum ++;
$mailcount ++;
}
@@ -368,35 +363,6 @@ END
$r->print(' |
');
-## BOMBS ##
- $r->print(<
-
-
-
-
- Problems with errors |
-
-
-
-
-END
- my $bombnum = 0;
- if (@bombs > 0) {
-# @bombs = sort { &cmp_title($a,$b) } @bombs;
- foreach my $bomb (@bombs) {
- if ($bombnum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print(''.$bombed{$bomb}{errorlink}.' | ');
- $bombnum ++;
- }
- } else {
- $r->print(' No problems with errors
| ');
- }
- $r->print(' | ');
$r->print('
|
@@ -410,9 +376,9 @@ sub getitems {
my $navmap = Apache::lonnavmaps::navmap->new();
my @allres=$navmap->retrieveResources();
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
- my %lastread = &Apache::lonnet::dump('nohist_'.$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'},'lastread');
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
+ my %lastread = &Apache::lonnet::dump('nohist_'.$env{'request.course.id'}.'_discuss',$env{'user.domain'},$env{'user.name'},'lastread');
my %lastreadtime = ();
my @discussions = ();
my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist();
@@ -430,13 +396,9 @@ sub getitems {
%{$$ungraded{$symb}} = ();
my $title = $resource->compTitle();
my $ressymb = $symb;
- if ($ressymb =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) {
- $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';
- unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
- $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper/|;
- }
+ if ($ressymb =~ m-___adm/\w+/\w+/\d+/bulletinboard$-) {
+ $ressymb = $resource->wrap_symb();
}
-
# Check for unread discussion postings
if (defined($discussiontime{$ressymb})) {
push(@discussions,$ressymb);
@@ -448,9 +410,9 @@ sub getitems {
if (defined($lastreadtime{$ressymb})) {
$prevread = $lastreadtime{$ressymb};
}
- my %contrib = &Apache::lonnet::restore($ressymb,$ENV{'request.course.id'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'},
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
if ($contrib{'version'}) {
for (my $id=1;$id<=$contrib{'version'};$id++) {
unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) {
@@ -517,7 +479,7 @@ sub getmail {
my $msgid=&Apache::lonnet::escape($message);
my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)=
&Apache::lonmsg::unpackmsgid($msgid);
- if ($fromcid eq $ENV{'request.course.id'}) {
+ if ($fromcid eq $env{'request.course.id'}) {
if (defined($sendtime) && $sendtime!~/error/) {
my $numsendtime = $sendtime;
$sendtime = &Apache::lonlocal::locallocaltime($sendtime);
@@ -542,7 +504,7 @@ sub getmail {
foreach my $msgid (sort(keys(%what))) {
my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)=
&Apache::lonmsg::unpackmsgid($_);
- if ($fromcid eq $ENV{'request.course.id'}) {
+ if ($fromcid eq $env{'request.course.id'}) {
if (defined($sendtime) && $sendtime!~/error/) {
my $numsendtime = $sendtime;
$sendtime = &Apache::lonlocal::locallocaltime($sendtime);
@@ -567,3 +529,4 @@ sub cmp_title {
return $atitle cmp $btitle;
}
+1;