Diff for /loncom/interface/loncreateuser.pm between versions 1.31 and 1.33

version 1.31, 2002/04/22 15:26:46 version 1.33, 2002/04/23 21:05:45
Line 85  BEGIN { Line 85  BEGIN {
 sub phase_one {  sub phase_one {
     my $r=shift;      my $r=shift;
     my $defdom=$ENV{'user.domain'};      my $defdom=$ENV{'user.domain'};
     $r->print(<<ENDDOCUMENT);      my @domains = &Apache::loncommon::get_domains();
       my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
       $r->print(<<"ENDDOCUMENT");
 <html>  <html>
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
Line 94  sub phase_one { Line 96  sub phase_one {
 <h1>Create User, Change User Privileges</h1>  <h1>Create User, Change User Privileges</h1>
 <form action=/adm/createuser method=post>  <form action=/adm/createuser method=post>
 <input type=hidden name=phase value=two>  <input type=hidden name=phase value=two>
   <p>
 Username: <input type=text size=15 name=ccuname><br>  Username: <input type=text size=15 name=ccuname><br>
 Domain: <input type=text size=15 name=ccdomain value=$defdom><p>  Domain: $domform 
   </p>
 <input type=submit value="Continue">  <input type=submit value="Continue">
 </form>  </form>
 </body>  </body>
Line 165  ENDFORMINFO Line 169  ENDFORMINFO
     my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);      my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);
     my %incdomains;       my %incdomains; 
     my %inccourses;      my %inccourses;
     my %home_servers = &get_home_servers($ccdomain);    
     foreach (%Apache::lonnet::hostdom) {      foreach (%Apache::lonnet::hostdom) {
        $incdomains{$_}=1;         $incdomains{$_}=1;
     }      }
Line 176  ENDFORMINFO Line 179  ENDFORMINFO
     }      }
     if ($uhome eq 'no_host') {      if ($uhome eq 'no_host') {
         my $home_server_list=          my $home_server_list=
             '<option value="default" selected>default</option>'."\n";              '<option value="default" selected>default</option>'."\n".
         foreach (sort keys(%home_servers)) {                  &Apache::loncommon::home_server_option_list($ccdomain);
             $home_server_list.=          
                 '<option value="'.$_.'">'.$_.' '.  
                     $home_servers{$_}."</option>\n";  
         }  
  $r->print(<<ENDNEWUSER);   $r->print(<<ENDNEWUSER);
 $dochead  $dochead
 <h1>Create New User</h1>  <h1>Create New User</h1>
Line 552  ENDNEWUSERHEAD Line 552  ENDNEWUSERHEAD
         if (lc($desiredhost) eq 'default') {          if (lc($desiredhost) eq 'default') {
             $desiredhost = undef;              $desiredhost = undef;
         } else {          } else {
             my %home_servers = &get_home_servers($ENV{'form.ccdomain'});                my %home_servers = &Apache::loncommon::get_home_servers
                   ($ENV{'form.ccdomain'});  
             if (! exists($home_servers{$desiredhost})) {              if (! exists($home_servers{$desiredhost})) {
                 $r->print($error.'Invalid home server specified');                  $r->print($error.'Invalid home server specified');
                 return;                  return;
Line 832  ENDTABLE Line 833  ENDTABLE
 #---------------------------------------------- end functions for &phase_two  #---------------------------------------------- end functions for &phase_two
   
 #--------------------------------- functions for &phase_two and &phase_three  #--------------------------------- functions for &phase_two and &phase_three
 sub get_home_servers {  
     my $domain = shift;  
     my %home_servers;  
     foreach (keys(%Apache::lonnet::libserv)) {  
         if ($Apache::lonnet::hostdom{$_} eq $domain) {  
             $home_servers{$_} = $Apache::lonnet::hostname{$_};  
         }  
     }  
     return %home_servers;  
 }  
   
 #--------------------------end of functions for &phase_two and &phase_three  #--------------------------end of functions for &phase_two and &phase_three
   

Removed from v.1.31  
changed lines
  Added in v.1.33


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