Diff for /loncom/interface/lonnavmaps.pm between versions 1.76 and 1.80

version 1.76, 2002/10/14 14:14:49 version 1.80, 2002/10/14 18:41:02
Line 823  sub new_handle { Line 823  sub new_handle {
     # Initialize the nav map      # Initialize the nav map
     my $navmap = Apache::lonnavmaps::navmap->new(      my $navmap = Apache::lonnavmaps::navmap->new(
                         $ENV{"request.course.fn"}.".db",                          $ENV{"request.course.fn"}.".db",
                         $ENV{"request.course.fn"}."_parms.db", 1);                          $ENV{"request.course.fn"}."_parms.db", 1, 1);
   
   
     if (!defined($navmap)) {      if (!defined($navmap)) {
Line 977  sub new_handle { Line 977  sub new_handle {
     my $now = time();      my $now = time();
     my $in24Hours = $now + 24 * 60 * 60;      my $in24Hours = $now + 24 * 60 * 60;
     my $depth = 1;      my $depth = 1;
       my $displayedHereMarker = 0;
   
     # We know the first thing is a BEGIN_MAP (see "$self->{STARTED}"      # We know the first thing is a BEGIN_MAP (see "$self->{STARTED}"
     # code in iterator->next), so ignore the first one      # code in iterator->next), so ignore the first one
Line 1076  sub new_handle { Line 1077  sub new_handle {
             } else {              } else {
                 @parts[0] = "0"; # this is to get past foreach loop below                  @parts[0] = "0"; # this is to get past foreach loop below
                  # you can consider a non-problem resource as a resource                   # you can consider a non-problem resource as a resource
                  # with only one part without loss                    # with only one part without loss
             }              }
   
             # Display one part, in event of network error.              # Display one part, in event of network error.
Line 1132  sub new_handle { Line 1133  sub new_handle {
                     my $mapId = $curRes->map_pc();                      my $mapId = $curRes->map_pc();
                     my $nowOpen = !defined($filterHash{$mapId});                      my $nowOpen = !defined($filterHash{$mapId});
                     $icon = $nowOpen ?                      $icon = $nowOpen ?
                         "folder_closed.gif" : "folder_opened.gif";                          "navmap.folder.closed.gif" : "navmap.folder.open.gif";
                     $icon = "<img src=\"/adm/lonIcons/$icon\" alt=\"\" border=\"0\" />";                      $icon = "<img src=\"/adm/lonIcons/$icon\" alt=\"\" border=\"0\" />";
                     $linkopen = "<a href=\"/adm/navmaps?filter=";                      $linkopen = "<a href=\"/adm/navmaps?filter=";
                     $linkopen .= ($nowOpen xor $condition) ?                       $linkopen .= ($nowOpen xor $condition) ? 
Line 1155  sub new_handle { Line 1156  sub new_handle {
                         $curRes->duedate() > time()) {                          $curRes->duedate() > time()) {
                         $color = $hurryUpColor;                          $color = $hurryUpColor;
                     }                      }
                       # Special case: If this is the last try, and there is
                       # more then one available, give a bit of urgency
                       my $tries = $curRes->tries($part);
                       my $maxtries = $curRes->maxtries($part);
                       if ($tries && $maxtries && $maxtries > 1 &&
                           $maxtries - $tries == 1) {
                           $color = $hurryUpColor;
                       }
                     if ($color ne "") {                      if ($color ne "") {
                         $colorizer = "bgcolor=\"$color\"";                          $colorizer = "bgcolor=\"$color\"";
                     }                      }
Line 1165  sub new_handle { Line 1174  sub new_handle {
                 }                  }
   
                 # FIRST COL: The resource indentation, branch icon, and name                  # FIRST COL: The resource indentation, branch icon, and name
                 $r->print("  <tr><td align=\"left\" valign=\"bottom\">\n");                  $r->print("  <tr><td align=\"left\" valign=\"center\">\n");
   
                 # print indentation                  # print indentation
                 for (my $i = 0; $i < $indentLevel - $deltalevel; $i++) {                  for (my $i = 0; $i < $indentLevel - $deltalevel; $i++) {
Line 1178  sub new_handle { Line 1187  sub new_handle {
                 my $curMarkerEnd = "";                  my $curMarkerEnd = "";
   
                 # Is this the current resource?                  # Is this the current resource?
                 if ($curRes->src() eq $currenturl) {                  if ($curRes->src() eq $currenturl && !$displayedHereMarker) {
                     $curMarkerBegin = '<a name="curloc" /><font color="red" size="+2">&gt; </font>';                      $curMarkerBegin = '<a name="curloc" /><font color="red" size="+2">&gt; </font>';
                     $curMarkerEnd = '<font color="red" size="+2"> &lt;</font>';                      $curMarkerEnd = '<font color="red" size="+2"> &lt;</font>';
                       $displayedHereMarker = 1;
                 }                  }
   
                 if ($curRes->is_problem() && $part ne "0" && !$condensed) {                   if ($curRes->is_problem() && $part ne "0" && !$condensed) { 
Line 1219  sub new_handle { Line 1229  sub new_handle {
                     }                      }
                 }                  }
   
                 $r->print("<td align=\"left\" valign=\"bottom\">$discussionHTML$feedbackHTML</td>");                  $r->print("<td align=\"left\" valign=\"center\">$discussionHTML$feedbackHTML</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 1232  sub new_handle { Line 1242  sub new_handle {
                     my $icon = $statusIconMap{$curRes->status($part)};                      my $icon = $statusIconMap{$curRes->status($part)};
                     my $alt = $iconAltTags{$icon};                      my $alt = $iconAltTags{$icon};
                     if ($icon) {                      if ($icon) {
                         $r->print("<td valign=\"bottom\" width=\"50\" align=\"right\">$linkopen<img src=\"/adm/lonIcons/$icon\" border=\"0\" alt=\"$alt\" />$linkclose</td>\n");                          $r->print("<td valign=\"center\" width=\"50\" align=\"right\">$linkopen<img src=\"/adm/lonIcons/$icon\" border=\"0\" alt=\"$alt\" />$linkclose</td>\n");
                     } else {                      } else {
                         $r->print("<td></td>\n");                          $r->print("<td></td>\n");
                     }                      }
Line 1241  sub new_handle { Line 1251  sub new_handle {
                 }                  }
   
                 # FOURTH COL: Text description                  # FOURTH COL: Text description
                 $r->print("<td $colorizer align=\"right\" valign=\"bottom\">\n");                  $r->print("<td $colorizer align=\"right\" valign=\"center\">\n");
                                   
                 if ($curRes->kind() eq "res" &&                  if ($curRes->kind() eq "res" &&
                     $curRes->is_problem() &&                      $curRes->is_problem() &&
Line 1330  sub getDescription { Line 1340  sub getDescription {
         return "Open " . timeToHumanString($res->opendate($part));          return "Open " . timeToHumanString($res->opendate($part));
     }      }
     if ($status == $res->OPEN) {      if ($status == $res->OPEN) {
         if ($res->duedate()) {          if ($res->duedate($part)) {
             return "Due " . timeToHumanString($res->duedate($part));              return "Due " . timeToHumanString($res->duedate($part));
         } else {          } else {
             return "Open, no due date";              return "Open, no due date";
Line 1352  sub getDescription { Line 1362  sub getDescription {
         return "Not yet graded.";          return "Not yet graded.";
     }      }
     if ($status == $res->TRIES_LEFT) {      if ($status == $res->TRIES_LEFT) {
         my $tries = $res->tries();          my $tries = $res->tries($part);
         my $maxtries = $res->maxtries();          my $maxtries = $res->maxtries($part);
         my $triesString = "($tries of $maxtries tries used)";          my $triesString = "";
           if ($tries && $maxtries) {
               $triesString = "<font size=\"-1\"><i>($tries of $maxtries tries used)</i></font>";
               if ($maxtries > 1 && $maxtries - $tries == 1) {
                   $triesString = "<b>$triesString</b>";
               }
           }
         if ($res->duedate()) {          if ($res->duedate()) {
             return "Due " . timeToHumanString($res->duedate($part)) .              return "Due " . timeToHumanString($res->duedate($part)) .
                 " $triesString";                  " $triesString";
Line 2828  sub status { Line 2844  sub status {
     # If it's WRONG...      # If it's WRONG...
     if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE) {      if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE) {
         # and there are TRIES LEFT:          # and there are TRIES LEFT:
         if ($self->tries() < $self->maxtries()) {          if ($self->tries($part) < $self->maxtries($part) || !$self->maxtries($part)) {
             return TRIES_LEFT;              return TRIES_LEFT;
         }          }
         return INCORRECT; # otherwise, return orange; student can't fix this          return INCORRECT; # otherwise, return orange; student can't fix this

Removed from v.1.76  
changed lines
  Added in v.1.80


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