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

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 14 Apr 2004 21:22:44 -0000


matthew		Wed Apr 14 17:22:44 2004 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  &evalgraph and &diffgraph: Only output 2 digits beyond the decimal
  point.  No need to report a degree of difficulty of 0.47474747474747.
  Also xhtml-ized.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.70 loncom/interface/lonmeta.pm:1.71
--- loncom/interface/lonmeta.pm:1.70	Wed Apr 14 16:45:14 2004
+++ loncom/interface/lonmeta.pm	Wed Apr 14 17:22:44 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.70 2004/04/14 20:45:14 matthew Exp $
+# $Id: lonmeta.pm,v 1.71 2004/04/14 21:22:44 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -114,21 +114,21 @@
         return '';
     }
     my $val=int($value*10.+0.5)-10;
-    my $output='<table border=0 cellpadding=0 cellspacing=0><tr>';
+    my $output='<table border="0" cellpadding="0" cellspacing="0"><tr>';
     if ($val>=20) {
-	$output.='<td width=20 bgcolor="#555555">&nbsp&nbsp;</td>';
+	$output.='<td width="20" bgcolor="#555555">&nbsp&nbsp;</td>';
     } else {
-        $output.='<td width='.($val).' bgcolor="#555555">&nbsp;</td>'.
-                 '<td width='.(20-$val).' bgcolor="#FF3333">&nbsp;</td>';
+        $output.='<td width="'.($val).'" bgcolor="#555555">&nbsp;</td>'.
+                 '<td width="'.(20-$val).'" bgcolor="#FF3333">&nbsp;</td>';
     }
     $output.='<td bgcolor="#FFFF33">&nbsp;</td>';
     if ($val>20) {
-	$output.='<td width='.($val-20).' bgcolor="#33FF33">&nbsp;</td>'.
-                 '<td width='.(40-$val).' bgcolor="#555555">&nbsp;</td>';
+	$output.='<td width="'.($val-20).'" bgcolor="#33FF33">&nbsp;</td>'.
+                 '<td width="'.(40-$val).'" bgcolor="#555555">&nbsp;</td>';
     } else {
-        $output.='<td width=20 bgcolor="#555555">&nbsp&nbsp;</td>';
+        $output.='<td width="20" bgcolor="#555555">&nbsp&nbsp;</td>';
     }
-    $output.='<td> ('.$value.') </td></tr></table>';
+    $output.='<td> ('.sprintf("%5.2f",$value).') </td></tr></table>';
     return $output;
 }
 
@@ -140,15 +140,15 @@
     my $val=int(40.0*$value+0.5);
     my @colors=('#FF9933','#EEAA33','#DDBB33','#CCCC33',
                 '#BBDD33','#CCCC33','#DDBB33','#EEAA33');
-    my $output='<table border=0 cellpadding=0 cellspacing=0><tr>';
+    my $output='<table border="0" cellpadding="0" cellspacing="0"><tr>';
     for (my $i=0;$i<8;$i++) {
 	if ($val>$i*5) {
-            $output.='<td width=5 bgcolor="'.$colors[$i].'">&nbsp;</td>';
+            $output.='<td width="5" bgcolor="'.$colors[$i].'">&nbsp;</td>';
         } else {
-	    $output.='<td width=5 bgcolor="#555555">&nbsp;</td>';
+	    $output.='<td width="5" bgcolor="#555555">&nbsp;</td>';
 	}
     }
-    $output.='<td> ('.$value.') </td></tr></table>';
+    $output.='<td> ('.sprintf("%3.2f",$value).') </td></tr></table>';
     return $output;
 }