Diff for /loncom/interface/Attic/londropadd.pm between versions 1.34 and 1.35

version 1.34, 2002/04/30 13:51:00 version 1.35, 2002/04/30 15:24:16
Line 84  sub modifystudent { Line 84  sub modifystudent {
     my %roles = &Apache::lonnet::dump('roles',$udom,$unam);      my %roles = &Apache::lonnet::dump('roles',$udom,$unam);
     my ($tmp) = keys(%roles);      my ($tmp) = keys(%roles);
     # Bail out if we were unable to get the students roles      # Bail out if we were unable to get the students roles
     return if ($tmp =~ /^(con_lost|error|no_such_host)/i);      return "$1" if ($tmp =~ /^(con_lost|error|no_such_host)/i);
     # Go through the roles looking for enrollment in this course      # Go through the roles looking for enrollment in this course
       my $result = '';
     foreach my $course (keys(%roles)) {      foreach my $course (keys(%roles)) {
         my $value = $roles{$course};          if ($course=~/^$courseid(?:\/)*(?:\s+)*(\w+)*\_st$/) {
         if ($course=~/^$courseid(?:\/)*(\w+)*\_st$/) {  
             # We are in this course              # We are in this course
             my $section=$1;              my $section=$1;
             $section='' if ($course eq $courseid.'_st');              $section='' if ($course eq $courseid.'_st');
             if (((!$section) && (!$csec)) || ($section ne $csec)) {              if ( ((!$section) && (!$csec)) || ($section ne $csec) ) {
                 my (undef,$end,$start)=split(/\_/,$roles{$course});                  my (undef,$end,$start)=split(/\_/,$roles{$course});
                 my $now=time;                  my $now=time;
                 if (!($start && ($now<$start)) || !($end && ($now>$end))) {                  if (!($start && ($now<$start)) || !($end && ($now>$end))) {
                     my $reply=&Apache::lonnet::modifystudent                      my $reply=&Apache::lonnet::modifystudent
                         ($udom,$unam,'','','','','','','',                          ($udom,$unam,'','','','','','','',
                          $section,time,undef,undef,$desiredhost);                           $section,time,undef,undef,$desiredhost);
                       $result .= $reply.':';
                 }                  }
             }              }
         }          }
     }      }
       if ($result eq '') {
           $result eq 'Unable to find section for this student';
       } elsif ($result =~ /^(ok:)+$/) {
           $result eq 'ok';
       }
       return $result;
 }  }
   
 # ============ build a domain and server selection form  # ============ build a domain and server selection form
Line 939  sub upfile_drop_add { Line 946  sub upfile_drop_add {
 sub drop_student_list {  sub drop_student_list {
     my $r=shift;      my $r=shift;
     my $count=0;      my $count=0;
     foreach (@{$ENV{'form.droplist'}}) {      my @droplist;
       if (ref($ENV{'form.droplist'})) {
           @droplist = @{$ENV{'form.droplist'}};
       } else {
           @droplist = ($ENV{'form.droplist'});
       }
       foreach (@droplist) {
         my ($uname,$udom)=split(/\:/,$_);          my ($uname,$udom)=split(/\:/,$_);
         &modifystudent($udom,$uname,$ENV{'request.course.id'});          my $result = &modifystudent($udom,$uname,$ENV{'request.course.id'});
         $r->print('Dropped '.$uname.' at '.$udom.'<br>');          if ($result eq 'ok') {
               $r->print('Dropped '.$uname.' at '.$udom.'<br>');
           } else {
               $r->print('Error dropping '.$uname.' at '.$udom.': '.$result.
                         '<br />');
           }
         $count++;          $count++;
     }      }
     $r->print('<p><b>Dropped '.$count.' student(s).</b>');      $r->print('<p><b>Dropped '.$count.' student(s).</b>');

Removed from v.1.34  
changed lines
  Added in v.1.35


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>