[LON-CAPA-cvs] cvs: loncom /homework grades.pm
ng
lon-capa-cvs@mail.lon-capa.org
Mon, 28 Jul 2003 18:04:39 -0000
This is a MIME encoded message
--ng1059415479
Content-Type: text/plain
ng Mon Jul 28 14:04:39 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
Remove a few print statements that were left inadvertantly in.
Displays all names as fullnames (username (domain if different)).
Add counter - shows number of students in a section/class.
Use Next-> to indicate further selection.
--ng1059415479
Content-Type: text/plain
Content-Disposition: attachment; filename="ng-20030728140439.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.125 loncom/homework/grades.pm:1.126
--- loncom/homework/grades.pm:1.125 Fri Jul 25 16:35:40 2003
+++ loncom/homework/grades.pm Mon Jul 28 14:04:39 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.125 2003/07/25 20:35:40 ng Exp $
+# $Id: grades.pm,v 1.126 2003/07/28 18:04:39 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -127,7 +127,7 @@
my $result ='<table border="0">'.
'<tr><td colspan=3><font size=+1><b>Current Resource: </b>'.$probTitle.'</font></td></tr>'."\n";
my ($partlist,$handgrade) = &response_type($url);
- my %resptype = (); #,$hdgrade)=('','no');
+ my %resptype = ();
my $hdgrade='no';
for (sort keys(%$handgrade)) {
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
@@ -154,12 +154,12 @@
push @ans,$ans;
}
my $grayFont = '<font color="#999999">';
- return '<table border="1">'.
+ return '<blockquote><table border="1">'.
'<tr valign="top"><td>Answer</td><td>'.
(join '</td><td>',@ans).'</td></tr>'.
'<tr valign="top"><td>'.$grayFont.'Option ID</font></td><td>'.$grayFont.
(join '</td><td>'.$grayFont,@IDs).'</font></td></tr>'.
- '</table>';
+ '</table></blockquote>';
}
if ($response eq 'essay') {
if (! exists ($ENV{'form.'.$symb})) {
@@ -174,7 +174,7 @@
$ENV{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
$ENV{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob.
}
- return &keywords_highlight($answer);
+ return '<br /><br /><blockquote>'.&keywords_highlight($answer).'</blockquote>';
}
return $answer;
}
@@ -475,7 +475,7 @@
sense = "the student";
}
if (ctr == 0) {
- alert("Please select "+sense+" before clicking on the $viewgrade button.");
+ alert("Please select "+sense+" before clicking on the Next button.");
return false;
}
document.gradesub.submit();
@@ -527,20 +527,20 @@
&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,'javascript:reLoadList(this.form);').'<br />';
}
- $gradeTable.='To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
- 'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".
- ' on the check boxes for the group of students.<br />'."\n".
+ $gradeTable.='To '.lc($viewgrade).' a submission or a group of submissions, click on the check box(es) '.
+ 'next to the student\'s name(s). Then click on the Next button.<br />'."\n".
'<input type="hidden" name="command" value="processGroup" />'."\n";
$gradeTable.='<input type="button" '."\n".
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".
- 'value="'.$viewgrade.'" />'."\n";
+ 'value="Next->" />'."\n";
my (undef, undef, $fullname) = &getclasslist($getsec,'1');
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
'<table border="0"><tr bgcolor="#e6ffff">';
my $loop = 0;
while ($loop < 2) {
- $gradeTable.='<td><b> Select </b></td><td><b> Fullname </b>'.
+ $gradeTable.='<td><b> No.</b> </td><td><b> Select </b></td>'.
+ '<td><b> Fullname </b>'.
'<font color="#999999">(Username)</font> </td>';
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
foreach (sort(@$partlist)) {
@@ -548,6 +548,7 @@
}
}
$loop++;
+# $gradeTable.='<td></td>' if ($loop%2 ==1);
}
$gradeTable.='</tr>'."\n";
@@ -574,7 +575,8 @@
$ctr++;
if ( $perm{'vgr'} eq 'F' ) {
$gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1);
- $gradeTable.='<td align="center"><input type=checkbox name="stuinfo" value="'.
+ $gradeTable.='<td align="right">'.$ctr.' </td>'.
+ '<td align="center"><input type=checkbox name="stuinfo" value="'.
$student.':'.$$fullname{$student}.' "></td>'."\n".
'<td> '.$$fullname{$student}.' '."\n".
'<font color="#999999">('.$uname.')</font></td>'."\n";
@@ -585,11 +587,12 @@
$gradeTable.='<td align="middle"> '.$status{$_}.' </td>'."\n";
}
}
+# $gradeTable.='<td></td>' if ($ctr%2 ==1);
$gradeTable.='</tr>'."\n" if ($ctr%2 ==0);
}
}
if ($ctr%2 ==1) {
- $gradeTable.='<td> </td><td> </td>';
+ $gradeTable.='<td> </td><td> </td><td> </td>';
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
foreach (@$partlist) {
$gradeTable.='<td> </td>';
@@ -601,7 +604,7 @@
$gradeTable.='</table></td></tr></table>'.
'<input type="button" '.
'onClick="javascript:checkSelect(this.form.stuinfo);" '.
- 'value="'.$viewgrade.'" /></form>'."\n";
+ 'value="Next->" /></form>'."\n";
if ($ctr == 0) {
my $num_students=(scalar(keys(%$fullname)));
if ($num_students eq 0) {
@@ -895,8 +898,7 @@
shwsel = "";
if (re.test(msgchk)) { shwsel = "checked" }
var message = document.SCORE["savemsg"+i].value;
- var shownOnce = document.SCORE["shownOnce"+i].value;
- message = (shownOnce == 0 ? checkEntities(message) : message);
+ message = (document.SCORE["shownOnce"+i].value == 0 ? checkEntities(message) : message);
displaySavedMsg(i,message,shwsel); //I do not get it. w/o checkEntities on saved messages,
//any < is already converted to <, etc. However, only once!!
}
@@ -1468,11 +1470,9 @@
'"><img src="/adm/lonIcons/unknown.gif" border=0"> File uploaded by student</a> '.
'<font color="red" size="1">Like all files provided by users, '.
'this file may contain virusses</font><br />':'').
- '<b>Submitted Answer: </b>'.($responsetype =~ /^(essay|option)$/ ?
- '<blockquote>' : '').
+ '<b>Submitted Answer: </b>'.
&cleanRecord($subval,$responsetype,$symb).
- ($responsetype =~ /^(essay|option)$/ ? '</blockquote><br />' :
- '<br /><br />').$similar."\n"
+ '<br /><br />'.$similar."\n"
if ($ENV{'form.lastSub'} eq 'lastonly' ||
($ENV{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$part} =~ /:yes$/));
@@ -1519,7 +1519,6 @@
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.';
}
$msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript
-# $result.='<tr><td bgcolor="#ffffff">'."\n".
$result='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n".
'<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n";
$result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter.
@@ -1566,11 +1565,11 @@
my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1');
$ntstu =~ s/<option>$nsel</<option selected="on">$nsel</;
$endform.=$ntstu.'student(s) ';
- $endform.='<input type="button" value="Next" '.
- 'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> '."\n".
- '<input type="button" value="Previous" '.
- 'onClick="javascript:checksubmit(this.form,\'Previous\');" TARGET=_self> ';
- $endform.='(Next and Previous do not save the scores.)'."\n" ;
+ $endform.='<input type="button" value="Previous" '.
+ 'onClick="javascript:checksubmit(this.form,\'Previous\');" TARGET=_self> '."\n".
+ '<input type="button" value="Next" '.
+ 'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> ';
+ $endform.='(Next and Previous (student) do not save the scores.)'."\n" ;
$endform.='</td><tr></table></form>';
$endform.=&show_grading_menu_form($symb,$url);
$request->print($endform);
@@ -2059,14 +2058,15 @@
'<input type="hidden" name="Status" value="'.$ENV{'form.Status'}.'" />'."\n".
'<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n";
- $result.='<h3>Assign Common Grade To ';
+ my $sectionClass;
if ($ENV{'form.section'} eq 'all') {
- $result.='Class </h3>';
+ $sectionClass='Class </h3>';
} elsif ($ENV{'form.section'} eq 'no') {
- $result.='Students in no Section </h3>';
+ $sectionClass='Students in no Section </h3>';
} else {
- $result.='Students in Section '.$ENV{'form.section'}.'</h3>';
+ $sectionClass='Students in Section '.$ENV{'form.section'}.'</h3>';
}
+ $result.='<h3>Assign Common Grade To '.$sectionClass;
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n".
'<table border=0><tr bgcolor="#ffffdd"><td>';
#radio buttons/text box for assigning points for a section or class.
@@ -2107,7 +2107,6 @@
'onChange="javascript:writeRadText(\''.$partid.'\','.
$weight{$partid}.')"> '.
'<option selected="on"> </option>'.
-# '<option>excused</option></select></td></tr>'."\n";
'<option>excused</option>'.
'<option>reset status</option></select></td></tr>'."\n";
$ctsparts++;
@@ -2119,21 +2118,14 @@
#table listing all the students in a section/class
#header of table
- $result.= '<h3>Assign Grade to Specific Students in ';
- if ($ENV{'form.section'} eq 'all') {
- $result.='the Class </h3>';
- } elsif ($ENV{'form.section'} eq 'no') {
- $result.='no Section </h3>';
- } else {
- $result.='Section '.$ENV{'form.section'}.'</h3>';
- }
+ $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><b>Fullname</b> <font color="#999999">(Username)</font></td>'."\n";
+ '<table border=0><tr bgcolor="#deffff"><td> <b>No.</b> </td>'.
+ '<td> <b>Fullname</b> <font color="#999999">(Username)</font></td>'."\n";
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
- $display =~ s/^Number of Attempts/Tries/; # makes the column narrower
+ $display =~ s|^Number of Attempts|Tries<br />|; # makes the column narrower
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
if ($display =~ /^Partial Credit Factor/) {
my ($partid) = &split_part_type($part);
@@ -2154,13 +2146,13 @@
my $uname = $_;
$uname=~s/:/_/;
$result.='<input type="hidden" name="ctr'.$ctr.'" value="'.$uname.'" />'."\n";
- $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},
- $_,$$fullname{$_},\@parts,\%weight);
$ctr++;
+ $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},
+ $_,$$fullname{$_},\@parts,\%weight,$ctr);
}
$result.='</table></td></tr></table>';
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
- $result.='<input type="button" value="Submit Changes" '.
+ $result.='<input type="button" value="Save" '.
'onClick="javascript:submit();" TARGET=_self /></form>'."\n";
if (scalar(%$fullname) eq 0) {
my $colspan=3+scalar(@parts);
@@ -2173,11 +2165,11 @@
#--- call by previous routine to display each student
sub viewstudentgrade {
- my ($url,$symb,$courseid,$student,$fullname,$parts,$weight) = @_;
+ my ($$url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
my ($uname,$udom) = split(/:/,$student);
$student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
- my $result='<tr bgcolor="#ffffdd"><td>'.
+ my $result='<tr bgcolor="#ffffdd"><td align="right">'.$ctr.' </td><td> '.
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.
'\')"; TARGET=_self>'.$fullname.'</a> '.
'<font color="#999999">('.$uname.($ENV{'user.domain'} eq $udom ? '' : ':'.$udom).')</font></td>'."\n";
@@ -2197,17 +2189,13 @@
$status = 'nothing' if ($status eq '');
$result.='<input type="hidden" name="'.'GD_'.$student.'_'.
$part.'_solved_s" value="'.$status.'" />'."\n";
- $result.='<td align="middle"><select name="'.
+ $result.='<td align="middle"> <select name="'.
'GD_'.$student.'_'.$part.'_solved" '.
'onChange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n";
-# my $optsel = '<option selected="on"> </option><option>excused</option>'."\n";
-# $optsel = '<option> </option><option selected="on">excused</option>'."\n"
-# if ($status eq 'excused');
-# $result.=$optsel;
$result.= (($status eq 'excused') ? '<option> </option><option selected="on">excused</option>'
: '<option selected="on"> </option><option>excused</option>')."\n";
$result.='<option>reset status</option>';
- $result.="</select></td>\n";
+ $result.="</select> </td>\n";
} else {
$result.='<input type="hidden" name="'.
'GD_'.$student.'_'.$part.'_'.$type.'_s" value="'.$score.'" />'.
@@ -2231,9 +2219,10 @@
my $title='<h3><font color="#339933">Current Grade Status</font></h3>';
$title.='<font size=+1><b>Current Resource: </b>'.$ENV{'form.probTitle'}.'</font><br />'."\n";
$title.='<font size=+1><b>Section: </b>'.$ENV{'form.section'}.'</font>'."\n";
+
my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n";
- $result.= '<table border="0"><tr bgcolor="#deffff">'.
- '<td rowspan=2><b>Username</b></td><td rowspan=2><b>Domain</b></td><td rowspan=2><b>Fullname</b></td>'."\n";
+ $result.= '<table border="0"><tr bgcolor="#deffff"><td rowspan=2> <b>No.</b> </td>'.
+ '<td rowspan=2> <b>Fullname</b> <font color="#999999">(username)</font></td>'."\n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -2283,6 +2272,7 @@
$result .= $header;
$result .= '</tr>'."\n";
my $noupdate;
+ my ($updateCtr,$noupdateCtr) = (1,1);
for ($i=0; $i<$ENV{'form.total'}; $i++) {
my $line;
my $user = $ENV{'form.ctr'.$i};
@@ -2291,12 +2281,11 @@
my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= '<tr bgcolor="#ffffde"><td>'.$uname.' </td><td>'.
- $udom.' </td><td>'.
- $$fullname{$usercolon}.' </td>';
+ $line .= '<td> '.$$fullname{$usercolon}.
+ ' <font color="#999999">('.$uname.($udom eq $ENV{'user.domain'} ? '' : '$udom').')</font></td>';
my $usec=$classlist->{"$uname:$udom"}[5];
if (!&canmodify($usec)) {
- my $numcols=scalar(@partid)*(scalar(@parts)-1)*2;
+ my $numcols=scalar(@partid)*4+2;
$noupdate.=$line."<td colspan=\"$numcols\"><font color=\"red\">Not allowed to modify student</font></td></tr>";
next;
}
@@ -2322,7 +2311,6 @@
if ($dropMenu eq 'reset status' &&
$old_score ne '') { # ignore if no previous attempts => nothing to reset
- print "reset status<br>";
$newrecord{'resource.'.$_.'.tries'} = 0;
$newrecord{'resource.'.$_.'.solved'} = '';
$newrecord{'resource.'.$_.'.award'} = '';
@@ -2363,14 +2351,17 @@
$count++;
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},
$udom,$uname);
- $result.=$line;
+ $result.='<tr bgcolor="#ffffde"><td align="right"> '.$updateCtr.' </td>'.$line;
+ $updateCtr++;
} else {
- $noupdate.=$line;
+ $noupdate.='<tr bgcolor="#ffffde"><td align="right"> '.$noupdateCtr.' </td>'.$line;
+ $noupdateCtr++;
}
}
if ($noupdate) {
- my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
- $result .= '<tr bgcolor="#ffffff"><td align="center" colspan="'.$numcols.'">No Changes Occured For the Students Below</td></tr>'.$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>'.$noupdate;
}
$result .= '</table></td></tr></table>'."\n".
&show_grading_menu_form ($symb,$url);
@@ -2762,34 +2753,33 @@
'<input type="hidden" name="saveState" value="'.$ENV{'form.saveState'}.'" />'."<br />\n";
$result.=' <input type="button" '.
- 'onClick="javascript:checkPickOne(this.form);"value="Submit" /><br />'."\n";
+ 'onClick="javascript:checkPickOne(this.form);"value="Next->" /><br />'."\n";
$request->print($result);
- my $studentTable.=' <b>Select a student you wish to grade</b><br>'.
+ my $studentTable.=' <b>Select a student you wish to grade and then click on the Next button.</b><br>'.
'<table border="0"><tr><td bgcolor="#777777">'.
'<table border="0"><tr bgcolor="#e6ffff">'.
+ '<td align="right"> <b>No.</b></td>'.
'<td><b> Fullname <font color="#999999">(username)</font></b></td>'.
- '<td><b> Fullname <font color="#999999">(username)</font></b></td>'.
- '<td><b> Fullname <font color="#999999">(username)</font></b></td>'.
+ '<td align="right"> <b>No.</b></td>'.
'<td><b> Fullname <font color="#999999">(username)</font></b></td></tr>';
my (undef,undef,$fullname) = &getclasslist($getsec,'1');
my $ptr = 1;
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
my ($uname,$udom) = split(/:/,$student);
- $studentTable.=($ptr%4 == 1 ? '<tr bgcolor="#ffffe6"><td>' : '</td><td>');
- $studentTable.='<input type="radio" name="student" value="'.$student.'" /> '.$$fullname{$student}.
+ $studentTable.=($ptr%2 == 1 ? '<tr bgcolor="#ffffe6">' : '</td>');
+ $studentTable.='<td align="right">'.$ptr.' </td>';
+ $studentTable.='<td> <input type="radio" name="student" value="'.$student.'" /> '.$$fullname{$student}.
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font>'."\n";
- $studentTable.=($ptr%4 == 0 ? '</td></tr>' : '');
+ $studentTable.=($ptr%2 == 0 ? '</td></tr>' : '');
$ptr++;
}
- $studentTable.='</td><td> </td><td> </td><td> ' if ($ptr%4 == 2);
- $studentTable.='</td><td> </td><td> ' if ($ptr%4 == 3);
- $studentTable.='</td><td> ' if ($ptr%4 == 0);
+ $studentTable.='</td><td> </td><td> ' if ($ptr%2 == 0);
$studentTable.='</td></tr></table></td></tr></table>'."\n";
- $studentTable.='<br /><input type="button" '.
- 'onClick="javascript:checkPickOne(this.form);"value="Submit" /></form>'."\n";
+ $studentTable.='<input type="button" '.
+ 'onClick="javascript:checkPickOne(this.form);"value="Next->" /></form>'."\n";
$studentTable.=&show_grading_menu_form($symb,$url);
$request->print($studentTable);
@@ -2883,7 +2873,6 @@
if($curRes == $iterator->BEGIN_MAP) { $depth++; }
if($curRes == $iterator->END_MAP) { $depth--; }
-# if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {
if (ref($curRes) && $curRes->is_problem()) {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
@@ -2982,7 +2971,7 @@
$$record{"$version:resource.$partid.regrader"}.' (<b>Part:</b> '.$partid.')' : '';
}
$displaySub[2].=(exists $$record{"$version:resource.regrader"}) ?
- $$record{"$version:resource.regrader"} : '';
+ $$record{"$version:resource.regrader"} : ''; # needed because old essay regrader has not parts info
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1].
($displaySub[2] eq '' ? '' : 'Manually graded by '.$displaySub[2]).' </td></tr>';
}
@@ -3062,7 +3051,6 @@
$score = 'excused';
} elsif ($dropMenu eq 'reset status'
&& $ENV{'form.solved'.$question.'_'.$partid} ne '') { #update only if previous record exists
- print "got to reset = $ENV{'form.solved'.$question.'_'.$partid}:<br>";
$newrecord{'resource.'.$partid.'.tries'} = 0;
$newrecord{'resource.'.$partid.'.solved'} = '';
$newrecord{'resource.'.$partid.'.award'} = '';
@@ -3563,7 +3551,7 @@
'The <b>complete</b> set/page/sequence: For one student</td></tr>'."\n";
$result.='<tr bgcolor="#ffffe6"><td><br />'.
- '<input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="View/Grade/Regrade" />'.
+ '<input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="Next->" />'.
'</td></tr></table>'."\n";
$result.='</td><td valign="top">';
--ng1059415479--