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

stredwic lon-capa-cvs@mail.lon-capa.org
Tue, 02 Jul 2002 22:06:53 -0000


stredwic		Tue Jul  2 18:06:53 2002 EDT

  Modified files:              
    /loncom/interface	lonchart.pm 
  Log:
  There was a problem where the offsets of the checkboxs above the columns
  were not the same between Mozilla and Netscape.  Mozilla's strayed way
  far from their columns.  To remedy this, I put the check boxes and the
  column headers into a table.  The current position for the check boxes
  is center.  It is almost center in both Netscape and Mozilla, but are definitely 
  above their respective columns.  Left justified may look better, it puts
  the checkbox directly above the first character of the header.  This can
  be changed.  I had originally had the checkboxes centered and looks good
  someplaces and only ok others.  For now, I left it centered.
  
  
Index: loncom/interface/lonchart.pm
diff -u loncom/interface/lonchart.pm:1.52 loncom/interface/lonchart.pm:1.53
--- loncom/interface/lonchart.pm:1.52	Tue Jul  2 17:48:36 2002
+++ loncom/interface/lonchart.pm	Tue Jul  2 18:06:53 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonchart.pm,v 1.52 2002/07/02 21:48:36 stredwic Exp $
+# $Id: lonchart.pm,v 1.53 2002/07/02 22:06:53 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -223,13 +223,14 @@
 
 sub CreateTableHeadings {
     my ($CacheData,$studentInformation,$headings,$spacePadding)=@_;
-    my $Str='<pre>';
+    my $Str='<tr>';
 
     for(my $index=0; $index<(scalar @$headings); $index++) {
         if(!&ShouldShowColumn($CacheData, 'heading'.$index)) {
             next;
         }
 
+        $Str .= '<td align="left"><pre>';
 	my $data=$$headings[$index];
 	$Str .= $data;
 
@@ -238,6 +239,7 @@
 	$Str .= (' 'x($CacheData->{$$studentInformation[$index].'Length'}-
                       $length));
 	$Str .= $spacePadding;
+        $Str .= '</pre></td>';
     }
 
     foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) {
@@ -245,6 +247,7 @@
             next;
         }
 
+        $Str .= '<td align="left"><pre>';
         my $name = $CacheData->{$sequence.':title'};
 	$Str .= $name;
 	my @titleLength=split(//,$CacheData->{$sequence.':title'});
@@ -252,10 +255,11 @@
                      (scalar @titleLength);
 	$Str .= (' 'x$leftover);
 	$Str .= $spacePadding;
+        $Str .= '</pre></td>';
     }
 
-    $Str .= 'Total Solved/Total Problems';
-    $Str .= '</pre>';
+    $Str .= '<td>Total Solved/Total Problems</td>';
+    $Str .= '</tr></tbody></table>';
 
     return $Str;
 }
@@ -303,20 +307,17 @@
 
     my $found=0;
     my ($name, $length, $position);
-    my $present='<pre>';
+    my $present='<table border="0" cellpadding="0" cellspacing="0">';
+    $present .= '</tbody><tr>';
     for(my $index=0; $index<(scalar @$headings); $index++) {
         if(!&ShouldShowColumn($CacheData, 'heading'.$index)) {
             next;
         }
+        $present .= '<td align="center">';
         $name = $headings->[$index];
-        $length=$CacheData->{$$studentInformation[$index].'Length'};
-        $position=int($length/2);
-	$present .= (' 'x($position));
         $present .= '<input type="checkbox" checked="on" ';
         $present .= 'name="heading'.$index.'">';
-        $position+=2;
-	$present .= (' 'x($length-$position));
-	$present .= $spacePadding;
+        $present .= '</td>';
         $found++;
     }
 
@@ -324,26 +325,21 @@
         if(!&ShouldShowColumn($CacheData, 'sequence'.$sequence)) {
             next;
         }
+        $present .= '<td align="center">';
         $name = $CacheData->{$sequence.':title'};
-        $length=$CacheData->{$sequence.':columnWidth'};
-        $position=int($length/2);
-	$present .= (' 'x($position));
         $present .= '<input type="checkbox" checked="on" ';
         $present .= 'name="sequence'.$sequence.'">';
-        $position+=2;
-	$present .= (' 'x($length-$position));
-	$present .= $spacePadding;
+        $present .= '</td>';
         $found++;
     }
 
     if($found) {
-        $present .= '</pre>';
         $present  = $present;
     } else {
-        $present = '';
+        $present = '<td></td>';
     }
 
-    return $present.'</form>'."\n";;
+    return $present.'</tr></form>'."\n";;
 }
 
 sub CreateForm {