--- loncom/interface/lonhelper.pm 2006/05/09 21:39:47 1.144 +++ loncom/interface/lonhelper.pm 2006/05/09 21:44:18 1.145 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.144 2006/05/09 21:39:47 foxr Exp $ +# $Id: lonhelper.pm,v 1.145 2006/05/09 21:44:18 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2293,16 +2293,129 @@ use Apache::lonnet; # the set of users that should be on or off. # $multiselect - True if multiselect allowed. # $resultname - Name of result variable. +# $javascript - If true, the javascript to run this is output +# This should be true for the first call for a page +# and false for all other calls... only matters if +# multiselect is true. # Returns: # HTML text to add to the rendering of the helper. # sub render_student_list { my ( $sections, $students, $formprefix, $defaultusers, - $multiselect, $resultname) = @_; + $multiselect, $resultname, $javascript) = @_; my $result = ""; + if ($javascript && $multiselect) { + $result .= < +// + +SCRIPT + + } + # If multiple selections are allowed, we have a listbox # at the top which allows quick selections from each section # as well as from categories of personnel. @@ -2435,136 +2548,6 @@ sub render { my $buttons = ''; my $var = $self->{'variable'}; - if ($self->{'multichoice'}) { - $result = < -// - -SCRIPT - - my %lt=&Apache::lonlocal::texthash( - 'ocs' => "Select Only Current Students", - 'ues' => "Unselect Expired Students", - 'sas' => "Select All Students", - 'uas' => "Unselect All Students", - 'sfsg' => "Select Current Students for Section/Group", - 'ufsg' => "Unselect for Section/Group"); - - $buttons = < - - - - - - - -

-
-BUTTONS -# $result .= $buttons; - -} if (defined $self->{ERROR_MSG}) { $result .= '' . $self->{ERROR_MSG} . '

'; @@ -2704,7 +2687,8 @@ BUTTONS "current", \%defaultUsers, $self->{'multichoice'}, - $self->{'variable'}); + $self->{'variable'}, + 1); # If activeonly is not set then we can also give the expired students: @@ -2718,7 +2702,8 @@ BUTTONS "future", \%defaultUsers, $self->{'multichoice'}, - $self->{'variable'}); + $self->{'variable'}, + 0); # Past $result .= &render_student_list(\%sections, @@ -2726,7 +2711,8 @@ BUTTONS "past", \%defaultUsers, $self->{'multichoice'}, - $self->{'variable'}); + $self->{'variable'}, + 0); }