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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Tue, 04 Feb 2003 16:28:51 -0000


bowersj2		Tue Feb  4 11:28:51 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Third column, the icon quick-status, in place and working.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.134 loncom/interface/lonnavmaps.pm:1.135
--- loncom/interface/lonnavmaps.pm:1.134	Tue Feb  4 11:14:27 2003
+++ loncom/interface/lonnavmaps.pm	Tue Feb  4 11:28:50 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.134 2003/02/04 16:14:27 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.135 2003/02/04 16:28:50 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -56,6 +56,26 @@
 
 # Some data
 
+# Keep these mappings in sync with lonquickgrades, which uses the colors
+# instead of the icons.
+my %statusIconMap = 
+    ( Apache::lonnavmaps::resource->NETWORK_FAILURE    => '',
+      Apache::lonnavmaps::resource->NOTHING_SET        => '',
+      Apache::lonnavmaps::resource->CORRECT            => 'navmap.correct.gif',
+      Apache::lonnavmaps::resource->EXCUSED            => 'navmap.correct.gif',
+      Apache::lonnavmaps::resource->PAST_DUE_NO_ANSWER => 'navmap.wrong.gif',
+      Apache::lonnavmaps::resource->PAST_DUE_ANSWER_LATER => 'navmap.wrong.gif',
+      Apache::lonnavmaps::resource->ANSWER_OPEN        => 'navmap.wrong.gif',
+      Apache::lonnavmaps::resource->OPEN_LATER         => '',
+      Apache::lonnavmaps::resource->TRIES_LEFT         => 'navmap.open.gif',
+      Apache::lonnavmaps::resource->INCORRECT          => 'navmap.wrong.gif',
+      Apache::lonnavmaps::resource->OPEN               => 'navmap.open.gif',
+      Apache::lonnavmaps::resource->ATTEMPTED          => 'navmap.open.gif' );
+
+my %iconAltTags = 
+    ( 'navmap.correct.gif' => 'Correct',
+      'navmap.wrong.gif'   => 'Incorrect',
+      'navmap.open.gif'    => 'Open' );
 
 sub cleanup {
     if (tied(%navmaphash)){
@@ -239,27 +259,6 @@
     # is not yet done and due in less then 24 hours
     my $hurryUpColor = "#FF0000";
 
-    # Keep these mappings in sync with lonquickgrades, which uses the colors
-    # instead of the icons.
-    my %statusIconMap = 
-        ( $res->NETWORK_FAILURE    => '',
-          $res->NOTHING_SET        => '',
-          $res->CORRECT            => 'navmap.correct.gif',
-          $res->EXCUSED            => 'navmap.correct.gif',
-          $res->PAST_DUE_NO_ANSWER => 'navmap.wrong.gif',
-          $res->PAST_DUE_ANSWER_LATER => 'navmap.wrong.gif',
-          $res->ANSWER_OPEN        => 'navmap.wrong.gif',
-          $res->OPEN_LATER         => '',
-          $res->TRIES_LEFT         => 'navmap.open.gif',
-          $res->INCORRECT          => 'navmap.wrong.gif',
-          $res->OPEN               => 'navmap.open.gif',
-          $res->ATTEMPTED          => 'navmap.open.gif' );
-
-    my %iconAltTags = 
-        ( 'navmap.correct.gif' => 'Correct',
-          'navmap.wrong.gif'   => 'Incorrect',
-          'navmap.open.gif'    => 'Open' );
-
     my %condenseStatuses =
         ( $res->NETWORK_FAILURE    => 1,
           $res->NOTHING_SET        => 1,
@@ -1227,7 +1226,28 @@
 }
 sub render_quick_status {
     my ($resource, $part, $params) = @_;
-    return "<td align='center'>quick_status</td>";
+    my $result = "";
+    my $firstDisplayed = !$params->{'condensed'} && 
+        $params->{'multipart'} && $part eq "0";
+
+    my $link = $params->{"resourceLink"};
+    my $linkopen = "<a href='$link'>";
+    my $linkclose = "</a>";
+
+    if ($resource->is_problem() &&
+        !$firstDisplayed) {
+        my $icon = $statusIconMap{$resource->status($part)};
+        my $alt = $iconAltTags{$icon};
+        if ($icon) {
+            $result .= "<td width='30' valign='center' width='50' align='right'>$linkopen<img width='25' height='25' src='/adm/lonIcons/$icon' border='0' alt='$alt' />$linkclose</td>\n";
+        } else {
+            $result .= "<td width='30'>&nbsp;</td>\n";
+        }
+    } else { # not problem, no icon
+        $result .= "<td width='30'>&nbsp;</td>\n";
+    }
+
+    return $result;
 }
 sub render_long_status {
     my ($resource, $part, $params) = @_;