--- loncom/interface/loncoursedata.pm 2005/07/14 02:28:25 1.149 +++ loncom/interface/loncoursedata.pm 2005/10/04 18:27:32 1.150 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.149 2005/07/14 02:28:25 albertel Exp $ +# $Id: loncoursedata.pm,v 1.150 2005/10/04 18:27:32 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -869,7 +869,9 @@ sub populate_student_table { my $dbh = &Apache::lonmysql::get_dbh(); my $request = 'INSERT IGNORE INTO '.$student_table. "(student,section,status) VALUES "; - my $classlist = &get_classlist($courseid); + my $cdom = $env{'course.'.$courseid.'.domain'}; + my $cnum = $env{'course.'.$courseid.'.num'}; + my $classlist = &get_classlist($cdom,$cnum); my $student_count=0; while (my ($student,$data) = each %$classlist) { my ($section,$status) = ($data->[&CL_SECTION()], @@ -2697,9 +2699,9 @@ Retrieve the classist of a given class o information is returned from the classlist.db file and, if needed, from the students environment. -Optional arguments are $cid, $cdom, and $cnum (course id, course domain, -and course number, respectively). Any omitted arguments will be taken -from the current environment ($env{'request.course.id'}, +Optional arguments are $cdom, and $cnum (course domain, +and course number, respectively). If either is ommitted the course +will be taken from the current environment ($env{'request.course.id'}, $env{'course.'.$cid.'.domain'}, and $env{'course.'.$cid.'.num'}). Returns a reference to a hash which contains: @@ -2727,10 +2729,13 @@ sub CL_TYPE { return 8; } sub CL_LOCKEDTYPE { return 9; } sub get_classlist { - my ($cid,$cdom,$cnum) = @_; - $cid = $cid || $env{'request.course.id'}; - $cdom = $cdom || $env{'course.'.$cid.'.domain'}; - $cnum = $cnum || $env{'course.'.$cid.'.num'}; + my ($cdom,$cnum) = @_; + my $cid = $cdom.'_'.$cnum; + if (!defined($cdom) || !defined($cnum)) { + $cid = $env{'request.course.id'}; + $cdom = $env{'course.'.$cid.'.domain'}; + $cnum = $env{'course.'.$cid.'.num'}; + } my $now = time; # my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum);