--- loncom/interface/Attic/londropadd.pm 2002/05/03 20:38:13 1.40
+++ loncom/interface/Attic/londropadd.pm 2002/09/17 15:52:44 1.50
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.40 2002/05/03 20:38:13 matthew Exp $
+# $Id: londropadd.pm,v 1.50 2002/09/17 15:52:44 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,49 +31,35 @@
#
# (TeX Content Handler
#
-# YEAR=2000
-# 05/29/00,05/30,10/11 Gerd Kortemeyer)
-#
-# 10/11,10/12,10/16 Gerd Kortemeyer)
-#
-# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28,
-# 12/08,12/12 Gerd Kortemeyer)
-#
-# 12/26,12/27,12/28,
-# YEAR=2001
-# 01/01/01,01/15,02/10,02/13,02/14,02/22 Gerd Kortemeyer
-# 8/6 Scott Harrison
-# Guy Albertelli
-# 9/25 Gerd Kortemeyer
-# 12/19 Guy Albertelli
-# YEAR=2002
-# 1/4 Gerd Kortemeyer
+###############################################################
+###############################################################
package Apache::londropadd;
use strict;
use Apache::lonnet();
use Apache::loncommon();
+use Apache::lonhtmlcommon();
use Apache::Constants qw(:common :http REDIRECT);
-# ================================================================ Print header
-
+###############################################################
+###############################################################
sub header {
+ my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager');
return(<
-
$ENV{'course.'.$ENV{'request.course.id'}.'.description'}
-Enrollment Manager
+$bodytag
+ + Enroll a single student + +
+ + Modify student data + +
+ + View Classlist + +
+ + Drop Students + +
+END } -sub phase_two_header { +############################################################### +############################################################### +sub print_upload_manager_header { my ($r,$datatoken,$distotal,$krbdefdom)=@_; my $javascript; + if (! exists($ENV{'form.upfile_associate'})) { + $ENV{'form.upfile_associate'} = 'forward'; + } + if ($ENV{'form.associate'} eq 'Reverse Association') { + if ( $ENV{'form.upfile_associate'} ne 'reverse' ) { + $ENV{'form.upfile_associate'} = 'reverse'; + } else { + $ENV{'form.upfile_associate'} = 'forward'; + } + } if ($ENV{'form.upfile_associate'} eq 'reverse') { - $javascript=&phase_two_javascript_reverse_associate(); + $javascript=&upload_manager_javascript_reverse_associate(); } else { - $javascript=&phase_two_javascript_forward_associate(); + $javascript=&upload_manager_javascript_forward_associate(); } my $javascript_validations=&javascript_validations($krbdefdom); $r->print(<Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)
-Note: for large courses, this operation might be time consuming.
+Note: for large courses, this operation may be time consuming.
ENDPICK
}
# ======================================================= Menu Phase Two Upload
-sub menu_phase_two_upload {
+sub print_upload_manager_form {
my $r=shift;
my $datatoken;
@@ -487,14 +526,18 @@ sub menu_phase_two_upload {
my $today=time;
my $halfyear=$today+15552000;
my $defdom=$r->dir_config('lonDefDomain');
- &phase_two_header($r,$datatoken,$distotal,$krbdefdom);
+ &print_upload_manager_header($r,$datatoken,$distotal,$krbdefdom);
my $i;
my $keyfields;
if ($total>=0) {
- my @d=(['username','Username'],['names','Last Name, First Names'],
- ['fname','First Name'],['mname','Middle Names/Initials'],
- ['lname','Last Name'],['gen','Generation'],
- ['id','ID/Student Number'],['sec','Group/Section'],
+ my @d=(['username','Username'],
+ ['names','Last Name, First Names'],
+ ['fname','First Name'],
+ ['mname','Middle Names/Initials'],
+ ['lname','Last Name'],
+ ['gen','Generation'],
+ ['id','ID/Student Number'],
+ ['sec','Group/Section'],
['ipwd','Initial Password']);
if ($ENV{'form.upfile_associate'} eq 'reverse') {
&Apache::loncommon::csv_print_samples($r,\@records);
@@ -508,7 +551,7 @@ sub menu_phase_two_upload {
$keyfields=join(',',sort(keys(%sone)));
}
}
- &phase_two_end($r,$i,$keyfields,$defdom,$today,$halfyear);
+ &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear);
}
# ======================================================= Enroll single student
@@ -525,7 +568,7 @@ sub enroll_single_student {
if (lc($desiredhost) eq 'default') {
$desiredhost = undef;
} else {
- my %home_servers = &Apache::loncommon::get_home_servers($domain);
+ my %home_servers =&Apache::loncommon::get_library_servers($domain);
if (! exists($home_servers{$desiredhost})) {
$r->print('Error:'.
'Invalid home server specified');
@@ -537,7 +580,8 @@ sub enroll_single_student {
my $amode='';
my $genpwd='';
if ($ENV{'form.login'} eq 'krb') {
- $amode='krb4';
+ $amode='krb';
+ $amode.=$ENV{'form.krbver'};
$genpwd=$ENV{'form.krbarg'};
} elsif ($ENV{'form.login'} eq 'int') {
$amode='internal';
@@ -572,7 +616,7 @@ sub enroll_single_student {
}
# ======================================================= Menu Phase Two Enroll
-sub menu_phase_two_enroll {
+sub print_enroll_single_student_form {
my $r=shift;
$r->print("
ID/Student Number:
- -Group/Section:
+First Name: | |
Middle Name: | |
Last Name: | |
Generation: |
Username:
@@ -647,12 +692,17 @@ $intform$locform
-
Group/Section: +
+ + + + + +
+
+ID/Student Number: +
Disable ID/Student Number Safeguard and Force Change of Conflicting IDs -(only do if you know what you are doing)
-
-
+(only do if you know what you are doing)
+
+
-ENDSENROLL +END + return; } # =================================================== get the current classlist @@ -719,9 +773,14 @@ sub menu_phase_two_drop { } # ============================================== view classlist -sub menu_phase_two_view { +sub print_html_classlist { my $r=shift; - $r->print("ERROR:$error"); + } + } elsif (!defined(%currentlist)) { + $r->print("There are no students currently enrolled.\n"); + } else { + &show_class_list($r,'csv','nolink',%currentlist); } } # =================================================== Show student list to drop sub show_class_list { - my ($r,%currentlist)=@_; + my ($r,$mode,$linkto,%currentlist)=@_; my $cid=$ENV{'request.course.id'}; - $r->print(<
username | domain | ID | student name | generation | section |
---|---|---|---|---|---|
'. - 'Internal error: unable to get environment '. - 'for '.$sname.' in domain '.$sdom.' | |||||
'. + 'Internal error: unable to get environment '. + 'for '.$sname.' in domain '.$sdom.' | |||||
$sname | + if ($mode eq 'view') { + $r->print("|||||
\n "); + if ($linkto eq 'nothing') { + $r->print($sname); + } elsif ($linkto eq 'aboutme') { + $r->print(&Apache::loncommon::aboutmewrapper($sname,$sname, + $sdom)); + } elsif ($linkto eq 'modify') { + $r->print(''.$sname."\n"); + } + $r->print(<<"END"); + | $sdom | $reply{$sname} | $info{'lastname'}, $info{'firstname'} $info{'middlename'} | @@ -773,9 +883,182 @@ END$ssec |
'. + 'Unable to retrieve environment data for '.$sname. + 'in domain '.$sdom.'
'. + 'Please contact your LON-CAPA administrator '. + 'regarding this situation.