--- loncom/interface/Attic/londropadd.pm 2002/01/04 18:13:58 1.19 +++ loncom/interface/Attic/londropadd.pm 2002/04/03 16:45:25 1.21 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.19 2002/01/04 18:13:58 www Exp $ +# $Id: londropadd.pm,v 1.21 2002/04/03 16:45:25 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -129,22 +129,22 @@ sub record_sep { if ($ENV{'form.upfiletype'} eq 'xml') { } elsif ($ENV{'form.upfiletype'} eq 'space') { my $i=0; - map { + foreach (split(/\s+/,$record)) { my $field=$_; $field=~s/^(\"|\')//; $field=~s/(\"|\')$//; $components{$i}=$field; $i++; - } split(/\s+/,$record); + } } elsif ($ENV{'form.upfiletype'} eq 'tab') { my $i=0; - map { + foreach (split(/\t+/,$record)) { my $field=$_; $field=~s/^(\"|\')//; $field=~s/(\"|\')$//; $components{$i}=$field; $i++; - } split(/\t+/,$record); + } } else { my @allfields=split(/\,/,$record); my $i=0; @@ -173,7 +173,9 @@ sub dropstudent { my ($udom,$unam,$courseid,$csec)=@_; $courseid=~s/\_/\//g; $courseid=~s/^(\w)/\/$1/; - map { + foreach (split(/\&/, + &Apache::lonnet::reply('dump:'.$udom.':'.$unam.':roles', + &Apache::lonnet::homeserver($unam,$udom)))) { my ($key,$value)=split(/\=/,$_); $key=&Apache::lonnet::unescape($key); if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) { @@ -197,8 +199,7 @@ sub dropstudent { } } } - } split(/\&/,&Apache::lonnet::reply('dump:'.$udom.':'.$unam.':roles', - &Apache::lonnet::homeserver($unam,$udom))); + } } # ============================================================== Menu Phase One @@ -434,19 +435,19 @@ ENDPICK if ($total>=2) { %sthree=&record_sep($records[2]); } - map { + foreach (sort keys %sone) { $r->print('
'. $ssec." | \n"); - } sort keys %currentlist; + } $r->print('
Processed Students: '.$count);
# --------------------------------------------------------------- Drop students
if ($ENV{'form.fullup'} eq 'yes') {
@@ -952,7 +953,7 @@ sub upfile_drop_add {
my %currentlist=();
my $now=time;
unless ($classlst=~/^error\:/) {
- map {
+ foreach (split(/\&/,$classlst)) {
my ($name,$value)=split(/\=/,$_);
my ($end,$start)=split(/\:/,
&Apache::lonnet::unescape($value));
@@ -961,9 +962,9 @@ sub upfile_drop_add {
if ($active) {
$currentlist{&Apache::lonnet::unescape($name)}=1;
}
- } split(/\&/,$classlst);
+ }
# ------------------------------------------------ Now got up-to-date classlist
- map {
+ foreach (@studentdata) {
my %entries=&record_sep($_);
unless (($entries{$fields{'username'}} eq '') ||
(!defined($entries{$fields{'username'}}))) {
@@ -971,7 +972,7 @@ sub upfile_drop_add {
$entries{$fields{'username'}}.':'.
$domain});
}
- } @studentdata;
+ }
# ----------------------------------------------------------- Print out choices
&show_drop_list($r,%currentlist);
} else {
@@ -990,14 +991,14 @@ sub upfile_drop_add {
sub drop_student_list {
my $r=shift;
my $count=0;
- map {
+ foreach (keys %ENV) {
if ($_=~/^form\.drop\:/) {
my ($dummy,$uname,$udom)=split(/\:/,$_);
&dropstudent($udom,$uname,$ENV{'request.course.id'});
$r->print('Dropped '.$uname.' at '.$udom.'
');
$count++;
}
- } keys %ENV;
+ }
$r->print('
Dropped '.$count.' student(s).'); $r->print('
Re-enrollment will re-activate data.'); }