--- loncom/interface/Attic/londropadd.pm 2004/01/15 19:27:05 1.99
+++ loncom/interface/Attic/londropadd.pm 2004/05/14 18:11:12 1.111
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.99 2004/01/15 19:27:05 matthew Exp $
+# $Id: londropadd.pm,v 1.111 2004/05/14 18:11:12 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,14 +37,13 @@ use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::Constants qw(:common :http REDIRECT);
use Spreadsheet::WriteExcel;
+use Apache::lonstathelpers();
use Apache::lonlocal;
###############################################################
###############################################################
sub header {
- my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager').
- &Apache::loncommon::help_open_faq(9).
- &Apache::loncommon::help_open_bug('Instructor Interface');
+ my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager');
my $title = &mt('LON-CAPA Enrollment Manager');
return(<
@@ -701,7 +700,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();
@@ -1102,7 +1101,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';
}
@@ -1110,94 +1109,119 @@ sub print_html_classlist {
$ENV{'form.Status'} = 'Active';
}
my $status_select = &Apache::lonhtmlcommon::StatusOptions
- ($ENV{'form.Status'},'studentform');
- my $CCL=&mt('Current Class List');
- $r->print(<
-
-
-$CCL
-
-END
+ ($ENV{'form.Status'});
+ my $cid=$ENV{'request.course.id'};
+ my $cdom=$ENV{'course.'.$cid.'.domain'};
+ my $cnum=$ENV{'course.'.$cid.'.num'};
+ #
+ # List course personnel
+ my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
+ #
+ if (! defined($ENV{'form.output'}) ||
+ $ENV{'form.output'} !~ /^(csv|excel|html)$/ ) {
+ $ENV{'form.output'} = 'html';
+ }
+ #
+ $r->print('
');
+ foreach my $role (sort keys %coursepersonnel) {
+ next if ($role =~ /^\s*$/);
+ $r->print('
');
my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
if (! defined($classlist)) {
$r->print(&mt('There are no students currently enrolled.')."\n");
} else {
# Print out the available choices
if ($ENV{'form.action'} eq 'modifystudent') {
- &show_class_list($r,'view','modify','modifystudent',
+ &show_class_list($r,'view','modify',
$ENV{'form.Status'},$classlist,$keylist);
} else {
- &show_class_list($r,'view','aboutme','classlist',
+ &Apache::lonnet::logthis('showing class list '.$ENV{'form.output'});
+
+ &show_class_list($r,$ENV{'form.output'},'aboutme',
$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 ($r,$mode,$linkto,$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)$/) {
+ if ($sortby !~ /^(username|domain|section|fullname|id|start|end)$/) {
$sortby = 'username';
}
# Print out header
- if ($mode eq 'view') {
+ $r->print(<
+
+END
+ if ($mode eq 'html' || $mode eq 'view') {
if ($linkto eq 'aboutme') {
$r->print(&mt('Select a user name to view the users personal page.'));
} elsif ($linkto eq 'modify') {
$r->print(&mt('Select a user name to modify the students information'));
}
my %lt=&Apache::lonlocal::texthash(
- 'usrn' => "username",
- 'dom' => "domain",
- 'sn' => "student name",
- 'sec' => "section",
+ 'usrn' => "username",
+ 'dom' => "domain",
+ 'sn' => "student name",
+ 'sec' => "section",
+ 'start' => "start date",
+ 'end' => "end date",
);
$r->print(<