--- loncom/interface/Attic/londropadd.pm 2002/10/16 18:45:10 1.59 +++ loncom/interface/Attic/londropadd.pm 2003/02/13 21:35:50 1.64 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.59 2002/10/16 18:45:10 matthew Exp $ +# $Id: londropadd.pm,v 1.64 2003/02/13 21:35:50 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,6 +41,7 @@ use Apache::lonnet(); use Apache::loncommon(); use Apache::lonhtmlcommon(); use Apache::Constants qw(:common :http REDIRECT); +use Spreadsheet::WriteExcel; ############################################################### ############################################################### @@ -92,7 +93,7 @@ sub modifystudent { } } if ($result eq '') { - $result eq 'Unable to find section for this student'; + $result = 'Unable to find section for this student'; } else { $result =~ s/(ok:)+/ok/g; } @@ -220,6 +221,7 @@ function verify_message (vf,founduname,f alert('You need to specify the username field'); return; } + // alert('current.radiovalue = '+current.radiovalue); if (current.radiovalue == null || current.radiovalue == 'nochange') { // They did not check any of the login radiobuttons. alert('You must choose an authentication type'); @@ -459,7 +461,13 @@ ENDPICK ############################################################### sub print_upload_manager_footer { my ($r,$i,$keyfields,$defdom,$today,$halfyear)=@_; - my %param = ( formname => 'document.studentform'); + + my ($krbdef,$krbdefdom) = + &Apache::loncommon::get_kerberos_defaults($defdom); + my %param = ( formname => 'document.studentform', + kerb_def_dom => $krbdefdom, + kerb_def_auth => $krbdef + ); my $krbform = &Apache::loncommon::authform_kerberos(%param); my $intform = &Apache::loncommon::authform_internal(%param); my $locform = &Apache::loncommon::authform_local(%param); @@ -520,12 +528,11 @@ sub print_upload_manager_form { my @records=&Apache::loncommon::upfile_record_sep(); my $total=$#records; my $distotal=$total+1; - $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; - my $krbdefdom=$1; - $krbdefdom=~tr/a-z/A-Z/; my $today=time; my $halfyear=$today+15552000; my $defdom=$r->dir_config('lonDefDomain'); + my ($krbdef,$krbdefdom) = + &Apache::loncommon::get_kerberos_defaults($defdom); &print_upload_manager_header($r,$datatoken,$distotal,$krbdefdom); my $i; my $keyfields; @@ -627,14 +634,17 @@ sub enroll_single_student { sub print_enroll_single_student_form { my $r=shift; $r->print("
'. + 'Your Excel spreadsheet is ready for download.
'."\n"); + } } @@ -1053,7 +1094,8 @@ sub modify_single_student { my $displayable_endtime = localtime($endtime); # # check for forceid override - if (($sid ne $old{'id'}) && (! exists($ENV{'form.forceid'}))) { + if ((defined($old{'id'})) && ($old{'id'} ne '') && + ($sid ne $old{'id'}) && (! exists($ENV{'form.forceid'}))) { $r->print("You changed the students id ". " but did not disable the ID change safeguard.". " The students id will not be changed."); @@ -1104,7 +1146,15 @@ sub modify_single_student {
END
#
- # Send request(s) to modify data
+ # Send request(s) to modify data (final undef is for 'desiredhost',
+ # which is a moot point because the student already has an account.
+ my $modify_section_results = &modifystudent($sdom,$slogin,
+ $ENV{'request.course.id'},
+ $section,undef);
+ if ($modify_section_results !~ /^ok/) {
+ $r->print("An error occured during the attempt to change the ".
+ "section for this student.
");
+ }
my $roleresults = &Apache::lonnet::modifystudent
($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname,
$generation,$section,$endtime,$starttime,$ENV{'form.forceid'});
@@ -1638,7 +1688,9 @@ sub handler {
if (! exists($ENV{'form.state'})) {
&print_html_classlist($r);
} elsif ($ENV{'form.state'} eq 'csv') {
- &print_csv_classlist($r);
+ &print_formatted_classlist($r,'csv');
+ } elsif ($ENV{'form.state'} eq 'excel') {
+ &print_formatted_classlist($r,'excel');
} else {
&print_html_classlist($r);
}