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

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Thu, 16 Oct 2008 16:36:01 -0000


bisitz		Thu Oct 16 12:36:01 2008 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
  Log:
  - Use LON-CAPA standard table for quick grades table
  - Keep multicolor background settings, but switch from HTML attribute "bgcolor=..." to style="background-color=..." needed to keep this functional
  - Corrected table row closure (was "<tr>" instead of "</tr>")
  - Added missing &mt() call to introduction text for detailed scores table
  - Added info style to info text about time consumption
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.42 loncom/interface/lonquickgrades.pm:1.43
--- loncom/interface/lonquickgrades.pm:1.42	Sun Aug 17 19:25:40 2008
+++ loncom/interface/lonquickgrades.pm	Thu Oct 16 12:35:53 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.42 2008/08/17 23:25:40 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.43 2008/10/16 16:35:53 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -85,14 +85,15 @@
     $r->print(&Apache::loncommon::start_page($title));
 
     if (!$showPoints && !$notshowSPRSlink ) {
-        $r->print(<<HEADER); 
-<p>This screen shows how many problems (or problem parts) you have completed, and
-how many you have not yet done. You can also look at <a href="/adm/studentcalc">a detailed
-score sheet</a>.</p>
-HEADER
+        $r->print('<p>'
+                 .&mt('This screen shows how many problems (or problem parts) you have completed'
+                     .', and how many you have not yet done.'
+                     .' You can also look at [_1]a detailed score sheet[_2].'
+                     ,'<a href="/adm/studentcalc">','</a>')
+                 .'</p>');
     }
 
-    $r->print(&mt('This may take a few moments to display.'));
+    $r->print('<p class="LC_info">'.&mt('This may take a few moments to display.').'</p>');
 
     $r->rflush();
 
@@ -223,14 +224,15 @@
     my $indentString = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
 
     # Second pass: Print the maps.
-    $r->print('<table cellspacing="3" border="2"><tr><td align="center"><b>' .
-	      &mt('Folder') . '</b></td>');
+    $r->print(&Apache::loncommon::start_data_table()
+             .&Apache::loncommon::start_data_table_header_row()
+             .'<th>'.&mt('Folder').'</th>');
     $title = &mt($showPoints ? "Points Scored" : "Done");
     if ($totalAttempted) {
 	$title .= " / " . &mt("Attempted");
     }
-    $r->print("<td align='center'>$title / "
-	      . &mt('Total') . "</td><tr>\n\n");
+    $r->print("<th>$title / ".&mt('Total').'</td>'
+             .&Apache::loncommon::end_data_table_header_row());
     while ($depth > 0) {
         if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
         if ($curRes == $iterator->END_MAP()) { $depth--; }
@@ -246,16 +248,19 @@
                 my $ratio;
                 $ratio = $correct / $total;
                 my $color = mixColors(\@start, \@end, $ratio);
-                $r->print("<tr><td bgcolor='$color'>");
+                $r->print(&Apache::loncommon::start_data_table_row()
+                         .'<td style="background-color:'.$color.';">');
                 
 		my $thisIndent = '';
                 for (my $i = 1; $i < $depth; $i++) { $thisIndent .= $indentString; }
                 
                 $r->print("$thisIndent$title</td>");
 		if ($totalAttempted) {
-		    $r->print("<td valign='top'>$thisIndent<nobr>$correct / $attempted / $total</nobr></td></tr>\n");
+		    $r->print("<td valign='top'>$thisIndent<nobr>$correct / $attempted / $total</nobr></td>"
+                             .&Apache::loncommon::end_data_table_row());
 		} else {
-		    $r->print("<td valign='top'>$thisIndent<nobr>$correct / $total</nobr></td></tr>\n");
+		    $r->print("<td valign='top'>$thisIndent<nobr>$correct / $total</nobr></td>"
+                             .&Apache::loncommon::end_data_table_row());
 		}
             }
         }
@@ -267,9 +272,11 @@
     if ($topLevelParts > 0) {
         my $ratio = $topLevelRight / $topLevelParts;
         my $color = mixColors(\@start, \@end, $ratio);
-        $r->print("<tr><td bgcolor='$color'>");
+        $r->print(&Apache::loncommon::start_data_table_row()
+                 .'<td style="background-color:'.$color.';">');
         $r->print(&mt("Problems Not Contained In A Folder")."</td><td>");
-        $r->print("$topLevelRight / $topLevelParts</td></tr>");
+        $r->print("$topLevelRight / $topLevelParts</td>"
+                 .&Apache::loncommon::end_data_table_row());
     }
 
     if ($showPoints) {
@@ -277,13 +284,16 @@
 
 	$title = $showPoints ? "Points" : "Parts Done";
 	my $totaltitle = $showPoints ? &mt("Awarded Total Points") : &mt("Total Parts Done");
-	$r->print("<tr><td colspan='2' align='right'>$totaltitle: <b>$totalRight</b><br>");
+	$r->print(&Apache::loncommon::start_data_table_row()
+                 .'<td colspan="2" align="right">'.$totaltitle.': <b>'.$totalRight.'</b><br>');
 	$r->print(&mt("Max Possible To Date")." $maxHelpLink: <b>$totalPossible</b><br>");
 	$title = $showPoints ? "Points" : "Parts";
-	$r->print(&mt("Total $title In Course").": <b>$totalParts</b></td></tr>\n\n");
+	$r->print(&mt("Total $title In Course").': <b>'.$totalParts.'</b></td>'
+                 .&Apache::loncommon::end_data_table_row());
     }
 
-    $r->print("</table>".&Apache::loncommon::end_page());
+    $r->print(&Apache::loncommon::end_data_table()
+             .&Apache::loncommon::end_page());
 
     return OK;
 }