version 1.46, 2002/08/21 17:18:08
|
version 1.49, 2002/09/13 15:33:39
|
Line 142 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); |
my $create_classlist_help = |
<p> |
&Apache::loncommon::help_open_topic("Course_Create_Class_List", |
<font size="+1"><a href="/adm/dropadd?phase=two&uplist=yes">Upload a course list</a></font> |
"How do I create a class list from a spreadsheet"); |
</p><p> |
my $create_csv_help = |
<font size="+1"><a href="/adm/dropadd?phase=two&enroll=yes">Enroll a single student</a></font> |
&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
</p><p> |
"How do I create a CSV file from a spreadsheet"); |
<font size="+1"><a href="/adm/dropadd?phase=two&view=yes">View Classlist</a></font> |
$r->print(<<ENDUPFORM); |
</p><p> |
<input type=hidden name=phase value=two> |
<font size="+1"><a href="/adm/dropadd?phase=two&drop=yes">Drop Students</a></font> |
<hr> |
</p> |
<h3>Upload a courselist</h3> |
END |
$upfile_select |
|
<p><input type=submit name="fileupload" value="Upload Courselist"> |
|
<br /> |
|
$create_classlist_help <br /> |
|
$create_csv_help |
|
|
|
<hr /> |
|
<h3>Enroll a single student</h3> |
|
<p><input type=submit name="enroll" value="Enroll Student"></p> |
|
<hr /> |
|
<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 325 function verify(vf) {
|
Line 308 function verify(vf) {
|
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec); |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec); |
} |
} |
|
|
|
// |
|
// vf = this.form |
|
// tf = column number |
|
// |
|
// values of nw |
|
// |
|
// 0 = none |
|
// 1 = username |
|
// 2 = names (lastname, firstnames) |
|
// 3 = fname (firstname) |
|
// 4 = mname (middlename) |
|
// 5 = lname (lastname) |
|
// 6 = gen (generation) |
|
// 7 = id |
|
// 8 = section |
|
// 9 = ipwd (password) |
|
// |
function flip(vf,tf) { |
function flip(vf,tf) { |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var i; |
var i; |
|
// make sure no other columns are labeled the same as this one |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
if ((i!=tf) && (eval('vf.f'+i+'.selectedIndex')==nw)) { |
if ((i!=tf) && (eval('vf.f'+i+'.selectedIndex')==nw)) { |
eval('vf.f'+i+'.selectedIndex=0;') |
eval('vf.f'+i+'.selectedIndex=0;') |
} |
} |
} |
} |
if (tf==1 && nw!=0) { |
// If we set this to 'lastname, firstnames', clear out all the ones |
for (i=2;i<=5;i++) { |
// set to 'fname','mname','lname','gen' (3,4,5,6) currently. |
eval('vf.f'+i+'.selectedIndex=0;') |
|
} |
|
} |
|
if (nw==2) { |
if (nw==2) { |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
if ((eval('vf.f'+i+'.selectedIndex')>=3) && |
if ((eval('vf.f'+i+'.selectedIndex')>=3) && |
Line 346 function flip(vf,tf) {
|
Line 344 function flip(vf,tf) {
|
} |
} |
} |
} |
} |
} |
|
// If we set this to one of 'fname','mname','lname','gen' (3,4,5,6), |
|
// clear out any that are set to 'lastname, firstnames' (2) |
if ((nw>=3) && (nw<=6)) { |
if ((nw>=3) && (nw<=6)) { |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
if (eval('vf.f'+i+'.selectedIndex')==2) { |
if (eval('vf.f'+i+'.selectedIndex')==2) { |
Line 353 function flip(vf,tf) {
|
Line 353 function flip(vf,tf) {
|
} |
} |
} |
} |
} |
} |
|
// If we set the password, make the password form below correspond to |
|
// the new value. |
if (nw==9) { |
if (nw==9) { |
changed_radio('int',document.studentform); |
changed_radio('int',document.studentform); |
set_auth_radio_buttons('int',document.studentform); |
set_auth_radio_buttons('int',document.studentform); |
Line 546 sub enroll_single_student {
|
Line 548 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 730 sub menu_phase_two_drop {
|
Line 733 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 889 END
|
Line 895 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 928 sub upfile_drop_add {
|
Line 960 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 1096 sub handler {
|
Line 1129 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 1117 sub handler {
|
Line 1153 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); |