--- loncom/interface/lonhelper.pm 2005/10/11 22:05:20 1.122 +++ loncom/interface/lonhelper.pm 2005/10/17 18:20:59 1.123 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.122 2005/10/11 22:05:20 albertel Exp $ +# $Id: lonhelper.pm,v 1.123 2005/10/17 18:20:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2189,6 +2189,10 @@ selection. Defaults to false. If true, only active students and course personnel will be shown. Defaults to false. +=item * B: + +If true, the selection of no users is allowed. Defaults to false. + =back =cut @@ -2224,6 +2228,7 @@ sub start_student { if (defined($token->[2]{'nextstate'})) { $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; } + $paramHash->{'emptyallowed'} = $token->[2]{'emptyallowed'}; } @@ -2485,9 +2490,14 @@ sub postprocess { my $self = shift; my $result = $env{'form.' . $self->{'variable'} . '.forminput'}; - if (!$result) { - $self->{ERROR_MSG} = - &mt('You must choose at least one student to continue.'); + if (!$result && !$self->{'emptyallowed'}) { + if ($self->{'coursepersonnel'}) { + $self->{ERROR_MSG} = + &mt('You must choose at least one user to continue.'); + } else { + $self->{ERROR_MSG} = + &mt('You must choose at least one student to continue.'); + } return 0; }