--- loncom/interface/lonuserutils.pm 2010/01/20 16:46:23 1.114 +++ 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.114 2010/01/20 16:46:23 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.117 2010/03/21 14:15:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3403,7 +3403,7 @@ sub results_header_row { if ($rolefilter eq 'Any') { $description .= &mt('All users with co-author roles in domain',$showfilter); } else { - $description .= &mt('All co-authors in domain with [_1] roles',$rolefilter); + $description .= &mt('All co-authors in domain with [_1] roles',$rolefilter); } } } elsif (($env{'form.roletype'} eq 'course') || @@ -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'}) { @@ -4839,11 +4847,14 @@ sub setsections_javascript { function setSections(formname,crstype) { var re1 = /^currsec_/; var re2 =/\\W/; + var trimleading = /^\\s+/; + var trimtrailing = /\\s+\$/; var groups = new Array($groupslist); for (var i=0;i 0) { - if (formname.elements[i+1].value != "" && formname.elements[i+1].value != null) { - sections = sections + "," + formname.elements[i+1].value; - } - } - else { - sections = formname.elements[i+1].value; - } - var newsecs = formname.elements[i+1].value; - var numsplit; + var newsecs = formname.elements[num+1].value; var validsecs = new Array(); + var validsecstr = ''; var badsecs = new Array(); if (newsecs != null && newsecs != "") { - numsplit = newsecs.split(/,/g); - for (var i=0; i 0) { @@ -4899,7 +4920,6 @@ function setSections(formname,crstype) { } numsec = numsec + validsecs.length; } - if ((role == 'st') && (numsec > 1)) { if (crstype == 'Community') { alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); @@ -4907,25 +4927,36 @@ function setSections(formname,crstype) { alert("$alerts{'inco'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); } return; - } - else { - if (numsplit != null) { - for (var j=0; j