'.
'';
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.=' Part '.(split(/_/))[0].' Status ';
@@ -557,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++;
@@ -577,8 +595,7 @@ LISTJAVASCRIPT
$gradeTable.=''.$ctr.' '.
' '."\n".
- ' '.$$fullname{$student}.' '."\n".
- '('.$uname.') '."\n";
+ ''.&nameUserString(undef,$$fullname{$student},$uname,$udom).' '."\n";
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
foreach (sort keys(%status)) {
@@ -611,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/;
@@ -758,7 +775,9 @@ sub sub_page_js {
var points = formname["GD_BOX"+i+"_"+partid].value;
if (points == "") {
var name = formname["name"+i].value;
- var resp = confirm("You did not assign a score for "+name+", part "+partid+". Continue?");
+ var studentID = (name != '' ? name : formname["unamedom"+i].value);
+ var resp = confirm("You did not assign a score for "+studentID+
+ ", part "+partid+". Continue?");
if (resp == false) {
formname["GD_BOX"+i+"_"+partid].focus();
return false;
@@ -1183,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;
@@ -1252,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
@@ -1288,6 +1334,7 @@ sub submission {
' '."\n".
' '."\n".
' '."\n".
+ ' '."\n".
' '."\n".
' '."\n".
' '."\n".
@@ -1338,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);
@@ -1351,9 +1407,7 @@ KEYWORDS
my $result=''."\n".
''."\n";
- $result.='Fullname: '.$ENV{'form.fullname'}.
- ' Username: '.$uname.
- ($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').' '."\n";
+ $result.='Fullname: '.&nameUserString(undef,$ENV{'form.fullname'},$uname,$udom).' '."\n";
$result.=' '."\n";
@@ -1451,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.
@@ -1470,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$/));
@@ -1531,17 +1592,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 +2236,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 +2292,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 +2353,7 @@ sub editgrades {
my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= ' '.$$fullname{$usercolon}.
- ' ('.$uname.($udom eq $ENV{'user.domain'} ? '' : '$udom').') ';
+ $line .= ''.&nameUserString(undef,$$fullname{$usercolon},$uname,$udom).' ';
my $usec=$classlist->{"$uname:$udom"}[5];
if (!&canmodify($usec)) {
my $numcols=scalar(@partid)*4+2;
@@ -2312,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) {
@@ -2495,7 +2570,6 @@ to this page if the data selected is ins
$javascript
ENDPICK
- $request->print(&show_grading_menu_form($symb,$url));
return '';
}
@@ -2712,7 +2786,9 @@ LISTJAVASCRIPT
$result.='