--- loncom/homework/grades.pm 2006/10/17 20:19:31 1.380
+++ loncom/homework/grades.pm 2006/10/24 01:03:54 1.382
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.380 2006/10/17 20:19:31 albertel Exp $
+# $Id: grades.pm,v 1.382 2006/10/24 01:03:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1469,7 +1469,8 @@ sub get_increment {
#--- displays the grading box, used in essay type problem and grading by page/sequence
sub gradeBox {
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
- my $checkIcon = ' ';
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
my $wgtmsg = ($wgt > 0 ? '(problem weight)' :
@@ -1492,10 +1493,10 @@ sub gradeBox {
my $increment = &get_increment();
$result.='
'."\n";
+ $studentTable.=' ' if ($ptr%2 == 0);
+ $studentTable.=''."\n";
$studentTable.=' " />'."\n";
@@ -3830,9 +3839,10 @@ sub getSymbMap {
1,0,1);
for my $sequence ($navmap->getById('0.0'), @sequences) {
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
- my $title = $minder.'.'.$sequence->compTitle();
- push @titles, $title; # minder in case two titles are identical
- $symbx{$title} = $sequence->symb();
+ my $title = $minder.'.'.
+ &HTML::Entities::encode($sequence->compTitle(),'"\'&');
+ push(@titles, $title); # minder in case two titles are identical
+ $symbx{$title} = &HTML::Entities::encode($sequence->symb(),'"\'&');
$minder++;
}
}
@@ -3868,6 +3878,11 @@ sub displayPage {
my $result=' '.$env{'form.title'}.' ';
$result.=' Student: '.&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom).
' '."\n";
+ if (&Apache::lonnet::validCODE($env{'form.CODE'})) {
+ $result.=' CODE: '.$env{'form.CODE'}.' '."\n";
+ } else {
+ delete($env{'form.CODE'});
+ }
&sub_page_js($request);
$request->print($result);
@@ -3892,7 +3907,12 @@ sub displayPage {
' '."\n".
' '."\n";
- my $checkIcon = ' '."\n";
+ }
+ my $checkIcon = ' ';
$studentTable.=' Note: Problems graded correct by the computer are marked with a '.$checkIcon.
@@ -3917,11 +3937,12 @@ sub displayPage {
$studentTable.=''.$prob.
(scalar(@{$parts}) == 1 ? '' : ' ('.scalar(@{$parts}).' parts)').' ';
$studentTable.='';
+ 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|||g;
# while ($companswer =~ /()/s) { # '."\n".
' '.
+ 'onClick="javascript:checkSubmitPage(this.form,'.$question.');" />'.
''."\n";
$studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
@@ -4200,10 +4221,20 @@ sub updateGradeByPage {
$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);
}
@@ -4321,14 +4352,14 @@ sub scantron_CODElist {
}
sub scantron_CODEunique {
- my $result='
+ my $result='
Yes
-
-
+
+
No
- ';
+ ';
return $result;
}