Diff for /loncom/interface/Attic/londropadd.pm between versions 1.53 and 1.55

version 1.53, 2002/09/25 16:16:19 version 1.55, 2002/09/26 14:04:34
Line 558  sub print_upload_manager_form { Line 558  sub print_upload_manager_form {
 sub enroll_single_student {  sub enroll_single_student {
     my $r=shift;      my $r=shift;
     $r->print('<h3>Enrolling Student</h3>');      $r->print('<h3>Enrolling Student</h3>');
     $r->print('<p>Enrolling '.$ENV{'form.cuname'}." in domain ".      $r->print('<p>Enrolling '.$ENV{'form.cuname'}." \@ ".
               $ENV{'form.lcdomain'}.'</p>');                $ENV{'form.lcdomain'}.'</p>');
     if (($ENV{'form.cuname'})&&($ENV{'form.cuname'}!~/\W/)&&      if (($ENV{'form.cuname'})&&($ENV{'form.cuname'}!~/\W/)&&
         ($ENV{'form.lcdomain'})&&($ENV{'form.lcdomain'}!~/\W/)) {          ($ENV{'form.lcdomain'})&&($ENV{'form.lcdomain'}!~/\W/)) {
Line 594  sub enroll_single_student { Line 594  sub enroll_single_student {
         my $home = &Apache::lonnet::homeserver($ENV{'form.cuname'},          my $home = &Apache::lonnet::homeserver($ENV{'form.cuname'},
                                                    $ENV{'form.lcdomain'});                                                     $ENV{'form.lcdomain'});
         if ((($amode) && ($genpwd)) || ($home ne 'no_host')) {          if ((($amode) && ($genpwd)) || ($home ne 'no_host')) {
               # Clean out any old roles the student has in this class.
             &modifystudent($ENV{'form.lcdomain'},$ENV{'form.cuname'},              &modifystudent($ENV{'form.lcdomain'},$ENV{'form.cuname'},
                            $ENV{'request.course.id'},$ENV{'form.csec'},                             $ENV{'request.course.id'},$ENV{'form.csec'},
                             $desiredhost);                              $desiredhost);
           $r->print(&Apache::lonnet::modifystudent(              my $login_result = &Apache::lonnet::modifystudent
                       $ENV{'form.lcdomain'},$ENV{'form.cuname'},                  ($ENV{'form.lcdomain'},$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'},
                     $desiredhost));                   $desiredhost);
               if ($login_result =~ /^ok/) {
                   $r->print($login_result);
                   $r->print("<p> If active, the new role will be available ".
                             "when the student next logs in to LON-CAPA.</p>");
               } else {
                   $r->print("unable to enroll: ".$login_result);
               }
  } else {   } else {
             $r->print('<p><font color="#ff0000">ERROR</font>&nbsp;'.              $r->print('<p><font color="#ff0000">ERROR</font>&nbsp;'.
                       'Invalid login mode or password.  '.                        'Invalid login mode or password.  '.
Line 790  sub print_csv_classlist { Line 798  sub print_csv_classlist {
     if (! scalar(@$student_array)) {      if (! scalar(@$student_array)) {
         $r->print("There are no students currently enrolled.\n");          $r->print("There are no students currently enrolled.\n");
     } else {      } else {
         &show_class_list($r,'csv','nolink','any',$student_array,$student_data);          &show_class_list($r,'csv','nolink','csv',
                            'any',$student_array,$student_data);
     }      }
 }  }
   
Line 1131  sub get_enrollment_data { Line 1140  sub get_enrollment_data {
 sub show_drop_list {  sub show_drop_list {
     my ($students,$s_data,$r)=@_;      my ($students,$s_data,$r)=@_;
     my $cid=$ENV{'request.course.id'};      my $cid=$ENV{'request.course.id'};
     $r->print(<<'END');      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 <input type="hidden" name="action" value="drop" />                                              ['sortby']);
       my $sortby = $ENV{'form.sortby'};
       if ($sortby !~ /^(username|domain|section|fullname|id)$/) {
           $sortby = 'username';
       }
       my $action = "drop";
       $r->print(<<END);
   <input type="hidden" name="sortby" value="$sortby" />
   <input type="hidden" name="action" value="$action" />
 <input type="hidden" name="state"  value="done" />  <input type="hidden" name="state"  value="done" />
 <script>  <script>
 function checkAll(field) {  function checkAll(field) {
Line 1148  function uncheckAll(field) { Line 1165  function uncheckAll(field) {
 <p>  <p>
 <input type="hidden" name="phase" value="four">  <input type="hidden" name="phase" value="four">
 <table border=2>  <table border=2>
 <tr><th>&nbsp;</th><th>username</th><th>domain</th>  <tr><th>&nbsp;</th>
     <th>ID</th><th>student name</th><th>section</th></tr>      <th>
          <a href="/adm/dropadd?action=$action&sortby=username">username</a>
       </th><th>
          <a href="/adm/dropadd?action=$action&sortby=domain">domain</a>
       </th><th>
          <a href="/adm/dropadd?action=$action&sortby=id">ID</a>
       </th><th>
          <a href="/adm/dropadd?action=$action&sortby=fullname">student name</a>
       </th><th>
          <a href="/adm/dropadd?action=$action&sortby=section">section</a>
       </th>
   </tr>
 END  END
     foreach my $student (@$students) {      my @Sorted_Students = sort {
               lc($s_data->{$a.':'.$sortby})  cmp lc($s_data->{$b.':'.$sortby})
                   ||
               lc($s_data->{$a.':username'}) cmp lc($s_data->{$b.':username'})
                   ||
               lc($s_data->{$a.':domain'})   cmp lc($s_data->{$b.':domain'})
           } @$students;
       foreach my $student (@Sorted_Students) {
         my $error;          my $error;
         if (exists($s_data->{$student.':error'})) {          if (exists($s_data->{$student.':error'})) {
             $error = $s_data->{$student.':error'};              $error = $s_data->{$student.':error'};
Line 1364  sub upfile_drop_add { Line 1399  sub upfile_drop_add {
                 }                  }
             }              }
         } # end of foreach (@studentdata)          } # end of foreach (@studentdata)
         $r->print('<p>Processed Students: '.$count);          $r->print('<p>Processed Students: '.$count.'</p>');
           $r->print("<p>If active, the new role will be available when the ".
                     "students next log in to LON-CAPA.</p>");
         #####################################          #####################################
         #           Drop students           #          #           Drop students           #
         #####################################          #####################################
Line 1445  sub drop_student_list { Line 1482  sub drop_student_list {
         my ($uname,$udom)=split(/\:/,$_);          my ($uname,$udom)=split(/\:/,$_);
         my $result = &modifystudent($udom,$uname,$ENV{'request.course.id'});          my $result = &modifystudent($udom,$uname,$ENV{'request.course.id'});
         if ($result eq 'ok' || $result eq 'ok:') {          if ($result eq 'ok' || $result eq 'ok:') {
             $r->print('Dropped '.$uname.' at '.$udom.'<br>');              $r->print('Dropped '.$uname.' @ '.$udom.'<br>');
         } else {          } else {
             $r->print('Error dropping '.$uname.' at '.$udom.': '.$result.              $r->print('Error dropping '.$uname.' @ '.$udom.': '.$result.
                       '<br />');                        '<br />');
         }          }
         $count++;          $count++;
Line 1541  sub handler { Line 1578  sub handler {
         } elsif ($ENV{'form.state'} eq 'done') {          } elsif ($ENV{'form.state'} eq 'done') {
             &drop_student_list($r);              &drop_student_list($r);
         } else {          } else {
             &menu_phase_two_drop($r);              &print_drop_menu($r);
         }          }
     } elsif ($ENV{'form.action'} eq 'enrollstudent') {      } elsif ($ENV{'form.action'} eq 'enrollstudent') {
         if (! exists($ENV{'form.state'})) {          if (! exists($ENV{'form.state'})) {

Removed from v.1.53  
changed lines
  Added in v.1.55


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