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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Thu, 01 Nov 2007 00:47:45 -0000


This is a MIME encoded message

--albertel1193878065
Content-Type: text/plain

albertel		Wed Oct 31 20:47:45 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - data table colors in pickstudents to grade and assign common grade
  
  
--albertel1193878065
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20071031204745.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.473 loncom/homework/grades.pm:1.474
--- loncom/homework/grades.pm:1.473	Wed Oct 31 14:01:34 2007
+++ loncom/homework/grades.pm	Wed Oct 31 20:47:42 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.473 2007/10/31 18:01:34 albertel Exp $
+# $Id: grades.pm,v 1.474 2007/11/01 00:47:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -865,7 +865,7 @@
     my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status;
     $env{'form.Status'} = $saveStatus;
     $gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n".
-	'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n".
+	'<label><input type="radio" name="lastSub" value="last" /> last submission &amp; parts info </label>'."\n".
 	'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n".
 	'<label><input type="radio" name="lastSub" value="all" /> all details</label><br />'."\n".
         '&nbsp;<b>Grading Increments:</b> <select name="increment">'.
@@ -902,27 +902,27 @@
     $gradeTable.=&check_buttons();
     $gradeTable.='<label><input type="checkbox" name="checkPlag" checked="checked" />Check For Plagiarism</label>';
     my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup);
-    $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
-	'<table border="0"><tr bgcolor="#e6ffff">';
+    $gradeTable.= &Apache::loncommon::start_data_table().
+	&Apache::loncommon::start_data_table_header_row();
     my $loop = 0;
     while ($loop < 2) {
-	$gradeTable.='<td><b>&nbsp;No.</b>&nbsp;</td><td><b>&nbsp;Select&nbsp;</b></td>'.
-	    '<td>'.&nameUserString('header').'&nbsp;Section/Group</td>';
+	$gradeTable.='<th>No.</th><th>Select</th>'.
+	    '<th>'.&nameUserString('header').'&nbsp;'.'Section/Group</th>';
 	if ($env{'form.showgrading'} eq 'yes' 
 	    && $submitonly ne 'queued'
 	    && $submitonly ne 'all') {
 	    foreach (sort(@$partlist)) {
 		my $display_part=&get_display_part((split(/_/))[0],$symb);
-		$gradeTable.='<td><b>&nbsp;Part: '.$display_part.
-		    ' Status&nbsp;</b></td>';
+		$gradeTable.='<th>Part: '.$display_part.
+		    ' Status</h>';
 	    }
 	} elsif ($submitonly eq 'queued') {
-	    $gradeTable.='<td><b>&nbsp;'.&mt('Queue Status').'&nbsp;</b></td>';
+	    $gradeTable.='<th>'.&mt('Queue Status').'&nbsp;</th>';
 	}
 	$loop++;
 #	$gradeTable.='<td></td>' if ($loop%2 ==1);
     }
-    $gradeTable.='</tr>'."\n";
+    $gradeTable.=&Apache::loncommon::end_data_table_header_row()."\n";
 
     my $ctr = 0;
     foreach my $student (sort 
@@ -978,13 +978,15 @@
 	my $section = $classlist->{$student}->[&Apache::loncoursedata::CL_SECTION()];
         my $group = $classlist->{$student}->[&Apache::loncoursedata::CL_GROUP()];
 	if ( $perm{'vgr'} eq 'F' ) {
-	    $gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1);
+	    if ($ctr%2 ==1) {
+		$gradeTable.= &Apache::loncommon::start_data_table_row();
+	    }
 	    $gradeTable.='<td align="right">'.$ctr.'&nbsp;</td>'.
                '<td align="center"><label><input type=checkbox name="stuinfo" value="'.
                $student.':'.$$fullname{$student}.':::SECTION'.$section.
 	       ')&nbsp;" />&nbsp;&nbsp;</label></td>'."\n".'<td>'.
 	       &nameUserString(undef,$$fullname{$student},$uname,$udom).
-	       '&nbsp;'.$section.'/'.$group.'</td>'."\n";
+	       '&nbsp;'.$section.($group ne '' ?'/'.$group:'').'</td>'."\n";
 
 	    if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
 		foreach (sort keys(%status)) {
@@ -993,7 +995,9 @@
 		}
 	    }
 #	    $gradeTable.='<td></td>' if ($ctr%2 ==1);
-	    $gradeTable.='</tr>'."\n" if ($ctr%2 ==0);
+	    if ($ctr%2 ==0) {
+		$gradeTable.=&Apache::loncommon::end_data_table_row()."\n";
+	    }
 	}
     }
     if ($ctr%2 ==1) {
@@ -1007,10 +1011,10 @@
 	    } elsif ($submitonly eq 'queued') {
 		$gradeTable.='<td>&nbsp;</td>';
 	    }
-	$gradeTable.='</tr>';
+	$gradeTable.=&Apache::loncommon::end_data_table_row();
     }
 
-    $gradeTable.='</table></td></tr></table>'."\n".
+    $gradeTable.=&Apache::loncommon::end_data_table()."\n".
 	'<input type="button" '.
 	'onClick="javascript:checkSelect(this.form.stuinfo);" '.
 	'value="Next->" /></form>'."\n";
@@ -1028,7 +1032,7 @@
 		' students checked for '.$submissions.')</span><br />';
 	}
     } elsif ($ctr == 1) {
-	$gradeTable =~ s/type=checkbox/type=checkbox checked/;
+	$gradeTable =~ s/type="checkbox"/type="checkbox" checked="checked"/;
     }
     $gradeTable.=&show_grading_menu_form($symb);
     $request->print($gradeTable);
@@ -3169,14 +3173,12 @@
 	$sectionClass=&mt('Students in Section(s) [_1]',$section_display).'</h3>';
     }
     $result.='<h3>'.&mt('Assign Common Grade To [_1]',$sectionClass);
-    $result.= '<table border=0><tr><td bgcolor="#777777">'."\n".
-	'<table border=0><tr bgcolor="#ffffdd"><td>';
+    $result.= &Apache::loncommon::start_data_table();
     #radio buttons/text box for assigning points for a section or class.
     #handles different parts of a problem
     my ($partlist,$handgrade,$responseType) = &response_type($symb);
     my %weight = ();
     my $ctsparts = 0;
-    $result.='<table border="0">';
     my %seen = ();
     my @part_response_id = &flatten_responseType($responseType);
     foreach my $part_response_id (@part_response_id) {
@@ -3188,12 +3190,14 @@
 	my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb);
 	$weight{$partid} = $wgt eq '' ? '1' : $wgt;
 
+	$result.=&Apache::loncommon::start_data_table_row().'<td>';
 	$result.='<input type="hidden" name="partid_'.
 	    $ctsparts.'" value="'.$partid.'" />'."\n";
 	$result.='<input type="hidden" name="weight_'.
 	    $partid.'" value="'.$weight{$partid}.'" />'."\n";
 	my $display_part=&get_display_part($partid,$symb);
-	$result.='<tr><td><b>Part:</b> '.$display_part.'&nbsp; &nbsp;<b>Point:</b> </td><td>';
+	$result.=
+	    '<b>Part:</b> '.$display_part.'&nbsp; &nbsp;<b>Point:</b> </td><td>';
 	$result.='<table border="0"><tr>';  
 	my $ctr = 0;
 	while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across
@@ -3208,26 +3212,27 @@
 	    $partid.'" size="4" '.'onChange="javascript:writePoint(\''.
 		$partid.'\','.$weight{$partid}.',\'textval\')" /> /'.
 	    $weight{$partid}.' (problem weight)</td>'."\n";
-	$result.= '</td><td><select name="SELVAL_'.$partid.'"'.
+	$result.= '<td><select name="SELVAL_'.$partid.'"'.
 	    'onChange="javascript:writeRadText(\''.$partid.'\','.
 		$weight{$partid}.')"> '.
 	    '<option selected="selected"> </option>'.
 	    '<option>excused</option>'.
 	    '<option>reset status</option></select></td>'.
-            '<td><label><input type="checkbox" name="FORCE_'.$partid.'" /> Override "Correct"</label></td></tr>'."\n";
+            '<td><label><input type="checkbox" name="FORCE_'.$partid.'" /> Override "Correct"</label></td>'.&Apache::loncommon::end_data_table_row()."\n";
 	$ctsparts++;
     }
-    $result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n".
+    $result.=&Apache::loncommon::end_data_table()."\n".
 	'<input type="hidden" name="totalparts" value="'.$ctsparts.'" />';
     $result.='<input type="button" value="Revert to Default" '.
-	'onClick="javascript:resetEntry('.$ctsparts.');" target="_self" />';
+	'onClick="javascript:resetEntry('.$ctsparts.');" />';
 
     #table listing all the students in a section/class
     #header of table
     $result.= '<h3>Assign Grade to Specific Students in '.$sectionClass;
-    $result.= '<table border=0><tr><td bgcolor="#777777">'."\n".
-	'<table border=0><tr bgcolor="#deffff"><td>&nbsp;<b>No.</b>&nbsp;</td>'.
-	'<td>'.&nameUserString('header')."</td>\n";
+    $result.= &Apache::loncommon::start_data_table().
+	&Apache::loncommon::start_data_table_header_row().
+	'<th>No.</th>'.
+	'<th>'.&nameUserString('header')."</th>\n";
     my (@parts) = sort(&getpartlist($symb));
     my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
     my @partids = ();
@@ -3239,16 +3244,16 @@
         push(@partids, $partid);
 	my $display_part=&get_display_part($partid,$symb);
 	if ($display =~ /^Partial Credit Factor/) {
-	    $result.='<td><b>Score Part:</b> '.$display_part.
-		' <br /><b>(weight = '.$weight{$partid}.')</b></td>'."\n";
+	    $result.='<th>Score Part: '.$display_part.
+		' <br />(weight = '.$weight{$partid}.')</th>'."\n";
 	    next;
 	} else {
 	    $display =~s/\[Part: \Q$partid\E\]/Part:<\/b> $display_part/;
 	}
 	$display =~ s|Problem Status|Grade Status<br />|;
-	$result.='<td><b>'.$display.'</td>'."\n";
+	$result.='<th>'.$display.'</th>'."\n";
     }
-    $result.='</tr>';
+    $result.=&Apache::loncommon::end_data_table_header_row();
 
     my %last_resets = 
 	&get_last_resets($symb,$env{'request.course.id'},\@partids);
@@ -3268,7 +3273,7 @@
 	$result.=&viewstudentgrade($symb,$env{'request.course.id'},
 				   $_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets);
     }
-    $result.='</table></td></tr></table>';
+    $result.=&Apache::loncommon::end_data_table();
     $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
     $result.='<input type="button" value="Save" '.
 	'onClick="javascript:submit();" target="_self" /></form>'."\n";
@@ -3291,7 +3296,7 @@
     my ($uname,$udom) = split(/:/,$student);
     my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
     my %aggregates = (); 
-    my $result='<tr bgcolor="#ffffdd"><td align="right">'.
+    my $result=&Apache::loncommon::start_data_table_row().'<td align="right">'.
 	'<input type="hidden" name="ctr'.($ctr-1).'" value="'.$student.'" />'.
 	"\n".$ctr.'&nbsp;</td><td>&nbsp;'.
 	'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.
@@ -3346,7 +3351,7 @@
 		'value="'.$score.'" size="4" /></td>'."\n";
 	}
     }
-    $result.='</tr>';
+    $result.=&Apache::loncommon::end_data_table_row();
     return $result;
 }
 

--albertel1193878065--