[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Tue, 08 Oct 2002 18:54:39 -0000


bowersj2		Tue Oct  8 14:54:39 2002 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  * Added alt tags to the status icons for accessibility.
  * Handled "ungraded_attempted" status.
          * If the problem is untried, it shows "open" as usual.
          * If the problem is tried and ungraded, no status icon is
            shown and the text "Not yet graded" shows in the last col.
          # If the problem has been graded, the status of the problem shows
            as it usually does for correct & incorrect.
  * Fixed two "ROWS" -> "COLS". (Duh.)
  * Corrected (?) status message display to get the composite status.
  * Corrected some comments.
  * Found a subtle dependency on parts having numeric names: != used
    instead of 'ne'. D'oh! That's why Guy's problem wasn't working 
    right.
  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.68 loncom/interface/lonnavmaps.pm:1.69
--- loncom/interface/lonnavmaps.pm:1.68	Mon Oct  7 17:07:47 2002
+++ loncom/interface/lonnavmaps.pm	Tue Oct  8 14:54:39 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.68 2002/10/07 21:07:47 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.69 2002/10/08 18:54:39 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -892,7 +892,13 @@
           $res->OPEN_LATER         => '',
           $res->TRIES_LEFT         => 'navmap.open.gif',
           $res->INCORRECT          => 'navmap.wrong.gif',
-          $res->OPEN               => 'navmap.open.gif' );
+          $res->OPEN               => 'navmap.open.gif',
+          $res->ATTEMPTED          => '' );
+
+    my %iconAltTags = 
+        ( 'navmap.correct.gif' => 'Correct',
+          'navmap.wrong.gif'   => 'Incorrect',
+          'navmap.open.gif'    => 'Open' );
 
     my %condenseStatuses =
         ( $res->NETWORK_FAILURE    => 1,
@@ -1108,7 +1114,7 @@
 
                 $r->print("  ${newBranchText}${linkopen}$icon${linkclose}\n");
 
-                if ($curRes->is_problem() && $part != "0" && !$condensed) { 
+                if ($curRes->is_problem() && $part ne "0" && !$condensed) { 
                     $partLabel = " (Part $part)"; 
                     $title = "";
                 }
@@ -1151,12 +1157,13 @@
                 # columns?
                 my $firstDisplayed = !$condensed && $multipart && $part eq "0";
 
-                # THIRD ROW: Problem status icon
+                # THIRD COL: Problem status icon
                 if ($curRes->is_problem() &&
                     !$firstDisplayed) {
                     my $icon = $statusIconMap{$curRes->status($part)};
+                    my $alt = $iconAltTags{$icon};
                     if ($icon) {
-                        $r->print("<td valign=\"bottom\" width=\"50\" align=\"right\">$linkopen<img src=\"/adm/lonIcons/$icon\" border=\"0\" />$linkclose</td>\n");
+                        $r->print("<td valign=\"bottom\" width=\"50\" align=\"right\">$linkopen<img src=\"/adm/lonIcons/$icon\" border=\"0\" alt=\"$alt\" />$linkclose</td>\n");
                     } else {
                         $r->print("<td></td>\n");
                     }
@@ -1164,7 +1171,7 @@
                     $r->print("<td></td>\n");
                 }
 
-                # FOURTH ROW: Text description
+                # FOURTH COL: Text description
                 $r->print("<td $colorizer align=\"right\" valign=\"bottom\">\n");
                 
                 if ($curRes->kind() eq "res" &&
@@ -1244,7 +1251,7 @@
 sub getDescription {
     my $res = shift;
     my $part = shift;
-    my $status = $res->getDateStatus();
+    my $status = $res->status($part);
 
     if ($status == $res->NETWORK_FAILURE) { return ""; }
     if ($status == $res->NOTHING_SET) {
@@ -1272,6 +1279,9 @@
     if ($status == $res->EXCUSED) {
         return "Excused by instructor";
     }
+    if ($status == $res->ATTEMPTED) {
+        return "Not yet graded.";
+    }
     if ($status == $res->TRIES_LEFT) {
         my $tries = $res->tries();
         my $maxtries = $res->maxtries();
@@ -2489,6 +2499,8 @@
 
 =item * B<NETWORK_FAILURE>: Information not available due to network failure.
 
+=item * B<ATTEMPTED>: Attempted, and not yet graded.
+
 =back
 
 =cut
@@ -2499,6 +2511,7 @@
 sub CORRECT               { return 13; }
 sub CORRECT_BY_OVERRIDE   { return 14; }
 sub EXCUSED               { return 15; }
+sub ATTEMPTED             { return 16; }
 
 sub getCompletionStatus {
     my $self = shift;
@@ -2517,6 +2530,7 @@
     if ($status eq 'incorrect_attempted') {return $self->INCORRECT; }
     if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }
     if ($status eq 'excused') {return $self->EXCUSED; }
+    if ($status eq 'ungraded_attempted') {return $self->ATTEMPTED; }
     return $self->NOT_ATTEMPTED;
 }
 
@@ -2550,6 +2564,8 @@
 
 =item * OPEN: The item is open and not yet tried.
 
+=item * ATTEMPTED: The problem has been attempted.
+
 =back
 
 =cut
@@ -2572,7 +2588,11 @@
     # There are a few whole rows we can dispose of:
     if ($completionStatus == CORRECT ||
         $completionStatus == CORRECT_BY_OVERRIDE ) {
-        return CORRECT(); 
+        return CORRECT; 
+    }
+
+    if ($completionStatus == ATTEMPTED) {
+        return ATTEMPTED;
     }
 
     # If it's EXCUSED, then return that no matter what
@@ -2584,8 +2604,8 @@
         return NOTHING_SET;
     }
 
-    # Now we're down to a 3 (incorrect, incorrect_override, not_attempted)
-    # by 4 matrix (date status).
+    # Now we're down to a 4 (incorrect, incorrect_override, not_attempted)
+    # by 4 matrix (date statuses).
 
     if ($dateStatus == PAST_DUE_ANSWER_LATER ||
         $dateStatus == PAST_DUE_NO_ANSWER ) {