--- loncom/interface/Attic/londropadd.pm 2004/02/20 19:44:59 1.102
+++ loncom/interface/Attic/londropadd.pm 2004/03/17 19:56:47 1.108
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.102 2004/02/20 19:44:59 matthew Exp $
+# $Id: londropadd.pm,v 1.108 2004/03/17 19:56:47 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -699,7 +699,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();
@@ -1100,7 +1100,7 @@ sub print_drop_menu {
# ============================================== view classlist
sub print_html_classlist {
- my $r=shift;
+ my ($r,$mode) = @_;
if (! exists($ENV{'form.sortby'})) {
$ENV{'form.sortby'} = 'username';
}
@@ -1108,13 +1108,14 @@ sub print_html_classlist {
$ENV{'form.Status'} = 'Active';
}
my $status_select = &Apache::lonhtmlcommon::StatusOptions
- ($ENV{'form.Status'},'studentform');
+ ($ENV{'form.Status'});
my $cid=$ENV{'request.course.id'};
my $cdom=$ENV{'course.'.$cid.'.domain'};
my $cnum=$ENV{'course.'.$cid.'.num'};
-# -------------------------------------------------------- Get course personnel
+ #
+ # List course personnel
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
- $r->print('
');
my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
if (! defined($classlist)) {
$r->print(&mt('There are no students currently enrolled.')."\n");
@@ -1159,40 +1168,37 @@ END
if ($ENV{'form.action'} eq 'modifystudent') {
&show_class_list($r,'view','modify','modifystudent',
$ENV{'form.Status'},$classlist,$keylist);
- } else {
+ } elsif (! defined($mode) || $mode eq '') {
&show_class_list($r,'view','aboutme','classlist',
$ENV{'form.Status'},$classlist,$keylist);
+ } elsif ($mode eq 'csv' || $mode eq 'excel') {
+ &show_class_list($r,$mode,'nolink','csv',
+ $ENV{'form.Status'},$classlist,$keylist);
}
}
}
-# ============================================== view classlist
-sub print_formatted_classlist {
- my $r=shift;
- my $mode = shift;
- my $cid=$ENV{'request.course.id'};
- my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
- if (! defined($classlist)) {
- $r->print(&mt('There are no students currently enrolled.')."\n");
- } else {
- &show_class_list($r,$mode,'nolink','csv',
- $ENV{'form.Status'},$classlist,$keylist);
- }
-}
-
# =================================================== Show student list to drop
sub show_class_list {
my ($r,$mode,$linkto,$action,$statusmode,$classlist,$keylist)=@_;
my $cid=$ENV{'request.course.id'};
#
# Variables for excel output
- my ($excel_workbook, $excel_sheet, $excel_filename,$row);
+ my ($excel_workbook, $excel_sheet, $excel_filename,$row,$format);
+ #
+ # Variables for csv output
+ my ($CSVfile,$CSVfilename);
#
my $sortby = $ENV{'form.sortby'};
if ($sortby !~ /^(username|domain|section|fullname|id)$/) {
$sortby = 'username';
}
# Print out header
+ $r->print(<
+
+
+END
if ($mode eq 'view') {
if ($linkto eq 'aboutme') {
$r->print(&mt('Select a user name to view the users personal page.'));
@@ -1212,7 +1218,8 @@ sub show_class_list {