version 1.42, 2002/05/09 15:56:02
|
version 1.48, 2002/09/09 20:54:52
|
Line 59 use Apache::Constants qw(:common :http R
|
Line 59 use Apache::Constants qw(:common :http R
|
# ================================================================ Print header |
# ================================================================ Print header |
|
|
sub header { |
sub header { |
|
my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager'); |
return(<<ENDHEAD); |
return(<<ENDHEAD); |
<html> |
<html> |
<head> |
<head> |
<title>LON-CAPA Enrollment Manager</title> |
<title>LON-CAPA Enrollment Manager</title> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
$bodytag |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>$ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h1> |
|
<h2>Enrollment Manager</h2> |
|
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
action="/adm/dropadd" name="studentform"> |
action="/adm/dropadd" name="studentform"> |
ENDHEAD |
ENDHEAD |
Line 129 sub domain_form {
|
Line 127 sub domain_form {
|
$select_menus{$dom}->{'default'}= 'default'; |
$select_menus{$dom}->{'default'}= 'default'; |
$select_menus{$dom}->{'select2'}->{'default'} = 'default'; |
$select_menus{$dom}->{'select2'}->{'default'} = 'default'; |
# Now build up the other items in the second menu |
# Now build up the other items in the second menu |
my %servers = &Apache::loncommon::get_home_servers($dom); |
my %servers = &Apache::loncommon::get_library_servers($dom); |
foreach my $server (keys(%servers)) { |
foreach my $server (keys(%servers)) { |
$select_menus{$dom}->{'select2'}->{$server} |
$select_menus{$dom}->{'select2'}->{$server} |
= "$server $servers{$server}"; |
= "$server $servers{$server}"; |
Line 144 sub domain_form {
|
Line 142 sub domain_form {
|
# ============================================================== Menu Phase One |
# ============================================================== Menu Phase One |
sub menu_phase_one { |
sub menu_phase_one { |
my $r=shift; |
my $r=shift; |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
$r->print(<<END); |
$r->print(<<ENDUPFORM); |
<p> |
<input type=hidden name=phase value=two> |
<font size="+1"><a href="/adm/dropadd?phase=two&uplist=yes">Upload a course list</a></font> |
<hr> |
</p><p> |
<h3>Upload a courselist</h3> |
<font size="+1"><a href="/adm/dropadd?phase=two&enroll=yes">Enroll a single student</a></font> |
$upfile_select |
</p><p> |
<p><input type=submit name="fileupload" value="Upload Courselist"> |
<font size="+1"><a href="/adm/dropadd?phase=two&view=yes">View Classlist</a></font> |
<hr /> |
</p><p> |
<h3>Enroll a single student</h3> |
<font size="+1"><a href="/adm/dropadd?phase=two&drop=yes">Drop Students</a></font> |
<p><input type=submit name="enroll" value="Enroll Student"></p> |
</p> |
<hr /> |
END |
<h3>Classlist</h3> |
|
<p><input type=submit name="view" value="View Class List"> |
|
<input type=submit name="viewcsv" value="Comma Separated Class List"></p> |
|
<hr /> |
|
<h3>Drop students</h3> |
|
<p><input type=submit name="drop" value="Selection List"></p> |
|
ENDUPFORM |
|
} |
} |
|
|
sub phase_two_header { |
sub phase_two_header { |
Line 526 sub enroll_single_student {
|
Line 517 sub enroll_single_student {
|
if (lc($desiredhost) eq 'default') { |
if (lc($desiredhost) eq 'default') { |
$desiredhost = undef; |
$desiredhost = undef; |
} else { |
} else { |
my %home_servers = &Apache::loncommon::get_home_servers($domain); |
my %home_servers =&Apache::loncommon::get_library_servers($domain); |
if (! exists($home_servers{$desiredhost})) { |
if (! exists($home_servers{$desiredhost})) { |
$r->print('<font color="#ff0000">Error:</font>'. |
$r->print('<font color="#ff0000">Error:</font>'. |
'Invalid home server specified'); |
'Invalid home server specified'); |
Line 538 sub enroll_single_student {
|
Line 529 sub enroll_single_student {
|
my $amode=''; |
my $amode=''; |
my $genpwd=''; |
my $genpwd=''; |
if ($ENV{'form.login'} eq 'krb') { |
if ($ENV{'form.login'} eq 'krb') { |
$amode='krb4'; |
$amode='krb'; |
|
$amode.=$ENV{'form.krbver'}; |
$genpwd=$ENV{'form.krbarg'}; |
$genpwd=$ENV{'form.krbarg'}; |
} elsif ($ENV{'form.login'} eq 'int') { |
} elsif ($ENV{'form.login'} eq 'int') { |
$amode='internal'; |
$amode='internal'; |
Line 722 sub menu_phase_two_drop {
|
Line 714 sub menu_phase_two_drop {
|
# ============================================== view classlist |
# ============================================== view classlist |
sub menu_phase_two_view { |
sub menu_phase_two_view { |
my $r=shift; |
my $r=shift; |
$r->print("<h3>Current Classlist</h3>"); |
$r->print(<<END); |
|
<font size="+1">Current Classlist</font> |
|
<font size="+1"><a href="/adm/dropadd?phase=two&viewcsv=yes">CSV format</a></font><br /> |
|
END |
my $cid=$ENV{'request.course.id'}; |
my $cid=$ENV{'request.course.id'}; |
my ($error,%currentlist)=&get_current_classlist |
my ($error,%currentlist)=&get_current_classlist |
($ENV{'course.'.$cid.'.domain'},$ENV{'course.'.$cid.'.num'}); |
($ENV{'course.'.$cid.'.domain'},$ENV{'course.'.$cid.'.num'}); |
Line 881 END
|
Line 876 END
|
END |
END |
} |
} |
|
|
|
# |
|
# Print out the initial form to get the courselist file |
|
# |
|
sub print_first_courselist_upload_form { |
|
my $r=shift; |
|
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
|
my $create_classlist_help = |
|
&Apache::loncommon::help_open_topic("Course_Create_Class_List", |
|
"How do I create a class list from a spreadsheet"); |
|
my $create_csv_help = |
|
&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
|
"How do I create a CSV file from a spreadsheet"); |
|
$r->print(<<ENDUPFORM); |
|
<input type=hidden name=phase value=two> |
|
<hr> |
|
<h3>Upload a courselist</h3> |
|
$upfile_select |
|
<p><input type=submit name="fileupload" value="Upload Courselist"> |
|
<br /> |
|
$create_classlist_help <br /> |
|
$create_csv_help |
|
</body></html> |
|
ENDUPFORM |
|
return; |
|
} |
|
|
# ================================================= Drop/Add from uploaded file |
# ================================================= Drop/Add from uploaded file |
sub upfile_drop_add { |
sub upfile_drop_add { |
my $r=shift; |
my $r=shift; |
Line 909 sub upfile_drop_add {
|
Line 930 sub upfile_drop_add {
|
if (lc($desiredhost) eq 'default') { |
if (lc($desiredhost) eq 'default') { |
$desiredhost = undef; |
$desiredhost = undef; |
} else { |
} else { |
my %home_servers = &Apache::loncommon::get_home_servers($domain); |
my %home_servers = &Apache::loncommon::get_library_servers($domain); |
if (! exists($home_servers{$desiredhost})) { |
if (! exists($home_servers{$desiredhost})) { |
$r->print('<font color="#ff0000">Error:</font>'. |
$r->print('<font color="#ff0000">Error:</font>'. |
'Invalid home server specified'); |
'Invalid home server specified'); |
Line 920 sub upfile_drop_add {
|
Line 941 sub upfile_drop_add {
|
my $amode = ''; |
my $amode = ''; |
my $genpwd = ''; |
my $genpwd = ''; |
if ($ENV{'form.login'} eq 'krb') { |
if ($ENV{'form.login'} eq 'krb') { |
$amode='krb4'; |
$amode='krb'; |
|
$amode.=$ENV{'form.krbver'}; |
$genpwd=$ENV{'form.krbarg'}; |
$genpwd=$ENV{'form.krbarg'}; |
} elsif ($ENV{'form.login'} eq 'int') { |
} elsif ($ENV{'form.login'} eq 'int') { |
$amode='internal'; |
$amode='internal'; |
Line 1088 sub handler {
|
Line 1110 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
} |
} |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['enroll','drop','view','phase', |
|
'viewcsv','uplist']); |
# Needs to be in a course |
# Needs to be in a course |
if (($ENV{'request.course.fn'}) && |
if (($ENV{'request.course.fn'}) && |
(&Apache::lonnet::allowed('cst',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('cst',$ENV{'request.course.id'}))) { |
Line 1109 sub handler {
|
Line 1134 sub handler {
|
} |
} |
} |
} |
if ($ENV{'form.phase'} eq 'two') { |
if ($ENV{'form.phase'} eq 'two') { |
if ($ENV{'form.fileupload'}) { |
if ($ENV{'form.uplist'}) { |
|
&print_first_courselist_upload_form($r); |
|
} elsif ($ENV{'form.fileupload'}) { |
&menu_phase_two_upload($r); |
&menu_phase_two_upload($r); |
} elsif ($ENV{'form.enroll'}) { |
} elsif ($ENV{'form.enroll'}) { |
&menu_phase_two_enroll($r); |
&menu_phase_two_enroll($r); |