--- loncom/interface/Attic/londropadd.pm 2002/05/03 16:30:48 1.38
+++ loncom/interface/Attic/londropadd.pm 2002/09/25 16:16:19 1.53
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.38 2002/05/03 16:30:48 matthew Exp $
+# $Id: londropadd.pm,v 1.53 2002/09/25 16:16:19 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,49 +31,35 @@
#
# (TeX Content Handler
#
-# YEAR=2000
-# 05/29/00,05/30,10/11 Gerd Kortemeyer)
-#
-# 10/11,10/12,10/16 Gerd Kortemeyer)
-#
-# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28,
-# 12/08,12/12 Gerd Kortemeyer)
-#
-# 12/26,12/27,12/28,
-# YEAR=2001
-# 01/01/01,01/15,02/10,02/13,02/14,02/22 Gerd Kortemeyer
-# 8/6 Scott Harrison
-# Guy Albertelli
-# 9/25 Gerd Kortemeyer
-# 12/19 Guy Albertelli
-# YEAR=2002
-# 1/4 Gerd Kortemeyer
+###############################################################
+###############################################################
package Apache::londropadd;
use strict;
use Apache::lonnet();
use Apache::loncommon();
+use Apache::lonhtmlcommon();
use Apache::Constants qw(:common :http REDIRECT);
-# ================================================================ Print header
-
+###############################################################
+###############################################################
sub header {
+ my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager');
return(<
-
Drop/Add Students
-
$locform
-
Group/Section: +
+ + + + + +
+
+ID/Student Number: +
Disable ID/Student Number Safeguard and Force Change of Conflicting IDs -(only do if you know what you are doing)
-
-
+(only do if you know what you are doing)
+
+
-ENDSENROLL +END + return; } # =================================================== get the current classlist sub get_current_classlist { - my ($domain,$identifier) = @_; - # domain is the domain the class is being run in - # identifier is the internal, unique identifier for the class. - my %currentlist=(); - my $now=time; - my %results=&Apache::lonnet::dump('classlist',$domain,$identifier); - my ($tmp) = keys(%results); - if ($tmp !~ /^(con_lost|error|no_such_host)/i) { - foreach my $student (keys(%results)) { - # Extract the start and end dates - my ($end,$start)=split(/\:/,$results{$student}); - # If the class isn't over, put it in the list - unless (($end) && ($now>$end)) { - $currentlist{$student}=1; - } - } - return (undef,%currentlist); - } else { - $tmp =~ s/^error://; - return ($tmp,undef); - } + my $r = shift; + # Call DownloadClasslist + my $cid = $ENV{'request.course.id'}; + my $c = $r->connection; + my $classlisthash = &Apache::loncoursedata::DownloadClasslist + ($cid,'Not downloaded',$c); + # Call ProcessClasslist + my %cache; + my @students = &Apache::loncoursedata::ProcessClasslist(\%cache, + $classlisthash, + $cid,$c); + return (\@students,\%cache); } # ========================================================= Menu Phase Two Drop -sub menu_phase_two_drop { +sub print_drop_menu { my $r=shift; + $r->print("ERROR:$error"); - } elsif (!defined(%currentlist)) { + my ($student_array,$student_data)=&get_current_classlist($r); + if (! scalar(@$student_array)) { + $r->print("There are no students currently enrolled.\n"); + return; + } + # Print out the available choices + &show_drop_list($student_array,$student_data,$r); + return; +} + +# ============================================== view classlist +sub print_html_classlist { + my $r=shift; + $r->print(<
+
+ username + | + domain + | + ID + | + student name + | + section + | +|
---|---|---|---|---|---|
'. + 'Error'. + 'Error retrieving data for '. + join('@',split(/:/,$student)). + ', '.$error.' | |||||
\n "); + if ($linkto eq 'nothing') { + $r->print($username); + } elsif ($linkto eq 'aboutme') { + $r->print(&Apache::loncommon::aboutmewrapper($username, + $username, + $domain)); + } elsif ($linkto eq 'modify') { + $r->print(''. + $username."\n"); + } + $r->print(<<"END"); + | +$domain | +$id | +$name | +$section | +
'. + 'Unable to retrieve environment data for '.$sname. + 'in domain '.$sdom.'
'. + 'Please contact your LON-CAPA administrator '. + 'regarding this situation.