--- loncom/interface/lonannounce.pm 2006/06/29 15:23:59 1.56
+++ loncom/interface/lonannounce.pm 2006/11/29 07:46:39 1.62
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Announce
#
-# $Id: lonannounce.pm,v 1.56 2006/06/29 15:23:59 albertel Exp $
+# $Id: lonannounce.pm,v 1.62 2006/11/29 07:46:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -80,9 +80,13 @@ sub readcalendar {
$returnhash{$courseid.'@'.$item}=$thiscal{$item};
}
}
-
- my $can_see_hidden = $env{'request.role.adv'};
- my $navmap;# = Apache::lonnavmaps::navmap->new();
+ my $can_see_hidden = ($env{'request.role.adv'} &&
+ ($courseid eq $env{'request.course.id'}));
+
+ my $navmap;
+ if ($courseid eq $env{'request.course.id'}) {
+ $navmap = Apache::lonnavmaps::navmap->new();
+ }
my %resourcedata=
&Apache::lonnet::dump('resourcedata',$coursedom,$coursenum);
foreach my $thiskey (sort keys %resourcedata) {
@@ -241,7 +245,6 @@ sub listcell {
foreach my $item (@items) {
if (ref($item)) {
my ($courseid,$start,$end,$msg)=@$item;
- &Apache::lonnet::logthis(" msg2 is ".ref($msg)." $msg ");
my $fullmsg=&Apache::lonlocal::locallocaltime($start);
if ($start!=$end) {
$fullmsg.=&mt(' to ').
@@ -280,10 +283,16 @@ sub display_msg {
my $output = $msg->{'datetype'}. ': '.$msg->{'realm'};
if (exists($msg->{'url'})) {
- $output .= ': '.&Apache::lonnet::gettitle($msg->{'url'});
+ my $displayurl=&Apache::lonnet::gettitle($msg->{'url'});
+ if ($msg->{'url'}!~/\Q$displayurl\E$/) {
+ $output .= ' - '.$displayurl;
+ }
}
if (exists($msg->{'symb'})) {
- $output .= ': '.&Apache::lonnet::gettitle($msg->{'symb'});
+ my $displaysymb=&Apache::lonnet::gettitle($msg->{'symb'});
+ if ($msg->{'symb'}!~/\Q$displaysymb\E$/) {
+ $output .= ' - '.$displaysymb;
+ }
}
$output .= ' ('.$msg->{'section'}.') ';
return $output;
@@ -349,7 +358,8 @@ ENDDIA
# ----------------------------------------------------- Summarize all calendars
sub get_all_calendars {
my %allcal=();
- foreach my $course (sort(&Apache::loncommon::findallcourses())) {
+ my %courses = &Apache::loncommon::findallcourses();
+ foreach my $course (sort(keys(%courses))) {
%allcal=(%allcal,&readcalendar($course));
}
return %allcal;
@@ -486,9 +496,9 @@ SERVERANNOUNCE
# list servers
foreach my $host (sort(keys(%Apache::lonnet::hostname))) {
if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$host})) {
- $r->print ('
'.
+ $r->print ('