'.
'';
@@ -568,18 +572,21 @@ LISTJAVASCRIPT
my %status = ();
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
(%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
- my $statusflg = '';
+ my $submitted = 0;
+ my $graded = 1;
foreach (keys(%status)) {
- $statusflg = 1 if ($status{$_} ne 'nothing');
+ $submitted = 1 if ($status{$_} ne 'nothing');
+ $graded = 0 if ($status{$_} =~ /^correct/);
my ($foo,$partid,$foo1) = split(/\./,$_);
if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
- $statusflg = '';
+ $submitted = 0;
$gradeTable.=' ';
}
}
- next if ($statusflg eq '' && $submitonly eq 'yes');
+ next if (!$submitted && ($submitonly eq 'yes' || $submitonly eq 'graded'));
+ next if (!$graded && $submitonly eq 'graded');
}
$ctr++;
@@ -621,7 +628,7 @@ LISTJAVASCRIPT
} else {
$gradeTable=' '.
'No submissions found for this resource for any students. ('.$num_students.
- ' checked for submissions ';
+ ' checked for submissions) ';
}
} elsif ($ctr == 1) {
$gradeTable =~ s/type=checkbox/type=checkbox checked/;
@@ -1195,27 +1202,46 @@ sub gradeBox {
}
sub show_problem {
- my ($request,$symb,$uname,$udom,$removeform,$viewon) = @_;
- my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
- $ENV{'request.course.id'});
+ my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode) = @_;
+ my $rendered;
+ if ($mode eq 'both' or $mode eq 'text') {
+ $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
+ $ENV{'request.course.id'});
+ }
if ($removeform) {
$rendered=~s|||g;
$rendered=~s|name="submit"|name="would_have_been_submit"|g;
}
- my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
- $ENV{'request.course.id'});
+ my $companswer;
+ if ($mode eq 'both' or $mode eq 'answer') {
+ $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
+ $ENV{'request.course.id'});
+ }
if ($removeform) {
$companswer=~s|||g;
- $rendered=~s|name="submit"|name="would_have_been_submit"|g;
+ $companswer=~s|name="submit"|name="would_have_been_submit"|g;
}
my $result.='';
$result.='';
- $result.=' View of the problem - '.$ENV{'form.fullname'}.
- ' ' if ($viewon);
- $result.=''.$rendered.' ';
- $result.='Correct answer: '.$companswer;
+ if ($viewon) {
+ $result.=' ';
+ if ($mode eq 'both' or $mode eq 'text') {
+ $result.='View of the problem - ';
+ } else {
+ $result.='Correct answer: ';
+ }
+ $result.=$ENV{'form.fullname'}.' ';
+ }
+ if ($mode eq 'both') {
+ $result.=''.$rendered.' ';
+ $result.='Correct answer: '.$companswer;
+ } elsif ($mode eq 'text') {
+ $result.=' '.$rendered;
+ } elsif ($mode eq 'answer') {
+ $result.=' '.$companswer;
+ }
$result.='
';
$result.='
';
return $result;
@@ -1264,8 +1290,16 @@ sub submission {
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
- if ($ENV{'form.vProb'} eq 'yes' or !$ENV{'form.vProb'}) {
- $request->print(&show_problem($request,$symb,$uname,$udom,0,1));
+ if ($ENV{'form.vProb'} eq 'yes' or $ENV{'form.vAns'} eq 'yes') {
+ my $mode;
+ if ($ENV{'form.vProb'} eq 'yes' && $ENV{'form.vAns'} eq 'yes') {
+ $mode='both';
+ } elsif ($ENV{'form.vProb'} eq 'yes') {
+ $mode='text';
+ } elsif ($ENV{'form.vAns'} eq 'yes') {
+ $mode='answer';
+ }
+ $request->print(&show_problem($request,$symb,$uname,$udom,0,1,$mode));
}
# kwclr is the only variable that is guaranteed to be non blank
@@ -1300,6 +1334,7 @@ sub submission {
' '."\n".
' '."\n".
' '."\n".
+ ' '."\n".
' '."\n".
' '."\n".
' '."\n".
@@ -1350,10 +1385,19 @@ KEYWORDS
}
}
- if ($ENV{'form.vProb'} eq 'all') {
+ if ($ENV{'form.vProb'} eq 'all' or $ENV{'form.vAns'} eq 'all') {
$request->print(' ') if ($counter > 0);
- $request->print(&show_problem($request,$symb,$uname,$udom,1,1));
+ my $mode;
+ if ($ENV{'form.vProb'} eq 'all' && $ENV{'form.vAns'} eq 'all') {
+ $mode='both';
+ } elsif ($ENV{'form.vProb'} eq 'all' ) {
+ $mode='text';
+ } elsif ($ENV{'form.vAns'} eq 'all') {
+ $mode='answer';
+ }
+ $request->print(&show_problem($request,$symb,$uname,$udom,1,1,$mode));
}
+
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
my ($partlist,$handgrade) = &response_type($url,$symb);
@@ -1461,13 +1505,20 @@ KEYWORDS
my ($ressub,$subval) = split(/:/,$_,2);
# Similarity check
my $similar='';
- my ($oname,$odom,$ocrsid,$oessay,$osim)=&most_similar($uname,$udom,$subval);
- if ($osim) {
- $osim=int($osim*100.0);
- $similar='Essay is '.$osim.
- '% similar to an essay by '.&Apache::loncommon::plainname($oname,$odom).
- ' '.
- &keywords_highlight($oessay).' ';
+ my $oname;
+ my $odom;
+ my $ocrsid;
+ my $oessay;
+ my $osim;
+ if($ENV{'form.checkPlag'}){
+ ($oname,$odom,$ocrsid,$oessay,$osim)=&most_similar($uname,$udom,$subval);
+ if ($osim) {
+ $osim=int($osim*100.0);
+ $similar='Essay is '.$osim.
+ '% similar to an essay by '.&Apache::loncommon::plainname($oname,$odom).
+ ' '.
+ &keywords_highlight($oessay).' ';
+ }
}
$lastsubonly.=' Part '.
$partid.' ( ID '.$respid.
@@ -1480,7 +1531,7 @@ KEYWORDS
'this file may contain virusses ':'').
'Submitted Answer: '.
&cleanRecord($subval,$responsetype,$symb).
- ' '.$similar."\n"
+ ' '.$similar."\n"
if ($ENV{'form.lastSub'} eq 'lastonly' ||
($ENV{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$part} =~ /:yes$/));
@@ -1782,15 +1833,25 @@ sub processHandGrade {
}
$ctr = 0;
@parsedlist = reverse @parsedlist if ($button eq 'Previous');
+ my ($partlist) = &response_type($url);
foreach my $student (@parsedlist) {
+ my $submitonly=$ENV{'form.submitonly'};
my ($uname,$udom) = split(/:/,$student);
- if ($ENV{'form.submitonly'} eq 'yes') {
- my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
- my $statusflg = '';
- foreach (split(/:/,$ENV{'form.gradePartRespid'})){
- $statusflg = 1 if (exists ($record{'resource.'.$_.'.submission'}));
+ if ($submitonly =~ /^(yes|graded)$/) {
+# my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
+ my %status=&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
+ my $submitted = 0;
+ my $graded = 1;
+ foreach (keys(%status)) {
+ $submitted = 1 if ($status{$_} ne 'nothing');
+ $graded = 0 if ($status{$_} =~ /^correct/);
+ my ($foo,$partid,$foo1) = split(/\./,$_);
+ if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
+ $submitted = 0;
+ }
}
- next if ($statusflg eq '');
+ next if (!$submitted && ($submitonly eq 'yes' || $submitonly eq 'graded'));
+ next if (!$graded && $submitonly eq 'graded');
}
push @nextlist,$student if ($ctr < $ntstu);
last if ($ctr == $ntstu);
@@ -2327,18 +2388,17 @@ sub editgrades {
$newrecord{'resource.'.$_.'.awarded'} = 0;
$newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
$updateflag = 1;
+ } elsif (!($old_part eq $partial && $old_score eq $score)) {
+ $updateflag = 1;
+ $newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne '';
+ $newrecord{'resource.'.$_.'.solved'} = $score;
+ $rec_update++;
}
$line .= ''.$old_aw.' '.
''.$awarded.
($score eq 'excused' ? $score : '').' ';
- if (!($old_part eq $partial && $old_score eq $score)) {
- $updateflag = 1;
- $newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne '';
- $newrecord{'resource.'.$_.'.solved'} = $score;
- $rec_update++;
- }
my $partid=$_;
foreach my $stores (@parts) {
@@ -2726,7 +2786,9 @@ LISTJAVASCRIPT
$result.='