--- loncom/interface/lonuserutils.pm 2010/01/19 18:02:20 1.113 +++ loncom/interface/lonuserutils.pm 2010/02/19 15:41:40 1.116 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.113 2010/01/19 18:02:20 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.116 2010/02/19 15:41:40 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3197,7 +3197,6 @@ ENDJS $date_items; if ($context eq 'course' && $env{'form.bulkaction'} eq 'chgsec') { my ($cnum,$cdom) = &get_course_identity(); - my $crstype = &Apache::loncommon::course_type(); if ($crstype eq 'Community') { $lt{'fors'} = &mt('For member roles changing the section, will result in a section switch as members may only be in one section of a community at a time.'); $lt{'forn'} = &mt('For a role in a community that is not a member role, a user may have roles in more than one section of a community at a time.'); @@ -3404,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') || @@ -4840,11 +4839,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); + var numsplit; + if (newsecs.indexOf(',') == -1) { + numsplit = new Array(newsecs); + } else { + numsplit = newsecs.split(/,/g); + } for (var i=0; i 0) { @@ -4900,7 +4912,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'}"); @@ -4908,25 +4919,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 0) { + sections = sections + "," + validsecstr; + } else { + sections = validsecstr; + } + } + formname.elements[num+2].value = sections; } } }