'.
'';
@@ -1195,27 +1199,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 +1287,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 +1331,7 @@ sub submission {
' '."\n".
' '."\n".
' '."\n".
+ ' '."\n".
' '."\n".
' '."\n".
' '."\n".
@@ -1350,10 +1382,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 +1502,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 +1528,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$/));
@@ -2327,18 +2375,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 +2773,9 @@ LISTJAVASCRIPT
$result.='