Diff for /loncom/interface/lonnavmaps.pm between versions 1.122 and 1.126

version 1.122, 2002/12/12 18:24:05 version 1.126, 2003/01/13 22:41:20
Line 96  sub real_handler { Line 96  sub real_handler {
                                           ''));                                            ''));
     $r->print('<script>window.focus();</script>');      $r->print('<script>window.focus();</script>');
   
       $r->rflush();
   
       # Now that we've displayed some stuff to the user, init the navmap
       $navmap->init();
   
     $r->print('<table border="0" cellpadding="2" cellspacing="0">');      $r->print('<table border="0" cellpadding="2" cellspacing="0">');
     my $date=localtime;      my $date=localtime;
     $r->print('<tr><td align="right" valign="bottom">Key:&nbsp;&nbsp;</td>');      $r->print('<tr><td align="right" valign="bottom">Key:&nbsp;&nbsp;</td>');
Line 178  sub real_handler { Line 183  sub real_handler {
     $r->print('<br>&nbsp;');      $r->print('<br>&nbsp;');
     $r->rflush();      $r->rflush();
   
     # Now that we've displayed some stuff to the user, init the navmap  
     $navmap->init();  
   
     # Check that it's defined      # Check that it's defined
     if (!($navmap->courseMapDefined())) {      if (!($navmap->courseMapDefined())) {
         $r->print('<font size="+2" color="red">Coursemap undefined.</font>' .          $r->print('<font size="+2" color="red">Coursemap undefined.</font>' .
Line 271  sub real_handler { Line 273  sub real_handler {
     $mapIterator->next(); # discard the first BEGIN_MAP      $mapIterator->next(); # discard the first BEGIN_MAP
     my $curRes = $mapIterator->next();      my $curRes = $mapIterator->next();
     my $counter = 0;      my $counter = 0;
   <<<<<<< lonnavmaps.pm
   
       # We only need to do this if we need to open the maps to show the
       # current position
       while ($depth > 0 && !$ENV{'form.alreadyHere'}) {
   =======
     my $foundJump = ($jumpType == $NOTHING); # look for jump point if we have one      my $foundJump = ($jumpType == $NOTHING); # look for jump point if we have one
     my $looped = 0;       my $looped = 0; 
   
Line 278  sub real_handler { Line 286  sub real_handler {
     # current position. This will change the counter so we can't count      # current position. This will change the counter so we can't count
     # for the jump marker with this loop.      # for the jump marker with this loop.
     while ($depth > 0 && !$ENV{'form.alreadyHere'}) {      while ($depth > 0 && !$ENV{'form.alreadyHere'}) {
   >>>>>>> 1.122
         if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }          if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
         if ($curRes == $mapIterator->END_MAP()) { $depth--; }          if ($curRes == $mapIterator->END_MAP()) { $depth--; }
   
Line 296  sub real_handler { Line 305  sub real_handler {
             }              }
             $ENV{'form.alreadyHere'} = 1;              $ENV{'form.alreadyHere'} = 1;
         }          }
   <<<<<<< lonnavmaps.pm
               
   =======
         $looped = 1;          $looped = 1;
   
         $curRes = $mapIterator->next();          $curRes = $mapIterator->next();
Line 325  sub real_handler { Line 337  sub real_handler {
             $foundJump = 1;              $foundJump = 1;
         }          }
   
   >>>>>>> 1.122
         $curRes = $mapIterator->next();          $curRes = $mapIterator->next();
     }      }
           
Line 600  sub real_handler { Line 613  sub real_handler {
                 $r->print("</td>\n");                  $r->print("</td>\n");
   
                 # SECOND COL: Is there text, feedback, errors??                  # SECOND COL: Is there text, feedback, errors??
                 my $discussionHTML = ""; my $feedbackHTML = "";                  my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = "";
   
                 if ($curRes->hasDiscussion()) {                  if ($curRes->hasDiscussion()) {
                     $discussionHTML = $linkopen .                      $discussionHTML = $linkopen .
Line 620  sub real_handler { Line 633  sub real_handler {
                     }                      }
                 }                  }
   
                 $r->print("<td width=\"75\" align=\"left\" valign=\"center\">$discussionHTML$feedbackHTML&nbsp;</td>");                  if ($curRes->getErrors()) {
                       my $errors = $curRes->getErrors();
                       foreach (split(/,/, $errors)) {
                           if ($_) {
                               $errorHTML .= '&nbsp;<a href="/adm/email?display='
                                   . &Apache::lonnet::escape($_) . '">'
                                   . '<img src="/adm/lonMisc/bomb.gif" '
                                   . 'border="0" /></a>';
                           }
                       }
                   }
   
                   $r->print("<td width=\"75\" align=\"left\" valign=\"center\">$discussionHTML$feedbackHTML$errorHTML&nbsp;</td>");
   
                 # Is this the first displayed part of a multi-part problem                  # Is this the first displayed part of a multi-part problem
                 # that has not been condensed, so we should suppress these two                  # that has not been condensed, so we should suppress these two
Line 672  sub real_handler { Line 697  sub real_handler {
         $r->print('<script>location += "#curloc";</script>');          $r->print('<script>location += "#curloc";</script>');
     }      }
   
     $r->print("</body></html>");  
   
     $navmap->untieHashes();      $navmap->untieHashes();
   
       $r->print("<h1>Course Map Untied</h1></body></html>");
   
     return OK;      return OK;
 }  }
   
Line 985  sub new { Line 1010  sub new {
         return undef;          return undef;
     }      }
   
     # Now copy the hashes for speed (?)      $self->{NAV_HASH} = \%navmaphash;
     my %realnav; my %realparm;      $self->{PARM_HASH} = \%parmhash;
     foreach (%navmaphash) { $realnav{$_} = $navmaphash{$_}; }  
     foreach (%parmhash) { $realparm{$_} = $navmaphash{$_}; }  
     $self->{NAV_HASH} = \%realnav;  
     $self->{PARM_HASH} = \%realparm;  
   
     bless($self);      bless($self);
     $self->untieHashes();      $self->untieHashes();
Line 1064  sub init { Line 1085  sub init {
         my %emailstatus = &Apache::lonnet::dump('email_status');          my %emailstatus = &Apache::lonnet::dump('email_status');
         my $logoutTime = $emailstatus{'logout'};          my $logoutTime = $emailstatus{'logout'};
         my $courseLeaveTime = $emailstatus{'logout_'.$ENV{'request.course.id'}};          my $courseLeaveTime = $emailstatus{'logout_'.$ENV{'request.course.id'}};
         $self->{LAST_CHECK} = ($courseLeaveTime > $logoutTime ?          $self->{LAST_CHECK} = ($courseLeaveTime < $logoutTime ?
                                $courseLeaveTime : $logoutTime);                                 $courseLeaveTime : $logoutTime);
         my %discussiontime = &Apache::lonnet::dump('discussiontimes',           my %discussiontime = &Apache::lonnet::dump('discussiontimes', 
                                                    $cdom, $cnum);                                                     $cdom, $cnum);
Line 1145  sub DESTROY { Line 1166  sub DESTROY {
     $self->untieHashes();      $self->untieHashes();
 }  }
   
 # Private function: Does the given resource (as a symb string) have  # Private method: Does the given resource (as a symb string) have
 # current discussion? Returns 0 if chat/mail data not extracted.  # current discussion? Returns 0 if chat/mail data not extracted.
 sub hasDiscussion {  sub hasDiscussion {
     my $self = shift;      my $self = shift;
     my $symb = shift;      my $symb = shift;
     if (!defined($self->{DISCUSSION_TIME})) { return 0; }      if (!defined($self->{DISCUSSION_TIME})) { return 0; }
   
       #return defined($self->{DISCUSSION_TIME}->{$symb});
     return $self->{DISCUSSION_TIME}->{$symb} >      return $self->{DISCUSSION_TIME}->{$symb} >
            $self->{LAST_CHECK};             $self->{LAST_CHECK};
 }  }
   
 # Private function: Does the given resource (as a symb string) have  # Private method: Does the given resource (as a symb string) have
 # current feedback? Returns the string in the feedback hash, which  # current feedback? Returns the string in the feedback hash, which
 # will be false if it does not exist.  # will be false if it does not exist.
 sub getFeedback {   sub getFeedback { 
Line 1168  sub getFeedback { Line 1190  sub getFeedback {
     return $self->{FEEDBACK}->{$symb};      return $self->{FEEDBACK}->{$symb};
 }  }
   
   # Private method: Get the errors for that resource (by source).
   sub getErrors { 
       my $self = shift;
       my $src = shift;
       
       if (!defined($self->{ERROR_MSG})) { return ""; }
       return $self->{ERROR_MSG}->{$src};
   }
   
 =pod  =pod
   
 =item * B<getById>(id): Based on the ID of the resource (1.1, 3.2, etc.), get a resource object for that resource. This method, or other methods that use it (as in the resource object) is the only proper way to obtain a resource object.  =item * B<getById>(id): Based on the ID of the resource (1.1, 3.2, etc.), get a resource object for that resource. This method, or other methods that use it (as in the resource object) is the only proper way to obtain a resource object.
Line 1459  sub new { Line 1490  sub new {
             if ($curRes == $iterator->END_MAP()) { $depth--; }              if ($curRes == $iterator->END_MAP()) { $depth--; }
                   
             if (ref($curRes)) {              if (ref($curRes)) {
   <<<<<<< lonnavmaps.pm
                   # If there's only one resource, this will save it
                   $resource = $curRes; $resourceCount++;
   =======
                 # If there's only one resource, this will save it                  # If there's only one resource, this will save it
                 # we have to filter empty resources from consideration here,                  # we have to filter empty resources from consideration here,
                 # or even "empty", redirecting maps have two (start & finish)                  # or even "empty", redirecting maps have two (start & finish)
Line 1466  sub new { Line 1501  sub new {
                 if($direction == FORWARD && $curRes->src()) {                   if($direction == FORWARD && $curRes->src()) { 
                     $resource = $curRes; $resourceCount++;                       $resource = $curRes; $resourceCount++; 
                 }                  }
   >>>>>>> 1.122
                 my $resultingVal = $curRes->{DATA}->{$valName};                  my $resultingVal = $curRes->{DATA}->{$valName};
                 my $nextResources = $curRes->$nextResourceMethod();                  my $nextResources = $curRes->$nextResourceMethod();
                 my $nextCount = scalar(@{$nextResources});                  my $nextCount = scalar(@{$nextResources});
Line 2233  sub hasDiscussion { Line 2269  sub hasDiscussion {
   
 sub getFeedback {  sub getFeedback {
     my $self = shift;      my $self = shift;
     return $self->{NAV_MAP}->getFeedback($self->src());      my $source = $self->src();
       if ($source =~ /^\/res\//) { $source = substr $source, 5; }
       return $self->{NAV_MAP}->getFeedback($source);
   }
   
   sub getErrors {
       my $self = shift;
       my $source = $self->src();
       if ($source =~ /^\/res\//) { $source = substr $source, 5; }
       return $self->{NAV_MAP}->getErrors($source);
 }  }
   
 =pod  =pod

Removed from v.1.122  
changed lines
  Added in v.1.126


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