'.
+ my $result=''.
'';
+
$result.='Fullname: '.$fullname.
' Username: '.$uname.
' Domain: '.$udom.' ';
if ($ENV{'form.handgrade'} eq 'yes') {
# my $subonly = &get_last_submission($symb,$uname,$udom,$ENV{'request.course.id'});
- my ($classlist) = &getclasslist('all','0');
+# my ($classlist) = &getclasslist('all','0');
+ my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0');
my @collaborators;
# foreach ( sort(@{ $$classlist{'all'} }) ) {
# my ($uname,$udom) = split(/:/);
@@ -503,24 +506,22 @@ KEYWORDS
if (scalar(@collaborators) != 0) {
$result.='Collaborators: ';
foreach (@collaborators) {
- $result.=$_.' ('.&get_fullname($_,$udom).') ';
+ $result.=$_.' ('.$$fullname{$_.':'.$udom}.') ';
+# $result.=$_.' ('.&get_fullname($_,$udom).') ';
}
$result.=' '."\n";
$result.=' '."\n";
}
}
- $result.='
'."\n";
- $request->print($result);
+ $request->print($result.'
'."\n");
my ($partlist,$handgrade) = &response_type($url);
- # print student answer
- if ($ENV{'form.lastSub'} eq 'lastonly') {
+ # print student answer
+ if ($ENV{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) {
my ($string,$timestamp)=&get_last_submission ($symb,$uname,$udom,$ENV{'request.course.id'});
- my $lastsubonly='';
- $lastsubonly.='';
- $lastsubonly.='Last Submission Only '.
+ my $lastsubonly.=' Last Submission Only '.
($$timestamp eq '' ? '' : ' Date Submitted: '.$$timestamp).' ';
if ($$timestamp eq '') {
$lastsubonly.=''.$$string[0].' ';
@@ -532,12 +533,14 @@ KEYWORDS
my ($ressub,$subval) = split(/:/,$_,2);
$lastsubonly.='Part ID '.
$partid.' Response ID '.$respid.
- ' Submission '.&keywords_highlight($subval).' ';
+ ' Submission '.&keywords_highlight($subval).''
+ if ($ENV{'form.lastSub'} eq 'lastonly' ||
+ ($ENV{'form.lastSub'} eq 'hdgrade' && $$handgrade{$part} =~ /:yes$/));
}
}
}
}
- $lastsubonly.='
'."\n";
+ $lastsubonly.=' '."\n";
$request->print($lastsubonly);
} else {
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
@@ -554,6 +557,10 @@ KEYWORDS
my %seen = ();
my @partlist;
+ my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
+# while (my ($k,$v) = each (%record)){
+# print "key=$k ==> value=$v ";
+# }
for (sort keys(%$handgrade)) {
my ($partid,$respid) = split(/_/);
next if ($seen{$partid} > 0);
@@ -563,12 +570,10 @@ KEYWORDS
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : 'problem weight assigned by computer ');
$wgt = ($wgt > 0 ? $wgt : '1');
- my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
- my $score = ($record{'resource.0.awarded'} eq '' ? '' : $record{'resource.0.awarded'}*$wgt);
+ my $score = ($record{'resource.'.$partid.'.awarded'} eq '' ? '' : $record{'resource.'.$partid.'.awarded'}*$wgt);
# display grading options
$result=' ';
-
$result.='';
$request->print($endform);
}
-
return '';
}
@@ -672,12 +676,12 @@ sub processHandGrade {
my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'};
my %keyhash = ();
- $ENV{'form.keywords'} =~ s/,\s{0,}|\s+/ /g;
- $ENV{'form.keywords'} =~ s/^\s+|\s+$//;
- $keyhash{$symb.'_keywords'} = $ENV{'form.keywords'};
- $keyhash{$symb.'_subject'} = $ENV{'form.msgsub'};
- $keyhash{$loginuser.'_kwclr'} = $ENV{'form.kwclr'};
- $keyhash{$loginuser.'_kwsize'} = $ENV{'form.kwsize'};
+ $ENV{'form.keywords'} =~ s/,\s{0,}|\s+/ /g;
+ $ENV{'form.keywords'} =~ s/^\s+|\s+$//;
+ $keyhash{$symb.'_keywords'} = $ENV{'form.keywords'};
+ $keyhash{$symb.'_subject'} = $ENV{'form.msgsub'};
+ $keyhash{$loginuser.'_kwclr'} = $ENV{'form.kwclr'};
+ $keyhash{$loginuser.'_kwsize'} = $ENV{'form.kwsize'};
$keyhash{$loginuser.'_kwstyle'} = $ENV{'form.kwstyle'};
my ($ctr,$idx) = (1,1);
@@ -706,9 +710,10 @@ sub processHandGrade {
if ($ENV{'form.refresh'} eq 'on') {
my $ctr = 0;
- while ($ctr < $ntstu) {
+ $ENV{'form.NTSTU'}=$ngrade;
+ while ($ctr < $ngrade) {
($ENV{'form.student'},my $udom) = split(/:/,$ENV{'form.unamedom'.$ctr});
- &submission($request,$ctr,$ntstu-1);
+ &submission($request,$ctr,$ngrade-1);
$ctr++;
}
return '';
@@ -745,51 +750,50 @@ sub processHandGrade {
}
}
my $firststu = $ENV{'form.unamedom0'};
- my $laststu = $ENV{'form.unamedom'.($ngrade-1)};
-
- my ($classlist) = &getclasslist($ENV{'form.section'},'0');
- my (@nextlist,@prevlist);
- my ($nextflg,$ctr,$ctprev) = (0,0,0);
- my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
- foreach my $student ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) {
- my ($uname,$udom) = split(/:/,$student);
- my (%status) = &student_gradeStatus($ENV{'form.url'},$udom,$uname,$partlist);
- my $statusflg = '';
- foreach (keys(%status)) {
- $statusflg = 1 if ($status{$_} ne 'nothing');
- }
- next if ($statusflg eq '' && $ENV{'form.submitonly'} eq 'yes');
+ my $laststu = $ENV{'form.unamedom'.($ngrade-1)};
+ $ctr = 2;
+ while ($laststu eq '') {
+ $laststu = $ENV{'form.unamedom'.($ngrade-$ctr)};
+ $ctr++;
+ $laststu = $firststu if ($ctr > $ngrade);
+ }
+ my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0');
+ my (@parsedlist,@nextlist);
+ my ($nextflg) = 0;
+ foreach ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) {
if ($nextflg == 1 && $button =~ /Next$/) {
- push @nextlist,$uname if ($ctr < $ntstu);
- $ctr++;
- last if ($ctr == $ntstu);
+ push @parsedlist,$_;
}
- $nextflg = 1 if ($student eq $laststu);
+ $nextflg = 1 if ($_ eq $laststu);
if ($button eq 'Previous') {
- last if ($student eq $firststu);
- push @prevlist,$uname;
- $ctprev++;
+ last if ($_ eq $firststu);
+ push @parsedlist,$_;
}
}
-
- if ($button eq 'Previous') {
- if ($ctprev <= $ntstu) {
- @nextlist = @prevlist;
- } else {
- my $idx = 0;
- my $start = $ctprev - $ntstu;
- while ($idx < $ntstu) {
- $nextlist[$idx] = $prevlist[$start+$idx];
- $idx++;
+ $ctr = 0;
+ my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
+ @parsedlist = reverse @parsedlist if ($button eq 'Previous');
+ foreach my $student (@parsedlist) {
+ my ($uname,$udom) = split(/:/,$student);
+ if ($ENV{'form.submitonly'} eq 'yes') {
+ my (%status) = &student_gradeStatus($ENV{'form.url'},$udom,$uname,$partlist) ;
+ my $statusflg = '';
+ foreach (keys(%status)) {
+ $statusflg = 1 if ($status{$_} ne 'nothing');
}
+ next if ($statusflg eq '');
}
+ push @nextlist,$student if ($ctr < $ntstu);
+ $ctr++;
}
$ctr = 0;
my $total = scalar(@nextlist)-1;
- foreach my $student (@nextlist) {
- $ENV{'form.student'} = $student;
+ foreach (sort @nextlist) {
+ my ($uname,$udom) = split(/:/);
+ $ENV{'form.student'} = $uname;
+ $ENV{'form.fullname'} = $$fullname{$_};
&submission($request,$ctr,$total);
$ctr++;
}
@@ -830,10 +834,10 @@ sub saveHandGrade {
if ( scalar(keys(%newrecord)) > 0 ) {
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
- while (my ($k,$v) = each %newrecord) {
- print "k=$k:v=$v: \n";
- }
-# &Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},$domain,$stuname);
+# while (my ($k,$v) = each %newrecord) {
+# print "k=$k:v=$v: \n";
+# }
+ &Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},$domain,$stuname);
}
return '';
}
@@ -974,11 +978,11 @@ sub viewGradeaStu_form {
$result.=' View/Grade an Individual Student\'s Submission '."\n";
$result.=''."\n";
$result.='
");
hwdWin.document.write("