--- loncom/interface/lonuserutils.pm 2009/11/18 23:46:28 1.106 +++ loncom/interface/lonuserutils.pm 2010/08/04 16:50:29 1.121 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.106 2009/11/18 23:46:28 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.121 2010/08/04 16:50:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -386,7 +386,7 @@ sub javascript_validations { if (($context eq 'course') || ($context eq 'domain')) { if ($context eq 'course') { if ($env{'request.course.sec'} eq '') { - $setsection_call = 'setSections(document.'.$param{'formname'}."'$crstype'".');'; + $setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');'; $setsections_js = &setsections_javascript($param{'formname'},$groupslist, $mode,'',$crstype); @@ -1448,8 +1448,12 @@ sub print_userlist { } if (!(($context eq 'domain') && (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { - $r->print(' '.&list_submit_button(&mt('Update Display')). - "\n</p>\n"); + $r->print( + "\n</p>\n" + .'<p>' + .&list_submit_button(&mt('Update Display')) + ."</p>\n" + ); } my ($indexhash,$keylist) = &make_keylist_array(); my (%userlist,%userinfo,$clearcoursepick); @@ -1468,9 +1472,11 @@ sub print_userlist { $title = &mt('Select Communities'); $warning = &mt('Warning: data retrieval for multiple communities can take considerable time, as this operation is not currently optimized.'); } + my @standardnames = &Apache::loncommon::get_standard_codeitems(); my $courseform = &Apache::lonhtmlcommon::course_selection($formname,$numcodes, - $codetitles,$idlist,$idlist_titles,$crstype); + $codetitles,$idlist,$idlist_titles,$crstype, + \@standardnames); $r->print('<p>'.&Apache::lonhtmlcommon::start_pick_box()."\n". &Apache::lonhtmlcommon::start_pick_box()."\n". &Apache::lonhtmlcommon::row_title($title,'LC_oddrow_value')."\n". @@ -1688,7 +1694,7 @@ sub role_filter { $role_select .= '</select>'; $output = '<label><span class="LC_nobreak">' .&mt('Role: [_1]',$role_select) - .'</span></label>'; + .'</span></label> '; } return $output; } @@ -1728,7 +1734,7 @@ sub section_group_filter { } if (@options > 0) { my $currsel; - $markup = '<select name="'.$name{$item}.'" />'."\n"; + $markup = '<select name="'.$name{$item}.'">'."\n"; foreach my $option ('all','none',@options) { $currsel = ''; if ($env{'form.'.$name{$item}} eq $option) { @@ -1743,7 +1749,9 @@ sub section_group_filter { $markup .= '</option>'."\n"; } $markup .= '</select>'."\n"; - $output .= (' 'x3).'<label>'.$title{$item}.': '.$markup.'</label>'; + $output .= (' 'x3).'<span class="LC_nobreak">' + .'<label>'.$title{$item}.': '.$markup.'</label>' + .'</span> '; } } return $output; @@ -1917,7 +1925,7 @@ function setCourseCat(formname) { if (formname.Year.options[formname.Year.selectedIndex].value == -1) { return; } - courseSet('Year'); + courseSet('$codetitles[0]'); for (var j=0; j<formname.Semester.length; j++) { if (formname.Semester.options[j].value == "$env{'form.Semester'}") { formname.Semester.options[j].selected = true; @@ -1926,7 +1934,7 @@ function setCourseCat(formname) { if (formname.Semester.options[formname.Semester.selectedIndex].value == -1) { return; } - courseSet('Semester'); + courseSet('$codetitles[1]'); for (var j=0; j<formname.Department.length; j++) { if (formname.Department.options[j].value == "$env{'form.Department'}") { formname.Department.options[j].selected = true; } @@ -1934,7 +1942,7 @@ function setCourseCat(formname) { if (formname.Department.options[formname.Department.selectedIndex].value == -1) { return; } - courseSet('Department'); + courseSet('$codetitles[2]'); for (var j=0; j<formname.Number.length; j++) { if (formname.Number.options[j].value == "$env{'form.Number'}") { formname.Number.options[j].selected = true; @@ -2397,7 +2405,7 @@ END if ($env{'form.userwin'}) { $checkwin = ' checked="checked"'; } - $output .= '</td><td valign="top"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>'; + $output .= '</td><td valign="top" style="border-left: 1px solid;"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>'; } $output .= "\n".'<div class="LC_clear_float_footer"> </div>'."\n". &Apache::loncommon::start_data_table(). @@ -2462,9 +2470,13 @@ END time.'_'.rand(1000000000).'.csv'; unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) { $r->log_error("Couldn't open $CSVfilename for output $!"); - $r->print(&mt('Problems occurred in writing the CSV file. ' - .'This error has been logged. ' - .'Please alert your LON-CAPA administrator.')); + $r->print( + '<p class="LC_error">' + .&mt('Problems occurred in writing the CSV file.') + .' '.&mt('This error has been logged.') + .' '.&mt('Please alert your LON-CAPA administrator.') + .'</p>' + ); $CSVfile = undef; } # @@ -2933,7 +2945,7 @@ sub print_username_link { $output = $in->{'username'}; } else { $output = '<a href="javascript:username_display_launch('. - "'$in->{'username'}','$in->{'domain'}'".')" />'. + "'$in->{'username'}','$in->{'domain'}'".')">'. $in->{'username'}.'</a>'; } return $output; @@ -3163,9 +3175,9 @@ ENDJS my %lt = &Apache::lonlocal::texthash ( chac => 'Access dates to apply for selected users', chse => 'Changes in section affiliation to apply to selected users', - fors => 'For student roles changing the section, will result in a section switch as students may only be in one section of a course at a time.', - forn => 'For a role in a course that is not a student role, a user may have roles in more than one section of a course at a time.', - reta => "Retain each user's current section affiliations?", + fors => 'For student roles, changing the section will result in a section switch as students may only be in one section of a course at a time.', + forn => 'For a course role that is not "student", users may have roles in more than one section at a time.', + reta => "Retain each user's current section affiliations?", dnap => '(Does not apply to student roles).', ); my ($date_items,$headertext); @@ -3183,14 +3195,13 @@ ENDJS $permission,$crstype); } $output .= '<h3>'.$headertext.'</h3>'. - '<form name="'.$formname.'" method="post">'."\n". + '<form name="'.$formname.'" method="post" action="">'."\n". $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.'); + $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 community role that is not "member", users may have roles in more than one section at a time.'); $lt{'dnap'} = &mt('(Does not apply to member roles).'); } my $info; @@ -3231,7 +3242,7 @@ sub section_picker { my ($cdom,$cnum,$role,$rowtitle,$permission,$context,$mode,$crstype) = @_; my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum); my $sections_select .= &course_sections(\%sections_count,$role); - my $secbox = '<p>'.&Apache::lonhtmlcommon::start_pick_box()."\n"; + my $secbox = '<div>'.&Apache::lonhtmlcommon::start_pick_box()."\n"; if ($mode eq 'upload') { my ($options,$cb_script,$coursepick) = &default_role_selector($context,1,$crstype); @@ -3244,7 +3255,7 @@ sub section_picker { '<td align="center">'.&mt('Existing sections')."\n". '<br />'.$sections_select.'</td><td align="center">'. &mt('New section').'<br />'."\n". - '<input type="text" name="newsec" size="15" />'."\n". + '<input type="text" name="newsec" size="15" value="" />'."\n". '<input type="hidden" name="sections" value="" />'."\n". '</td></tr></table>'."\n"; } else { @@ -3253,7 +3264,7 @@ sub section_picker { $env{'request.course.sec'}; } $secbox .= &Apache::lonhtmlcommon::row_closure(1)."\n". - &Apache::lonhtmlcommon::end_pick_box().'</p>'; + &Apache::lonhtmlcommon::end_pick_box().'</div>'; return $secbox; } @@ -3394,7 +3405,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') || @@ -3654,14 +3665,13 @@ sub print_first_users_upload_form { $str .= '<h2>'.&mt('Upload a file containing information about users').'</h2>'."\n"; # Excel and CSV Help - $str .= '<p>' + $str .= '<div class="LC_left_float">' .&Apache::loncommon::help_open_topic("Course_Create_Class_List", &mt("How do I create a users list from a spreadsheet")) - ."<br />\n" + .'</div><div class="LC_left_float">'."\n" .&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", &mt("How do I create a CSV file from a spreadsheet")) - ."</p>\n"; - + .'</div><br clear="all" />'."\n"; $str .= &Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_title(&mt('File')); if (&Apache::lonlocal::current_language() ne 'en') { @@ -3685,8 +3695,6 @@ sub print_first_users_upload_form { .'<input type="submit" name="fileupload" value="'.&mt('Next').'" />' .'</p>'; - $str .= &Apache::loncommon::end_page(); - $r->print($str); return; } @@ -4386,10 +4394,9 @@ sub print_drop_menu { # ================================================================== Phase four sub update_user_list { - my ($r,$context,$setting,$choice) = @_; + my ($r,$context,$setting,$choice,$crstype) = @_; my $now = time; my $count=0; - my $crstype; if ($context eq 'course') { $crstype = &Apache::loncommon::course_type(); } @@ -4404,7 +4411,7 @@ sub update_user_list { 'reenable' => 'Re-enabled', 'activate' => 'Activated', 'chgdates' => 'Changed Access Dates for', - 'chgsec' => 'Changed section for', + 'chgsec' => 'Changed section(s) for', 'drop' => 'Dropped', }, error => {'revoke' => 'revoking', @@ -4421,8 +4428,9 @@ sub update_user_list { ($startdate,$enddate) = &get_dates_from_form(); } foreach my $item (@changelist) { - my ($role,$uname,$udom,$cid,$sec,$scope,$result,$type,$locktype,@sections, - $scopestem); + my ($role,$uname,$udom,$cid,$sec,$scope,$result,$type,$locktype, + @sections,$scopestem,$singlesec,$showsecs,$warn_singlesec, + $nothingtodo,$keepnosection); if ($choice eq 'drop') { ($uname,$udom,$sec) = split(/:/,$item,-1); $role = 'st'; @@ -4521,14 +4529,23 @@ 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'}) { + if (!$env{'form.retainsec'} || ($role eq 'st')) { if ($sec eq '') { if (@newsecs == 0) { - $result = &mt('No change in section assignment (none)'); + $result = 'ok'; $nochg = 1; + $nothingtodo = 1; } else { $revresult = &Apache::lonnet::revokerole($udom,$uname, @@ -4555,13 +4572,23 @@ sub update_user_list { } else { if ($sec eq '') { $nochg = 1; - } else { + $keepnosection = 1; + } else { push(@retained,$sec); } } # add new sections + my (@diffs,@shownew); + if (@retained) { + @diffs = &Apache::loncommon::compare_arrays(\@retained,\@newsecs); + } else { + @diffs = @newsecs; + } if (@newsecs == 0) { - if (!$nochg) { + if ($nochg) { + $result = 'ok'; + $nothingtodo = 1; + } else { if ($role eq 'st') { $result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,undef,$end,$start,$type,$locktype,$cid,'',$context); @@ -4570,22 +4597,58 @@ sub update_user_list { $result = &Apache::lonnet::assignrole($udom,$uname,$newscope,$role,$end,$start,'','',$context); } } + $showsecs = &mt('No section'); + } elsif (@diffs == 0) { + $result = 'ok'; + $nothingtodo = 1; } else { - foreach my $newsec (@newsecs) { + foreach my $newsec (@newsecs) { if (!grep(/^\Q$newsec\E$/,@retained)) { if ($role eq 'st') { $result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$newsec,$end,$start,$type,$locktype,$cid,'',$context); + if (@newsecs > 1) { + my $showsingle; + if ($newsec eq '') { + $showsingle = &mt('No section'); + } else { + $showsingle = $newsec; + } + if ($crstype eq 'Community') { + $warn_singlesec = &mt('Although more than one section was indicated, a role was only added for the first section - [_1], as each community member may only be in one section at a time.','<i>'.$showsingle.'</i>'); + } else { + $warn_singlesec = &mt('Although more than one section was indicated, a role was only added for the first section - [_1], as each student may only be in one section of a course at a time.','<i>'.$showsingle.'</i>'); + } + $showsecs = $showsingle; + last; + } else { + if ($newsec eq '') { + $showsecs = &mt('No section'); + } else { + $showsecs = $newsec; + } + } } else { my $newscope = $scopestem; if ($newsec ne '') { $newscope .= '/'.$newsec; + push(@shownew,$newsec); } $result = &Apache::lonnet::assignrole($udom,$uname, $newscope,$role,$end,$start); + } } } } + unless ($role eq 'st') { + unless ($showsecs) { + my @tolist = sort(@shownew,@retained); + if ($keepnosection) { + push(@tolist,&mt('No section')); + } + $showsecs = join(', ',@tolist); + } + } } } my $extent = $scope; @@ -4596,13 +4659,48 @@ sub update_user_list { } } if ($result eq 'ok' || $result eq 'ok:') { - $r->print(&mt("$result_text{'ok'}{$choice} role of '[_1]' in [_2] for [_3]", - $plrole,$extent,$uname.':'.$udom).'<br />'); - $count++; + my $dates; + if (($choice eq 'chgsec') || ($choice eq 'chgdates')) { + $dates = &dates_feedback($start,$end,$now); + } + if ($choice eq 'chgsec') { + if ($nothingtodo) { + $r->print(&mt("Section assignment for role of '[_1]' in [_2] for '[_3]' unchanged.",$plrole,$extent,'<i>'. + &Apache::loncommon::plainname($uname,$udom). + '</i>').' '); + if ($sec eq '') { + $r->print(&mt('[_1]No section[_2] - [_3]','<b>','</b>',$dates)); + } else { + $r->print(&mt('Section(s): [_1] - [_2]', + '<b>'.$showsecs.'</b>',$dates)); + } + $r->print('<br />'); + } else { + $r->print(&mt("$result_text{'ok'}{$choice} role of '[_1]' in [_2] for '[_3]' to [_4] - [_5]",$plrole,$extent, + '<i>'.&Apache::loncommon::plainname($uname,$udom).'</i>', + '<b>'.$showsecs.'</b>',$dates).'<br />'); + $count ++; + } + if ($warn_singlesec) { + $r->print('<div class="LC_warning">'.$warn_singlesec.'</div>'); + } + } elsif ($choice eq 'chgdates') { + $r->print(&mt("$result_text{'ok'}{$choice} role of '[_1]' in [_2] for '[_3]' - [_4]",$plrole,$extent, + '<i>'.&Apache::loncommon::plainname($uname,$udom).'</i>', + $dates).'<br />'); + $count ++; + } else { + $r->print(&mt("$result_text{'ok'}{$choice} role of '[_1]' in [_2] for '[_3]'.",$plrole,$extent, + '<i>'.&Apache::loncommon::plainname($uname,$udom).'</i>'). + '<br />'); + $count ++; + } } else { $r->print( - &mt("Error $result_text{'error'}{$choice} [_1] in [_2] for [_3]: [_4].", - $plrole,$extent,$uname.':'.$udom,$result).'<br />'); + &mt("Error $result_text{'error'}{$choice} [_1] in [_2] for '[_3]': [_4].", + $plrole,$extent, + '<i>'.&Apache::loncommon::plainname($uname,$udom).'</i>', + $result).'<br />'); } } $r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n"); @@ -4618,7 +4716,7 @@ sub update_user_list { } } } - $r->print('<p><b>'.&mt("$result_text{'ok'}{$choice} role(s) for [quant,_1,user,users,no users].",$count).'</b></p>'); + $r->print('<p><b>'.&mt("$result_text{'ok'}{$choice} for [quant,_1,user role,user roles,no user roles].",$count).'</b></p>'); if ($count > 0) { if ($choice eq 'revoke' || $choice eq 'drop') { $r->print('<p>'.&mt('Re-enabling will re-activate data for the role.').'</p>'); @@ -4638,6 +4736,27 @@ sub update_user_list { $r->print('<a href="javascript:document.studentform.submit()">'.$linktext.'</a></form>'."\n"); } +sub dates_feedback { + my ($start,$end,$now) = @_; + my $dates; + if ($start < $now) { + if ($end == 0) { + $dates .= &mt('role(s) active now; no end date'); + } elsif ($end > $now) { + $dates = &mt('role(s) active now; ends [_1].',&Apache::lonlocal::locallocaltime($end)); + } else { + $dates = &mt('role(s) expired: [_1].',&Apache::lonlocal::locallocaltime($end)); + } + } else { + if ($end == 0 || $end > $now) { + $dates = &mt('future role(s); starts: [_1].',&Apache::lonlocal::locallocaltime($start)); + } else { + $dates = &mt('role(s) expired: [_1].',&Apache::lonlocal::locallocaltime($end)); + } + } + return $dates; +} + sub classlist_drop { my ($scope,$uname,$udom,$now) = @_; my ($cdom,$cnum) = ($scope=~m{^/($match_domain)/($match_courseid)}); @@ -4818,7 +4937,7 @@ sub setsections_javascript { accr => 'A course coordinator role will be added with access to all sections.', acor => 'A coordinator role will be added with access to all sections', inea => 'In each course, each user may only have one student role at a time.', - inec => 'In each community, each user may only have on member role at a time.', + inec => 'In each community, each user may only have one member role at a time.', youh => 'You had selected ', secs => 'sections.', plmo => 'Please modify your selections so they include no more than one section.', @@ -4826,16 +4945,21 @@ sub setsections_javascript { plch => 'Please choose a different section name.', mnot => 'may not be used as a section name, as it is the name of a course group.', secn => 'Section names and group names must be distinct. Please choose a different section name.', + nonw => 'Section names may only contain letters or numbers.', ); $setsection_js .= <<"ENDSECCODE"; 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<formname.elements.length;i++) { var str = formname.elements[i].name; var checkcurr = str.match(re1); if (checkcurr != null) { + var num = i; if ($checkincluded) { $rolecode if (role == 'cc' || role == 'co') { @@ -4847,38 +4971,60 @@ function setSections(formname,crstype) { } else { var sections = ''; var numsec = 0; - var sections; - for (var j=0; j<formname.elements[i].length; j++) { - if (formname.elements[i].options[j].selected == true ) { - if (formname.elements[i].options[j].value != "") { + var fromexisting = new Array(); + for (var j=0; j<formname.elements[num].length; j++) { + if (formname.elements[num].options[j].selected == true ) { + var addsec = formname.elements[num].options[j].value; + if ((addsec != "") && (addsec != null)) { + fromexisting.push(addsec); if (numsec == 0) { - if (formname.elements[i].options[j].value != "") { - sections = formname.elements[i].options[j].value; - numsec ++; - } - } - else { - sections = sections + "," + formname.elements[i].options[j].value - numsec ++; + sections = addsec; + } else { + sections = sections + "," + addsec; } + numsec ++; } } } - if (numsec > 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); - numsec = numsec + numsplit.length; + var numsplit; + if (newsecs.indexOf(',') == -1) { + numsplit = new Array(newsecs); + } else { + numsplit = newsecs.split(/,/g); + } + for (var m=0; m<numsplit.length; m++) { + var newsec = numsplit[m]; + newsec = newsec.replace(trimleading,''); + newsec = newsec.replace(trimtrailing,''); + if (re2.test(newsec) == true) { + badsecs.push(newsec); + } else { + if (newsec != '') { + var isnew = 1; + if (fromexisting != null) { + for (var n=0; n<fromexisting.length; n++) { + if (newsec == fromexisting[n]) { + isnew = 0; + } + } + } + if (isnew == 1) { + validsecs.push(newsec); + } + } + } + } + if (badsecs.length > 0) { + alert("$alerts{'nonw'}\\n$alerts{'plch'}"); + return; + } + numsec = numsec + validsecs.length; } - if ((role == 'st') && (numsec > 1)) { if (crstype == 'Community') { alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); @@ -4886,25 +5032,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<numsplit.length; j++) { - if ((numsplit[j] == 'all') || - (numsplit[j] == 'none')) { - alert("'"+numsplit[j]+"' $alerts{'mayn'}\\n$alerts{'plch'}"); + } else { + if (validsecs != null) { + for (var j=0; j<validsecs.length; j++) { + if (validsecstr == '' || validsecstr == null) { + validsecstr = validsecs[j]; + } else { + validsecstr += ','+validsecs[j]; + } + if ((validsecs[j] == 'all') || + (validsecs[j] == 'none')) { + alert("'"+validsecs[j]+"' $alerts{'mayn'}\\n$alerts{'plch'}"); return; } for (var k=0; k<groups.length; k++) { - if (numsplit[j] == groups[k]) { - alert("'"+numsplit[j]+"' $alerts{'mnot'}\\n$alerts{'secn'}"); + if (validsecs[j] == groups[k]) { + alert("'"+validsecs[j]+"' $alerts{'mnot'}\\n$alerts{'secn'}"); return; } } } } - formname.elements[i+2].value = sections; } + if ((validsecstr != '') && (validsecstr != null)) { + if ((sections == '') || (sections == null)) { + sections = validsecstr; + } else { + sections = sections + "," + validsecstr; + } + } + formname.elements[num+2].value = sections; } } }