Diff for /loncom/interface/lonnavmaps.pm between versions 1.74 and 1.81

version 1.74, 2002/10/11 21:29:18 version 1.81, 2002/10/14 18:48:13
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 917  sub new_handle { Line 917  sub new_handle {
     my $currenturl = $ENV{'form.postdata'};      my $currenturl = $ENV{'form.postdata'};
     $currenturl=~s/^http\:\/\///;      $currenturl=~s/^http\:\/\///;
     $currenturl=~s/^[^\/]+//;      $currenturl=~s/^[^\/]+//;
     my $queryAdd = "postdata=" . &Apache::lonnet::escape($currenturl);      # alreadyHere allows us to only open the maps necessary to view
       # the current location once, while at the same time remembering
       # the current location. Without that check, the user would never
       # be able to close those maps; the user would close it, and the
       # currenturl scan would re-open it.
       my $queryAdd = "postdata=" . &Apache::lonnet::escape($currenturl) .
           "&alreadyHere=1";
   
     $r->print('<a href="navmaps?condition=1&filter=">Show All Resources</a><br /><br />');      $r->print('<a href="navmaps?condition=1&filter=">Show All Resources</a><br /><br />');
   
Line 935  sub new_handle { Line 941  sub new_handle {
     # loop should be obvious.      # loop should be obvious.
     # Here's a simple example of the iterator.      # Here's a simple example of the iterator.
     # If there is a current resource      # If there is a current resource
     if ($currenturl) {      if ($currenturl && !$ENV{'form.alreadyHere'}) {
         # Give me every resource...          # Give me every resource...
         my $mapIterator = $navmap->getIterator(undef, undef, {}, 1);          my $mapIterator = $navmap->getIterator(undef, undef, {}, 1);
         my $found != 0;          my $found != 0;
Line 971  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 1070  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 1097  sub new_handle { Line 1104  sub new_handle {
                     'symb='.&Apache::lonnet::escape($curRes->symb()).                      'symb='.&Apache::lonnet::escape($curRes->symb()).
                     '"';                      '"';
                 my $title = $curRes->title();                  my $title = $curRes->title();
                   if (!$title) {
                       $title = $curRes->src();
                       $title = substr ($title, rindex($title, "/") + 1);
                   }
                 my $partLabel = "";                  my $partLabel = "";
                 my $newBranchText = "";                  my $newBranchText = "";
   
Line 1126  sub new_handle { Line 1137  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 1144  sub new_handle { Line 1155  sub new_handle {
   
                     # Special case in the navmaps: If in less then                      # Special case in the navmaps: If in less then
                     # 24 hours, give it a bit of urgency                      # 24 hours, give it a bit of urgency
                     if ($status == $curRes->OPEN() &&                      if ($status == $curRes->OPEN() && $curRes->duedate() &&
                         $curRes->duedate() < time()+(24*60*60)) {                          $curRes->duedate() < time()+(24*60*60) && 
                           $curRes->duedate() > time()) {
                           $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;                          $color = $hurryUpColor;
                     }                      }
                     if ($color ne "") {                      if ($color ne "") {
Line 1158  sub new_handle { Line 1178  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 1171  sub new_handle { Line 1191  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 1212  sub new_handle { Line 1233  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 1225  sub new_handle { Line 1246  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 1234  sub new_handle { Line 1255  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 1323  sub getDescription { Line 1344  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 1345  sub getDescription { Line 1366  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 2821  sub status { Line 2848  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.74  
changed lines
  Added in v.1.81


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