version 1.10, 2002/07/24 16:58:08
|
version 1.11, 2002/07/25 20:51:39
|
Line 60 sub end_essayresponse {
|
Line 60 sub end_essayresponse {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $part=$Apache::inputtags::part; |
my $part=$Apache::inputtags::part; |
my $id = &Apache::response::start_response($parstack,$safeeval); |
my $id = &Apache::response::start_response($parstack,$safeeval); |
|
my $collaborators = $ENV{'form.HWCOL'.$id}; |
|
if ($collaborators =~ /[^\s]/) { |
|
$Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators; |
|
} |
if ( $target eq 'grade' ) { |
if ( $target eq 'grade' ) { |
if ( defined $ENV{'form.submitted'}) { |
if ( defined $ENV{'form.submitted'}) { |
my $response = $ENV{'form.HWVAL'.$id}; |
my $response = $ENV{'form.HWVAL'.$id}; |
Line 71 sub end_essayresponse {
|
Line 75 sub end_essayresponse {
|
} |
} |
} |
} |
} |
} |
my $collaborators = $ENV{'form.HWCOL'.$id}; |
|
if ($collaborators =~ /[^\s]/) { |
|
my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators"); |
|
my ($badlist,$toomany) = &check_collaborators($ncol,$collaborators,'yes'); |
|
$Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators; |
|
$Apache::lonhomework::results{"resource.$part.$id.badcollaborators"}=(join(', ',@$badlist)) |
|
if (scalar(@$badlist) > 0); |
|
$Apache::lonhomework::results{"resource.$part.$id.toomanycollaborators"}=$$toomany |
|
if ($toomany > 0); |
|
} |
|
&Apache::response::end_response; |
&Apache::response::end_response; |
return ''; |
return ''; |
} |
} |
|
|
sub check_collaborators { |
sub check_collaborators { |
my ($ncol,$coll,$retbad) = @_; |
my ($ncol,$coll) = @_; |
my %classlist=&Apache::lonnet::dump('classlist', |
my %classlist=&Apache::lonnet::dump('classlist', |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
Line 103 sub check_collaborators {
|
Line 98 sub check_collaborators {
|
} |
} |
|
|
if (scalar(@badcollaborators)) { |
if (scalar(@badcollaborators)) { |
my $badlist = sprintf ("The following user%s invalid: ", |
$result = '<table border="0"><tr bgcolor="#ffbbbb"><td> The following user'. |
(scalar(@badcollaborators) > 1 ? 's are' : ' is')); |
(scalar(@badcollaborators) > 1 ? 's are' : ' is').' invalid: '. |
$result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>'. |
join(', ',@badcollaborators).'. Please correct.</td></tr></table>'; |
$badlist.join(', ',@badcollaborators).'. Please correct.</td></tr></table>'; |
|
} |
} |
my $toomany = scalar(@collaborators) - $ncol; |
my $toomany = scalar(@collaborators) - $ncol; |
if ($toomany > 0) { |
if ($toomany > 0) { |
Line 114 sub check_collaborators {
|
Line 108 sub check_collaborators {
|
'You have too many collaborators. Please remove '.$toomany.' collaborator'. |
'You have too many collaborators. Please remove '.$toomany.' collaborator'. |
($toomany > 1 ? 's' :'').'.</td></tr></table>'; |
($toomany > 1 ? 's' :'').'.</td></tr></table>'; |
} |
} |
return (\@badcollaborators,\$toomany) if ($retbad eq 'yes'); |
|
return $result; |
return $result; |
} |
} |
|
|