Diff for /loncom/interface/loncreateuser.pm between versions 1.406.2.14 and 1.406.2.14.2.1

version 1.406.2.14, 2017/04/02 12:40:18 version 1.406.2.14.2.1, 2017/08/15 23:42:33
Line 2345  sub modify_login_block { Line 2345  sub modify_login_block {
   
 sub personal_data_display {  sub personal_data_display {
     my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,      my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,
         $now,$captchaform,$emailusername,$usertype) = @_;          $now,$captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded) = @_;
     my ($output,%userenv,%canmodify,%canmodify_status);      my ($output,%userenv,%canmodify,%canmodify_status);
     my @userinfo = ('firstname','middlename','lastname','generation',      my @userinfo = ('firstname','middlename','lastname','generation',
                     'permanentemail','id');                      'permanentemail','id');
Line 2372  sub personal_data_display { Line 2372  sub personal_data_display {
                 'inststatus'     => "Affiliation",                  'inststatus'     => "Affiliation",
                 'email'          => 'E-mail address',                  'email'          => 'E-mail address',
                 'valid'          => 'Validation',                  'valid'          => 'Validation',
                   'username'       => 'Username',
     );      );
   
     %canmodify_status =      %canmodify_status =
Line 2390  sub personal_data_display { Line 2391  sub personal_data_display {
             if (ref($emailusername) eq 'HASH') {              if (ref($emailusername) eq 'HASH') {
                 if (ref($emailusername->{$usertype}) eq 'HASH') {                  if (ref($emailusername->{$usertype}) eq 'HASH') {
                     my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();                      my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();
                     @userinfo = ();                                @userinfo = ();
                     if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {                      if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
                         foreach my $field (@{$infofields}) {                           foreach my $field (@{$infofields}) { 
                             if ($emailusername->{$usertype}->{$field}) {                              if ($emailusername->{$usertype}->{$field}) {
Line 2420  sub personal_data_display { Line 2421  sub personal_data_display {
     $output = '<h3>'.$lt{'pd'}.'</h3>'.      $output = '<h3>'.$lt{'pd'}.'</h3>'.
               &Apache::lonhtmlcommon::start_pick_box();                &Apache::lonhtmlcommon::start_pick_box();
     if (($context eq 'selfcreate') && ($newuser eq 'email')) {      if (($context eq 'selfcreate') && ($newuser eq 'email')) {
           my $size = 25;
           if ($condition) {
               if ($condition =~ /^\@[^\@]+$/) {
                   $size = 10;
               } else {
                   undef($condition);
               }
           }
           if ($excluded) {
               unless ($excluded =~ /^\@[^\@]+$/) {
                   undef($condition);
               }
           }
         $output .= &Apache::lonhtmlcommon::row_title($lt{'email'}.'<b>*</b>',undef,          $output .= &Apache::lonhtmlcommon::row_title($lt{'email'}.'<b>*</b>',undef,
                                                      'LC_oddrow_value')."\n".                                                       'LC_oddrow_value')."\n".
                    '<input type="text" name="uname" size="25" value="" autocomplete="off" />';                     '<input type="text" name="uname" size="'.$size.'" value="" autocomplete="off" />';
           if ($condition) {
               $output .= $condition;
           } elsif ($excluded) {
               $output .= '<br /><span style="font-size: smaller">'.&mt('You must use an e-mail address that does not end with [_1]',
                                                                        $excluded).'</span>';
           }
           if ($usernameset eq 'first') {
               $output .= '<br /><span style="font-size: smaller">';
               if ($condition) {
                   $output .= &mt('Your username in LON-CAPA will be the part of your e-mail address before [_1]',
                                         $condition);
               } else {
                   $output .= &mt('Your username in LON-CAPA will be the part of your e-mail address before the @');
               }
               $output .= '</span>';
           }
         $rowcount ++;          $rowcount ++;
         $output .= &Apache::lonhtmlcommon::row_closure(1);          $output .= &Apache::lonhtmlcommon::row_closure(1);
         my $upassone = '<input type="password" name="upass'.$now.'" size="20" autocomplete="off" />';          my $upassone = '<input type="password" name="upass'.$now.'" size="20" autocomplete="off" />';
Line 2437  sub personal_data_display { Line 2467  sub personal_data_display {
                                                      'LC_oddrow_value')."\n".                                                       'LC_oddrow_value')."\n".
                    $upasstwo.                     $upasstwo.
                    &Apache::lonhtmlcommon::row_closure()."\n";                     &Apache::lonhtmlcommon::row_closure()."\n";
           if ($usernameset eq 'free') {
               my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
               $output .= &Apache::lonhtmlcommon::row_title($lt{'username'},undef,'LC_oddrow_value')."\n".
                          &mt('Use e-mail address: ').
                          '<label><input type="radio" name="emailused" value="1" checked="checked" onclick="'.$onclick.'" />'.&mt('Yes').'</label>'."\n".
                          ('&nbsp;'x2).
                          '<label><input type="radio" name="emailused" value="0" onclick="'.$onclick.'" />'.&mt('No').'</label>'."\n".
                          '<div id="selfcreateusername" style="display: none; font-size: smaller">'.
                          '<br /><span class="LC_nobreak">'.&mt('Preferred username').
                          '&nbsp;<input type="text" name="username" value="" size="20" autocomplete="off"/>'.
                          '</span></div>'."\n".&Apache::lonhtmlcommon::row_closure(1);
               $rowcount ++;
           }
     }      }
     foreach my $item (@userinfo) {      foreach my $item (@userinfo) {
         my $rowtitle = $lt{$item};          my $rowtitle = $lt{$item};
Line 4910  sub handler { Line 4953  sub handler {
                             unless ($usertype) {                              unless ($usertype) {
                                 $usertype = 'default';                                  $usertype = 'default';
                             }                              }
                               my ($showstatus,$showemail,$pickstart);
                               my $numextras = 0;
                               my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
                               if ((ref($types) eq 'ARRAY') && (@{$types} > 0)) {
                                   if (ref($usertypes) eq 'HASH') {
                                       if ($usertypes->{$usertype}) {
                                           $showstatus = $usertypes->{$usertype};
                                       } else {
                                           $showstatus = $othertitle;
                                       }
                                       if ($showstatus) {
                                           $numextras ++;
                                       }
                                   }
                               }
                               if (($info{$uname}{'email'} ne '') && ($info{$uname}{'email'} ne $uname)) {
                                   $showemail = $info{$uname}{'email'};
                                   $numextras ++;
                               }
                             if (ref($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}) eq 'HASH') {                              if (ref($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}) eq 'HASH') {
                                 if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {                                  if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
                                       $pickstart = 1;
                                     $r->print('<div>'.&Apache::lonhtmlcommon::start_pick_box());                                      $r->print('<div>'.&Apache::lonhtmlcommon::start_pick_box());
                                     my ($num,$count,$showstatus);                                      my ($num,$count);
                                     $count = scalar(keys(%{$domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}}));                                      $count = scalar(keys(%{$domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}}));
                                     unless ($usertype eq 'default') {                                      $count += $numextras;
                                         my ($othertitle,$usertypes,$types) =   
                                             &Apache::loncommon::sorted_inst_types($dom);  
                                         if (ref($usertypes) eq 'HASH') {  
                                             if ($usertypes->{$usertype}) {  
                                                 $showstatus = $usertypes->{$usertype};  
                                                 $count ++;  
                                             }  
                                         }  
                                     }  
                                     foreach my $field (@{$infofields}) {                                      foreach my $field (@{$infofields}) {
                                         next unless ($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}{$field});                                          next unless ($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}{$field});
                                         next unless ($infotitles->{$field});                                          next unless ($infotitles->{$field});
                                         $r->print(&Apache::lonhtmlcommon::row_title($infotitles->{$field}).                                          $r->print(&Apache::lonhtmlcommon::row_title($infotitles->{$field}).
                                                   $info{$uname}{$field});                                                    $info{$uname}{$field});
                                         $num ++;                                          $num ++;
                                         if ($count == $num) {                                          unless ($count == $num) {
                                             $r->print(&Apache::lonhtmlcommon::row_closure(1));  
                                         } else {  
                                             $r->print(&Apache::lonhtmlcommon::row_closure());                                              $r->print(&Apache::lonhtmlcommon::row_closure());
                                         }                                          }
                                     }                                      }
                                     if ($showstatus) {                                  }
                                         $r->print(&Apache::lonhtmlcommon::row_title(&mt('Status type (self-reported)')).                              }
                                                   $showstatus.                              if ($numextras) {
                                                   &Apache::lonhtmlcommon::row_closure(1));                                  unless ($pickstart) {
                                       $r->print('<div>'.&Apache::lonhtmlcommon::start_pick_box());
                                       $pickstart = 1;
                                   }
                                   if ($showemail) {
                                       my $closure = '';
                                       unless ($showstatus) {
                                           $closure = 1;
                                     }                                      }
                                     $r->print(&Apache::lonhtmlcommon::end_pick_box().'</div>');                                      $r->print(&Apache::lonhtmlcommon::row_title(&mt('E-mail address')).
                                                 $showemail.
                                                 &Apache::lonhtmlcommon::row_closure($closure));
                                   }
                                   if ($showstatus) {
                                       $r->print(&Apache::lonhtmlcommon::row_title(&mt('Status type[_1](self-reported)','<br />')).
                                                 $showstatus.
                                                 &Apache::lonhtmlcommon::row_closure(1));
                                 }                                  }
                             }                              }
                               if ($pickstart) {
                                   $r->print(&Apache::lonhtmlcommon::end_pick_box().'</div>');
                               } else {
                                   $r->print('<div>'.&mt('No information to display for this account request.').'</div>');
                               }
                           } else {
                               $r->print('<div>'.&mt('No information available for this account request.').'</div>');
                         }                          }
                     }                      }
                 }                  }
             }              }
             $r->print(&close_popup_form());  
         }          }
           $r->print(&close_popup_form());
     } elsif (($env{'form.action'} eq 'listusers') &&       } elsif (($env{'form.action'} eq 'listusers') && 
              ($permission->{'view'} || $permission->{'cusr'})) {               ($permission->{'view'} || $permission->{'cusr'})) {
         my $helpitem = 'Course_View_Class_List';          my $helpitem = 'Course_View_Class_List';
Line 5817  function validate_types(form) { Line 5890  function validate_types(form) {
 }  }
   
 function check_types(num,countfail,needaction) {  function check_types(num,countfail,needaction) {
     var typeidx = getIndexByName('selfenroll_types_'+num);      var boxname = 'selfenroll_types_'+num;
       var typeidx = getIndexByName(boxname);
     var count = 0;      var count = 0;
     if (typeidx != -1) {      if (typeidx != -1) {
         if (document.$formname.elements[typeidx].length) {          if (document.$formname.elements[boxname].length) {
             for (var k=0; k<document.$formname.elements[typeidx].length; k++) {              for (var k=0; k<document.$formname.elements[boxname].length; k++) {
                 if (document.$formname.elements[typeidx][k].checked) {                  if (document.$formname.elements[boxname][k].checked) {
                     count ++;                      count ++;
                 }                  }
             }              }

Removed from v.1.406.2.14  
changed lines
  Added in v.1.406.2.14.2.1


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