--- loncom/interface/Attic/londropadd.pm 2004/02/20 19:44:59 1.102 +++ 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.102 2004/02/20 19:44:59 matthew Exp $ +# $Id: londropadd.pm,v 1.111 2004/05/14 18:11:12 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,6 +37,7 @@ use Apache::loncommon(); use Apache::lonhtmlcommon(); use Apache::Constants qw(:common :http REDIRECT); use Spreadsheet::WriteExcel; +use Apache::lonstathelpers(); use Apache::lonlocal; ############################################################### @@ -699,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(); @@ -1100,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'; } @@ -1108,111 +1109,119 @@ 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('
'.$_.' | ');
- foreach (split(/\,/,$coursepersonnel{$_})) {
- my ($puname,$pudom)=split(/\:/,$_);
+ #
+ if (! defined($ENV{'form.output'}) ||
+ $ENV{'form.output'} !~ /^(csv|excel|html)$/ ) {
+ $ENV{'form.output'} = 'html';
+ }
+ #
+ $r->print('
-$CCL - -END + # + # Interface output + $r->print(''); + $r->print(" \n");
if ($ENV{'form.action'} ne 'modifystudent') {
- my %lt=&Apache::lonlocal::texthash(
- 'ef' => "Excel format",
- 'ss' => "Student Status",
- );
- $r->print(< '.&mt('Current Class List').''); 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(<
'); } elsif ($mode eq 'excel') { $excel_workbook->close(); $r->print(' '. &mt('Your Excel spreadsheet').' '.&mt('is ready for download').'. '."\n"); + } elsif ($mode eq 'csv') { + close($CSVfile); + $r->print(''. + &mt('Your CSV file').' is ready for download.'. + "\n"); + $r->rflush(); } } @@ -1663,7 +1719,7 @@ sub show_drop_list { ['sortby']); } my $sortby = $ENV{'form.sortby'}; - if ($sortby !~ /^(username|domain|section|fullname|id)$/) { + if ($sortby !~ /^(username|domain|section|fullname|id|start|end)$/) { $sortby = 'username'; } # @@ -1687,13 +1743,14 @@ function uncheckAll(field) { END +my %lt=&Apache::lonlocal::texthash('usrn' => "username", + 'dom' => "domain", + 'sn' => "student name", + 'sec' => "section", + 'start' => "start date", + 'end' => "end date", + ); if ($nosort) { - my %lt=&Apache::lonlocal::texthash( - 'usrn' => "username", - 'dom' => "domain", - 'sn' => "student name", - 'sec' => "section", - ); $r->print(<ID |
$lt{'sn'} |
$lt{'sec'} |
+ $lt{'start'} |
+ $lt{'end'} |
|
@@ -1726,6 +1779,10 @@ END
$lt{'sn'}
$lt{'sec'}
+ |
+ $lt{'start'}
+ |
+ $lt{'end'}
|
$id |
$name |
$section |
+ $start |
+ $end |
|