[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm assesscalc.pm classcalc.pm studentcalc.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 23 Jun 2003 19:58:19 -0000


This is a MIME encoded message

--matthew1056398299
Content-Type: text/plain

matthew		Mon Jun 23 15:58:19 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	Spreadsheet.pm assesscalc.pm 
                                 	classcalc.pm studentcalc.pm 
  Log:
  Bug 1729 - color hints on export/import rows.  The color of the export
  row of the assessment sheet is the same as the import row of the 
  student sheet.  The export row of the student sheet is the same color
  as the import rows of the course level sheet.
  
  
--matthew1056398299
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20030623155819.txt"

Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.16 loncom/interface/spreadsheet/Spreadsheet.pm:1.17
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.16	Fri Jun 20 12:14:30 2003
+++ loncom/interface/spreadsheet/Spreadsheet.pm	Mon Jun 23 15:58:18 2003
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.16 2003/06/20 16:14:30 matthew Exp $
+# $Id: Spreadsheet.pm,v 1.17 2003/06/23 19:58:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1143,13 +1143,15 @@
 ############################################
 sub html_export_row {
     my $self = shift();
+    my ($color) = @_;
+    $color = '#CCCCFF' if (! defined($color));
     my $allowed = &Apache::lonnet::allowed('mgr',$ENV{'request.course.id'});
     my $row_html;
     my @rowdata = $self->get_row(0);
     foreach my $cell (@rowdata) {
         if ($cell->{'name'} =~ /^[A-Z]/) {
-	    $row_html .= '<td bgcolor="#CCCCFF">'.
-                &html_editable_cell($cell,'#CCCCFF',$allowed).'</td>';
+	    $row_html .= '<td bgcolor="'.$color.'">'.
+                &html_editable_cell($cell,$color,$allowed).'</td>';
         } else {
 	    $row_html .= '<td bgcolor="#DDCCFF">'.
                 &html_editable_cell($cell,'#DDCCFF',$allowed).'</td>';
@@ -1161,14 +1163,14 @@
 sub html_template_row {
     my $self = shift();
     my $allowed = &Apache::lonnet::allowed('mgr',$ENV{'request.course.id'});
-    my ($num_uneditable) = @_;
+    my ($num_uneditable,$importcolor) = @_;
     my $row_html;
     my @rowdata = $self->get_template_row();
     my $count = 0;
     for (my $i = 0; $i<=$#rowdata; $i++) {
         my $cell = $rowdata[$i];
         if ($i < $num_uneditable) {
-	    $row_html .= '<td bgcolor="#FFDDDD">'.
+	    $row_html .= '<td bgcolor="'.$importcolor.'">'.
                 &html_uneditable_cell($cell,'#FFDDDD',$allowed).'</td>';
         } else {
 	    $row_html .= '<td bgcolor="#EOFFDD">'.
@@ -1222,14 +1224,19 @@
 
 sub html_row {
     my $self = shift();
-    my ($num_uneditable,$row) = @_;
+    my ($num_uneditable,$row,$exportcolor,$importcolor) = @_;
     my $allowed = &Apache::lonnet::allowed('mgr',$ENV{'request.course.id'});
     my @rowdata = $self->get_row($row);
     my $num_cols_output = 0;
     my $row_html;
+    my $color = $importcolor;
+    if ($row == 0) {
+        $color = $exportcolor;
+    }
+    $color = '#FFDDDD' if (! defined($color));
     foreach my $cell (@rowdata) {
 	if ($num_cols_output++ < $num_uneditable) {
-	    $row_html .= '<td bgcolor="#FFDDDD">';
+	    $row_html .= '<td bgcolor="'.$color.'">';
 	    $row_html .= &html_uneditable_cell($cell,'#FFDDDD');
 	} else {
 	    $row_html .= '<td bgcolor="#EOFFDD">';
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.13 loncom/interface/spreadsheet/assesscalc.pm:1.14
--- loncom/interface/spreadsheet/assesscalc.pm:1.13	Thu Jun 12 17:17:11 2003
+++ loncom/interface/spreadsheet/assesscalc.pm	Mon Jun 23 15:58:18 2003
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.13 2003/06/12 21:17:11 matthew Exp $
+# $Id: assesscalc.pm,v 1.14 2003/06/23 19:58:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -371,13 +371,15 @@
     ###################################
     # Determine table structure
     ###################################
+    my $importcolor = '#FFFFFF';
+    my $exportcolor = '#FFFF66';
     my $num_uneditable = 1;
     my $num_left = 52-$num_uneditable;
     my $tableheader =<<"END";
 <table border="2">
 <tr>
   <th colspan="2" rowspan="2"><font size="+2">Assessment</font></th>
-  <td bgcolor="#FFDDDD" colspan="$num_uneditable">&nbsp;</td>
+  <td bgcolor="$importcolor" colspan="$num_uneditable">&nbsp;</td>
   <td colspan="$num_left">
       <b><font size="+1">Calculations</font></b></td>
 </tr><tr>
@@ -385,7 +387,7 @@
     my $label_num = 0;
     foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){
         if ($label_num<$num_uneditable) { 
-            $tableheader .= '<td bgcolor="#FFDDDD">';
+            $tableheader .= '<td bgcolor="'.$importcolor.'">';
         } else {
             $tableheader .= '<td>';
         }
@@ -398,11 +400,12 @@
     #
     # Print out template row
     $r->print('<tr><td>Template</td><td>&nbsp;</td>'.
-	      $self->html_template_row($num_uneditable)."</tr>\n");
+	      $self->html_template_row($num_uneditable,$importcolor).
+              "</tr>\n");
     #
     # Print out summary/export row
     $r->print('<tr><td>Export</td><td>0</td>'.
-	      $self->html_export_row()."</tr>\n");
+	      $self->html_export_row($exportcolor)."</tr>\n");
     #
     # Prepare to output rows
     $tableheader =<<"END";
@@ -411,7 +414,7 @@
 END
     foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){
 	if ($label_num<$num_uneditable) { 
-            $tableheader.='<th bgcolor="#FFDDDD">';
+            $tableheader.='<th bgcolor="'.$importcolor.'">';
         } else {
             $tableheader.='<th>';
         }
@@ -424,7 +427,7 @@
 	    $r->print("</table>\n".$tableheader);
 	}
 	$r->print('<tr><td>'.$rownum.'</td>'.
-                  $self->assess_html_row($rownum)."</tr>\n");
+                  $self->assess_html_row($rownum,$importcolor)."</tr>\n");
     }
     $r->print("</table>\n");
     return;
@@ -432,7 +435,7 @@
 
 sub assess_html_row {
     my $self = shift();
-    my ($row) = @_;
+    my ($row,$importcolor) = @_;
     my $parameter_name = $self->{'formulas'}->{'A'.$row};
     my @rowdata = $self->get_row($row);
     my $num_cols_output = 0;
@@ -446,7 +449,7 @@
     }
     foreach my $cell (@rowdata) {
         if ($num_cols_output < 1) {
-            $row_html .= '<td bgcolor="#FFDDDD">';
+            $row_html .= '<td bgcolor="'.$importcolor.'">';
             $row_html .= &Apache::Spreadsheet::html_uneditable_cell($cell,
                                                                     '#FFDDDD');
         } else {
Index: loncom/interface/spreadsheet/classcalc.pm
diff -u loncom/interface/spreadsheet/classcalc.pm:1.9 loncom/interface/spreadsheet/classcalc.pm:1.10
--- loncom/interface/spreadsheet/classcalc.pm:1.9	Mon Jun 23 12:06:11 2003
+++ loncom/interface/spreadsheet/classcalc.pm	Mon Jun 23 15:58:18 2003
@@ -1,5 +1,5 @@
 #
-# $Id: classcalc.pm,v 1.9 2003/06/23 16:06:11 matthew Exp $
+# $Id: classcalc.pm,v 1.10 2003/06/23 19:58:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,6 +112,8 @@
     ###################################
     # Determine table structure
     ###################################
+    my $importcolor = '#88FF88';
+    my $exportcolor = '#BBBBFF';
     my $num_uneditable = 26;
     my $num_left = 52-$num_uneditable;
     my $tableheader =<<"END";
@@ -119,7 +121,7 @@
 <table border="2">
 <tr>
   <th colspan="2" rowspan="2"><font size="+2">Course</font></th>
-  <td bgcolor="#FFDDDD" colspan="$num_uneditable">
+  <td bgcolor="$importcolor" colspan="$num_uneditable">
       <b><font size="+1">Import</font></b></td>
   <td colspan="$num_left">
       <b><font size="+1">Calculations</font></b></td>
@@ -128,7 +130,7 @@
     my $label_num = 0;
     foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){
         if ($label_num<$num_uneditable) { 
-            $tableheader.='<th bgcolor="#FFDDDD">';
+            $tableheader.='<th bgcolor="'.$importcolor.'">';
         } else {
             $tableheader.='<th>';
         }
@@ -141,11 +143,12 @@
     #
     # Print out template row
     $r->print('<tr><td>Template</td><td>&nbsp;</td>'.
-	      $self->html_template_row($num_uneditable)."</tr>\n");
+	      $self->html_template_row($num_uneditable,$importcolor).
+              "</tr>\n");
     #
     # Print out summary/export row
     $r->print('<tr><td>Summary</td><td>0</td>'.
-	      $self->html_export_row()."</tr>\n");
+	      $self->html_export_row($exportcolor)."</tr>\n");
     #
     # Prepare to output rows
     $tableheader =<<"END";
@@ -157,7 +160,7 @@
 END
     foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){
 	if ($label_num<$num_uneditable) { 
-            $tableheader.='<th bgcolor="#FFDDDD">';
+            $tableheader.='<th bgcolor="'.$importcolor.'">';
         } else {
             $tableheader.='<th>';
         }
@@ -180,7 +183,9 @@
 		  '<td>'.$student->{'domain'}  .'</td>'.
 		  '<td>'.$student->{'section'} .'</td>'.
 		  '<td>'.$student->{'status'}  .'</td>'.
-		  $self->html_row($num_uneditable,$rownum)."</tr>\n");
+		  $self->html_row($num_uneditable,$rownum,$exportcolor,
+                                  $importcolor).
+                  "</tr>\n");
     }
     $r->print("</table></p>\n");
     return;
Index: loncom/interface/spreadsheet/studentcalc.pm
diff -u loncom/interface/spreadsheet/studentcalc.pm:1.11 loncom/interface/spreadsheet/studentcalc.pm:1.12
--- loncom/interface/spreadsheet/studentcalc.pm:1.11	Thu Jun 12 17:17:11 2003
+++ loncom/interface/spreadsheet/studentcalc.pm	Mon Jun 23 15:58:18 2003
@@ -1,5 +1,5 @@
 #
-# $Id: studentcalc.pm,v 1.11 2003/06/12 21:17:11 matthew Exp $
+# $Id: studentcalc.pm,v 1.12 2003/06/23 19:58:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -147,6 +147,8 @@
 sub outsheet_html {
     my $self = shift;
     my ($r) = @_;
+    my $importcolor = '#FFFF66';
+    my $exportcolor = '#88FF88';
     ####################################
     # Get the list of assessment files #
     ####################################
@@ -163,7 +165,7 @@
 <table border="2">
 <tr>
   <th colspan="2" rowspan="2"><font size="+2">Student</font></th>
-  <td bgcolor="#FFDDDD" colspan="$num_uneditable">
+  <td bgcolor="$importcolor" colspan="$num_uneditable">
       <b><font size="+1">Import</font></b></td>
   <td colspan="$num_left">
       <b><font size="+1">Calculations</font></b></td>
@@ -172,7 +174,7 @@
     my $label_num = 0;
     foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){
         if ($label_num<$num_uneditable) { 
-            $tableheader .='<td bgcolor="#FFDDDD">';
+            $tableheader .='<td bgcolor="'.$importcolor.'">';
         } else {
             $tableheader .='<td>';
         }
@@ -191,12 +193,13 @@
         # Print out template row
         if (exists($ENV{'request.role.adv'}) && $ENV{'request.role.adv'}) {
             $r->print('<tr><td>Template</td><td>&nbsp;</td>'.
-                      $self->html_template_row($num_uneditable)."</tr>\n");
+                      $self->html_template_row($num_uneditable,
+                                               $importcolor)."</tr>\n");
         }
         #
         # Print out summary/export row
         $r->print('<tr><td>Summary</td><td>0</td>'.
-                  $self->html_export_row()."</tr>\n");
+                  $self->html_export_row($exportcolor)."</tr>\n");
     }
     $r->print("</table>\n");
     #
@@ -259,7 +262,8 @@
                 $row_output .= 
                     '<td colspan="52">Unavailable at this time</td></tr>'."\n";
             } else {
-                $row_output .= $self->html_row($num_uneditable,$rownum).
+                $row_output .= $self->html_row($num_uneditable,$rownum,
+                                               $exportcolor,$importcolor).
                     "</tr>\n";
             }
             $r->print($row_output);

--matthew1056398299--