Diff for /loncom/interface/Attic/londropadd.pm between versions 1.10 and 1.11

version 1.10, 2001/02/13 21:24:18 version 1.11, 2001/02/14 12:29:25
Line 15 Line 15
 # 12/08,12/12 Gerd Kortemeyer)  # 12/08,12/12 Gerd Kortemeyer)
 #  #
 # 12/26,12/27,12/28,  # 12/26,12/27,12/28,
 # 01/01/01,01/15,02/10,02/13 Gerd Kortemeyer  # 01/01/01,01/15,02/10,02/13,02/14 Gerd Kortemeyer
   
 package Apache::londropadd;  package Apache::londropadd;
   
Line 189  sub menu_phase_one { Line 189  sub menu_phase_one {
 <h3>Enroll a single student</h3>  <h3>Enroll a single student</h3>
 <p><input type=submit name=enroll value="Enroll Student">  <p><input type=submit name=enroll value="Enroll Student">
 <hr>  <hr>
 <h3>Drop a student</h3>  <h3>Drop students</h3>
 <p><input type=submit name=drop value="Drop Student">  <p><input type=submit name=drop value="Selection List">
 ENDUPFORM  ENDUPFORM
 }  }
   
Line 454  LON-CAPA domain: <input type=text size=1 Line 454  LON-CAPA domain: <input type=text size=1
 >Set Ending Date</a><p>  >Set Ending Date</a><p>
 <h3>Full Update</h3>  <h3>Full Update</h3>
 <input type=checkbox name=fullup value=yes> Full update   <input type=checkbox name=fullup value=yes> Full update 
 (also dropping students)<p>  (also print list of users not enrolled anymore)<p>
 <input type=button onClick="verify(this.form)" value="Update Courselist"><br>  <input type=button onClick="verify(this.form)" value="Update Courselist"><br>
 Note: for large courses, this operation might be time consuming.  Note: for large courses, this operation might be time consuming.
 ENDPICK  ENDPICK
Line 464  ENDPICK Line 464  ENDPICK
   
 sub menu_phase_two_enroll {  sub menu_phase_two_enroll {
     my $r=shift;      my $r=shift;
       
       $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
       my $krbdefdom=$1;
       $krbdefdom=~tr/a-z/A-Z/;
   
       my $today=time;
       my $halfyear=$today+15552000;
   
       my $defdom=$r->dir_config('lonDefDomain');
   
       $r->print(<<ENDSENROLL);
   <h3>Personal Data</h3>
   
   First Name: <input type=text name=cfirst size=15><br>
   Middle Name: <input type=text name=cmiddle size=15><br>
   Last Name: <input type=text name=clast size=15><br>
   Generation: <input type=text name=cgen size=5><p>
   
   ID/Student Number: <input type=text name=cstid size=10><p>
   
   Group/Section: <input type=text name=csec size=5><p>
   
   Initial password (if applicable): <input type=text name=cinpwd size=10><p>
   
   <h3>Login Type</h3>
   <input type=radio name=login value=krb onClick="clickkrb(this.form);">
   Kerberos authenticated with domain
   <input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p>
   <input type=radio name=login value=int onClick="clickint(this.form);"> 
   Internally authenticated (with initial password 
   <input type=text size=10 name=intpwd onChange="setint(this.form);">)
   <h3>LON-CAPA Domain for Students</h3>
   LON-CAPA domain: <input type=text size=10 value=$defdom name=lcdomain><p>
   <h3>Starting and Ending Dates</h3>
   <input type="hidden" value='' name="pres_value">
   <input type="hidden" value='' name="pres_type">
   <input type="hidden" value='' name="pres_marker">
   <input type="hidden" value='$today' name=startdate>
   <input type="hidden" value='$halfyear' name=enddate>
   <a 
    href="javascript:pjump('date_start','Enrollment Starting Date',document.studentform.startdate.value,'start','studentform.pres','dateset');"
   >Set Starting Date</a><p>
   
   <a 
    href="javascript:pjump('date_end','Enrollment Ending Date',document.studentform.enddate.value,'end','studentform.pres','dateset');"
   >Set Ending Date</a><p>
   ENDSENROLL
 }  }
   
 # ========================================================= Menu Phase Two Drop  # ========================================================= Menu Phase Two Drop
   
 sub menu_phase_two_drop {  sub menu_phase_two_drop {
     my $r=shift;      my $r=shift;
       my $cid=$ENV{'request.course.id'};
                    my $classlst=&Apache::lonnet::reply
                    ('dump:'.$ENV{'course.'.$cid.'.domain'}.':'.
                     $ENV{'course.'.$cid.'.num'}.':classlist',
                     $ENV{'course.'.$cid.'.home'});
                    my %currentlist=();
                    my $now=time;
                    unless ($classlst=~/^error\:/) {
                        map {
                           my ($name,$value)=split(/\=/,$_);
                           my ($end,$start)=split(/\:/,
                                               &Apache::lonnet::unescape($value));
                           my $active=1;
                           if (($end) && ($now>$end)) { $active=0; }
                           if ($active) {
              $currentlist{&Apache::lonnet::unescape($name)}=1;
                           }
                        } split(/\&/,$classlst);
   # ----------------------------------------------------------- Print out choices
                        &show_drop_list($r,%currentlist);
            } else {
                        $r->print(
                     '<font color=red><h3>Could not access classlist: '.$classlst.
                     '</h3></font>');
                    }
   }
   
   # =================================================== Show student list to drop
   
   sub show_drop_list {
       my ($r,%currentlist)=@_;
       my $cid=$ENV{'request.course.id'};
   
       $r->print('<input type=hidden name=phase value=four>');
                        $r->print('<table border=2>');
                        map {
                            my ($sname,$sdom)=split(/\:/,$_);
                            my %reply=&Apache::lonnet::idrget($sdom,$sname);
                            my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid);
                            my @reply=split(/[\&\=]/,&Apache::lonnet::reply(
                              'get:'.$sdom.':'.$sname.
         ':environment:firstname&middlename&lastname&generation',
                              &Apache::lonnet::homeserver($sname,$sdom)));
     $r->print(
                     '<tr><td><input type=checkbox name="drop:'.$_.'"></td><td>'.
                                      $sname.'</td><td>'.$sdom.'</td><td>'.
                                      $reply{$sname}.'</td><td>'.
                                      &Apache::lonnet::unescape($reply[2]).' '.
                                      &Apache::lonnet::unescape($reply[3]).', '.
                                      &Apache::lonnet::unescape($reply[0]).' '.
                                      &Apache::lonnet::unescape($reply[1]).
                                      '</td><td>'.
                                      $ssec."</td></tr>\n");
                        } sort keys %currentlist;
                        $r->print('</table><br>');
                        $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;
     $r->print('<input type=hidden name=phase value=four>');  
   
     &load_tmp_file($r);      &load_tmp_file($r);
     my @studentdata=&upfile_record_sep();      my @studentdata=&upfile_record_sep();
Line 620  sub upfile_drop_add { Line 722  sub upfile_drop_add {
         }          }
                      } @studentdata;                       } @studentdata;
 # ----------------------------------------------------------- Print out choices  # ----------------------------------------------------------- Print out choices
                      $r->print('<table border=2>');                       &show_drop_list($r,%currentlist);
                      map {  
                          my ($sname,$sdom)=split(/\:/,$_);  
                          my %reply=&Apache::lonnet::idrget($sdom,$sname);  
                          my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid);  
                          my @reply=split(/[\&\=]/,&Apache::lonnet::reply(  
                            'get:'.$sdom.':'.$sname.  
       ':environment:firstname&middlename&lastname&generation',  
                            &Apache::lonnet::homeserver($sname,$sdom)));  
   $r->print(  
                   '<tr><td><input type=checkbox name="drop:'.$_.'"></td><td>'.  
                                    $sname.'</td><td>'.$sdom.'</td><td>'.  
                                    $reply{$sname}.'</td><td>'.  
                                    $reply[2].' '.$reply[3],', '.$reply[0].' '.  
                                    $reply[1].'</td><td>'.  
                                    $ssec."</td></tr>\n");  
                      } sort keys %currentlist;  
                      $r->print('</table><br>');  
                      $r->print('<input type=submit value="Drop Students">');  
   
          } else {           } else {
                      $r->print(                       $r->print(
                   '<font color=red><h3>Could not access classlist: '.$classlst.                    '<font color=red><h3>Could not access classlist: '.$classlst.
Line 651  sub upfile_drop_add { Line 734  sub upfile_drop_add {
   }    }
 }  }
   
   # ================================================================== Phase four
   
   sub drop_student_list {
       my $r=shift;
       my $count=0;
       map {
    if ($_=~/^form\.drop\:/) {
       my ($dummy,$uname,$udom)=split(/\:/,$_);
               &dropstudent($udom,$uname,$ENV{'request.course.id'});
               $r->print('Dropped '.$uname.' at '.$udom.'<br>');
               $count++;
           }
       } keys %ENV;
       $r->print('<p><b>Dropped '.$count.' student(s).</b>');
       $r->print('<p>Re-enrollment will re-activate data.');
   }
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
   
 sub handler {  sub handler {
Line 696  sub handler { Line 796  sub handler {
       &upfile_drop_add($r);        &upfile_drop_add($r);
           }            }
       }        }
   # ------------------------------------------------------------------ Phase four
         if ($ENV{'form.phase'} eq 'four') {
     &drop_student_list($r);
         }
 # ------------------------------------------------------------------------- End  # ------------------------------------------------------------------------- End
       $r->print('</form></body></html>');        $r->print('</form></body></html>');
    } else {     } else {

Removed from v.1.10  
changed lines
  Added in v.1.11


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