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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 01 Oct 2005 06:21:14 -0000


albertel		Sat Oct  1 02:21:14 2005 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - conditions now no longer apply to user with bre,F at all, however navmaps does annotate resources with 'conditionally hidden' when they would not normally see it
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.341 loncom/interface/lonnavmaps.pm:1.342
--- loncom/interface/lonnavmaps.pm:1.341	Thu Sep 29 13:14:14 2005
+++ loncom/interface/lonnavmaps.pm	Sat Oct  1 02:21:12 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.341 2005/09/29 17:14:14 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.342 2005/10/01 06:21:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -690,7 +690,6 @@
 	} elsif ($type eq 'end') {
 	    $conjunction='by';
 	}
-	&Apache::lonnet::logthis("<p>$conjunction $type</p>");
         # Is it this year?
         if ( $time[5] == $now[5]) {
             # Return on Month Day, HH:MM meridian
@@ -1134,6 +1133,9 @@
     if ($resource->randomout()) {
         $nonLinkedText .= ' <i>(hidden)</i> ';
     }
+    if (!$resource->condval()) {
+        $nonLinkedText .= ' <i>(conditionally hidden)</i> ';
+    }
     
     # We're done preparing and finally ready to start the rendering
     my $result = "<td align='left' valign='center'>";
@@ -3582,7 +3584,19 @@
     my $condition=&Apache::lonnet::directcondval($condid);
     return $condition;
 }
-
+sub condval {
+    my $self=shift;
+    my $uri=&Apache::lonnet::deversion(&Apache::lonnet::declutter($self->src()));
+    my ($pathname,$filename)=($uri=~m|(.*)/([^/]*)|);
+    $pathname=~s/^adm\/wrapper\///;    
+
+    my $match=($env{'acc.res.'.$env{'request.course.id'}.'.'.$pathname}=~
+	       /\&\Q$filename\E\:([\d\|]+)\&/);
+    if ($match) {
+	return &Apache::lonnet::condval($1);
+    }
+    return 0;
+}
 sub compTitle {
     my $self = shift;
     my $title = $self->title();
@@ -4773,7 +4787,7 @@
     my $to = $self->to();
     foreach my $branch ( split(/,/, $to) ) {
         my $choice = $self->{NAV_MAP}->getById($branch);
-        if (!$choice->condition()) { next; }
+        #if (!$choice->condition()) { next; }
         my $next = $choice->goesto();
         $next = $self->{NAV_MAP}->getById($next);