[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 24 Oct 2006 01:03:55 -0000
albertel Mon Oct 23 21:03:55 2006 EDT
Modified files:
/loncom/homework grades.pm
Log:
- grade wuith a specific CODE on the grade entire set/page
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.381 loncom/homework/grades.pm:1.382
--- loncom/homework/grades.pm:1.381 Mon Oct 23 18:32:09 2006
+++ loncom/homework/grades.pm Mon Oct 23 21:03:54 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.381 2006/10/23 22:32:09 albertel Exp $
+# $Id: grades.pm,v 1.382 2006/10/24 01:03:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1570,12 +1570,14 @@
}
sub show_problem {
- my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode) = @_;
+ my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode,$form) = @_;
my $rendered;
+ my %form = ((ref($form) eq 'HASH')? %{$form} : ());
&Apache::lonxml::remember_problem_counter();
if ($mode eq 'both' or $mode eq 'text') {
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
- $env{'request.course.id'});
+ $env{'request.course.id'},
+ undef,\%form);
}
if ($removeform) {
$rendered=~s|<form(.*?)>||g;
@@ -1585,8 +1587,10 @@
my $companswer;
if ($mode eq 'both' or $mode eq 'answer') {
&Apache::lonxml::restore_problem_counter();
- $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
- $env{'request.course.id'});
+ $companswer=
+ &Apache::loncommon::get_student_answers($symb,$uname,$udom,
+ $env{'request.course.id'},
+ %form);
}
if ($removeform) {
$companswer=~s|<form(.*?)>||g;
@@ -3778,6 +3782,9 @@
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n";
+ $result.=' <b>'.&mt('Use CODE:').' </b>'.
+ '<input type="text" name="CODE" value="" /><br />'."\n";
+
$result.=' <input type="button" '.
'onClick="javascript:checkPickOne(this.form);"value="Next->" /><br />'."\n";
@@ -3871,6 +3878,11 @@
my $result='<h3><font color="#339933"> '.$env{'form.title'}.'</font></h3>';
$result.='<h3> Student: '.&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom).
'</h3>'."\n";
+ if (&Apache::lonnet::validCODE($env{'form.CODE'})) {
+ $result.='<h3> CODE: '.$env{'form.CODE'}.'</h3>'."\n";
+ } else {
+ delete($env{'form.CODE'});
+ }
&sub_page_js($request);
$request->print($result);
@@ -3895,6 +3907,10 @@
'<input type="hidden" name="overRideScore" value="no" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n";
+ if (defined($env{'form.CODE'})) {
+ $studentTable.=
+ '<input type="hidden" name="CODE" value="'.$env{'form.CODE'}.'" />'."\n";
+ }
my $checkIcon = '<img alt="'.&mt('Check Mark').
'" src="'.$request->dir_config('lonIconsURL').
'/check.gif" height="16" border="0" />';
@@ -3921,11 +3937,12 @@
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$prob.
(scalar(@{$parts}) == 1 ? '' : '<br />('.scalar(@{$parts}).' parts)').'</td>';
$studentTable.='<td valign="top">';
+ my %form = ('CODE' => $env{'form.CODE'},);
if ($env{'form.vProb'} eq 'yes' ) {
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
undef,'both');
} else {
- my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'});
+ my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
$companswer =~ s|<form(.*?)>||g;
$companswer =~ s|</form>||g;
# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a>
@@ -4084,7 +4101,7 @@
if ($displaySub[2]) {
$studentTable.='Manually graded by '.$displaySub[2];
}
- $studentTable.=' </td></tr>3';
+ $studentTable.=' </td></tr>';
}
$studentTable.='</table></td></tr></table>';
@@ -4204,10 +4221,20 @@
$changeflag++;
}
if (scalar(keys(%newrecord)) > 0) {
+ my %record =
+ &Apache::lonnet::restore($symbx,$env{'request.course.id'},
+ $udom,$uname);
+
+ if (&Apache::lonnet::validCODE($env{'form.CODE'})) {
+ $newrecord{'resource.CODE'} = $env{'form.CODE'};
+ } elsif (&Apache::lonnet::validCODE($record{'resource.CODE'})) {
+ $newrecord{'resource.CODE'} = '';
+ }
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'},
$udom,$uname);
- my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},
- $udom,$uname);
+ %record = &Apache::lonnet::restore($symbx,
+ $env{'request.course.id'},
+ $udom,$uname);
&check_and_remove_from_queue($parts,\%record,undef,$symbx,
$cdom,$cnum,$udom,$uname);
}