Diff for /loncom/interface/Attic/londropadd.pm between versions 1.173 and 1.178

version 1.173, 2007/10/22 22:16:38 version 1.178, 2009/02/04 13:21:48
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
 #  #
 ###############################################################  
 ##############################################################  =head1 NAME
   
   Apache::londropadd.pm
   
   =head1 SYNOPSIS
   
   drop & add students
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   =head1 SUBROUTINES
   
   =over
   
   =cut
   
 package Apache::londropadd;  package Apache::londropadd;
   
Line 42  use Apache::lonlocal; Line 57  use Apache::lonlocal;
 use Apache::longroup;  use Apache::longroup;
 use LONCAPA();  use LONCAPA();
   
 ###############################################################  
 ###############################################################  
 sub header {  sub header {
     my ($jscript,$loaditems) = @_;      my ($jscript,$loaditems) = @_;
     my $start_page;      my $start_page;
Line 59  $start_page Line 72  $start_page
 ENDHEAD  ENDHEAD
 }  }
   
 ###############################################################  =pod
 ###############################################################  
 # Drop student from all sections of a course, except optional $csec  =item modifystudent()
   
       Drop student from all sections of a course, except optional $csec
   
   =cut
   
 sub modifystudent {  sub modifystudent {
     my ($udom,$unam,$courseid,$csec,$desiredhost)=@_;      my ($udom,$unam,$courseid,$csec,$desiredhost)=@_;
     # if $csec is undefined, drop the student from all the courses matching      # if $csec is undefined, drop the student from all the courses matching
Line 104  sub modifystudent { Line 122  sub modifystudent {
     return $result;      return $result;
 }  }
   
 ###############################################################  =pod
 ###############################################################  
 # build a domain and server selection form  =item domain_form()
       
       build a domain and server selection form
   
   =cut
   
 sub domain_form {  sub domain_form {
     my ($defdom) = @_;      my ($defdom) = @_;
     # Set up domain and server selection forms      # Set up domain and server selection forms
Line 135  sub domain_form { Line 158  sub domain_form {
     return $result;      return $result;
 }  }
   
 ###############################################################  =pod
 ###############################################################  
 #  Menu Phase One  =item print_main_menu()
   
       Menu Phase One
   
   =cut
   
 sub print_main_menu {  sub print_main_menu {
     my ($r,$permission)=@_;      my ($r,$permission)=@_;
     #      #
Line 224  sub print_main_menu { Line 252  sub print_main_menu {
     return;      return;
 }  }
   
 ###############################################################  
 ###############################################################  
 sub hidden_input {  sub hidden_input {
     my ($name,$value) = @_;      my ($name,$value) = @_;
     return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'."\n";      return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'."\n";
 }  }
   
   
   
 sub print_upload_manager_header {  sub print_upload_manager_header {
     my ($r,$datatoken,$distotal,$krbdefdom)=@_;      my ($r,$datatoken,$distotal,$krbdefdom)=@_;
     my $javascript;      my $javascript;
Line 291  sub print_upload_manager_header { Line 321  sub print_upload_manager_header {
               $javascript."\n".$javascript_validations.'</script>');                $javascript."\n".$javascript_validations.'</script>');
 }  }
   
 ###############################################################  
 ###############################################################  
   
   
 sub javascript_validations {  sub javascript_validations {
     my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain)=@_;      my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain)=@_;
     my $authheader;      my $authheader;
Line 324  sub javascript_validations { Line 356  sub javascript_validations {
          name     => 'The optional name field was not specified.',           name     => 'The optional name field was not specified.',
          snum     => 'The optional student number field was not specified.',           snum     => 'The optional student number field was not specified.',
          section  => 'The optional section field was not specified.',            section  => 'The optional section field was not specified.', 
          email    => 'The optional email address field was not specified.',           email    => 'The optional e-mail address field was not specified.',
          continue => 'Continue enrollment?',           continue => 'Continue enrollment?',
          );           );
           
Line 471  END Line 503  END
     return $result;      return $result;
 }  }
   
 ###############################################################  
 ###############################################################  
   
 sub upload_manager_javascript_forward_associate {  sub upload_manager_javascript_forward_associate {
     return(<<ENDPICK);      return(<<ENDPICK);
 function verify(vf,sec_caller) {  function verify(vf,sec_caller) {
Line 564  function clearpwd(vf) { Line 597  function clearpwd(vf) {
 ENDPICK  ENDPICK
 }  }
   
 ###############################################################  
 ###############################################################  
   
 sub upload_manager_javascript_reverse_associate {  sub upload_manager_javascript_reverse_associate {
     return(<<ENDPICK);      return(<<ENDPICK);
 function verify(vf,sec_caller) {  function verify(vf,sec_caller) {
Line 619  function clearpwd(vf) { Line 653  function clearpwd(vf) {
 ENDPICK  ENDPICK
 }  }
   
 ###############################################################  
 ###############################################################  
   
 sub print_upload_manager_footer {  sub print_upload_manager_footer {
     my ($r,$i,$keyfields,$defdom,$today,$halfyear)=@_;      my ($r,$i,$keyfields,$defdom,$today,$halfyear)=@_;
   
Line 673  sub print_upload_manager_footer { Line 708  sub print_upload_manager_footer {
     return;      return;
 }  }
   
 ###############################################################  
 ###############################################################  
   
 sub print_upload_manager_form {  sub print_upload_manager_form {
     my $r=shift;      my $r=shift;
   
Line 728  sub print_upload_manager_form { Line 764  sub print_upload_manager_form {
              ['id',   &mt('ID/Student Number'),$env{'form.id_choice'}],               ['id',   &mt('ID/Student Number'),$env{'form.id_choice'}],
              ['sec',  &mt('Section'),          $env{'form.sec_choice'}],               ['sec',  &mt('Section'),          $env{'form.sec_choice'}],
              ['ipwd', &mt('Initial Password'),$env{'form.ipwd_choice'}],               ['ipwd', &mt('Initial Password'),$env{'form.ipwd_choice'}],
              ['email',&mt('EMail Address'),   $env{'form.email_choice'}]);               ['email',&mt('E-mail Address'),   $env{'form.email_choice'}]);
  if ($env{'form.upfile_associate'} eq 'reverse') {   if ($env{'form.upfile_associate'} eq 'reverse') {
     &Apache::loncommon::csv_print_samples($r,\@records);      &Apache::loncommon::csv_print_samples($r,\@records);
     $i=&Apache::loncommon::csv_print_select_table($r,\@records,      $i=&Apache::loncommon::csv_print_select_table($r,\@records,
Line 748  sub print_upload_manager_form { Line 784  sub print_upload_manager_form {
     &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear);      &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear);
 }  }
   
 ###############################################################  
 ###############################################################  
   
   
 sub enroll_single_student {  sub enroll_single_student {
     my ($r,$srcharray) = @_;       my ($r,$srcharray) = @_; 
     # Remove non alphanumeric values from section      # Remove non alphanumeric values from section
Line 961  sub make_dates_default { Line 999  sub make_dates_default {
     return $result;      return $result;
 }  }
   
 ##  =pod
 ## Single student enrollment routines (some of them)  
 ##  =item get_student_username_domain_form()
       
       Single student enrollment routines (some of them)
   
   =cut
   
 sub get_student_username_domain_form {  sub get_student_username_domain_form {
     my ($r,$elements,$response,$srch,$forcenewuser) =  @_;      my ($r,$elements,$response,$srch,$forcenewuser) =  @_;
     my $loaditems = {      my $loaditems = {
Line 1098  sub print_enroll_single_student_form { Line 1141  sub print_enroll_single_student_form {
                        'hs'   => "Home Server",                         'hs'   => "Home Server",
                        'pswd' => "Login Data",                         'pswd' => "Login Data",
        'psam' => "Please select an authentication mechanism",         'psam' => "Please select an authentication mechanism",
                        'mail' => "Email Address"                         'mail' => "E-mail Address"
    );     );
  my $authhelp=&Apache::loncommon::help_open_topic('Auth_Options');   my $authhelp=&Apache::loncommon::help_open_topic('Auth_Options');
         $user_data_html = <<END;          $user_data_html = <<END;
Line 1141  END Line 1184  END
                        'mn'   => "Middle Name",                         'mn'   => "Middle Name",
                        'ln'   => "Last Name",                         'ln'   => "Last Name",
                        'gen'  => "Generation",                         'gen'  => "Generation",
                        'mail' => "Email Address",                         'mail' => "E-mail Address",
    );     );
         $user_data_html = <<END;          $user_data_html = <<END;
 <h3>$lt{'udf'} $ccuname:$ccdomain</h3>  <h3>$lt{'udf'} $ccuname:$ccdomain</h3>
Line 1249  END Line 1292  END
     return;      return;
 }  }
   
 # ========================================================= Menu Phase Two Drop  =pod
   
   =item print_drop_menu()
   
       Menu Phase Two Drop
   
   =cut
   
 sub print_drop_menu {  sub print_drop_menu {
     my $r=shift;      my $r=shift;
     $r->print("<h3>".&mt('Drop Students')."</h3>");      $r->print("<h3>".&mt('Drop Students')."</h3>");
Line 1264  sub print_drop_menu { Line 1314  sub print_drop_menu {
     return;      return;
 }  }
   
 # ============================================== view classlist  
   =pod
   
   =item print_html_classlist()
   
       view classlist
   
   =cut
   
 sub print_html_classlist {  sub print_html_classlist {
     my ($r,$mode,$permission) = @_;      my ($r,$mode,$permission) = @_;
     if (! exists($env{'form.sortby'})) {      if (! exists($env{'form.sortby'})) {
Line 1354  sub print_html_classlist { Line 1412  sub print_html_classlist {
     }      }
 }  }
   
 # =================================================== Show student list to drop  
   =pod
   
   =item show_class_list()
   
       Show student list to drop
   
   =cut
   
 sub show_class_list {  sub show_class_list {
     my ($r,$mode,$linkto,$statusmode,$classlist,$keylist)=@_;      my ($r,$mode,$linkto,$statusmode,$classlist,$keylist)=@_;
     my $cid=$env{'request.course.id'};      my $cid=$env{'request.course.id'};
Line 1409  END Line 1475  END
                                            'start'  => "start date",                                             'start'  => "start date",
                                            'end'    => "end date",                                             'end'    => "end date",
                                            'type'   => "enroll type/action",                                             'type'   => "enroll type/action",
    'email'  => "email address",     'email'  => "e-mail address",
                                            'clicker'=> "clicker id",                                             'clicker'=> "clicker id",
                                            'photo'  => "photo",                                             'photo'  => "photo",
    );     );
Line 1512  END Line 1578  END
             time.'_'.rand(1000000000).'.csv';              time.'_'.rand(1000000000).'.csv';
  unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {   unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {
     $r->log_error("Couldn't open $CSVfilename for output $!");      $r->log_error("Couldn't open $CSVfilename for output $!");
     $r->print("Problems occured in writing the csv file.  ".      $r->print(&mt('Problems occurred in writing the csv file. '
       "This error has been logged.  ".                           .'This error has been logged. '
       "Please alert your LON-CAPA administrator.");                           .'Please alert your LON-CAPA administrator.'));
     $CSVfile = undef;      $CSVfile = undef;
  }   }
  #   #
Line 1756  END Line 1822  END
 }  }
   
   
 #  =pod
 # print out form for modification of a single students data  
 #  =item print_modify_student_form()
   
       print out form for modification of a single students data
   
   =cut
   
 sub print_modify_student_form {  sub print_modify_student_form {
     my $r = shift();      my $r = shift();
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
Line 1887  END Line 1958  END
     return;      return;
 }  }
   
 #  
 # modify a single students section   =pod 
 #  
   =item modify_single_student()
   
       modify a single students section 
   
   =cut
   
 sub modify_single_student {  sub modify_single_student {
     my ($r) = @_;      my ($r) = @_;
     #      #
Line 2051  END Line 2128  END
                                              $env{'request.course.id'},                                               $env{'request.course.id'},
                                              $section,undef);                                               $section,undef);
     if ($modify_section_results !~ /^ok/) {      if ($modify_section_results !~ /^ok/) {
         $r->print(&mt('An error occured during the attempt to change the section for this student.')."<br />");          $r->print(&mt('An error occurred during the attempt to change the section for this student.')."<br />");
     }      }
     my $roleresults = &Apache::lonnet::modifystudent      my $roleresults = &Apache::lonnet::modifystudent
         ($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname,          ($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname,
Line 2119  sub get_enrollment_data { Line 2196  sub get_enrollment_data {
     return ($start,$end,$section);      return ($start,$end,$section);
 }  }
   
 #################################################  
 #################################################  
   
 =pod  =pod
   
 =item show_drop_list  =item show_drop_list()
   
 Display a list of students to drop  Display a list of students to drop
 Inputs:   Inputs: 
Line 2144  which describes the order elements are s Line 2219  which describes the order elements are s
   
 =cut  =cut
   
 #################################################  
 #################################################  
 sub show_drop_list {  sub show_drop_list {
     my ($r,$classlist,$keylist,$nosort)=@_;      my ($r,$classlist,$keylist,$nosort)=@_;
     my $cid=$env{'request.course.id'};      my $cid=$env{'request.course.id'};
Line 2305  END Line 2378  END
     return;      return;
 }  }
   
 #  
 # Print out the initial form to get the courselist file  =pod 
 #  
   =item print_first_courselist_upload_form()
   
       Print out the initial form to get the courselist file
   
   =cut
   
 sub print_first_courselist_upload_form {  sub print_first_courselist_upload_form {
     my $r=shift;      my $r=shift;
     my $str;      my $str;
Line 2332  sub print_first_courselist_upload_form { Line 2411  sub print_first_courselist_upload_form {
     return;      return;
 }  }
   
 # ================================================= Drop/Add from uploaded file  
   =pod
   
   =item upfile_drop_add()
   
       Drop/Add from uploaded file
   
   =cut
   
 sub upfile_drop_add {  sub upfile_drop_add {
     my $r=shift;      my $r=shift;
     &Apache::loncommon::load_tmp_file($r);      &Apache::loncommon::load_tmp_file($r);
Line 2538  sub upfile_drop_add { Line 2625  sub upfile_drop_add {
                 }                  }
             }              }
         } # end of foreach (@studentdata)          } # end of foreach (@studentdata)
         $r->print("</p>\n<p>\n".&mt('Processed [_1] student(s).',$count).          $r->print("</p>\n<p>\n".&mt('Processed [quant,_1,student].',$count).
                   "</p>\n");                    "</p>\n");
         $r->print("<p>\n".          $r->print("<p>\n".
                   &mt('If active, the new role will be available when the '.                    &mt('If active, the new role will be available when the '.
Line 2589  sub drop_student_list { Line 2676  sub drop_student_list {
                       '<br />');                        '<br />');
         }          }
     }      }
     $r->print('<p><b>'.&mt('Dropped [_1] student(s).',$count).'</b></p>');      $r->print('<p><b>'.&mt('Dropped [quant,_1,student].',$count).'</b></p>');
     $r->print('<p>'.&mt('Re-enrollment will re-activate data.')) if ($count);      $r->print('<p>'.&mt('Re-enrollment will re-activate data.')) if ($count);
 }  }
   
Line 2646  sub get_permission { Line 2733  sub get_permission {
     return (\%permission,$allowed);      return (\%permission,$allowed);
 }  }
   
 ###################################################################  
 ###################################################################  
   
 =pod  =pod
   
 =item &handler  =item &handler()
   
 The typical handler you see in all these modules.  Takes $r, the  The typical handler you see in all these modules.  Takes $r, the
 http request, as an argument.    http request, as an argument.  
Line 2678  The response to the request is governed Line 2762  The response to the request is governed
   
 =cut  =cut
   
 ###################################################################  
 ###################################################################  
 sub handler {  sub handler {
     my $r=shift;      my $r=shift;
     if ($r->header_only) {      if ($r->header_only) {
Line 2890  sub handler { Line 2972  sub handler {
     return OK;      return OK;
 }  }
   
 ###################################################################  
 ###################################################################  
   
 1;  1;
 __END__  __END__
   
   =pod
   
   =back
   
   =cut

Removed from v.1.173  
changed lines
  Added in v.1.178


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