[LON-CAPA-cvs] cvs: loncom /interface londropadd.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Fri, 05 Dec 2003 21:27:59 -0000
raeburn Fri Dec 5 16:27:59 2003 EDT
Modified files:
/loncom/interface londropadd.pm
Log:
Added link to "Automated enrollment manager". Modified following functions:
javascript_validations and date_setting_table to support calls for customized versions of their output from loncreatecourse.pm - used by domain controller to create new courses.
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.90 loncom/interface/londropadd.pm:1.91
--- loncom/interface/londropadd.pm:1.90 Fri Nov 7 16:04:37 2003
+++ loncom/interface/londropadd.pm Fri Dec 5 16:27:59 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.90 2003/11/07 21:04:37 matthew Exp $
+# $Id: londropadd.pm,v 1.91 2003/12/05 21:27:59 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -146,7 +146,8 @@
'enrollone' => 'Enroll a single student',
'modify' => 'Modify student data',
'view' => 'View Class List',
- 'drop' => 'Drop Students');
+ 'drop' => 'Drop Students',
+ 'populate' => 'Automated Enrollment Manager');
$r->print(<<END);
<p>
@@ -169,7 +170,10 @@
<font size="+1">
<a href="/adm/dropadd?action=drop">$Text{'drop'}</a>
</font>
-</p>
+</p><p>
+<font size="+1">
+ <a href="/adm/populate">$Text{'populate'}</a>
+</font>
END
}
@@ -237,7 +241,12 @@
my %param = ( formname => 'studentform',
kerb_def_dom => $krbdefdom );
$authheader = &Apache::loncommon::authform_header(%param);
+ } elsif ($mode eq 'createcourse') {
+ my %param = ( formname => 'ccrs',
+ kerb_def_dom => $krbdefdom );
+ $authheader = &Apache::loncommon::authform_header(%param);
}
+
my %alert = &Apache::lonlocal::texthash
(username => 'You need to specify the username field.',
authen => 'You must choose an authentication type.',
@@ -256,10 +265,16 @@
END
my $auth_checks = (<<END);
var foundatype=0;
+END
+ unless ($mode eq 'createcourse') {
+ $auth_checks .= (<<END);
if (founduname==0) {
alert('$alert{'username'}');
return;
}
+END
+ }
+ $auth_checks .= (<<END);
// alert('current.radiovalue = '+current.radiovalue);
if (current.radiovalue == null || current.radiovalue == 'nochange') {
// They did not check any of the login radiobuttons.
@@ -289,7 +304,14 @@
}
}
END
- my $optional_checks = (<<END);
+ my $optional_checks = '';
+ if ($mode eq 'createcourse') {
+ $optional_checks = (<<END);
+ vf.submit();
+}
+END
+ } else {
+ $optional_checks = (<<END);
var message='';
if (foundname==0) {
message='$alert{'name'}';
@@ -323,14 +345,14 @@
vf.submit();
}
}
-
END
+ }
my $result = $function_name;
- if ($mode eq 'auth') {
+ if ( ($mode eq 'auth') || ($mode eq 'createcourse') ) {
$result .= $auth_checks;
}
$result .= $optional_checks;
- if ($mode eq 'auth') {
+ if ( ($mode eq 'auth') || ($mode eq 'createcourse') ) {
$result .= $authheader;
}
return $result;
@@ -674,21 +696,25 @@
}
sub setup_date_selectors {
- my ($starttime,$endtime) = @_;
+ my ($starttime,$endtime,$mode) = @_;
if (! defined($starttime)) {
$starttime = time;
- if (exists($ENV{'course.'.$ENV{'request.course.id'}.
+ unless ($mode eq 'createcourse') {
+ if (exists($ENV{'course.'.$ENV{'request.course.id'}.
'.default_enrollment_start_date'})) {
- $starttime = $ENV{'course.'.$ENV{'request.course.id'}.
+ $starttime = $ENV{'course.'.$ENV{'request.course.id'}.
'.default_enrollment_start_date'};
+ }
}
}
if (! defined($endtime)) {
$endtime = time+(6*30*24*60*60); # 6 months from now, approx
- if (exists($ENV{'course.'.$ENV{'request.course.id'}.
+ unless ($mode eq 'createcourse') {
+ if (exists($ENV{'course.'.$ENV{'request.course.id'}.
'.default_enrollment_end_date'})) {
- $endtime = $ENV{'course.'.$ENV{'request.course.id'}.
+ $endtime = $ENV{'course.'.$ENV{'request.course.id'}.
'.default_enrollment_end_date'};
+ }
}
}
my $startdateform = &Apache::lonhtmlcommon::date_setter('studentform',
@@ -697,6 +723,14 @@
my $enddateform = &Apache::lonhtmlcommon::date_setter('studentform',
'enddate',
$endtime);
+ if ($mode eq 'createcourse') {
+ $startdateform = &Apache::lonhtmlcommon::date_setter('ccrs',
+ 'startdate',
+ $starttime);
+ $enddateform = &Apache::lonhtmlcommon::date_setter('ccrs',
+ 'enddate',
+ $endtime);
+ }
return ($startdateform,$enddateform);
}
@@ -710,11 +744,14 @@
}
sub date_setting_table {
- my ($starttime,$endtime) = @_;
- my ($startform,$endform)=&setup_date_selectors($starttime,$endtime);
+ my ($starttime,$endtime,$mode) = @_;
+ my ($startform,$endform)=&setup_date_selectors($starttime,$endtime,$mode);
my $dateDefault = '<nobr>'.
'<input type="checkbox" name="makedatesdefault" />'.
' make these dates the default for future enrollment';
+ if ($mode eq 'createcourse') {
+ $dateDefault = ' ';
+ }
my $perpetual = '<nobr><input type="checkbox" name="no_end_date"';
if (defined($endtime) && $endtime == 0) {
$perpetual .= ' checked';