[LON-CAPA-cvs] cvs: loncom /interface lonpopulate.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 04 Nov 2005 15:03:29 -0000
This is a MIME encoded message
--albertel1131116609
Content-Type: text/plain
albertel Fri Nov 4 10:03:29 2005 EDT
Modified files:
/loncom/interface lonpopulate.pm
Log:
- just cleaing up some code
--albertel1131116609
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20051104100329.txt"
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.27 loncom/interface/lonpopulate.pm:1.28
--- loncom/interface/lonpopulate.pm:1.27 Tue Oct 4 14:27:32 2005
+++ loncom/interface/lonpopulate.pm Fri Nov 4 10:03:29 2005
@@ -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 @@
</form>
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 @@
$notifystate{$viewer} = 0;
}
- my $notifyshow = @ccs;
+ my $notifyshow = join(' ',@ccs);
if (@ccs > 0) {
@ccs = sort @ccs;
@@ -638,13 +632,11 @@
</form>
");
} 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("
<form name=\"enter\" method=\"post\"><br/>
<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
@@ -723,14 +715,9 @@
} 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 @@
}
}
if (@sections > 0) {
- my $secshow = @sections;
+ my $secshow = join(' ',@sections);
$r->print("
<form name=\"enter\" method=\"post\"><br/>
<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
@@ -804,7 +791,7 @@
<td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
");
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: <b>$realm ($enrollvar{coursecode})</b>; 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.
</td>
@@ -1488,18 +1475,13 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
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 @@
}
} 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.<br/><ul>\n";
foreach (@oldxlists) {
my ($xlist,$gp) = split/:/,$_;
@@ -1796,10 +1763,8 @@
my $warn_prefix = "";
my $coursecode = $settings{'internal.coursecode'};
my $owner = $settings{'internal.courseowner'};
- if ($settings{'internal.sectionnums'} =~ m/,/) {
- @currsections = split/,/,$settings{'internal.sectionnums'};
- } elsif ($settings{'internal.sectionnums'} ne '') {
- $currsections[0] = $settings{'internal.sectionnums'};
+ if ($settings{'internal.sectionnums'} ne '') {
+ @currsections = split(/,/,$settings{'internal.sectionnums'});
}
if ( exists($env{'form.secshow'}) ) {
@@ -1866,11 +1831,8 @@
}
}
- if ($seccount > 1) {
- $secstr = join(",",@sections);
- } else {
- $secstr = $sections[0];
- }
+ $secstr = join(",",@sections);
+
my %cenv = ('internal.sectionnums' => $secstr);
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
if ($reply !~ /^ok$/) {
@@ -1980,10 +1942,8 @@
my $putreply = '';
my $warning = '';
my $warn_prefix = '';
- if ($secstr =~ m/,/) {
- @allsections = split/,/,$secstr;
- } else {
- unless ($secstr eq '') { $allsections[0] = $secstr; }
+ if ($secstr ne '') {
+ @allsections = split(/,/,$secstr);
}
if ( exists($env{'form.numsec'}) ) {
@@ -2016,11 +1976,7 @@
if (@sections > 0 ) {
unless ($secstr eq '') { $secstr .= ","; }
- if (@sections > 1) {
- $secstr .= join(",",@sections);
- } else {
- $secstr .= $sections[0];
- }
+ $secstr .= join(",",@sections);
my %cenv = ('internal.sectionnums' => $secstr);
$putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
if ($putreply !~ /^ok$/) {
@@ -2137,16 +2093,12 @@
my @currsections = ();
my @currxlists = ();
- if ($settings{'internal.sectionnums'} =~ m/,/) {
- @currsections = split/,/,$settings{'internal.sectionnums'};
- } elsif ($settings{'internal.sectionnums'} ne '') {
- $currsections[0] = $settings{'internal.sectionnums'};
+ if ($settings{'internal.sectionnums'} ne '') {
+ @currsections = split(/,/,$settings{'internal.sectionnums'});
}
- 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) {
--albertel1131116609--