[LON-CAPA-cvs] cvs: loncom /interface londropadd.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 20 Jun 2003 18:34:52 -0000
matthew Fri Jun 20 14:34:52 2003 EDT
Modified files:
/loncom/interface londropadd.pm
Log:
Part of Bug:884. Enroll single student now uses the default dates from
the course environment. Additionally it uses the more pleasant 'date_setter'
method of getting date info from the user.
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.66 loncom/interface/londropadd.pm:1.67
--- loncom/interface/londropadd.pm:1.66 Wed May 21 12:06:09 2003
+++ loncom/interface/londropadd.pm Fri Jun 20 14:34:52 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.66 2003/05/21 16:06:09 matthew Exp $
+# $Id: londropadd.pm,v 1.67 2003/06/20 18:34:52 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -599,13 +599,19 @@
&modifystudent($ENV{'form.lcdomain'},$ENV{'form.cuname'},
$ENV{'request.course.id'},$ENV{'form.csec'},
$desiredhost);
+ my $startdate =
+ &Apache::lonhtmlcommon::get_date_from_form('startdate');
+ my $enddate =
+ &Apache::lonhtmlcommon::get_date_from_form('enddate');
+ &Apache::lonnet::logthis('startdate = '.$startdate);
+ &Apache::lonnet::logthis('enddate = '.$enddate);
my $login_result = &Apache::lonnet::modifystudent
($ENV{'form.lcdomain'},$ENV{'form.cuname'},
$ENV{'form.cstid'},$amode,$genpwd,
$ENV{'form.cfirst'},$ENV{'form.cmiddle'},
$ENV{'form.clast'},$ENV{'form.cgen'},
- $ENV{'form.csec'},$ENV{'form.enddate'},
- $ENV{'form.startdate'},$ENV{'form.forceid'},
+ $ENV{'form.csec'},$enddate,
+ $startdate,$ENV{'form.forceid'},
$desiredhost);
if ($login_result =~ /^ok/) {
$r->print($login_result);
@@ -644,6 +650,24 @@
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(<<END);
<input type="hidden" name="action" value="enrollstudent">
@@ -716,13 +740,10 @@
<input type="hidden" name="startdate" value='$today' />
<input type="hidden" name="enddate" value='$halfyear' />
</p><p>
-<a
- href="javascript:pjump('date_start','Enrollment Starting Date',document.studentform.startdate.value,'start','studentform.pres','dateset');"
->Set Starting Date</a>
-</p><p>
-<a
- href="javascript:pjump('date_end','Enrollment Ending Date',document.studentform.enddate.value,'end','studentform.pres','dateset');"
->Set Ending Date</a>
+<table>
+<tr><td align="right" ><b>Starting Date</b></td><td>$startdateform</td></tr>
+<tr><td align="right" ><b>Ending Date</b></td><td>$enddateform</td></tr>
+</table>
</p>
<h3>ID/Student Number</h3>
<p>