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

bisitz bisitz@source.lon-capa.org
Wed, 16 Dec 2009 16:09:24 -0000


bisitz		Wed Dec 16 16:09:24 2009 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Manual Grading:
  Use standard data_table for grading table
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.584 loncom/homework/grades.pm:1.585
--- loncom/homework/grades.pm:1.584	Tue Dec 15 18:26:18 2009
+++ loncom/homework/grades.pm	Wed Dec 16 16:09:24 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.584 2009/12/15 18:26:18 bisitz Exp $
+# $Id: grades.pm,v 1.585 2009/12/16 16:09:24 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1711,6 +1711,25 @@
     return $increment;
 }
 
+sub gradeBox_start {
+    return (
+        &Apache::loncommon::start_data_table()
+       .&Apache::loncommon::start_data_table_header_row()
+       .'<th>'.&mt('Part').'</th>'
+       .'<th>'.&mt('Points').'</th>'
+       .'<th>&nbsp;</th>'
+       .'<th>'.&mt('Assign Grade').'</th>'
+       .'<th>'.&mt('Weight').'</th>'
+       .'<th>'.&mt('Grade Status').'</th>'
+       .&Apache::loncommon::end_data_table_header_row()
+    );
+}
+
+sub gradeBox_end {
+    return (
+        &Apache::loncommon::end_data_table()
+    );
+}
 #--- displays the grading box, used in essay type problem and grading by page/sequence
 sub gradeBox {
     my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
@@ -1730,7 +1749,7 @@
     if ($last_resets{$partid}) {
         $aggtries = &get_num_tries($record,$last_resets{$partid},$partid);
     }
-    $result.='<table border="0"><tr>';
+    $result.=&Apache::loncommon::start_data_table_row();
     my $ctr = 0;
     my $thisweight = 0;
     my $increment = &get_increment();
@@ -1753,8 +1772,8 @@
 	$wgt.')" /></td>'."\n";
     $line.='<td>/'.$wgt.' '.$wgtmsg.
 	($$record{'resource.'.$partid.'.solved'} eq 'correct_by_student' ? '&nbsp;'.$checkIcon : '').
-	' </td><td><b>'.&mt('Grade Status').':</b>'."\n";
-    $line.='<select name="GD_SEL'.$counter.'_'.$partid.'" '.
+	' </td>'."\n";
+    $line.='<td><select name="GD_SEL'.$counter.'_'.$partid.'" '.
 	'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n";
     if ($$record{'resource.'.$partid.'.solved'} eq 'excused') {
 	$line.='<option></option>'.
@@ -1768,8 +1787,8 @@
 
 	#&mt('<td><b>Part:</b></td><td>[_1]</td><td><b>Points:</b></td><td>[_2]</td><td>or</td><td>[_3]</td>',$display_part,$radio,$line);
     $result .= 
-	    '<td><b>'.&mt('Part:').'</b></td><td>'.$display_part.'</td><td><b>'.&mt('Points:').'</b></td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>';
-    $result.='</tr></table>'."\n";
+	    '<td>'.$display_part.'</td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>';
+    $result.=&Apache::loncommon::end_data_table_row();
     $result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n".
 	'<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n".
 	'<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'.
@@ -2281,11 +2300,12 @@
     my @partlist;
     my @gradePartRespid;
     my @part_response_id = &flatten_responseType($responseType);
-    $request->print('<div class="LC_grade_assign">'.
-		    
-		    '<div class="LC_grade_assign_header">'.
-		    &mt('Assign Grades').'</div>'.
-		    '<div class="LC_grade_assign_body">');
+    $request->print(
+        '<div class="LC_grade_assign">'
+       .'<div class="LC_grade_assign_header">'
+       .&mt('Assign Grades').'</div>'
+    );
+    $request->print(&gradeBox_start()); # <div class="LC_grade_assign_body">
     foreach my $part_response_id (@part_response_id) {
     	my ($partid,$respid) = @{ $part_response_id };
 	my $part_resp = join('_',@{ $part_response_id });
@@ -2297,7 +2317,8 @@
 	push(@gradePartRespid,$partid.'.'.$respid);
 	$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
     }
-    $request->print('</div></div>');
+    $request->print(&gradeBox_end()); # </div>
+    $request->print('</div>');
 
     $request->print('<div class="LC_grade_info_links">');
     if ($perm{'vgr'}) {
@@ -4485,11 +4506,13 @@
  
 	    }
 	    if (&canmodify($usec)) {
+            $studentTable.=&gradeBox_start();
 		foreach my $partid (@{$parts}) {
 		    $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
 		    $studentTable.='<input type="hidden" name="q_'.$question.'" value="'.$partid.'" />'."\n";
 		    $question++;
 		}
+            $studentTable.=&gradeBox_end();
 		$prob++;
 	    }
 	    $studentTable.='</td></tr>';