--- loncom/homework/grades.pm 2003/11/07 18:05:33 1.149
+++ loncom/homework/grades.pm 2003/11/07 19:10:51 1.150
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.149 2003/11/07 18:05:33 albertel Exp $
+# $Id: grades.pm,v 1.150 2003/11/07 19:10:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -665,8 +665,9 @@ LISTJAVASCRIPT
my ($foo,$partid,$foo1) = split(/\./,$_);
if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
$submitted = 0;
+ my ($part)=split(/\./,$partid);
$gradeTable.='';
}
}
@@ -1532,8 +1533,10 @@ KEYWORDS
$result.=$$fullname{$_}.' ';
}
$result.='
'."\n";
+ my ($part)=split(/\./,$_);
$result.=''."\n";
+ '" value="'.$part.':'.(join ':',@goodcollaborators).'" />'.
+ "\n";
}
if (scalar(@badcollaborators) > 0) {
$result.='
'; @@ -1559,15 +1562,6 @@ KEYWORDS # (3) Last submission plus the parts info # (4) The whole record for this student if ($ENV{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) { - if ($ENV{'form.'.$uname.':'.$udom.':submitted_by'}) { - my $submitby=''. - 'Collaborative submission by: '. - ''. - $$fullname{$ENV{'form.'.$uname.':'.$udom.':submitted_by'}}.''; - $request->print($submitby); - } else { my ($string,$timestamp)= &get_last_submission(\%record); my $lastsubonly=''. ($$timestamp eq '' ? '' : 'Date Submitted: '. @@ -1575,8 +1569,21 @@ KEYWORDS if ($$timestamp eq '') { $lastsubonly.=' |
'.$$string[0];
} else {
+ my %seenparts;
for my $part (sort keys(%$handgrade)) {
my ($partid,$respid) = split(/_/,$part);
+ if ($ENV{"form.$uname:$udom:$partid:submitted_by"}) {
+ if (exists($seenparts{$partid})) { next; }
+ $seenparts{$partid}=1;
+ my $submitby='Part '.$partid.
+ ' Collaborative submission by: '.
+ ''.
+ $$fullname{$ENV{"form.$uname:$udom:$partid:submitted_by"}}.' '; + $request->print($submitby); + next; + } my $responsetype = $responseType->{$partid}->{$respid}; if (!exists($record{'resource.'.$partid.'.'.$respid.'.submission'})) { $lastsubonly.=' |
Part '. @@ -1628,7 +1635,6 @@ KEYWORDS } $lastsubonly.=' |
'."\n";
$request->print($lastsubonly);
- }
} elsif ($ENV{'form.lastSub'} eq 'datesub') {
my (undef,$responseType,undef,$parts) = &showResourceInfo($url);
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
@@ -1804,18 +1810,27 @@ sub processHandGrade {
$ENV{'form.msgsub'},$message);
}
if ($ENV{'form.collaborator'.$ctr}) {
- my (@collaborators) = split(/:/,$ENV{'form.collaborator'.$ctr});
- foreach (@collaborators) {
- my ($errorflag,$pts,$wgt) =
- &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,$ENV{'form.unamedom'.$ctr});
- if ($errorflag eq 'not_allowed') {
- $request->print("Not allowed to modify grades for $_:$udom");
- next;
- } else {
- if ($message ne '') {
- $msgstatus = &Apache::lonmsg::user_normal_msg ($_,$udom,
- $ENV{'form.msgsub'},
- $message);
+ &Apache::lonnet::logthis('collab '.(join(':',@{ $ENV{'form.collaborator'.$ctr} })));
+ my @collabstrs;
+ if (ref($ENV{'form.collaborator'.$ctr}) eq 'ARRAY') {
+ @collabstrs=@{$ENV{'form.collaborator'.$ctr}};
+ } else {
+ @collabstrs=$ENV{'form.collaborator'.$ctr};
+ }
+ foreach my $collabstr (@collabstrs) {
+ my ($part,@collaborators) = split(/:/,$collabstr);
+ foreach (@collaborators) {
+ my ($errorflag,$pts,$wgt) =
+ &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,
+ $ENV{'form.unamedom'.$ctr},$part);
+ if ($errorflag eq 'not_allowed') {
+ $request->print("Not allowed to modify grades for $_:$udom");
+ next;
+ } else {
+ if ($message ne '') {
+ $msgstatus = &Apache::lonmsg::user_normal_msg($_,$udom,$ENV{'form.msgsub'},$message);
+ }
+
}
}
}
@@ -1967,7 +1982,7 @@ sub processHandGrade {
#---- Save the score and award for each student, if changed
sub saveHandGrade {
- my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;
+ my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_;
my $usec = &Apache::lonnet::getsection($domain,$stuname,
$ENV{'request.course.id'});
if (!&canmodify($usec)) { return('not_allowed'); }
@@ -1975,6 +1990,9 @@ sub saveHandGrade {
my %newrecord = ();
my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
+ &Apache::lonnet::logthis("-$submitter-$stuname-$part-$_");
+ #collaborator may vary for different parts
+ if ($submitter && $_ ne $part) { next; }
my $dropMenu = $ENV{'form.GD_SEL'.$newflg.'_'.$_};
if ($dropMenu eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
@@ -2010,6 +2028,7 @@ sub saveHandGrade {
$newrecord{$reckey} = 'correct_by_override'
if ($record{$reckey} ne 'correct_by_override');
}
+
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter
if ($submitter && ($record{'resource.'.$_.'.submitted_by'} ne $submitter));
$newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
@@ -3925,6 +3944,11 @@ sub send_header {
#remotewindow.close();
#");
$request->print(&Apache::loncommon::bodytag('Grading'));
+ foreach my $key (sort(keys(%ENV))) {
+ if ($key =~ /^form\./) {
+ Apache->request->print("$key => $ENV{$key} "); + } + } } sub send_footer { |