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

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


bowersj2		Tue Feb  4 11:14:27 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Second column in place, the discussion/feedback/error column.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.133 loncom/interface/lonnavmaps.pm:1.134
--- loncom/interface/lonnavmaps.pm:1.133	Fri Jan 31 17:46:50 2003
+++ loncom/interface/lonnavmaps.pm	Tue Feb  4 11:14:27 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.133 2003/01/31 22:46:50 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.134 2003/02/04 16:14:27 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -717,6 +717,7 @@
     $navmap->untieHashes();
 
     $r->print("</body></html>");
+    $r->rflush();
 
     return OK;
 }
@@ -1083,16 +1084,10 @@
 
     my $nonLinkedText = ''; # stuff after resource title not in link
 
-    my $it = $params->{'iterator'};
+    my $link = $params->{"resourceLink"};
+    my $src = $resource->src();
+    my $it = $params->{"iterator"};
     my $filter = $it->{FILTER};
-    my $stack = $it->getStack();
-    my $src = getLinkForResource($stack);
-
-    my $srcHasQuestion = $src =~ /\?/;
-    my $link = $src.
-        ($srcHasQuestion?'&':'?') .
-        'symb=' . &Apache::lonnet::escape($resource->symb()).
-        '"';
 
     my $title = $resource->compTitle();
     if ($src =~ /^\/uploaded\//) {
@@ -1184,14 +1179,51 @@
         $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';
     }
 
-    $result .= "  $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText";
+    $result .= "  $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>";
 
     return $result;
 }
 
 sub render_communication_status {
     my ($resource, $part, $params) = @_;
-    return "<td align='center'>comm_status</td>";
+    my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = "";
+
+    my $link = $params->{"resourceLink"};
+    my $linkopen = "<a href='$link'>";
+    my $linkclose = "</a>";
+
+    if ($resource->hasDiscussion()) {
+        $discussionHTML = $linkopen .
+            '<img border="0" src="/adm/lonMisc/chat.gif" />' .
+            $linkclose;
+    }
+    
+    if ($resource->getFeedback()) {
+        my $feedback = $resource->getFeedback();
+        foreach (split(/\,/, $feedback)) {
+            if ($_) {
+                $feedbackHTML .= '&nbsp;<a href="/adm/email?display='
+                    . &Apache::lonnet::escape($_) . '">'
+                    . '<img src="/adm/lonMisc/feedback.gif" '
+                    . 'border="0" /></a>';
+            }
+        }
+    }
+    
+    if ($resource->getErrors()) {
+        my $errors = $resource->getErrors();
+        foreach (split(/,/, $errors)) {
+            if ($_) {
+                $errorHTML .= '&nbsp;<a href="/adm/email?display='
+                    . &Apache::lonnet::escape($_) . '">'
+                    . '<img src="/adm/lonMisc/bomb.gif" '
+                    . 'border="0" /></a>';
+            }
+        }
+    }
+
+    return "<td width=\"75\" align=\"left\" valign=\"center\">$discussionHTML$feedbackHTML$errorHTML&nbsp;</td>";
+
 }
 sub render_quick_status {
     my ($resource, $part, $params) = @_;
@@ -1380,10 +1412,20 @@
             my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];
             
             $result .= "  <tr bgcolor='$backgroundColor'>\n";
+
+            # Set up some data about the parts that the cols might want
+            my $filter = $it->{FILTER};
+            my $stack = $it->getStack();
+            my $src = getLinkForResource($stack);
+            
+            my $srcHasQuestion = $src =~ /\?/;
+            $args->{"resourceLink"} = $src.
+                ($srcHasQuestion?'&':'?') .
+                'symb=' . &Apache::lonnet::escape($curRes->symb()).
+                '"';
             
             # Now, display each column.
             foreach my $col (@$cols) {
-                $result .= "    <td>";
 
                 # If this is the first column and it's time to print
                 # the anchor, do so
@@ -1401,7 +1443,6 @@
                     $result .= &{$preparedColumns[$col]}($curRes, $part, $args);
                 }
 
-                $result .= "</td>\n";
             }
 
             $result .= "  </tr>\n";
@@ -1411,6 +1452,11 @@
         $curRes = $it->next();
     }
     
+    # Print out the part that jumps to #curloc if it exists
+    if ($args->{"displayedJumpMarker"}) {
+        $result .= "<script>location += "#curloc";</script>\n";
+    }
+
     $result .= "</table>";
 
     return $result;