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

version 1.11, 2001/02/14 12:29:25 version 1.12, 2001/02/14 22:51:48
Line 431  ENDPICK Line 431  ENDPICK
 <input type=hidden name=nfields value=$i>  <input type=hidden name=nfields value=$i>
 <input type=hidden name=keyfields value="$keyfields">  <input type=hidden name=keyfields value="$keyfields">
 <h3>Login Type</h3>  <h3>Login Type</h3>
   Note: this will not take effect if the user already exists<p>
 <input type=radio name=login value=krb onClick="clickkrb(this.form);">  <input type=radio name=login value=krb onClick="clickkrb(this.form);">
 Kerberos authenticated with domain  Kerberos authenticated with domain
 <input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p>  <input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p>
Line 460  Note: for large courses, this operation Line 461  Note: for large courses, this operation
 ENDPICK  ENDPICK
 }  }
   
   # ======================================================= Enroll single student
   
   sub enroll_single_student {
       my $r=shift;
       $r->print('<h3>Enrolling Student</h3>');
       if (($ENV{'form.cuname'})&&($ENV{'form.cuname'}!~/\W/)&&
           ($ENV{'form.cdomain'})&&($ENV{'form.cdomain'}!~/\W/)) {
    my $amode='';
           my $genpwd='';
           if ($ENV{'form.login'} eq 'krb') {
              $amode='krb4';
              $genpwd=$ENV{'form.krbdom'};
           } elsif ($ENV{'form.login'} eq 'int') {
              $amode='internal';
              $genpwd=$ENV{'form.intpwd'};
           }
           if (($amode) && ($genpwd)) {
      &dropstudent($ENV{'form.cdomain'},$ENV{'form.cuname'},
          $ENV{'request.course.id'},$ENV{'form.csec'});
             $r->print(&Apache::lonnet::modifystudent(
                         $ENV{'form.cdomain'},$ENV{'form.cuname'},
                         $ENV{'form.cstid'},$amode,$genpwd,
                  $ENV{'form.cfirst'},$ENV{'form.cmiddle'},
                         $ENV{'form.clast'},$ENV{'form.cgen'},
                         $ENV{'form.csec'},$ENV{'form.enddate'},
                         $ENV{'form.startdate'}));
    } else {
              $r->print('Invalid login mode or password');    
           }          
       } else {
           $r->print('Invalid username or domain');
       }    
   }
   
 # ======================================================= Menu Phase Two Enroll  # ======================================================= Menu Phase Two Enroll
   
 sub menu_phase_two_enroll {  sub menu_phase_two_enroll {
Line 475  sub menu_phase_two_enroll { Line 510  sub menu_phase_two_enroll {
     my $defdom=$r->dir_config('lonDefDomain');      my $defdom=$r->dir_config('lonDefDomain');
   
     $r->print(<<ENDSENROLL);      $r->print(<<ENDSENROLL);
 <h3>Personal Data</h3>  <script>
   function verify(vf) {
       var founduname=0;
       var foundpwd=0;
       var foundname=0;
       var foundid=0;
       var foundsec=0;
       var foundatype=0;
       var tw;
       var message='';
       if ((vf.cuname.value!=undefined) && (vf.cuname.value!='') && 
    (vf.cdomain.value!=undefined) && (vf.cdomain.value!='')) {
           founduname=1;
       }
       if ((vf.cfirst.value!=undefined) && (vf.cfirst.value!='') &&
    (vf.clast.value!=undefined) && (vf.clast.value!='')) {
           foundname=1;
       }
       if ((vf.csec.value!=undefined) && (vf.csec.value!='')) {
           foundsec=1;
       }
       if ((vf.cstid.value!=undefined) && (vf.cstid.value!='')) {
    foundid=1;
       }
       if (founduname==0) {
    alert('You need to specify at least the username and domain fields');
           return;
       }
       if (vf.login[0].checked) {
    foundatype=1;
           if (vf.krbdom.value=='') {
       alert('You need to specify the Kerberos domain');
               return;
           }
       }
       if (vf.login[1].checked) {
    foundatype=1;
           if ((vf.intpwd.value=='') && (foundpwd==0)) {
       alert('You need to specify the initial password');
               return;
           }
       }
       if (foundatype==0) {
    alert('You need to set the login type');
           return;
       }
       if (foundname==0) { message='No first and last name specified. '; }
       if (foundid==0) { message+='No ID or student number field specified. '; }
       if (foundsec==0) { message+='No section or group field specified. '; }
       if (vf.startdate.value=='') {
    message+='No starting date set. ';
       }
       if (vf.enddate.value=='') {
           message+='No ending date set. ';
       }
       if ((vf.enddate.value!='') && (vf.startdate.value!='')) {
          if (Math.round(vf.enddate.value)<Math.round(vf.startdate.value)) {
             alert('Ending date is before starting date');
             return;
          }
       }
       if (message!='') {
          message+='Continue enrollment?';
          if (confirm(message)) {
     pclose();
     vf.submit();
          }
       } else {
         pclose();
         vf.submit();
       }   
   }
   
   function setkrb(vf) {
       if (vf.krbdom.value!='') {
          vf.login[0].checked=true;
          vf.krbdom.value=vf.krbdom.value.toUpperCase();
          vf.intpwd.value='';
      }
   }
   
   function setint(vf) {
       if (vf.intpwd.value!='') {
          vf.login[1].checked=true;
          vf.krbdom.value='';
      }
   }
   
   function clickkrb(vf) {
       vf.krbdom.value='$krbdefdom';
       vf.intpwd.value='';
   }
   
   function clickint(vf) {
       vf.krbdom.value='';
   }
   
       function pclose() {
           parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
                    "height=350,width=350,scrollbars=no,menubar=no");
           parmwin.close();
       }
   
       function pjump(type,dis,value,marker,ret,call) {
           parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
                    +"&value="+escape(value)+"&marker="+escape(marker)
                    +"&return="+escape(ret)
                    +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
                    "height=350,width=350,scrollbars=no,menubar=no");
   
       }
   
       function dateset() {
           if (document.studentform.pres_marker.value=='end') {
              document.studentform.enddate.value=
          document.studentform.pres_value.value;
           }
           if (document.studentform.pres_marker.value=='start') {
              document.studentform.startdate.value=
          document.studentform.pres_value.value;
           }
           pclose();
       }
   
   </script>
   <h3>Personal Data</h3>
 First Name: <input type=text name=cfirst size=15><br>  First Name: <input type=text name=cfirst size=15><br>
 Middle Name: <input type=text name=cmiddle size=15><br>  Middle Name: <input type=text name=cmiddle size=15><br>
 Last Name: <input type=text name=clast size=15><br>  Last Name: <input type=text name=clast size=15><br>
Line 486  ID/Student Number: <input type=text name Line 645  ID/Student Number: <input type=text name
   
 Group/Section: <input type=text name=csec size=5><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 Data</h3>
   Username: <input type=text name=cuname size=15><p>
   Domain: <input type=text size=10 value=$defdom name=cdomain><p>
   Note: login settings below  will not take effect if the user already exists<p>
   
 <h3>Login Type</h3>  
 <input type=radio name=login value=krb onClick="clickkrb(this.form);">  <input type=radio name=login value=krb onClick="clickkrb(this.form);">
 Kerberos authenticated with domain  Kerberos authenticated with domain
 <input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p>  <input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p>
 <input type=radio name=login value=int onClick="clickint(this.form);">   <input type=radio name=login value=int onClick="clickint(this.form);"> 
 Internally authenticated (with initial password   Internally authenticated (with initial password 
 <input type=text size=10 name=intpwd onChange="setint(this.form);">)  <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>  <h3>Starting and Ending Dates</h3>
 <input type="hidden" value='' name="pres_value">  <input type="hidden" value='' name="pres_value">
 <input type="hidden" value='' name="pres_type">  <input type="hidden" value='' name="pres_type">
Line 510  LON-CAPA domain: <input type=text size=1 Line 670  LON-CAPA domain: <input type=text size=1
 <a   <a 
  href="javascript:pjump('date_end','Enrollment Ending Date',document.studentform.enddate.value,'end','studentform.pres','dateset');"   href="javascript:pjump('date_end','Enrollment Ending Date',document.studentform.enddate.value,'end','studentform.pres','dateset');"
 >Set Ending Date</a><p>  >Set Ending Date</a><p>
   <input type=button onClick="verify(this.form)" value="Enroll as student"><br>
   <input type=hidden name=phase value=five>
 ENDSENROLL  ENDSENROLL
 }  }
   
Line 800  sub handler { Line 962  sub handler {
       if ($ENV{'form.phase'} eq 'four') {        if ($ENV{'form.phase'} eq 'four') {
   &drop_student_list($r);    &drop_student_list($r);
       }        }
   # ------------------------------------------------------------------ Phase four
         if ($ENV{'form.phase'} eq 'five') {
     &enroll_single_student($r);
         }
 # ------------------------------------------------------------------------- End  # ------------------------------------------------------------------------- End
       $r->print('</form></body></html>');        $r->print('</form></body></html>');
    } else {     } else {

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


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