Diff for /loncom/interface/lonnavmaps.pm between versions 1.181 and 1.184

version 1.181, 2003/04/24 18:18:38 version 1.184, 2003/05/05 17:44:03
Line 199  sub real_handler { Line 199  sub real_handler {
         }          }
     }      }
   
       # Check to see if the student is jumping to next open, do-able problem
       if ($ENV{QUERY_STRING} eq 'jumpToFirstHomework') {
           # Find the next homework problem that they can do.
           my $iterator = $navmap->getIterator(undef, undef, undef, 1);
           my $depth = 1;
           $iterator->next();
           my $curRes = $iterator->next();
           my $foundDoableProblem = 0;
           my $problemRes;
           
           while ($depth > 0 && !$foundDoableProblem) {
               if ($curRes == $iterator->BEGIN_MAP()) { $depth++; }
               if ($curRes == $iterator->END_MAP()) { $depth--; }
   
               if (ref($curRes) && $curRes->is_problem()) {
                   my $status = $curRes->status();
                   if (($status == $curRes->OPEN || 
                        $status == $curRes->TRIES_LEFT()) &&
                       $curRes->getCompletionStatus() != $curRes->ATTEMPTED()) {
                       $problemRes = $curRes;
                       $foundDoableProblem = 1;
   
                       # Pop open all previous maps
                       my $stack = $iterator->getStack();
                       pop @$stack; # last resource in the stack is the problem
                                    # itself, which we don't need in the map stack
                       my @mapPcs = map {$_->map_pc()} @$stack;
                       $ENV{'form.filter'} = join(',', @mapPcs);
   
                       # Mark as both "here" and "jump"
                       $ENV{'form.postsymb'} = $curRes->symb();
                   }
               }
           } continue {
               $curRes = $iterator->next();
           }
   
           # If we found no problems, print a note to that effect.
           if (!$foundDoableProblem) {
               $r->print("<font size='+2'>All homework assignments have been completed.</font><br /><br />");
           }
       } else {
           $r->print("<a href='navmaps?jumpToFirstHomework'>" .
                     "Go To My First Homework Problem</a><br />");
       }
   
     # renderer call      # renderer call
     my $render = render({ 'cols' => [0,1,2,3],      my $render = render({ 'cols' => [0,1,2,3],
                           'url' => '/adm/navmaps',                            'url' => '/adm/navmaps',
Line 271  sub getDescription { Line 317  sub getDescription {
     my $part = shift;      my $part = shift;
     my $status = $res->status($part);      my $status = $res->status($part);
   
     if ($status == $res->NETWORK_FAILURE) { return ""; }      if ($status == $res->NETWORK_FAILURE) { 
           return "Having technical difficulties; please check status later"; 
       }
     if ($status == $res->NOTHING_SET) {      if ($status == $res->NOTHING_SET) {
         return "Not currently assigned.";          return "Not currently assigned.";
     }      }
Line 1472  sub init { Line 1520  sub init {
             unless ((time-$courserdatas{$cid.'.last_cache'})<240) {              unless ((time-$courserdatas{$cid.'.last_cache'})<240) {
                 my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.                  my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.
                                                  ':resourcedata',$chome);                                                   ':resourcedata',$chome);
                 if ($reply!~/^error\:/) {                  # Check for network failure
                   if ( $reply =~ /no.such.host/i || $reply =~ /con_lost/i) {
                       $self->{NETWORK_FAILURE} = 1;
                   } elsif ($reply!~/^error\:/) {
                     $courserdatas{$cid}=$reply;                      $courserdatas{$cid}=$reply;
                     $courserdatas{$cid.'.last_cache'}=time;                      $courserdatas{$cid.'.last_cache'}=time;
                 }                  }
                 # check to see if network failed  
                 elsif ( $reply=~/no.such.host/i || $reply=~/con.*lost/i )  
                 {  
                     $self->{NETWORK_FAILURE} = 1;  
                 }  
             }              }
             foreach (split(/\&/,$courserdatas{$cid})) {              foreach (split(/\&/,$courserdatas{$cid})) {
                 my ($name,$value)=split(/\=/,$_);                  my ($name,$value)=split(/\=/,$_);
Line 3069  sub countParts { Line 3115  sub countParts {
     return scalar(@{$parts}) + $delta;      return scalar(@{$parts}) + $delta;
 }  }
   
 # Private function: Extracts the parts information and saves it  sub partType {
       my $self = shift;
       my $part = shift;
   
       $self->extractParts();
       return $self->{PART_TYPE}->{$part};
   }
   
   # Private function: Extracts the parts information, both part names and
   # part types, and saves it
 sub extractParts {   sub extractParts { 
     my $self = shift;      my $self = shift;
           
Line 3086  sub extractParts { Line 3141  sub extractParts {
         if (!$metadata) {          if (!$metadata) {
             $self->{RESOURCE_ERROR} = 1;              $self->{RESOURCE_ERROR} = 1;
             $self->{PARTS} = [];              $self->{PARTS} = [];
               $self->{PART_TYPE} = {};
             return;              return;
         }          }
         foreach (split(/\,/,$metadata)) {          foreach (split(/\,/,$metadata)) {
             if ($_ =~ /^part_(.*)$/) {              if ($_ =~ /^part_(.*)$/) {
                 my $part = $1;                  my $part = $1;
                 # This floods the logs                  # This floods the logs if it blows up
                 #if (defined($parts{$part})) {                  if (defined($parts{$part})) {
                 #    Apache::lonnet::logthis("$part multiply defined in metadata for " . $self->symb());                      Apache::lonnet::logthis("$part multiply defined in metadata for " . $self->symb());
                 #  }                    }
   
                 # check to see if part is turned off.                  # check to see if part is turned off.
   

Removed from v.1.181  
changed lines
  Added in v.1.184


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>