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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 27 Oct 2004 18:15:31 -0000


albertel		Wed Oct 27 14:15:31 2004 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - teaching ->getNext about conditions
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.300 loncom/interface/lonnavmaps.pm:1.301
--- loncom/interface/lonnavmaps.pm:1.300	Thu Oct  7 18:12:47 2004
+++ loncom/interface/lonnavmaps.pm	Wed Oct 27 14:15:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.300 2004/10/07 22:12:47 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.301 2004/10/27 18:15:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3496,6 +3496,16 @@
     return $self->navHash("title_", 1); }
 # considered private and undocumented
 sub to { my $self=shift; return $self->navHash("to_", 1); }
+sub condition {
+    my $self=shift;
+    my $undercond=$self->navHash("undercond_", 1);
+    if (!defined($undercond)) { return 1; };
+    my $condid=$self->navHash("condid_$undercond");
+    if (!defined($condid)) { return 1; };
+    my $condition=&Apache::lonnet::directcondval($condid);
+    return $condition;
+}
+
 sub compTitle {
     my $self = shift;
     my $title = $self->title();
@@ -4669,6 +4679,7 @@
     my $to = $self->to();
     foreach my $branch ( split(/,/, $to) ) {
         my $choice = $self->{NAV_MAP}->getById($branch);
+        if (!$choice->condition()) { next; }
         my $next = $choice->goesto();
         $next = $self->{NAV_MAP}->getById($next);