Diff for /loncom/interface/Attic/londropadd.pm between versions 1.87 and 1.88

version 1.87, 2003/11/05 20:55:59 version 1.88, 2003/11/06 20:04:06
Line 48  use Apache::lonlocal; Line 48  use Apache::lonlocal;
 ###############################################################  ###############################################################
 sub header {  sub header {
     my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager');      my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager');
       my $title = &mt('LON-CAPA Enrollment Manager');
     return(<<ENDHEAD);      return(<<ENDHEAD);
 <html>  <html>
 <head>  <head>
 <title>LON-CAPA Enrollment Manager</title>  <title>$title</title>
 </head>  </head>
 $bodytag  $bodytag
 <form method="post" enctype="multipart/form-data"    <form method="post" enctype="multipart/form-data"  
Line 140  sub domain_form { Line 141  sub domain_form {
 #  Menu Phase One  #  Menu Phase One
 sub print_main_menu {  sub print_main_menu {
     my $r=shift;      my $r=shift;
       my %Text = &Apache::lonlocal::texthash
           ('upload'    => 'Upload a class list',
            'enrollone' => 'Enroll a single student',
            'modify'    => 'Modify student data',
            'view'      => 'View Class List',
            'drop'      => 'Drop Students');
   
     $r->print(<<END);      $r->print(<<END);
 <p>  <p>
 <font size="+1">  <font size="+1">
     <a href="/adm/dropadd?action=upload">Upload a course list</a>      <a href="/adm/dropadd?action=upload">$Text{'upload'}</a>
 </font>  </font>
 </p><p>  </p><p>
 <font size="+1">  <font size="+1">
     <a href="/adm/dropadd?action=enrollstudent">Enroll a single student</a>      <a href="/adm/dropadd?action=enrollstudent">$Text{'enrollone'}</a>
 </font>  </font>
 </p><p>  </p><p>
 <font size="+1">  <font size="+1">
     <a href="/adm/dropadd?action=modifystudent">Modify student data</a>      <a href="/adm/dropadd?action=modifystudent">$Text{'modify'}</a>
 </font>  </font>
 </p><p>  </p><p>
 <font size="+1">  <font size="+1">
     <a href="/adm/dropadd?action=classlist">View Class List</a>      <a href="/adm/dropadd?action=classlist">$Text{'view'}</a>
 </font>  </font>
 </p><p>  </p><p>
 <font size="+1">  <font size="+1">
     <a href="/adm/dropadd?action=drop">Drop Students</a>      <a href="/adm/dropadd?action=drop">$Text{'drop'}</a>
 </font>  </font>
 </p>  </p>
 END  END
Line 187  sub print_upload_manager_header { Line 195  sub print_upload_manager_header {
     }      }
     my $javascript_validations=&javascript_validations($krbdefdom);      my $javascript_validations=&javascript_validations($krbdefdom);
     my $checked=(($ENV{'form.noFirstLine'})?' checked="1"':'');      my $checked=(($ENV{'form.noFirstLine'})?' checked="1"':'');
       $r->print('<h3>'.&mt('Uploading Class List')."</h3>\n".
                 "<hr>\n".
                 '<h3>'.&mt('Identify fields')."</h3>\n");
       $r->print("<p>\n".
                 &mt('Total number of records found in file: [_1].',$distotal).
                 "\n".
                 "</p><hr>\n");
     $r->print(<<ENDPICK);      $r->print(<<ENDPICK);
 <h3>Uploading Class List</h3>  
 <hr>  
 <h3>Identify fields</h3>  
 Total number of records found in file: $distotal <hr />  
 Enter as many fields as you can. The system will inform you and bring you back  Enter as many fields as you can. The system will inform you and bring you back
 to this page if the data selected is insufficient to run your class.<hr />  to this page if the data selected is insufficient to run your class.<hr />
 <input type="button" value="Reverse Association" onClick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" />  <input type="button" value="Reverse Association" onClick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" />
Line 474  sub print_upload_manager_footer { Line 485  sub print_upload_manager_footer {
     my $date_table = &date_setting_table();      my $date_table = &date_setting_table();
     $r->print(<<ENDPICK);      $r->print(<<ENDPICK);
 </table>  </table>
 <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>
 <p>Note: this will not take effect if the user already exists</p>  <p>Note: this will not take effect if the user already exists</p>
 <p>  <p>
Line 1521  END Line 1532  END
 #  #
 sub print_first_courselist_upload_form {  sub print_first_courselist_upload_form {
     my $r=shift;      my $r=shift;
     my $upfile_select=&Apache::loncommon::upfile_select_html();      my $str;
     my $create_classlist_help =       $str  = '<input type="hidden" name="phase" value="two">';
  &Apache::loncommon::help_open_topic("Course_Create_Class_List",      $str .= '<input type="hidden" name="action" value="upload" />';
            "How do I create a class list from a spreadsheet");      $str .= '<input type="hidden"   name="state"  value="got_file" />';
     my $create_csv_help =      $str .= "<h3>".&mt('Upload a class list')."</h3>\n";
  &Apache::loncommon::help_open_topic("Course_Convert_To_CSV",      $str .= &Apache::loncommon::upfile_select_html();
            "How do I create a CSV file from a spreadsheet");      $str .= "<p>\n";
     $r->print(<<ENDUPFORM);      $str .= '<input type="submit" name="fileupload" value="'.
 <input type=hidden name=phase value=two>          &mt('Upload class list').'">'."\n";
 <h3>Upload a courselist</h3>      $str .= '<input type="checkbox" name="noFirstLine" /> '.
 $upfile_select          &mt('Ignore First Line')."</p>\n";
 <p>      $str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List",
 <input type=submit name="fileupload" value="Upload Courselist">                           "How do I create a class list from a spreadsheet").
 <input type="hidden" name="action" value="upload" />                               "<br />\n";
 <input type="hidden" name="state"  value="got_file" />      $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
 <input type="checkbox" name="noFirstLine" /> Ignore First Line<br />                             "How do I create a CSV file from a spreadsheet").
 </p>                                 "<br />\n";
 $create_classlist_help <br />      $str .= "</body>\n</html>\n";
 $create_csv_help      $r->print($str);
 </body></html>  
 ENDUPFORM  
     return;      return;
 }  }
   
Line 1576  sub upfile_drop_add { Line 1585  sub upfile_drop_add {
     } else {      } else {
         my %home_servers = &Apache::loncommon::get_library_servers($domain);          my %home_servers = &Apache::loncommon::get_library_servers($domain);
         if (! exists($home_servers{$desiredhost})) {          if (! exists($home_servers{$desiredhost})) {
             $r->print('<font color="#ff0000">Error:</font>'.              $r->print('<font color="#ff0000">'.&mt('Error').'</font>'.
                       'Invalid home server specified');                        &mt('Invalid home server specified'));
               $r->print("</body>\n</html>\n");
             return;              return;
         }          }
     }      }
Line 1602  sub upfile_drop_add { Line 1612  sub upfile_drop_add {
     if ($amode =~ /^krb/) {      if ($amode =~ /^krb/) {
         if (! defined($genpwd) || $genpwd eq '') {          if (! defined($genpwd) || $genpwd eq '') {
             $r->print('<font color="red" size="+1">'.              $r->print('<font color="red" size="+1">'.
                       'Unable to enroll students:'.'</font>  '.                        &mt('Unable to enroll students').'</font>  '.
                       'No Kerberos domain was specified.</p>');                        &mt('No Kerberos domain was specified.').'</p>');
             $amode = ''; # This causes the loop below to be skipped              $amode = ''; # This causes the loop below to be skipped
         }          }
     }      }
Line 1611  sub upfile_drop_add { Line 1621  sub upfile_drop_add {
         #######################################          #######################################
         ##         Enroll Students           ##          ##         Enroll Students           ##
         #######################################          #######################################
         $r->print('<h3>Enrolling Students</h3>'."\n".'<p>');          $r->print('<h3>'.&mt('Enrolling Students')."</h3>\n<p>\n");
         my $count=0;          my $count=0;
         my $flushc=0;          my $flushc=0;
         my %student=();          my %student=();
Line 1640  sub upfile_drop_add { Line 1650  sub upfile_drop_add {
                     }                      }
                 }                  }
                 if ($entries{$fields{'username'}}=~/\W/) {                  if ($entries{$fields{'username'}}=~/\W/) {
                     $r->print('<br /><b>Unacceptable username: '.                      $r->print('<br />'.
                               $entries{$fields{'username'}}.' for user '.        &mt('<b>[_1]</b>: Unacceptable username for user [_2] [_3] [_4] [_5]',
                               $fname.' '.$mname.' '.$lname.' '.$gen.'</b>');            $entries{$fields{'username'}},$fname,$mname,$lname,$gen).
                                 '</b>');
                 } else {                  } else {
                     # determine section number                      # determine section number
                     my $sec='';                      my $sec='';
Line 1696  sub upfile_drop_add { Line 1707  sub upfile_drop_add {
                              $email);                               $email);
                         if ($reply ne 'ok') {                          if ($reply ne 'ok') {
                             $reply =~ s/^error://;                              $reply =~ s/^error://;
                             $r->print('<br /><b>'.$username.'</b>:'.                              $r->print('<br />'.
                                       '  Unable to enroll: '.$reply);                  &mt('<b>[_1]</b>:  Unable to enroll: [_2]',$username,$reply));
           } else {            } else {
                             $count++; $flushc++;                              $count++; $flushc++;
                             $student{$username}=1;                              $student{$username}=1;
Line 1708  sub upfile_drop_add { Line 1719  sub upfile_drop_add {
                             }                              }
                         }                          }
                     } else {                      } else {
                         $r->print('<br /><b>'.$username.'</b>:'.                          $r->print('<br />'.
                            '  Unable to enroll: No password specified.');        &mt('<b>[_1]</b>: Unable to enroll.  No password specified.',$username)
                                     );
                     }                      }
                 }                  }
             }              }
         } # end of foreach (@studentdata)          } # end of foreach (@studentdata)
         $r->print('</p><p>Processed Students: '.$count.'</p>');          $r->print("</p>\n<p>\n".&mt('Processed [_1] student(s).',$count).
         $r->print("<p>If active, the new role will be available when the ".                    "</p>\n");
                   "students next log in to LON-CAPA.</p>");          $r->print("<p>\n".
                     &mt('If active, the new role will be available when the '.
                     'students next log in to LON-CAPA.')."</p>\n");
         #####################################          #####################################
         #           Drop students           #          #           Drop students           #
         #####################################          #####################################
         if ($ENV{'form.fullup'} eq 'yes') {          if ($ENV{'form.fullup'} eq 'yes') {
             $r->print('<h3>Dropping Students</h3>');              $r->print('<h3>'.&mt('Dropping Students')."</h3>\n");
             #  Get current classlist              #  Get current classlist
             my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();              my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
             if (! defined($classlist)) {              if (! defined($classlist)) {
                 $r->print("There are no students currently enrolled.\n");                  $r->print(&mt('There are no students currently enrolled.').
                             "\n");
             } else {              } else {
                 # Remove the students we just added from the list of students.                  # Remove the students we just added from the list of students.
                 foreach (@studentdata) {                  foreach (@studentdata) {
Line 1758  sub drop_student_list { Line 1773  sub drop_student_list {
         # drop student          # drop student
         my $result = &modifystudent($udom,$uname,$ENV{'request.course.id'});          my $result = &modifystudent($udom,$uname,$ENV{'request.course.id'});
         if ($result eq 'ok' || $result eq 'ok:') {          if ($result eq 'ok' || $result eq 'ok:') {
             $r->print('Dropped '.$uname.' @ '.$udom.'<br>');              $r->print(&mt('Dropped [_1]',$uname.'@'.$udom).'<br>');
             $count++;              $count++;
         } else {          } else {
             $r->print('Error dropping '.$uname.' @ '.$udom.': '.$result.              $r->print(
             &mt('Error dropping [_1]:[_2]',$uname.'@'.$udom,$result).
                       '<br />');                        '<br />');
         }          }
     }      }
     $r->print('<p><b>Dropped '.$count.' student(s).</b>');      $r->print('<p><b>'.&mt('Dropped [_1] student(s).',$count).'</b></p>');
     $r->print('<p>Re-enrollment will re-activate data.') if ($count);      $r->print('<p>'.&mt('Re-enrollment will re-activate data.')) if ($count);
 }  }
   
 ###################################################################  ###################################################################

Removed from v.1.87  
changed lines
  Added in v.1.88


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