--- loncom/interface/Attic/londropadd.pm 2004/03/01 16:34:54 1.106
+++ loncom/interface/Attic/londropadd.pm 2004/07/19 17:58:10 1.116
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.106 2004/03/01 16:34:54 matthew Exp $
+# $Id: londropadd.pm,v 1.116 2004/07/19 17:58:10 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,6 +37,7 @@ use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::Constants qw(:common :http REDIRECT);
use Spreadsheet::WriteExcel;
+use Apache::lonstathelpers();
use Apache::lonlocal;
###############################################################
@@ -172,10 +173,15 @@ sub print_main_menu {
$Text{'drop'}
$help{'Course_Drop_Student'}
+END
+ my ($cdom,$cnum) = split/_/,$ENV{'request.course.id'};
+ if (&Apache::lonnet::auto_run($cnum,$cdom) ) {
+ $r->print(<$Text{'populate'}
END
+ }
}
###############################################################
@@ -699,7 +705,7 @@ sub enroll_single_student {
$ENV{'form.csec'}=~s/\W//g;
#
# We do the dates first because the action of making them the defaul
- # in the course is entirely seperate from the action of enrolling the
+ # in the course is entirely separate from the action of enrolling the
# student. Also, a failure in setting the dates as default is not fatal
# to the process of enrolling / modifying a student.
my ($startdate,$enddate) = &get_dates_from_form();
@@ -780,7 +786,7 @@ sub setup_date_selectors {
my ($starttime,$endtime,$mode) = @_;
if (! defined($starttime)) {
$starttime = time;
- unless ($mode eq 'createcourse') {
+ unless ($mode eq 'create_enrolldates' || $mode eq 'create_defaultdates') {
if (exists($ENV{'course.'.$ENV{'request.course.id'}.
'.default_enrollment_start_date'})) {
$starttime = $ENV{'course.'.$ENV{'request.course.id'}.
@@ -804,12 +810,20 @@ sub setup_date_selectors {
my $enddateform = &Apache::lonhtmlcommon::date_setter('studentform',
'enddate',
$endtime);
- if ($mode eq 'createcourse') {
+ if ($mode eq 'create_enrolldates') {
$startdateform = &Apache::lonhtmlcommon::date_setter('ccrs',
- 'startdate',
+ 'startenroll',
$starttime);
$enddateform = &Apache::lonhtmlcommon::date_setter('ccrs',
- 'enddate',
+ 'endenroll',
+ $endtime);
+ }
+ if ($mode eq 'create_defaultdates') {
+ $startdateform = &Apache::lonhtmlcommon::date_setter('ccrs',
+ 'startaccess',
+ $starttime);
+ $enddateform = &Apache::lonhtmlcommon::date_setter('ccrs',
+ 'endaccess',
$endtime);
}
return ($startdateform,$enddateform);
@@ -830,7 +844,7 @@ sub date_setting_table {
my $dateDefault = ''.
' '.
&mt('make these dates the default for future enrollment');
- if ($mode eq 'createcourse') {
+ if ($mode eq 'create_enrolldates' || $mode eq 'create_defaultdates') {
$dateDefault = ' ';
}
my $perpetual = ' '.&mt('no ending date').'';
+ if ($mode eq 'create_enrolldates') {
+ $perpetual = ' ';
+ }
my $result = '';
$result .= "
\n";
$result .= '
'.&mt('Starting Date').'
'.
@@ -907,6 +924,8 @@ sub print_enroll_single_student_form {
#
my $username = $ENV{'form.cuname'};
my $domain = $ENV{'form.cudomain'};
+ $username=~s/[\W|_]//gs;
+ $domain=~s/[\W|_]//gs;
my $home = &Apache::lonnet::homeserver($username,$domain);
# $new_user flags whether we are creating a new user or using an old one
my $new_user = 1;
@@ -1115,21 +1134,28 @@ sub print_html_classlist {
#
# List course personnel
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
+ #
+ if (! defined($ENV{'form.output'}) ||
+ $ENV{'form.output'} !~ /^(csv|excel|html)$/ ) {
+ $ENV{'form.output'} = 'html';
+ }
+ #
$r->print('