--- loncom/interface/Attic/londropadd.pm 2002/11/08 20:51:48 1.60
+++ loncom/interface/Attic/londropadd.pm 2003/06/20 18:34:52 1.67
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.60 2002/11/08 20:51:48 matthew Exp $
+# $Id: londropadd.pm,v 1.67 2003/06/20 18:34:52 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -93,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;
}
@@ -213,6 +213,7 @@ sub javascript_validations {
my %param = ( formname => 'studentform',
kerb_def_dom => $krbdefdom );
my $authheader = &Apache::loncommon::authform_header(%param);
+ my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
return (<Enroll One Student
");
- my ($krbdefdom) = $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
- $krbdefdom=~tr/a-z/A-Z/;
my $today = time;
my $halfyear = $today+15552000;
my $defdom=$r->dir_config('lonDefDomain');
- my $javascript_validations=&javascript_validations($krbdefdom);
# Set up authentication forms
- my %param = ( formname => 'document.studentform');
+ my ($krbdef,$krbdefdom) =
+ &Apache::loncommon::get_kerberos_defaults($defdom);
+ my $javascript_validations=&javascript_validations($krbdefdom);
+ 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);
# Set up domain selection form
my $domform = &domain_form($defdom);
+ my $starttime = 'now';
+ if (exists($ENV{'course.'.$ENV{'request.course.id'}.
+ '.default_enrollment_start_date'})) {
+ $starttime = $ENV{'course.'.$ENV{'request.course.id'}.
+ '.default_enrollment_start_date'};
+ }
+ my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
+ if (exists($ENV{'course.'.$ENV{'request.course.id'}.
+ '.default_enrollment_end_date'})) {
+ $endtime = $ENV{'course.'.$ENV{'request.course.id'}.
+ '.default_enrollment_end_date'};
+ }
+ my $startdateform = &Apache::lonhtmlcommon::date_setter('studentform',
+ 'startdate',
+ $starttime);
+ my $enddateform = &Apache::lonhtmlcommon::date_setter('studentform',
+ 'enddate',
+ $endtime);
# Print it all out
$r->print(<
Starting Date | $startdateform |
Ending Date | $enddateform |
@@ -772,9 +796,11 @@ END
$r->print(<
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'});