Diff for /loncom/interface/lonnavmaps.pm between versions 1.84 and 1.85

version 1.84, 2002/10/17 19:25:27 version 1.85, 2002/10/24 18:38:26
Line 890  sub new_handle { Line 890  sub new_handle {
           $res->TRIES_LEFT         => 'navmap.open.gif',            $res->TRIES_LEFT         => 'navmap.open.gif',
           $res->INCORRECT          => 'navmap.wrong.gif',            $res->INCORRECT          => 'navmap.wrong.gif',
           $res->OPEN               => 'navmap.open.gif',            $res->OPEN               => 'navmap.open.gif',
           $res->ATTEMPTED          => '' );            $res->ATTEMPTED          => 'navmap.open.gif' );
   
     my %iconAltTags =       my %iconAltTags = 
         ( 'navmap.correct.gif' => 'Correct',          ( 'navmap.correct.gif' => 'Correct',
Line 925  sub new_handle { Line 925  sub new_handle {
   
     # Begin the HTML table      # Begin the HTML table
     # four cols: resource + indent, chat+feedback, icon, text string      # four cols: resource + indent, chat+feedback, icon, text string
     $r->print('<table cellspacing="0" cellpadding="3" width="100%" border="0" bgcolor="#FFFFFF">' ."\n");      $r->print('<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n");
   
     my $condition = 0;      my $condition = 0;
     if ($ENV{'form.condition'}) {      if ($ENV{'form.condition'}) {
Line 1218  sub new_handle { Line 1218  sub new_handle {
   
                 my $discussionHTML = ""; my $feedbackHTML = "";                  my $discussionHTML = ""; my $feedbackHTML = "";
   
                 # SECOND COL: Is there text or feedback?                  # SECOND COL: Is there text, feedback, errors??
                 if ($curRes->hasDiscussion()) {                  if ($curRes->hasDiscussion()) {
                     $discussionHTML = $linkopen .                      $discussionHTML = $linkopen .
                         '<img border="0" src="/adm/lonMisc/chat.gif" />' .                          '<img border="0" src="/adm/lonMisc/chat.gif" />' .
Line 1473  sub timeToHumanString { Line 1473  sub timeToHumanString {
         # Less then 5 days away, display day of the week and          # Less then 5 days away, display day of the week and
         # HH:MM          # HH:MM
         if ( $delta < $day * 5 ) {          if ( $delta < $day * 5 ) {
             my $timeStr = strftime("%A at %I:%M %P", localtime($time));              my $timeStr = strftime("%A, %b %e at %I:%M %P", localtime($time));
             $timeStr =~ s/12:00 am/midnight/;              $timeStr =~ s/12:00 am/midnight/;
             $timeStr =~ s/12:00 pm/noon/;              $timeStr =~ s/12:00 pm/noon/;
             return ($inPast ? "last " : "next ") .              return ($inPast ? "last " : "next ") .
Line 2270  These are methods that help you retrieve Line 2270  These are methods that help you retrieve
   
 # These info functions can be used directly, as they don't return  # These info functions can be used directly, as they don't return
 # resource information.  # resource information.
   sub comesfrom { my $self=shift; return $self->navHash("comesfrom_", 1); }
 sub ext { my $self=shift; return $self->navHash("ext_", 1) eq 'true:'; }  sub ext { my $self=shift; return $self->navHash("ext_", 1) eq 'true:'; }
   sub from { my $self=shift; return $self->navHash("from_", 1); }
 sub goesto { my $self=shift; return $self->navHash("goesto_", 1); }  sub goesto { my $self=shift; return $self->navHash("goesto_", 1); }
 sub kind { my $self=shift; return $self->navHash("kind_", 1); }  sub kind { my $self=shift; return $self->navHash("kind_", 1); }
 sub randomout { my $self=shift; return $self->navHash("randomout_", 1); }  sub randomout { my $self=shift; return $self->navHash("randomout_", 1); }
Line 2554  sub hasDiscussion { Line 2556  sub hasDiscussion {
   
 sub getFeedback {  sub getFeedback {
     my $self = shift;      my $self = shift;
     return $self->{NAV_MAP}->getFeedback($self->symb());      return $self->{NAV_MAP}->getFeedback($self->src());
 }  }
   
 =pod  =pod
Line 2884  sub status { Line 2886  sub status {
   
 =over 4  =over 4
   
 =item * B<getNext>(): Gets the next resource in the navmap after this one.  =item * B<getNext>($alreadySeenHashRef): Retreive an array of the possible next resources after this one. Always returns an array, even in the one- or zero-element case. The "alreadySeenHashRef" is an optional parameter that can be passed in to the method. If $$alreadySeenHashRef{$res->id()} is true in that hash, getNext will not return it in the list. In other words, you can use it to suppress resources you've already seen in the getNext method directly.
   
 =cut  =item * B<getPrevious>($alreadySeenHashRef): Retreive an array of the possible previous resources from this one. Always returns an array, even in the one- or zero-element case. $alreadySeenHashRef is the same as in getNext.
   
 # For the simple single-link case, to get from a resource to the next  =cut
 # resource, you need to look up the "to_" link in the nav hash, then  
 # follow that with the "goesto_" link.  
   
 sub getNext {  sub getNext {
     my $self = shift;      my $self = shift;
     my $alreadySeenHash = shift;      my $alreadySeenHash = shift;
     my @branches;      my @branches;
     my $to = $self->to();      my $to = $self->to();
     foreach my $branch ( split(/\,/, $to) ) {      foreach my $branch ( split(/,/, $to) ) {
         my $choice = $self->{NAV_MAP}->getById($branch);          my $choice = $self->{NAV_MAP}->getById($branch);
         my $next = $choice->goesto();          my $next = $choice->goesto();
         $next = $self->{NAV_MAP}->getById($next);          $next = $self->{NAV_MAP}->getById($next);
Line 2913  sub getNext { Line 2913  sub getNext {
     }      }
     return \@branches;      return \@branches;
 }  }
   
   sub getPrevious {
       my $self = shift;
       my @alreadySeen = shift;
       my @branches;
       my $from = $self->from();
       foreach my $branch ( split /,/, $from) {
           my $choice = $self->{NAV_MAP}->getById($branch);
           my $prev = $choice->comesfrom();
           $prev = $self->{NAV_MAP}->getById($prev);
   
           # Skip it if we've already seen it or the user doesn't have
           # browse privs
           my $browsePriv = &Apache::lonnet::allowed('bre', $self->src);
           if (!defined($alreadySeenHash) ||
               !defined($alreadySeenHash->{$next->{ID}}) ||
               ($browsePriv ne '2' && $browsePriv ne 'F')) {
               push @branches, $next;
           }
       }
       return \@branches;
   }
   
 =pod  =pod
   

Removed from v.1.84  
changed lines
  Added in v.1.85


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