--- loncom/homework/grades.pm 2003/07/29 14:24:24 1.127
+++ loncom/homework/grades.pm 2003/09/19 21:54:07 1.140
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.127 2003/07/29 14:24:24 ng Exp $
+# $Id: grades.pm,v 1.140 2003/09/19 21:54:07 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -96,6 +96,18 @@ sub get_fullname {
return $fullname;
}
+#--- Format fullname, username:domain if different for display
+#--- Use anywhere where the student names are listed
+sub nameUserString {
+ my ($type,$fullname,$uname,$udom) = @_;
+ if ($type eq 'header') {
+ return ' Fullname (Username) ';
+ } else {
+ return ' '.$fullname.' ('.$uname.
+ ($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').')';
+ }
+}
+
#--- Get the partlist and the response type for a given problem. ---
#--- Indicate if a response type is coded handgraded or not. ---
sub response_type {
@@ -206,7 +218,8 @@ sub commonJSfunctions {
}
}
} else {
- if (selectOne.selected) return selectOne.value;
+ // only one value it must be the selected one
+ return selectOne.value;
}
}
@@ -298,7 +311,7 @@ sub student_gradeStatus {
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
my %partstatus = ();
foreach (@$partlist) {
- my ($status,$foo) = split(/_/,$record{"resource.$_.solved"},2);
+ my ($status,undef) = split(/_/,$record{"resource.$_.solved"},2);
$status = 'nothing' if ($status eq '');
$partstatus{$_} = $status;
my $subkey = "resource.$_.submitted_by";
@@ -505,8 +518,8 @@ LISTJAVASCRIPT
my $saveStatus = $ENV{'form.Status'} eq '' ? 'Active' : $ENV{'form.Status'};
$ENV{'form.Status'} = $saveStatus;
- $gradeTable.=' last sub only'."\n".
- ' last sub & parts info'."\n".
+ $gradeTable.=' last submission only'."\n".
+ ' last submission & parts info'."\n".
' by dates and submissions'."\n".
' all details'."\n".
''."\n".
@@ -532,15 +545,14 @@ LISTJAVASCRIPT
$gradeTable.='" />'."\n";
-
+ $gradeTable.='Check For Plagiarism';
my (undef, undef, $fullname) = &getclasslist($getsec,'1');
$gradeTable.='
'.
'
';
my $loop = 0;
while ($loop < 2) {
$gradeTable.='
No.
Select
'.
- '
Fullname '.
- '(Username)
';
+ '
'.&nameUserString('header').'
';
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
foreach (sort(@$partlist)) {
$gradeTable.='
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.
@@ -1467,7 +1488,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$/));
@@ -1528,17 +1549,21 @@ KEYWORDS
my %seen = ();
my @partlist;
+ my @gradePartRespid;
for (sort keys(%$handgrade)) {
my ($partid,$respid) = split(/_/);
next if ($seen{$partid} > 0);
$seen{$partid}++;
next if ($$handgrade{$_} =~ /:no$/ && $ENV{'form.lastSub'} =~ /^(hdgrade)$/);
push @partlist,$partid;
+ push @gradePartRespid,$partid.'.'.$respid;
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
}
$result=''."\n";
+ $result.=''."\n" if ($counter == 0);
my $ctr = 0;
while ($ctr < scalar(@partlist)) {
$result.=''."\n".
'
No.
'.
- '
Fullname (Username)
'."\n";
+ '
'.&nameUserString('header')."
\n";
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
@@ -2160,7 +2183,7 @@ sub viewgrades {
#--- call by previous routine to display each student
sub viewstudentgrade {
- my ($$url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
+ 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);
@@ -2216,8 +2239,9 @@ sub editgrades {
$title.='Section: '.$ENV{'form.section'}.''."\n";
my $result= '
'."\n";
- $result.= '
No.
'.
- '
Fullname (username)
'."\n";
+ $result.= '
'.
+ '
No.
'.
+ '
'.&nameUserString('header')."
\n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -2276,8 +2300,7 @@ sub editgrades {
my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= '