Diff for /loncom/interface/lonuserutils.pm between versions 1.109.2.8 and 1.109.2.9

version 1.109.2.8, 2010/11/09 14:14:55 version 1.109.2.9, 2010/11/15 17:37:47
Line 630  END Line 630  END
 ###############################################################  ###############################################################
 sub upload_manager_javascript_forward_associate {  sub upload_manager_javascript_forward_associate {
     my ($can_assign) = @_;      my ($can_assign) = @_;
     my $auth_update;      my ($auth_update,$numbuttons,$argreset);
     if (ref($can_assign) eq 'HASH') {      if (ref($can_assign) eq 'HASH') {
         if (keys(%{$can_assign}) > 1) {          if ($can_assign->{'krb4'} || $can_assign->{'krb5'}) {
               $argreset .= "      vf.krbarg.value='';\n";
               $numbuttons ++ ;
           }
           if ($can_assign->{'int'}) {
               $argreset .= "      vf.intarg.value='';\n";
               $numbuttons ++;
           }
           if ($can_assign->{'loc'}) {
               $argreset .= "      vf.locarg.value='';\n";
               $numbuttons ++;
           }
           if (!$can_assign->{'int'}) {
               my $warning = &mt('You may not specify an initial password for each user, as this is only available when new users use LON-CAPA internal authentication.\n').
                             &mt('Your current role does not have rights to create users with that authentication type.');
               $auth_update = <<"END";
      // Currently the initial password field is only supported for internal auth
      // (see bug 6368).
      if (nw==2) {
          eval('vf.f'+tf+'.selectedIndex=0;')
          alert('$warning');
      }
   END
           } elsif ($numbuttons > 1) {
             $auth_update = <<"END";              $auth_update = <<"END";
    // If we set the password, make the password form below correspond to     // If we set the password, make the password form below correspond to
    // the new value.     // the new value.
    if (nw==9) {     if (nw==2) {
       changed_radio('int',document.studentform);        changed_radio('int',document.studentform);
       set_auth_radio_buttons('int',document.studentform);        set_auth_radio_buttons('int',document.studentform);
   $argreset
      }
   
 END  END
         }          }
         if ($can_assign->{'krb'}) {  
            $auth_update .= "      vf.krbarg.value='';\n";  
         }  
         if ($can_assign->{'int'}) {  
            $auth_update .= "      vf.intarg.value='';\n";  
         }  
         if ($can_assign->{'loc'}) {  
            $auth_update .= "     vf.locarg.value='';\n";  
         }  
         $auth_update .= "  
    }\n";  
     }      }
   
     return(<<ENDPICK);      return(<<ENDPICK);
Line 749  ENDPICK Line 764  ENDPICK
 ###############################################################  ###############################################################
 sub upload_manager_javascript_reverse_associate {  sub upload_manager_javascript_reverse_associate {
     my ($can_assign) = @_;      my ($can_assign) = @_;
     my $auth_update;      my ($auth_update,$numbuttons,$argreset);
     if (ref($can_assign) eq 'HASH') {      if (ref($can_assign) eq 'HASH') {
         if (keys(%{$can_assign}) > 1) {          if ($can_assign->{'krb4'} || $can_assign->{'krb5'}) {
             $auth_update = <<"END";              $argreset .= "      vf.krbarg.value='';\n";
     // initial password specified, pick internal authentication              $numbuttons ++ ;
     if (tf==8 && nw!=0) {  
         changed_radio('int',document.studentform);  
         set_auth_radio_buttons('int',document.studentform);  
 END  
         }  
         if ($can_assign->{'krb'}) {  
            $auth_update .= "        vf.krbarg.value='';\n";  
         }          }
         if ($can_assign->{'int'}) {          if ($can_assign->{'int'}) {
            $auth_update .= "        vf.intarg.value='';\n";              $argreset .= "      vf.intarg.value='';\n";
               $numbuttons ++;
         }          }
         if ($can_assign->{'loc'}) {          if ($can_assign->{'loc'}) {
            $auth_update .= "       vf.locarg.value='';\n";              $argreset .= "      vf.locarg.value='';\n";
               $numbuttons ++;
           }
           if (!$can_assign->{'int'}) {
               my $warning = &mt('You may not specify an initial password, as this is only available when new users use LON-CAPA internal authentication.\n').
                             &mt('Your current role does not have rights to create users with that authentication type.');
               $auth_update = <<"END";
      // Currently the initial password field is only supported for internal auth
      // (see bug 6368).
      if (tf==1 && nw!=0) {
          eval('vf.f'+tf+'.selectedIndex=0;')
          alert('$warning');
      }
   END
           } elsif ($numbuttons > 1) {
               $auth_update = <<"END";
      // initial password specified, pick internal authentication
      if (tf==1 && nw!=0) {
         changed_radio('int',document.studentform);
         set_auth_radio_buttons('int',document.studentform);
   $argreset
      }
   
   END
         }          }
         $auth_update .= "  
     }\n";  
     }      }
   
     return(<<ENDPICK);      return(<<ENDPICK);
 function verify(vf,sec_caller) {  function verify(vf,sec_caller) {
     var founduname=0;      var founduname=0;
Line 4164  sub upfile_drop_add { Line 4195  sub upfile_drop_add {
             my @secs;              my @secs;
             my %entries=&Apache::loncommon::record_sep($line);              my %entries=&Apache::loncommon::record_sep($line);
             # Determine user name              # Determine user name
               $entries{$fields{'username'}} =~ s/^\s+|\s+$//g;
             unless (($entries{$fields{'username'}} eq '') ||              unless (($entries{$fields{'username'}} eq '') ||
                     (!defined($entries{$fields{'username'}}))) {                      (!defined($entries{$fields{'username'}}))) {
                 my ($fname, $mname, $lname,$gen) = ('','','','');                  my ($fname, $mname, $lname,$gen) = ('','','','');
Line 4184  sub upfile_drop_add { Line 4216  sub upfile_drop_add {
                         $gen=$entries{$fields{'gen'}};                          $gen=$entries{$fields{'gen'}};
                     }                      }
                 }                  }
   
                 if ($entries{$fields{'username'}}                  if ($entries{$fields{'username'}}
                     ne &LONCAPA::clean_username($entries{$fields{'username'}})) {                      ne &LONCAPA::clean_username($entries{$fields{'username'}})) {
                       my $nowhitespace;
                       if ($entries{$fields{'username'}} =~ /\s/) {
                           $nowhitespace = ' - '.&mt('usernames may not contain spaces.');
                       }
                     $r->print('<br />'.                      $r->print('<br />'.
       &mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]',        &mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]',
           '<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen));            '<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen).
                                 $nowhitespace);
                     next;                      next;
                 } else {                  } else {
                       $entries{$fields{'domain'}} =~ s/^\s+|\s+$//g;
                     if ($entries{$fields{'domain'}}                       if ($entries{$fields{'domain'}} 
                         ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) {                          ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) {
                         $r->print('<br />'. '<b>'.$entries{$fields{'domain'}}.                          $r->print('<br />'. '<b>'.$entries{$fields{'domain'}}.
Line 4249  sub upfile_drop_add { Line 4288  sub upfile_drop_add {
                     # determine email address                      # determine email address
                     my $email='';                      my $email='';
                     if (defined($fields{'email'})) {                      if (defined($fields{'email'})) {
                           $entries{$fields{'email'}} =~ s/^\s+|\s+$//g;
                         if (defined($entries{$fields{'email'}})) {                          if (defined($entries{$fields{'email'}})) {
                             $email=$entries{$fields{'email'}};                              $email=$entries{$fields{'email'}};
                             unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; }                              unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; }
Line 4295  sub upfile_drop_add { Line 4335  sub upfile_drop_add {
                         $role = $defaultrole;                          $role = $defaultrole;
                     }                      }
                     # Clean up whitespace                      # Clean up whitespace
                     foreach (\$id,\$fname,\$mname,\$lname,\$gen) {                      foreach (\$id,\$fname,\$mname,\$lname,\$gen,\$inststatus) {
                         $$_ =~ s/(\s+$|^\s+)//g;                          $$_ =~ s/(\s+$|^\s+)//g;
                     }                      }
                     # check against rules                      # check against rules

Removed from v.1.109.2.8  
changed lines
  Added in v.1.109.2.9


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