[LON-CAPA-cvs] cvs: loncom /interface lonannounce.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 12 Jan 2006 23:36:46 -0000


albertel		Thu Jan 12 18:36:46 2006 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  - BUG#3787 - hiden items show in the calendar
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.42 loncom/interface/lonannounce.pm:1.43
--- loncom/interface/lonannounce.pm:1.42	Thu Jan 12 18:03:41 2006
+++ loncom/interface/lonannounce.pm	Thu Jan 12 18:36:45 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.42 2006/01/12 23:03:41 albertel Exp $
+# $Id: lonannounce.pm,v 1.43 2006/01/12 23:36:45 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::loncommon;
 use Apache::lonhtmlcommon();
 use Apache::lonlocal;
+use Apache::lonnavmaps();
 use Apache::lonrss();
 use Apache::lonnet;
 use HTML::Entities();
@@ -79,7 +80,10 @@
 	   $returnhash{$courseid.'@'.$item}=$thiscal{$item};
         }
     }
+
     if ($courseid eq $env{'request.course.id'}) {
+	my $can_see_hidden = $env{'request.role.adv'};
+	my $navmap = Apache::lonnavmaps::navmap->new();
 	my %resourcedata=
 	    &Apache::lonnet::dump('resourcedata',$coursedom,$coursenum);
 	foreach my $thiskey (sort keys %resourcedata) {
@@ -101,8 +105,17 @@
 		$middle=~s/\.$//;
 		my $realm=&mt('All Resources');
 		if ($middle=~/^(.+)\_\_\_\(all\)$/) {
-		    $realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1);
+		    my $map_url=$1;
+		    if (!$can_see_hidden) {
+			my $res = $navmap->getResourceByUrl($map_url);
+			if ($res->randomout()) { next; }
+		    }
+		    $realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($map_url);
 		} elsif ($middle) {
+		    if (!$can_see_hidden) {
+			my $res = $navmap->getBySymb($middle);
+			if ($res->randomout()) { next; }
+		    }
 		    $realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle);
 		}
 		my $datetype='';