Diff for /loncom/interface/Attic/londropadd.pm between versions 1.168 and 1.172

version 1.168, 2007/08/29 04:12:33 version 1.172, 2007/10/11 02:16:25
Line 262  sub print_upload_manager_header { Line 262  sub print_upload_manager_header {
         $password_choice = 'int';                  $password_choice = 'int';        
     }      }
     #      #
     my $javascript_validations=&javascript_validations('auth',$krbdefdom,      my $javascript_validations = 
                                     $password_choice);          &javascript_validations('auth',$krbdefdom,$password_choice,undef,
                                   $env{'request.role.domain'});
     my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');      my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');
     $r->print('<h3>'.&mt('Uploading Class List')."</h3>\n".      $r->print('<h3>'.&mt('Uploading Class List')."</h3>\n".
               "<hr>\n".                "<hr>\n".
Line 293  sub print_upload_manager_header { Line 294  sub print_upload_manager_header {
 ###############################################################  ###############################################################
 ###############################################################  ###############################################################
 sub javascript_validations {  sub javascript_validations {
     my ($mode,$krbdefdom,$curr_authtype,$curr_authfield)=@_;      my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain)=@_;
     my $authheader;      my $authheader;
     if ($mode eq 'auth') {      if ($mode eq 'auth') {
         my %param = ( formname => 'studentform',          my %param = ( formname => 'studentform',
Line 302  sub javascript_validations { Line 303  sub javascript_validations {
         $authheader = &Apache::loncommon::authform_header(%param);          $authheader = &Apache::loncommon::authform_header(%param);
     } elsif ($mode eq 'createcourse') {      } elsif ($mode eq 'createcourse') {
         my %param = ( formname => 'ccrs',          my %param = ( formname => 'ccrs',
                   kerb_def_dom => $krbdefdom,                        kerb_def_dom => $krbdefdom,
                       curr_authtype => $curr_authtype );                        curr_authtype => $curr_authtype );
         $authheader = &Apache::loncommon::authform_header(%param);          $authheader = &Apache::loncommon::authform_header(%param);
     } elsif ($mode eq 'modifycourse') {      } elsif ($mode eq 'modifycourse') {
Line 331  sub javascript_validations { Line 332  sub javascript_validations {
     my $function_name =(<<END);      my $function_name =(<<END);
 function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) {  function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) {
 END  END
       my ($authnum,%can_assign) =  &Apache::loncommon::get_assignable_auth($domain);
     my $auth_checks;      my $auth_checks;
     if ($mode eq 'createcourse') {      if ($mode eq 'createcourse') {
         $auth_checks .= (<<END);          $auth_checks .= (<<END);
Line 345  END Line 347  END
         $auth_checks .= (<<END);          $auth_checks .= (<<END);
     var foundatype=0;      var foundatype=0;
     if (founduname==0) {      if (founduname==0) {
  alert('$alert{'username'}');          alert('$alert{'username'}');
         return;          return;
     }      }
   
   END
           if ($authnum > 1) {
               $auth_checks .= (<<END);
     // alert('current.radiovalue = '+current.radiovalue);      // alert('current.radiovalue = '+current.radiovalue);
     if (current.radiovalue == null || current.radiovalue == '' || current.radiovalue == 'nochange') {      if (current.radiovalue == null || current.radiovalue == '' || current.radiovalue == 'nochange') {
         // They did not check any of the login radiobuttons.          // They did not check any of the login radiobuttons.
Line 355  END Line 361  END
         return;          return;
     }      }
 END  END
           }
     }      }
     if ($mode eq 'createcourse') {      if ($mode eq 'createcourse') {
         $auth_checks .= "          $auth_checks .= "
Line 984  sub get_student_username_domain_form { Line 991  sub get_student_username_domain_form {
 $jscript  $jscript
 <h3>$lt{'eos'}</h3>  <h3>$lt{'eos'}</h3>
 END  END
       $r->print($response);
     $r->print(&single_user_entry_form($defdom,$srch,$forcenewuser));      $r->print(&single_user_entry_form($defdom,$srch,$forcenewuser));
     return;      return;
 }  }
Line 1057  sub print_enroll_single_student_form { Line 1065  sub print_enroll_single_student_form {
         # Set up authentication forms          # Set up authentication forms
         my ($krbdef,$krbdefdom) =          my ($krbdef,$krbdefdom) =
             &Apache::loncommon::get_kerberos_defaults($ccdomain);              &Apache::loncommon::get_kerberos_defaults($ccdomain);
         $javascript_validations=&javascript_validations('auth',$krbdefdom);          $javascript_validations = 
               &javascript_validations('auth',$krbdefdom,undef,undef,$ccdomain);
         my %param = ( formname => 'document.studentform',          my %param = ( formname => 'document.studentform',
                       kerb_def_dom => $krbdefdom,                        kerb_def_dom => $krbdefdom,
                       kerb_def_auth => $krbdef                        kerb_def_auth => $krbdef
Line 1079  sub print_enroll_single_student_form { Line 1088  sub print_enroll_single_student_form {
         #          #
         #          #
  my %lt=&Apache::lonlocal::texthash(   my %lt=&Apache::lonlocal::texthash(
        'udf'  => "User Data for",         'udf'  => "Personal Data",
                        'fn'   => "First Name",                         'fn'   => "First Name",
                        'mn'   => "Middle Name",                         'mn'   => "Middle Name",
                        'ln'   => "Last Name",                         'ln'   => "Last Name",
                        'gen'  => "Generation",                         'gen'  => "Generation",
                        'hs'   => "Home Server",                         'hs'   => "Home Server",
                        'pswd' => "Password",                         'pswd' => "Login Data",
        'psam' => "Please select an authentication mechanism",         'psam' => "Please select an authentication mechanism",
                        'mail' => "Email Address"                         'mail' => "Email Address"
    );     );
Line 1108  sub print_enroll_single_student_form { Line 1117  sub print_enroll_single_student_form {
 </table>  </table>
 <h3>$lt{'pswd'}</h3>  <h3>$lt{'pswd'}</h3>
 $lt{'psam'}$authhelp  $lt{'psam'}$authhelp
 <table>  
 <p>  <p>
 $krbform  
 <br />  
 $intform  
 <br />  
 $locform  
 </p>  
 END  END
           if ($krbform ne '') {
               $user_data_html .= $krbform.'<br />';
           }
           if ($intform ne '') {
               $user_data_html .= $intform.'<br />';
           }
           if ($locform ne '') {
               $user_data_html .= $locform.'<br />';
           }
           $user_data_html .= "\n</p>\n"
     } else {      } else {
         # User already exists.  Do not worry about authentication          # User already exists.  Do not worry about authentication
         my %uenv = &Apache::lonnet::dump('environment',$ccdomain,$ccuname);          my %uenv = &Apache::lonnet::dump('environment',$ccdomain,$ccuname);
Line 1364  sub show_class_list { Line 1376  sub show_class_list {
     }      }
     my $displayphotos = $env{'form.displayphotos'};      my $displayphotos = $env{'form.displayphotos'};
   
       if (! exists($env{'form.displayclickers'})) {
           $env{'form.displayclickers'} = 'off';
       }
       my $displayclickers = $env{'form.displayclickers'};
   
     # Print out header       # Print out header 
     unless ($mode eq 'autoenroll') {      unless ($mode eq 'autoenroll') {
         $r->print(<<END);          $r->print(<<END);
Line 1373  END Line 1390  END
     $r->print(<<END);      $r->print(<<END);
 <input type="hidden" name="sortby" value="$sortby" />  <input type="hidden" name="sortby" value="$sortby" />
 <input type="hidden" name="displayphotos" value="$displayphotos" />  <input type="hidden" name="displayphotos" value="$displayphotos" />
   <input type="hidden" name="displayclickers" value="$displayclickers" />
 END  END
     if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') {      if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') {
         if ($linkto eq 'aboutme') {          if ($linkto eq 'aboutme') {
Line 1390  END Line 1408  END
                                            'end'    => "end date",                                             'end'    => "end date",
                                            'type'   => "enroll type/action",                                             'type'   => "enroll type/action",
    'email'  => "email address",     'email'  => "email address",
                                              'clicker'=> "clicker id",
                                            'photo'  => "photo",                                             'photo'  => "photo",
    );     );
         unless ($mode eq 'autoenroll') {          unless ($mode eq 'autoenroll') {
Line 1446  function photowindow(photolink) { Line 1465  function photowindow(photolink) {
        <a href="javascript:document.studentform.sortby.value='email';document.studentform.submit();">$lt{'email'}</a>         <a href="javascript:document.studentform.sortby.value='email';document.studentform.submit();">$lt{'email'}</a>
     </th>      </th>
 END  END
   
   # Clicker display on or off?
   
           my %clicker_options = &Apache::lonlocal::texthash(
                                                             'on' => 'Show',
                                                             'off' => 'Hide',
                                                            );
           my $clickerchg = 'on';
           if ($displayclickers eq 'on') {
               $clickerchg = 'off';
           }
           $r->print('    <th>'."\n".'     '.
               '<a href="javascript:document.studentform.displayclickers.value='.
                         "'".$clickerchg."'".';document.studentform.submit();">'.
                         $clicker_options{$clickerchg}.'</a>&nbsp;'.$lt{'clicker'}."\n".
                         '    </th>'."\n");
   
   # Photo display on or off?
         if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {          if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
             my %photo_options = &Apache::lonlocal::texthash(              my %photo_options = &Apache::lonlocal::texthash(
                                                             'on' => 'Show',                                                              'on' => 'Show',
Line 1462  END Line 1499  END
                       '    </th>'."\n");                        '    </th>'."\n");
         }          }
         $r->print("  </tr>\n");          $r->print("  </tr>\n");
   
   # Done with the HTML header line
   
     } elsif ($mode eq 'csv') {      } elsif ($mode eq 'csv') {
  #   #
  # Open a file   # Open a file
Line 1514  END Line 1554  END
                                       "active groups","email address"],                                        "active groups","email address"],
                             $format->{'bold'});                              $format->{'bold'});
     }      }
   
   # Done with header lines in all formats
   
     #      #
     # Sort the students      # Sort the students
     my %index;      my %index;
Line 1622  END Line 1665  END
     <td>$active_groups</td>      <td>$active_groups</td>
     <td>$email</td>      <td>$email</td>
 END  END
   
   # Clickers
               if ($displayclickers eq 'on') {
                  my $clickers =
                  (&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
                  if ($clickers!~/\w/) { $clickers='-'; }
                  $r->print('<td>'.$clickers.'</td>');
               } else {
                   $r->print('    <td>&nbsp;</td>  ');
               }
   
   # Photos
   
             if ($env{'course.'.$env{'request.course.id'}.              if ($env{'course.'.$env{'request.course.id'}.
  '.internal.showphoto'}) {   '.internal.showphoto'}) {
                 if ($displayphotos eq 'on') {                  if ($displayphotos eq 'on') {
Line 2701  sub handler { Line 2757  sub handler {
         my @search = ('srchterm','srchby','srchin','srchtype','srchdomain');          my @search = ('srchterm','srchby','srchin','srchtype','srchdomain');
         my ($jsback,$elements) = &Apache::loncreateuser::crumb_utilities();          my ($jsback,$elements) = &Apache::loncreateuser::crumb_utilities();
         my $jscript = '<script type="text/javascript">'.$jsback.'</script>';          my $jscript = '<script type="text/javascript">'.$jsback.'</script>';
    &Apache::loncreateuser::restore_prev_selections();
    my $srch;
    foreach my $item (@search) {
       $srch->{$item} = $env{'form.'.$item};
    }
   
         if ($env{'form.state'} eq 'gotusername') {          if ($env{'form.state'} eq 'gotusername') {
             my $srch;  
             foreach my $item (@search) {  
                 $srch->{$item} = $env{'form.'.$item};  
             }  
             if ($env{'form.phase'} eq 'get_user_info') {              if ($env{'form.phase'} eq 'get_user_info') {
                 my ($currstate,$response,$forcenewuser,$results) =                  my ($currstate,$response,$forcenewuser,$results) =
                     &Apache::loncreateuser::user_search_result($srch);                      &Apache::loncreateuser::user_search_result($srch);
                   if ($env{'form.currstate'} eq 'modify') {
                       $currstate = $env{'form.currstate'};
                   }
                 if ($currstate eq 'select') {                  if ($currstate eq 'select') {
                     $r->print(&header());                      $r->print(&header());
                     &Apache::lonhtmlcommon::add_breadcrumb                      &Apache::lonhtmlcommon::add_breadcrumb
Line 2752  sub handler { Line 2813  sub handler {
                 &print_enroll_single_student_form($r,$jscript,$ccuname,                  &print_enroll_single_student_form($r,$jscript,$ccuname,
                                                   $ccdomain,$srch);                                                    $ccdomain,$srch);
             } else {              } else {
                 &get_student_username_domain_form($r,$elements);                  &get_student_username_domain_form($r,$elements,undef,$srch);
             }              }
         } elsif ($env{'form.state'} eq 'enrolling') {          } elsif ($env{'form.state'} eq 'enrolling') {
             $r->print(&header($jscript));              $r->print(&header($jscript));
Line 2773  sub handler { Line 2834  sub handler {
                                                       'Course_Add_Student'));                                                        'Course_Add_Student'));
             &enroll_single_student($r,\@search);              &enroll_single_student($r,\@search);
         } else {          } else {
             &get_student_username_domain_form($r,$elements);              &get_student_username_domain_form($r,$elements,undef,$srch);
         }          }
     } elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) {      } elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) {
         $r->print(&header());          $r->print(&header());

Removed from v.1.168  
changed lines
  Added in v.1.172


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