');
@@ -1990,60 +1990,13 @@ KEYWORDS
'" value="'.$env{'form.fullname'}.'" />'."\n";
# If any part of the problem is an essay-response (handgraded), then check for collaborators
- my @col_fullnames;
- my ($classlist,$fullname);
+ my $fullname;
+ my $col_fullnames = [];
if ($env{'form.handgrade'} eq 'yes') {
- ($classlist,undef,$fullname) = &getclasslist('all','0');
- for (keys (%$handgrade)) {
- my $ncol = &Apache::lonnet::EXT('resource.'.$_.
- '.maxcollaborators',
- $symb,$udom,$uname);
- next if ($ncol <= 0);
- s/\_/\./g;
- next if ($record{'resource.'.$_.'.collaborators'} eq '');
- my @goodcollaborators = ();
- my @badcollaborators = ();
- foreach (split(/,?\s+/,$record{'resource.'.$_.'.collaborators'})) {
- $_ =~ s/[\$\^\(\)]//g;
- next if ($_ eq '');
- my ($co_name,$co_dom) = split /\@|:/,$_;
- $co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i);
- next if ($co_name eq $uname && $co_dom eq $udom);
- # Doing this grep allows 'fuzzy' specification
- my @Matches = grep /^$co_name:$co_dom$/i,keys %$classlist;
- if (! scalar(@Matches)) {
- push @badcollaborators,$_;
- } else {
- push @goodcollaborators, @Matches;
- }
- }
- if (scalar(@goodcollaborators) != 0) {
- $result.='Collaborators: ';
- foreach (@goodcollaborators) {
- my ($lastname,$givenn) = split(/,/,$$fullname{$_});
- push @col_fullnames, $givenn.' '.$lastname;
- $result.=$$fullname{$_}.' ';
- }
- $result.=' '."\n";
- my ($part)=split(/\./,$_);
- $result.=''.
- "\n";
- }
- if (scalar(@badcollaborators) > 0) {
- $result.='';
- $result.='This student has submitted ';
- $result.=(scalar(@badcollaborators) == 1) ? 'an invalid collaborator' : 'invalid collaborators';
- $result .= ': '.join(', ',@badcollaborators);
- $result .= ' | ';
- }
- if (scalar(@badcollaborators > $ncol)) {
- $result .= '';
- $result .= 'This student has submitted too many '.
- 'collaborators. Maximum is '.$ncol.'.';
- $result .= ' | ';
- }
- }
+ (my $sub_result,$fullname,$col_fullnames)=
+ &check_collaborators($symb,$uname,$udom,\%record,$handgrade,
+ $counter);
+ $result.=$sub_result;
}
$request->print($result."\n");
@@ -2179,16 +2132,16 @@ KEYWORDS
if ($env{'form.handgrade'} eq 'yes') {
my ($lastname,$givenn) = split(/,/,$env{'form.fullname'});
my $msgfor = $givenn.' '.$lastname;
- if (scalar(@col_fullnames) > 0) {
- my $lastone = pop @col_fullnames;
- $msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.';
+ if (scalar(@$col_fullnames) > 0) {
+ my $lastone = pop(@$col_fullnames);
+ $msgfor .= ', '.(join ', ',@$col_fullnames).' and '.$lastone.'.';
}
$msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript
$result=''."\n".
''."\n";
$result.=' '.
- &mt('Compose message to student').(scalar(@col_fullnames) >= 1 ? 's' : '').' |