--- loncom/interface/lonpopulate.pm 2005/10/04 18:27:32 1.27 +++ loncom/interface/lonpopulate.pm 2005/11/04 15:03:29 1.28 @@ -1,5 +1,5 @@ # automated enrollment configuration handler -# $Id: lonpopulate.pm,v 1.27 2005/10/04 18:27:32 albertel Exp $ +# $Id: lonpopulate.pm,v 1.28 2005/11/04 15:03:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -485,15 +485,9 @@ ENDTWO ENDTWO } elsif ($action eq "notify") { - my @notified = (); - if ($enrollvar{notifylist} =~ m/,/) { - @notified = split/,/,$enrollvar{notifylist}; - } else { - @notified = $enrollvar{notifylist}; - } - my $notifycount = 0; + my @notified = split(/,/,$enrollvar{notifylist}); foreach (@notified) { - unless ($_ eq '') { $notifycount ++; } + unless ($_ eq '') { $notifycount ++; } } my $noteset = ''; if ($notifycount) { @@ -572,7 +566,7 @@ ENDTWO $notifystate{$viewer} = 0; } - my $notifyshow = @ccs; + my $notifyshow = join(' ',@ccs); if (@ccs > 0) { @ccs = sort @ccs; @@ -638,13 +632,11 @@ ENDTWO "); } elsif ($action eq "crosslist") { - my @xlists = (); - if ($enrollvar{crosslistings} =~ m/,/) { - @xlists = split/,/,$enrollvar{crosslistings}; - } elsif ($enrollvar{crosslistings} ne '') { - $xlists[0] = $enrollvar{crosslistings}; + my @xlists; + if ($enrollvar{crosslistings} ne '') { + @xlists = split(/,/,$enrollvar{crosslistings}); } - my $cross_str = @xlists; + my $cross_str = join(' ',@xlists); $r->print("

@@ -723,14 +715,9 @@ ENDTWO } elsif ($action eq "sections") { my @sections = (); @sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode}); - my @storedsections = (); + my @storedsections = split(/,/,$enrollvar{sectionnums}); my @currsections = (); my %sec_id = (); - if ($enrollvar{sectionnums} =~ m/,/) { - @storedsections = split/,/,$enrollvar{sectionnums}; - } else { - $storedsections[0] = $enrollvar{sectionnums}; - } foreach (@storedsections) { if ($_ =~ m/^(\w+):(\w*)$/) { push @currsections, $1; @@ -738,7 +725,7 @@ ENDTWO } } if (@sections > 0) { - my $secshow = @sections; + my $secshow = join(' ',@sections); $r->print("
@@ -804,7 +791,7 @@ your changes. @@ -1488,18 +1475,13 @@ sub print_notify_response { my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs); my $notifylist = $settings{'internal.notifylist'}; my $coursecode = $settings{'internal.coursecode'}; - my @currpeople = (); + my @currpeople = split(/,/,$notifylist); my $notify = 0; my @people = (); my $peoplestr = ""; my $response = ""; my $noprocess = 0; - if ($notifylist =~ m/,/) { - @currpeople = split/,/,$notifylist; - } else { - $currpeople[0] = $notifylist; - } my $currcount = 0; foreach (@currpeople) { unless ($_ eq '') { $currcount ++; } @@ -1574,10 +1556,8 @@ sub print_crosslistings_menu () { my $xliststr = ''; my $response = ''; my $coursecode = $settings{'internal.coursecode'}; - if ($settings{'internal.crosslistings'} =~ m/,/) { - @currxlists = split/,/,$settings{'internal.crosslistings'}; - } elsif ($settings{'internal.crosslistings'} ne '') { - $currxlists[0] = $settings{'internal.crosslistings'}; + if ($settings{'internal.crosslistings'} ne '') { + @currxlists = split(/,/,$settings{'internal.crosslistings'}); } if (@currxlists > 0) { @@ -1600,11 +1580,8 @@ sub print_crosslistings_menu () { } } - if ($crosscount > 1) { - $xliststr = join(",",@xlists); - } else { - $xliststr = $xlists[0]; - } + $xliststr = join(",",@xlists); + my %cenv = ('internal.crosslistings' => $xliststr); my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); if ($reply !~ /^ok$/) { @@ -1682,10 +1659,8 @@ sub print_crosslistings_response () { my $warning = ''; my $warn_prefix = ''; - if ($xliststr =~ m/,/) { - @allxlists = split/,/,$xliststr; - } else { - unless ($xliststr eq '') { $allxlists[0] = $xliststr; } + if ($xliststr ne '') { + @allxlists = split(/,/,$xliststr); } if ( exists($env{'form.numcross'}) ) { @@ -1717,11 +1692,8 @@ sub print_crosslistings_response () { if (@xlists > 0 ) { unless ($xliststr eq '') { $xliststr .= ","; } - if (@xlists > 1) { - $xliststr .= join(",",@xlists); - } else { - $xliststr .= $xlists[0]; - } + $xliststr .= join(",",@xlists); + my %cenv = ('internal.crosslistings' => $xliststr); my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); if ($reply !~ /^ok$/) { @@ -1736,12 +1708,7 @@ sub print_crosslistings_response () { } } else { if ($xliststr =~ m/:/) { - my @oldxlists = (); - if ($xliststr =~ m/,/) { - @oldxlists = split/,/,$xliststr; - } else { - $oldxlists[0] = $xliststr; - } + my @oldxlists = (split/,/,$xliststr); $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.
$$tasktitleref{$action}
"); if (@currsections) { - my $secshow = @currsections; + my $secshow = join(' ',@currsections); $r->print(" Currently, this LON-CAPA course incorporates enrollment from $secshow sections. Students enrolling in any of these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update. For each section, uncheck the checkbox if you want registered students in that section to cease being included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise leave it checked. If you want to change the section/group designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section/groupID textbox and enter the new value. If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to store your changes.