--- loncom/interface/lonuserutils.pm 2010/02/19 15:41:40 1.116 +++ loncom/interface/lonuserutils.pm 2010/03/21 14:15:58 1.117 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.116 2010/02/19 15:41:40 bisitz Exp $ +# $Id: lonuserutils.pm,v 1.117 2010/03/21 14:15:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4527,7 +4527,15 @@ sub update_user_list { } elsif ($choice eq 'chgsec') { my (@newsecs,$revresult,$nochg,@retained); if (($role ne 'cc') && ($role ne 'co')) { - @newsecs = split(/,/,$env{'form.newsecs'}); + my @secs = sort(split(/,/,$env{'form.newsecs'})); + if (@secs) { + my %curr_groups = &Apache::longroup::coursegroups(); + foreach my $sec (@secs) { + next if (($sec =~ /\W/) || ($sec eq 'none') || + (exists($curr_groups{$sec}))); + push(@newsecs,$sec); + } + } } # remove existing section if not to be retained. if (!$env{'form.retainsec'}) { @@ -4884,8 +4892,8 @@ function setSections(formname,crstype) { } else { numsplit = newsecs.split(/,/g); } - for (var i=0; i 0) { - sections = sections + "," + validsecstr; - } else { + if ((sections == '') || (sections == null)) { sections = validsecstr; + } else { + sections = sections + "," + validsecstr; } } formname.elements[num+2].value = sections;