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

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


bowersj2		Tue Feb  4 11:37:51 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Fourth column in place. This should replace the original nav map,
  feature for feature, except for $rflush every 20 lines, which I will
  add in a minute.
  
  Also removed dead $colorizer from current nav map.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.135 loncom/interface/lonnavmaps.pm:1.136
--- loncom/interface/lonnavmaps.pm:1.135	Tue Feb  4 11:28:50 2003
+++ loncom/interface/lonnavmaps.pm	Tue Feb  4 11:37:51 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.135 2003/02/04 16:28:50 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.136 2003/02/04 16:37:51 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -77,6 +77,23 @@
       'navmap.wrong.gif'   => 'Incorrect',
       'navmap.open.gif'    => 'Open' );
 
+# Defines a status->color mapping, null string means don't color
+my %colormap = 
+    ( Apache::lonnavmaps::resource->NETWORK_FAILURE        => '',
+      Apache::lonnavmaps::resource->CORRECT                => '',
+      Apache::lonnavmaps::resource->EXCUSED                => '#3333FF',
+      Apache::lonnavmaps::resource->PAST_DUE_ANSWER_LATER  => '',
+      Apache::lonnavmaps::resource->PAST_DUE_NO_ANSWER     => '',
+      Apache::lonnavmaps::resource->ANSWER_OPEN            => '#006600',
+      Apache::lonnavmaps::resource->OPEN_LATER             => '',
+      Apache::lonnavmaps::resource->TRIES_LEFT             => '',
+      Apache::lonnavmaps::resource->INCORRECT              => '',
+      Apache::lonnavmaps::resource->OPEN                   => '',
+      Apache::lonnavmaps::resource->NOTHING_SET            => ''        );
+# And a special case in the nav map; what to do when the assignment
+# is not yet done and due in less then 24 hours
+my $hurryUpColor = "#FF0000";
+
 sub cleanup {
     if (tied(%navmaphash)){
 	&Apache::lonnet::logthis('Cleanup navmaps: navmaphash');
@@ -242,23 +259,6 @@
     # These are some data tables, which make it easy to change some of
     # of the specific visualization parameters if desired.
 
-    # Defines a status->color mapping, null string means don't color
-    my %colormap = 
-    ( $res->NETWORK_FAILURE        => '',
-      $res->CORRECT                => '',
-      $res->EXCUSED                => '#3333FF',
-      $res->PAST_DUE_ANSWER_LATER  => '',
-      $res->PAST_DUE_NO_ANSWER     => '',
-      $res->ANSWER_OPEN            => '#006600',
-      $res->OPEN_LATER             => '',
-      $res->TRIES_LEFT             => '',
-      $res->INCORRECT              => '',
-      $res->OPEN                   => '',
-      $res->NOTHING_SET            => ''        );
-    # And a special case in the nav map; what to do when the assignment
-    # is not yet done and due in less then 24 hours
-    my $hurryUpColor = "#FF0000";
-
     my %condenseStatuses =
         ( $res->NETWORK_FAILURE    => 1,
           $res->NOTHING_SET        => 1,
@@ -554,7 +554,6 @@
 
                 }
                 
-                my $colorizer = "";
                 my $color;
                 if ($curRes->is_problem()) {
                     $color = $colormap{$curRes->status};
@@ -563,10 +562,6 @@
                         lastTry($curRes, $part)) {
                         $color = $hurryUpColor;
                     }
-
-                    if ($color ne "") {
-                        $colorizer = "bgcolor=\"$color\"";
-                    }
                 }
 
                 if ($curRes->randomout()) {
@@ -1060,24 +1055,6 @@
 
 # Data for render_resource
 
-my $resObj = 'Apache::lonnavmaps::resource';
-# Defines a status->color mapping, null string means don't color
-my %colormap = 
-    ( $resObj->NETWORK_FAILURE        => '',
-      $resObj->CORRECT                => '',
-      $resObj->EXCUSED                => '#3333FF',
-      $resObj->PAST_DUE_ANSWER_LATER  => '',
-      $resObj->PAST_DUE_NO_ANSWER     => '',
-      $resObj->ANSWER_OPEN            => '#006600',
-      $resObj->OPEN_LATER             => '',
-      $resObj->TRIES_LEFT             => '',
-      $resObj->INCORRECT              => '',
-      $resObj->OPEN                   => '',
-      $resObj->NOTHING_SET            => ''        );
-# And a special case in the nav map; what to do when the assignment
-# is not yet done and due in less then 24 hours
-my $hurryUpColor = "#FF0000";
-
 sub render_resource {
     my ($resource, $part, $params) = @_;
 
@@ -1251,7 +1228,34 @@
 }
 sub render_long_status {
     my ($resource, $part, $params) = @_;
-    return "<td align='center'>long_status</td>";
+    my $result = "<td align='right' valign='center'>\n";
+    my $firstDisplayed = !$params->{'condensed'} && 
+        $params->{'multipart'} && $part eq "0";
+                
+    my $color;
+    if ($resource->is_problem()) {
+        $color = $colormap{$resource->status};
+        
+        if (dueInLessThen24Hours($resource, $part) ||
+            lastTry($resource, $part)) {
+            $color = $hurryUpColor;
+        }
+    }
+    
+    if ($resource->kind() eq "res" &&
+        $resource->is_problem() &&
+        !$firstDisplayed) {
+        if ($color) {$result .= "<font color=\"$color\"><b>"; }
+        $result .= getDescription($resource, $part);
+        if ($color) {$result .= "</b></font>"; }
+    }
+    if ($resource->is_map() && advancedUser() && $resource->randompick()) {
+        $result .= '(randomly select ' . $resource->randompick() .')';
+    }
+    
+    $result .= "&nbsp;</td>\n";
+    
+    return $result;
 }
 
 my @preparedColumns = (\&render_resource, \&render_communication_status,