--- loncom/interface/lonpopulate.pm 2003/12/11 02:54:51 1.5 +++ loncom/interface/lonpopulate.pm 2003/12/12 00:45:49 1.6 @@ -1,5 +1,5 @@ # automated enrollment configuration handler -# $Id: lonpopulate.pm,v 1.5 2003/12/11 02:54:51 raeburn Exp $ +# $Id: lonpopulate.pm,v 1.6 2003/12/12 00:45:49 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1205,7 +1205,7 @@ sub print_crosslistings_response () { push @badowner,$ENV{"form.$xl"}.":".$ENV{"form.$gp"}; } } else { - push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"}; + push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"}.":".$coursecheck; } } } @@ -1222,23 +1222,36 @@ sub print_crosslistings_response () { my %cenv = ('internal.crosslistings' => $xliststr); my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); if ($reply !~ /^ok$/) { - $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.
"; + $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.

"; } else { $response = "The courses listed below are now crosslisted with this LON-CAPA course, and students enrolling in 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.


\n"; + } + } else { + if ($xliststr =~ m/:/) { + my @oldxlists = (); + if ($xliststr =~ m/,/) { + @oldxlists = split/,/,$xliststr; + } else { + $oldxlists[0] = $xliststr; + } + $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.


\n"; } } - - foreach (@allxlists) { - my ($xlist,$gp) = split/:/,$_; - $response .= "
  • $xlist - ID: $gp
  • \n"; - } - $response .= "

    \n"; - if (@badxlists > 0) { $response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because they are not valid courses according to your institution's official schedule of classes and sections.


    \n"; } @@ -1263,6 +1276,7 @@ sub print_sections_menu () { my @sections = (); my $seccount = 0; my $removecount = 0; + my $addcount = 0; my $secstr = ''; my $response = ''; my $coursecode = $settings{'internal.coursecode'}; @@ -1271,14 +1285,44 @@ sub print_sections_menu () { } elsif ($settings{'internal.sectionnums'} ne '') { $currsections[0] = $settings{'internal.sectionnums'}; } - - if (@currsections > 0) { + + if ( exists($ENV{'form.secshow'}) ) { + for (my $i=0; $i<$ENV{'form.secshow'}; $i++) { + my $gp = "loncapasec_".$i; + my $secnum = "secnum_".$i; + my $sec = "sec_".$i; + if ( exists( $ENV{"form.$sec"} ) ) { + my $secentry; + if ( exists( $ENV{"form.$secnum"} ) ) { + $secentry = $ENV{"form.$secnum"}.':'; + } + if ( exists( $ENV{"form.$gp"} ) ) { + $secentry .= $ENV{"form.$gp"}; + } + push @sections, $secentry; + $seccount ++; + unless (grep/^$ENV{"form.$secnum"}:/,@currsections) { + $addcount ++; + } + } + } + if (@currsections > 0) { + for (my $i=0; $i<@currsections; $i++) { + if ($currsections[$i] =~ m/^(\w+:)/ ) { + my $oldsec = $1; + unless (grep/^$oldsec/,@sections) { + $removecount ++; + } + } + } + } + } elsif (@currsections > 0) { for (my $i=0; $i<@currsections; $i++) { my $sec = "sec_".$i; my $gp = "secgp_".$i; if ( exists($ENV{"form.$sec"}) ) { my $secentry = ''; - if ($currsections[$i] =~ m/^(\w+:)/) { + if ($currsections[$i] =~ m/^(\w+:)/ ) { $secentry = $1; } if ( exists($ENV{"form.$gp"}) ) { @@ -1305,8 +1349,12 @@ sub print_sections_menu () { if ($removecount > 0) { $response = "A total of $removecount sections have been removed from the list of sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).

    "; } + if ($addcount > 0) { + $response .= "A total of $addcount sections have been added to the list of +sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).

    "; + } if ($seccount > 0) { - $response .= "Students enrolling in the $seccount section(s) listed below will continue to be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.