[LON-CAPA-cvs] cvs: loncom /homework grades.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Sat, 03 Nov 2007 00:08:15 -0000


albertel		Fri Nov  2 20:08:15 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - data table grade assignments
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.476 loncom/homework/grades.pm:1.477
--- loncom/homework/grades.pm:1.476	Fri Nov  2 19:41:39 2007
+++ loncom/homework/grades.pm	Fri Nov  2 20:08:09 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.476 2007/11/02 23:41:39 albertel Exp $
+# $Id: grades.pm,v 1.477 2007/11/03 00:08:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3362,15 +3362,14 @@
 
     my $symb=&get_symb($request);
     my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
-    my $title='<h3><span class="LC_info">'.&mt('Current Grade Status').'</span></h3>';
-    $title.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4><br />'."\n";
+    my $title='<h2>'.&mt('Current Grade Status').'</h2>';
+    $title.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4>'."\n";
     $title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n";
 
-    my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n";
-    $result.= '<table border="0"><tr bgcolor="#deffff">'.
-	'<td rowspan=2 valign="center">&nbsp;<b>No.</b>&nbsp;</td>'.
-	'<td rowspan=2 valign="center">'.&nameUserString('header')."</td>\n";
-
+    my $result= &Apache::loncommon::start_data_table().
+	&Apache::loncommon::start_data_table_header_row().
+	'<th rowspan="2" valign="middle">'.&mt('No.').'</th>'.
+	'<th rowspan="2" valign="middle">'.&nameUserString('header')."</th>\n";
     my %scoreptr = (
 		    'correct'  =>'correct_by_override',
 		    'incorrect'=>'incorrect_by_override',
@@ -3395,8 +3394,8 @@
     }
     my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
     foreach my $partid (@partid) {
-	$header .= '<td align="center">&nbsp;<b>Old Score</b>&nbsp;</td>'.
-	    '<td align="center">&nbsp;<b>New Score</b>&nbsp;</td>';
+	$header .= '<th align="center">Old Score</th>'.
+	    '<th align="center">New Score</th>';
 	$columns{$partid}=2;
 	foreach my $stores (@parts) {
 	    my ($part,$type) = &split_part_type($stores);
@@ -3405,22 +3404,23 @@
 	    my $display=&Apache::lonnet::metadata($url,$stores.'.display');
 	    $display =~ s/\[Part: (\w)+\]//;
 	    $display =~ s/Number of Attempts/Tries/;
-	    $header .= '<td align="center">&nbsp;<b>Old '.$display.'</b>&nbsp;</td>'.
-		'<td align="center">&nbsp;<b>New '.$display.'</b>&nbsp;</td>';
+	    $header .= '<th align="center">Old '.$display.'</th>'.
+		'<th align="center">New '.$display.'</th>';
 	    $columns{$partid}+=2;
 	}
     }
     foreach my $partid (@partid) {
 	my $display_part=&get_display_part($partid,$symb);
-	$result .= '<td colspan="'.$columns{$partid}.
-	    '" align="center"><b>Part:</b> '.$display_part.
-	    ' (Weight = '.$weight{$partid}.')</td>';
+	$result .= '<th colspan="'.$columns{$partid}.
+	    '" align="center">Part: '.$display_part.
+	    ' (Weight = '.$weight{$partid}.')</th>';
 
     }
-    $result .= '</tr><tr bgcolor="#deffff">';
-    $result .= $header;
-    $result .= '</tr>'."\n";
-    my $noupdate;
+    $result .= &Apache::loncommon::end_data_table_header_row().
+	&Apache::loncommon::start_data_table_header_row().
+	$header.
+	&Apache::loncommon::end_data_table_header_row();
+    my @noupdate;
     my ($updateCtr,$noupdateCtr) = (1,1);
     for ($i=0; $i<$env{'form.total'}; $i++) {
 	my $line;
@@ -3432,7 +3432,8 @@
 	my $usec=$classlist->{"$uname:$udom"}[5];
 	if (!&canmodify($usec)) {
 	    my $numcols=scalar(@partid)*4+2;
-	    $noupdate.=$line."<td colspan=\"$numcols\"><span class=\"LC_warning\">Not allowed to modify student</span></td></tr>";
+	    push(@noupdate,
+		 $line."<td colspan=\"$numcols\"><span class=\"LC_warning\">Not allowed to modify student</span></td></tr>");
 	    next;
 	}
         my %aggregate = ();
@@ -3501,7 +3502,7 @@
 		    '<td align="center">'.$awarded.'&nbsp;</td>';
 	    }
 	}
-	$line.='</tr>'."\n";
+	$line.="\n";
 
 	my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
 	my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -3534,10 +3535,13 @@
 		}
 	    }
 
-	    $result.='<tr bgcolor="#ffffde"><td align="right">&nbsp;'.$updateCtr.'&nbsp;</td>'.$line;
+	    $result.=&Apache::loncommon::start_data_table_row().
+		'<td align="right">&nbsp;'.$updateCtr.'&nbsp;</td>'.$line.
+		&Apache::loncommon::end_data_table_row();
 	    $updateCtr++;
 	} else {
-	    $noupdate.='<tr bgcolor="#ffffde"><td align="right">&nbsp;'.$noupdateCtr.'&nbsp;</td>'.$line;
+	    push(@noupdate,
+		 '<td align="right">&nbsp;'.$noupdateCtr.'&nbsp;</td>'.$line);
 	    $noupdateCtr++;
 	}
         if ($aggregateflag) {
@@ -3545,16 +3549,24 @@
 				  $cdom,$cnum);
         }
     }
-    if ($noupdate) {
+    if (@noupdate) {
 #	my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
 	my $numcols=scalar(@partid)*4+2;
-	$result .= '<tr bgcolor="#ffffff"><td align="center" colspan="'.$numcols.'">No Changes Occurred For the Students Below</td></tr><tr bgcolor="#ffffde">'.$noupdate;
+	$result .= &Apache::loncommon::start_data_table_row('LC_empty_row').
+	    '<td align="center" colspan="'.$numcols.'">No Changes Occurred For the Students Below</td>'.
+	    &Apache::loncommon::end_data_table_row();
+	foreach my $line (@noupdate) {
+	    $result.=
+		&Apache::loncommon::start_data_table_row().
+		$line.
+		&Apache::loncommon::end_data_table_row();
+	}
     }
-    $result .= '</table></td></tr></table>'."\n".
-	&show_grading_menu_form ($symb);
-    my $msg = '<br /><b>Number of records updated = '.$rec_update.
+    $result .= &Apache::loncommon::end_data_table().
+	&show_grading_menu_form($symb);
+    my $msg = '<p><b>Number of records updated = '.$rec_update.
 	' for '.$count.' student'.($count <= 1 ? '' : 's').'.</b><br />'.
-	'<b>Total number of students = '.$env{'form.total'}.'</b><br />';
+	'<b>Total number of students = '.$env{'form.total'}.'</b></p>';
     return $title.$msg.$result;
 }