Diff for /loncom/interface/Attic/londropadd.pm between versions 1.24 and 1.25

version 1.24, 2002/04/15 23:37:37 version 1.25, 2002/04/16 19:08:49
Line 77  ENDHEAD Line 77  ENDHEAD
 # =========== Drop student from all sections of a course, except optional $csec  # =========== Drop student from all sections of a course, except optional $csec
   
 sub dropstudent {  sub dropstudent {
      my ($udom,$unam,$courseid,$csec)=@_;      my ($udom,$unam,$courseid,$csec)=@_;
      $courseid=~s/\_/\//g;      $courseid=~s/\_/\//g;
      $courseid=~s/^(\w)/\/$1/;      $courseid=~s/^(\w)/\/$1/;
      foreach (split(/\&/,      foreach (split(/\&/,
     &Apache::lonnet::reply('dump:'.$udom.':'.$unam.':roles',                     &Apache::lonnet::reply('dump:'.$udom.':'.$unam.':roles',
      &Apache::lonnet::homeserver($unam,$udom)))) {       &Apache::lonnet::homeserver($unam,$udom)))) {
         my ($key,$value)=split(/\=/,$_);          my ($key,$value)=split(/\=/,$_);
         $key=&Apache::lonnet::unescape($key);          $key=&Apache::lonnet::unescape($key);
         if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) {          if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) {
           my $section=$1;              my $section=$1;
           if ($key eq $courseid.'_st') { $section=''; }              if ($key eq $courseid.'_st') { $section=''; }
           if (((!$section) && (!$csec)) || ($section ne $csec)) {              if (((!$section) && (!$csec)) || ($section ne $csec)) {
     my ($dummy,$end,$start)=split(/\_/,                  my ($dummy,$end,$start)=split(/\_/,
                                     &Apache::lonnet::unescape($value));                                                &Apache::lonnet::unescape
             my $now=time;                                                ($value));
             my $notactive=0;                  my $now=time;
             if ($start) {                  my $notactive=0;
  if ($now<$start) { $notactive=1; }                  if ($start) {
             }                      if ($now<$start) { $notactive=1; }
             if ($end) {                  }
                 if ($now>$end) { $notactive=1; }                  if ($end) {
             }                       if ($now>$end) { $notactive=1; }
             unless ($notactive) {                  } 
                 my $reply=&Apache::lonnet::modifystudent(                  unless ($notactive) {
                                    $udom,$unam,'','','',                      my $reply=&Apache::lonnet::modifystudent
            '','','','',$section,time);                          ($udom,$unam,'','','',
                            '','','','',$section,time);
                   }
             }              }
   }  
         }          }
     }      }
 }  }
Line 468  ENDPICK Line 469  ENDPICK
   
 sub menu_phase_two_upload {  sub menu_phase_two_upload {
     my $r=shift;      my $r=shift;
   
     my $datatoken;      my $datatoken;
     if (!$ENV{'form.datatoken'}) {      if (!$ENV{'form.datatoken'}) {
       $datatoken=&Apache::loncommon::upfile_store($r);          $datatoken=&Apache::loncommon::upfile_store($r);
     } else {      } else {
       $datatoken=$ENV{'form.datatoken'};          $datatoken=$ENV{'form.datatoken'};
       &Apache::loncommon::load_tmp_file($r);          &Apache::loncommon::load_tmp_file($r);
     }      }
     my @records=&Apache::loncommon::upfile_record_sep();      my @records=&Apache::loncommon::upfile_record_sep();
     my $total=$#records;      my $total=$#records;
     my $distotal=$total+1;      my $distotal=$total+1;
   
     $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;      $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
     my $krbdefdom=$1;      my $krbdefdom=$1;
     $krbdefdom=~tr/a-z/A-Z/;      $krbdefdom=~tr/a-z/A-Z/;
   
     my $today=time;      my $today=time;
     my $halfyear=$today+15552000;      my $halfyear=$today+15552000;
   
     my $defdom=$r->dir_config('lonDefDomain');      my $defdom=$r->dir_config('lonDefDomain');
   
     &phase_two_header($r,$datatoken,$distotal,$krbdefdom);      &phase_two_header($r,$datatoken,$distotal,$krbdefdom);
   
     my $i;      my $i;
     my $keyfields;      my $keyfields;
     if ($total>=0) {      if ($total>=0) {
Line 511  sub menu_phase_two_upload { Line 506  sub menu_phase_two_upload {
     $keyfields=join(',',sort(keys(%sone)));      $keyfields=join(',',sort(keys(%sone)));
  }   }
     }      }
   
   
     &phase_two_end($r,$i,$keyfields,$defdom,$today,$halfyear);      &phase_two_end($r,$i,$keyfields,$defdom,$today,$halfyear);
 }  }
   
Line 526  sub enroll_single_student { Line 519  sub enroll_single_student {
  my $amode='';   my $amode='';
         my $genpwd='';          my $genpwd='';
         if ($ENV{'form.login'} eq 'krb') {          if ($ENV{'form.login'} eq 'krb') {
            $amode='krb4';              $amode='krb4';
            $genpwd=$ENV{'form.krbdom'};              $genpwd=$ENV{'form.krbdom'};
         } elsif ($ENV{'form.login'} eq 'int') {          } elsif ($ENV{'form.login'} eq 'int') {
            $amode='internal';              $amode='internal';
            $genpwd=$ENV{'form.intpwd'};              $genpwd=$ENV{'form.intpwd'};
         }  elsif ($ENV{'form.login'} eq 'loc') {          }  elsif ($ENV{'form.login'} eq 'loc') {
     $amode='localauth';      $amode='localauth';
     $genpwd=$ENV{'form.locarg'};      $genpwd=$ENV{'form.locarg'};
     if (!$genpwd) { $genpwd=" "; }      if (!$genpwd) { $genpwd=" "; }
  }   }
         if (($amode) && ($genpwd)) {          if (($amode) && ($genpwd)) {
    &dropstudent($ENV{'form.cdomain'},$ENV{'form.cuname'},              &dropstudent($ENV{'form.cdomain'},$ENV{'form.cuname'},
        $ENV{'request.course.id'},$ENV{'form.csec'});                           $ENV{'request.course.id'},$ENV{'form.csec'});
           $r->print(&Apache::lonnet::modifystudent(              $r->print(&Apache::lonnet::modifystudent
                       $ENV{'form.cdomain'},$ENV{'form.cuname'},                        ($ENV{'form.cdomain'},$ENV{'form.cuname'},
                       $ENV{'form.cstid'},$amode,$genpwd,                         $ENV{'form.cstid'},$amode,$genpwd,
                $ENV{'form.cfirst'},$ENV{'form.cmiddle'},                         $ENV{'form.cfirst'},$ENV{'form.cmiddle'},
                       $ENV{'form.clast'},$ENV{'form.cgen'},                         $ENV{'form.clast'},$ENV{'form.cgen'},
                       $ENV{'form.csec'},$ENV{'form.enddate'},                         $ENV{'form.csec'},$ENV{'form.enddate'},
                       $ENV{'form.startdate'},$ENV{'form.forceid'}));                         $ENV{'form.startdate'},$ENV{'form.forceid'}));
  } else {   } else {
            $r->print('Invalid login mode or password');                  $r->print('Invalid login mode or password');    
         }                    }          
     } else {      } else {
         $r->print('Invalid username or domain');          $r->print('Invalid username or domain');
     }          }
 }  }
   
 # ======================================================= Menu Phase Two Enroll  # ======================================================= Menu Phase Two Enroll
   
 sub menu_phase_two_enroll {  sub menu_phase_two_enroll {
     my $r=shift;      my $r=shift;
       
     $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;      $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
     my $krbdefdom=$1;      my $krbdefdom=$1;
     $krbdefdom=~tr/a-z/A-Z/;      $krbdefdom=~tr/a-z/A-Z/;
   
     my $today=time;      my $today=time;
     my $halfyear=$today+15552000;      my $halfyear=$today+15552000;
   
     my $defdom=$r->dir_config('lonDefDomain');      my $defdom=$r->dir_config('lonDefDomain');
     my $javascript_validations=&javascript_validations($krbdefdom);      my $javascript_validations=&javascript_validations($krbdefdom);
     $r->print(<<ENDSENROLL);      $r->print(<<ENDSENROLL);
Line 658  ENDSENROLL Line 648  ENDSENROLL
 sub menu_phase_two_drop {  sub menu_phase_two_drop {
     my $r=shift;      my $r=shift;
     my $cid=$ENV{'request.course.id'};      my $cid=$ENV{'request.course.id'};
                  my $classlst=&Apache::lonnet::reply      my $classlst=&Apache::lonnet::reply
                  ('dump:'.$ENV{'course.'.$cid.'.domain'}.':'.          ('dump:'.$ENV{'course.'.$cid.'.domain'}.':'.
                   $ENV{'course.'.$cid.'.num'}.':classlist',           $ENV{'course.'.$cid.'.num'}.':classlist',
                   $ENV{'course.'.$cid.'.home'});           $ENV{'course.'.$cid.'.home'});
                  my %currentlist=();      my %currentlist=();
                  my $now=time;      my $now=time;
                  unless ($classlst=~/^error\:/) {      unless ($classlst=~/^error\:/) {
                      foreach (split(/\&/,$classlst)) {          foreach (split(/\&/,$classlst)) {
                         my ($name,$value)=split(/\=/,$_);              my ($name,$value)=split(/\=/,$_);
                         my ($end,$start)=split(/\:/,              my ($end,$start)=split(/\:/,
                                             &Apache::lonnet::unescape($value));                                     &Apache::lonnet::unescape($value));
                         my $active=1;              my $active=1;
                         if (($end) && ($now>$end)) { $active=0; }              if (($end) && ($now>$end)) { $active=0; }
                         if ($active) {              if ($active) {
            $currentlist{&Apache::lonnet::unescape($name)}=1;                  $currentlist{&Apache::lonnet::unescape($name)}=1;
                         }              }
                      }          }
 # ----------------------------------------------------------- Print out choices  # ----------------------------------------------------------- Print out choices
                      &show_drop_list($r,%currentlist);          &show_drop_list($r,%currentlist);
          } else {      } else {
                      $r->print(          $r->print('<font color=red><h3>Could not access classlist: '.$classlst.
                   '<font color=red><h3>Could not access classlist: '.$classlst.  
                   '</h3></font>');                    '</h3></font>');
                  }      }
 }  }
   
 # =================================================== Show student list to drop  # =================================================== Show student list to drop
Line 691  sub show_drop_list { Line 680  sub show_drop_list {
     my $cid=$ENV{'request.course.id'};      my $cid=$ENV{'request.course.id'};
   
     $r->print('<input type=hidden name=phase value=four>');      $r->print('<input type=hidden name=phase value=four>');
                      $r->print('<table border=2>');      $r->print('<table border=2>');
                      foreach (sort keys %currentlist) {      foreach (sort keys %currentlist) {
                          my ($sname,$sdom)=split(/\:/,$_);          my ($sname,$sdom)=split(/\:/,$_);
                          my %reply=&Apache::lonnet::idrget($sdom,$sname);          my %reply=&Apache::lonnet::idrget($sdom,$sname);
                          my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid);          my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid);
                          my @reply=split(/[\&\=]/,&Apache::lonnet::reply(          my @reply=split(/[\&\=]/,&Apache::lonnet::reply
                            'get:'.$sdom.':'.$sname.                          ('get:'.$sdom.':'.$sname.
       ':environment:firstname&middlename&lastname&generation',                           ':environment:firstname&middlename&lastname&generation',
                            &Apache::lonnet::homeserver($sname,$sdom)));                           &Apache::lonnet::homeserver($sname,$sdom)));
   $r->print(          $r->print('<tr><td><input type=checkbox name="drop:'.$_.'"></td><td>'.
                   '<tr><td><input type=checkbox name="drop:'.$_.'"></td><td>'.                    $sname.'</td><td>'.$sdom.'</td><td>'.
                                    $sname.'</td><td>'.$sdom.'</td><td>'.                    $reply{$sname}.'</td><td>'.
                                    $reply{$sname}.'</td><td>'.                    &Apache::lonnet::unescape($reply[2]).' '.
                                    &Apache::lonnet::unescape($reply[2]).' '.                    &Apache::lonnet::unescape($reply[3]).', '.
                                    &Apache::lonnet::unescape($reply[3]).', '.                    &Apache::lonnet::unescape($reply[0]).' '.
                                    &Apache::lonnet::unescape($reply[0]).' '.                    &Apache::lonnet::unescape($reply[1]).
                                    &Apache::lonnet::unescape($reply[1]).                    '</td><td>'.
                                    '</td><td>'.                    $ssec."</td></tr>\n");
                                    $ssec."</td></tr>\n");      }
                      }      $r->print('</table><br>');
                      $r->print('</table><br>');      $r->print('<input type=submit value="Drop Students">');
                      $r->print('<input type=submit value="Drop Students">');  
 }  }
   
 # ================================================= Drop/Add from uploaded file  # ================================================= Drop/Add from uploaded file
   
 sub upfile_drop_add {  sub upfile_drop_add {
     my $r=shift;      my $r=shift;
   
     &Apache::loncommon::load_tmp_file($r);      &Apache::loncommon::load_tmp_file($r);
     my @studentdata=&Apache::loncommon::upfile_record_sep();      my @studentdata=&Apache::loncommon::upfile_record_sep();
   
     my @keyfields=split(/\,/,$ENV{'form.keyfields'});      my @keyfields=split(/\,/,$ENV{'form.keyfields'});
     my $cid=$ENV{'request.course.id'};      my $cid=$ENV{'request.course.id'};
              my %fields=();      my %fields=();
              for (my $i=0;$i<=$ENV{'form.nfields'};$i++) {      for (my $i=0;$i<=$ENV{'form.nfields'};$i++) {
  if ($ENV{'form.upfile_associate'} eq 'reverse') {          if ($ENV{'form.upfile_associate'} eq 'reverse') {
      if ($ENV{'form.f'.$i} ne 'none') {              if ($ENV{'form.f'.$i} ne 'none') {
  $fields{$keyfields[$i]}=$ENV{'form.f'.$i};                  $fields{$keyfields[$i]}=$ENV{'form.f'.$i};
      }              }
  } else {          } else {
      $fields{$ENV{'form.f'.$i}}=$keyfields[$i];              $fields{$ENV{'form.f'.$i}}=$keyfields[$i];
  }          }
              }      }
              my $startdate=$ENV{'form.startdate'};      my $startdate=$ENV{'form.startdate'};
              my $enddate=$ENV{'form.enddate'};      my $enddate=$ENV{'form.enddate'};
              if ($startdate=~/\D/) { $startdate=''; }      if ($startdate=~/\D/) { $startdate=''; }
              if ($enddate=~/\D/) { $enddate=''; }      if ($enddate=~/\D/) { $enddate=''; }
              my $domain=$ENV{'form.lcdomain'};      my $domain=$ENV{'form.lcdomain'};
              my $amode='';      my $amode='';
              my $genpwd='';      my $genpwd='';
              if ($ENV{'form.login'} eq 'krb') {      if ($ENV{'form.login'} eq 'krb') {
                  $amode='krb4';          $amode='krb4';
                  $genpwd=$ENV{'form.krbdom'};          $genpwd=$ENV{'form.krbdom'};
              } elsif ($ENV{'form.login'} eq 'int') {      } elsif ($ENV{'form.login'} eq 'int') {
                  $amode='internal';          $amode='internal';
                  if ((defined($ENV{'form.intpwd'})) && ($ENV{'form.intpwd'})) {          if ((defined($ENV{'form.intpwd'})) && ($ENV{'form.intpwd'})) {
      $genpwd=$ENV{'form.intpwd'};              $genpwd=$ENV{'form.intpwd'};
                  }          }
              } elsif ($ENV{'form.login'} eq 'loc') {      } elsif ($ENV{'form.login'} eq 'loc') {
  $amode='localauth';          $amode='localauth';
  if ((defined($ENV{'form.locarg'})) && ($ENV{'form.locarg'})) {          if ((defined($ENV{'form.locarg'})) && ($ENV{'form.locarg'})) {
      $genpwd=$ENV{'form.locarg'};              $genpwd=$ENV{'form.locarg'};
                  }          }
      }      }
              unless (($domain=~/\W/) || ($amode eq '')) {      unless (($domain=~/\W/) || ($amode eq '')) {
               $r->print('<h3>Enrolling Students</h3>');          $r->print('<h3>Enrolling Students</h3>');
               my $count=0;          my $count=0;
               my $flushc=0;          my $flushc=0;
               my %student=();          my %student=();
 # ----------------------------------------------------------- Get new classlist  # ----------------------------------------------------------- Get new classlist
 # --------------------------------------------------------- Enroll new students  # --------------------------------------------------------- Enroll new students
       foreach (@studentdata) {          foreach (@studentdata) {
   my %entries=&Apache::loncommon::record_sep($_);              my %entries=&Apache::loncommon::record_sep($_);
               unless (($entries{$fields{'username'}} eq '') ||
                 unless (($entries{$fields{'username'}} eq '') ||                      (!defined($entries{$fields{'username'}}))) {
                         (!defined($entries{$fields{'username'}}))) {                  my $fname=''; my $mname=''; my $lname=''; my $gen='';
                   my $fname=''; my $mname=''; my $lname=''; my $gen='';                  if (defined($fields{'names'})) {
                   if (defined($fields{'names'})) {                      ($lname,$fname,$mname)=
       ($lname,$fname,$mname)=                          ($entries{$fields{'names'}}=~/([^\,]+)\,\s*(\w+)\s*(.*)$/);
             ($entries{$fields{'names'}}=~/([^\,]+)\,\s*(\w+)\s*(.*)$/);                  } else {
                   } else {                      if (defined($fields{'fname'})) {
                       if (defined($fields{'fname'})) {                          $fname=$entries{$fields{'fname'}};
          $fname=$entries{$fields{'fname'}};                      }
       }                      if (defined($fields{'mname'})) {
                       if (defined($fields{'mname'})) {                          $mname=$entries{$fields{'mname'}};
          $mname=$entries{$fields{'mname'}};                      }
       }                      if (defined($fields{'lname'})) {
                       if (defined($fields{'lname'})) {                          $lname=$entries{$fields{'lname'}};
          $lname=$entries{$fields{'lname'}};                      }
       }                      if (defined($fields{'gen'})) {
                       if (defined($fields{'gen'})) {                          $gen=$entries{$fields{'gen'}};
          $gen=$entries{$fields{'gen'}};                      }
       }                  }
                   }                  if ($entries{$fields{'username'}}=~/\W/) {
                   if ($entries{$fields{'username'}}=~/\W/) {                      $r->print('<p><b>Unacceptable username: '.
                      $r->print('<p><b>Unacceptable username: '.  
                               $entries{$fields{'username'}}.' for user '.                                $entries{$fields{'username'}}.' for user '.
                               $fname.' '.$mname.' '.$lname.' '.$gen.'</b><p>');                                $fname.' '.$mname.' '.$lname.' '.$gen.'</b><p>');
   } else {                  } else {
                       my $sec='';                      my $sec='';
                       my $username=$entries{$fields{'username'}};                      my $username=$entries{$fields{'username'}};
                       if (defined($fields{'sec'})) {                      if (defined($fields{'sec'})) {
                          if (defined($entries{$fields{'sec'}})) {                          if (defined($entries{$fields{'sec'}})) {
      $sec=$entries{$fields{'sec'}};                              $sec=$entries{$fields{'sec'}};
                          }                          }
                       }                      }
                       my $id='';                      my $id='';
                       if (defined($fields{'id'})) {                      if (defined($fields{'id'})) {
                          if (defined($entries{$fields{'id'}})) {                          if (defined($entries{$fields{'id'}})) {
      $id=$entries{$fields{'id'}};                              $id=$entries{$fields{'id'}};
                          }                          }
                          $id=~tr/A-Z/a-z/;                          $id=~tr/A-Z/a-z/;
                       }                      }
                       my $password='';                      my $password='';
                       if ($genpwd) {                       if ($genpwd) { 
                          $password=$genpwd;                           $password=$genpwd; 
       } else {                      } else {
                          if (defined($fields{'ipwd'})) {                          if (defined($fields{'ipwd'})) {
      if ($entries{$fields{'ipwd'}}) {                              if ($entries{$fields{'ipwd'}}) {
  $password=$entries{$fields{'ipwd'}};                                  $password=$entries{$fields{'ipwd'}};
                              }                              }
                          }                          }
                       }                      }
                       if ($password) {                      if ($password) {
  &dropstudent($domain,$username,$cid,$sec);                          &dropstudent($domain,$username,$cid,$sec);
                          my $reply=&Apache::lonnet::modifystudent(                          my $reply=&Apache::lonnet::modifystudent
                           $domain,$username,$id,$amode,$password,                              ($domain,$username,$id,$amode,$password,
    $fname,$mname,$lname,$gen,$sec,$enddate,$startdate,                               $fname,$mname,$lname,$gen,$sec,$enddate,
                            $ENV{'form.forceid'});                               $startdate,$ENV{'form.forceid'});
                          unless ($reply eq 'ok') {                          unless ($reply eq 'ok') {
                             $r->print(                              $r->print(
                              "<p><b>Error enrolling $username: $reply</b><p>");                               "<p><b>Error enrolling $username: $reply</b><p>");
           } else {            } else {
Line 833  sub upfile_drop_add { Line 818  sub upfile_drop_add {
                                 $flushc=0;                                  $flushc=0;
                             }                              }
                         }                          }
                      } else {                      } else {
                             $r->print(                          $r->print("<p><b>No password for $username</b><p>");
                              "<p><b>No password for $username</b><p>");                      }
                      }                  }
                   }              }                 
                  }                           }
               }          $r->print('<p>Processed Students: '.$count);
               $r->print('<p>Processed Students: '.$count);  
 # --------------------------------------------------------------- Drop students  # --------------------------------------------------------------- Drop students
               if ($ENV{'form.fullup'} eq 'yes') {          if ($ENV{'form.fullup'} eq 'yes') {
  $r->print('<h3>Dropping Students</h3>');              $r->print('<h3>Dropping Students</h3>');
 # ------------------------------------------------------- Get current classlist  # ------------------------------------------------------- Get current classlist
                  my $classlst=&Apache::lonnet::reply              my $classlst=&Apache::lonnet::reply
                  ('dump:'.$ENV{'course.'.$cid.'.domain'}.':'.                  ('dump:'.$ENV{'course.'.$cid.'.domain'}.':'.
                   $ENV{'course.'.$cid.'.num'}.':classlist',                           $ENV{'course.'.$cid.'.num'}.':classlist',
                   $ENV{'course.'.$cid.'.home'});                           $ENV{'course.'.$cid.'.home'});
                  my %currentlist=();              my %currentlist=();
                  my $now=time;              my $now=time;
                  unless ($classlst=~/^error\:/) {              unless ($classlst=~/^error\:/) {
                      foreach (split(/\&/,$classlst)) {                  foreach (split(/\&/,$classlst)) {
                         my ($name,$value)=split(/\=/,$_);                      my ($name,$value)=split(/\=/,$_);
                         my ($end,$start)=split(/\:/,                      my ($end,$start)=split(/\:/,
                                             &Apache::lonnet::unescape($value));                                             &Apache::lonnet::unescape($value));
                         my $active=1;                      my $active=1;
                         if (($end) && ($now>$end)) { $active=0; }                      if (($end) && ($now>$end)) { $active=0; }
                         if ($active) {                      if ($active) {
            $currentlist{&Apache::lonnet::unescape($name)}=1;                          $currentlist{&Apache::lonnet::unescape($name)}=1;
                         }                      }
                      }                  }
 # ------------------------------------------------ Now got up-to-date classlist  # ------------------------------------------------ Now got up-to-date classlist
                      foreach (@studentdata) {                  foreach (@studentdata) {
                  my %entries=&Apache::loncommon::record_sep($_);                      my %entries=&Apache::loncommon::record_sep($_);
                         unless (($entries{$fields{'username'}} eq '') ||                      unless (($entries{$fields{'username'}} eq '') ||
                           (!defined($entries{$fields{'username'}}))) {                              (!defined($entries{$fields{'username'}}))) {
    delete($currentlist{                          delete($currentlist{
                             $entries{$fields{'username'}}.':'.                              $entries{$fields{'username'}}.':'.
                             $domain});                                  $domain});
         }                      }
                      }                  }
 # ----------------------------------------------------------- Print out choices  # ----------------------------------------------------------- Print out choices
                      &show_drop_list($r,%currentlist);                  &show_drop_list($r,%currentlist);
          } else {              } else {
                      $r->print(                  $r->print('<font color=red><h3>Could not access classlist: '.
                   '<font color=red><h3>Could not access classlist: '.$classlst.                            $classlst.'</h3></font>');
                   '</h3></font>');              }
                  }          }
      }  
 # ------------------------------------------------------------------------ Done  # ------------------------------------------------------------------------ Done
       }
   }  
 }  }
   
 # ================================================================== Phase four  # ================================================================== Phase four
Line 912  sub handler { Line 894  sub handler {
       $r->send_http_header;        $r->send_http_header;
       return OK;        return OK;
    }     }
   
 # ----------------------------------------------------- Needs to be in a course  # ----------------------------------------------------- Needs to be in a course
   
    if (($ENV{'request.course.fn'}) &&      if (($ENV{'request.course.fn'}) && 
        (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'}))) {         (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'}))) {
   
 # ------------------------------------------------------------------ Start page  # ------------------------------------------------------------------ Start page
       $r->content_type('text/html');         $r->content_type('text/html');
       $r->send_http_header;         $r->send_http_header;
       &header($r);         &header($r);
   
 # --------------------------------------------------- Phase one, initial screen  # --------------------------------------------------- Phase one, initial screen
       unless ($ENV{'form.phase'}) {         unless ($ENV{'form.phase'}) {
   &menu_phase_one($r);             &menu_phase_one($r);
       }         }
 # ------------------------------------------------------------------- Phase two  # ------------------------------------------------------------------- Phase two
          if ($ENV{'form.associate'} eq 'Reverse Association') {
       if ($ENV{'form.associate'} eq 'Reverse Association') {             $ENV{'form.phase'} = 'two';
  $ENV{'form.phase'} = 'two';             if ( $ENV{'form.upfile_associate'} ne 'reverse' ) {
  if ( $ENV{'form.upfile_associate'} ne 'reverse' ) {                 $ENV{'form.upfile_associate'} = 'reverse';
   $ENV{'form.upfile_associate'} = 'reverse';             } else {
  } else {                 $ENV{'form.upfile_associate'} = 'forward';
   $ENV{'form.upfile_associate'} = 'forward';             }
  }         }
       }         if ($ENV{'form.phase'} eq 'two') {
       if ($ENV{'form.phase'} eq 'two') {             if ($ENV{'form.fileupload'}) {
  if ($ENV{'form.fileupload'}) {                 &menu_phase_two_upload($r);
      &menu_phase_two_upload($r);             } elsif ($ENV{'form.enroll'}) {
          } elsif ($ENV{'form.enroll'}) {                 &menu_phase_two_enroll($r);
              &menu_phase_two_enroll($r);             } elsif ($ENV{'form.drop'}) {
          } elsif ($ENV{'form.drop'}) {                 &menu_phase_two_drop($r);
              &menu_phase_two_drop($r);             }
          }         }
       }  
   
   
   
   
 # ----------------------------------------------------------------- Phase three  # ----------------------------------------------------------------- Phase three
       if ($ENV{'form.phase'} eq 'three') {         if ($ENV{'form.phase'} eq 'three') {
   if ($ENV{'form.datatoken'}) {             if ($ENV{'form.datatoken'}) {
       &upfile_drop_add($r);                 &upfile_drop_add($r);
           }             }
       }         }
 # ------------------------------------------------------------------ Phase four  # ------------------------------------------------------------------ Phase four
       if ($ENV{'form.phase'} eq 'four') {         if ($ENV{'form.phase'} eq 'four') {
   &drop_student_list($r);             &drop_student_list($r);
       }         }
 # ------------------------------------------------------------------ Phase five  # ------------------------------------------------------------------ Phase five
       if ($ENV{'form.phase'} eq 'five') {         if ($ENV{'form.phase'} eq 'five') {
   &enroll_single_student($r);             &enroll_single_student($r);
       }         }
 # ------------------------------------------------------------------------- End  # ------------------------------------------------------------------------- End
       $r->print('</form></body></html>');         $r->print('</form></body></html>');
    } else {     } else {
 # ----------------------------- Not in a course, or not allowed to modify parms  # ----------------------------- Not in a course, or not allowed to modify parms
       $ENV{'user.error.msg'}=         $ENV{'user.error.msg'}=
         "/adm/dropadd:cst:0:0:Cannot drop or add students";             "/adm/dropadd:cst:0:0:Cannot drop or add students";
       return HTTP_NOT_ACCEPTABLE;          return HTTP_NOT_ACCEPTABLE; 
    }     }
    return OK;     return OK;
 }  }

Removed from v.1.24  
changed lines
  Added in v.1.25


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