--- loncom/interface/lonmsgdisplay.pm 2006/04/25 20:02:30 1.14 +++ loncom/interface/lonmsgdisplay.pm 2006/05/17 09:46:01 1.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.14 2006/04/25 20:02:30 albertel Exp $ +# $Id: lonmsgdisplay.pm,v 1.25 2006/05/17 09:46:01 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,6 +28,7 @@ package Apache::lonmsgdisplay; +use Apache::lonselstudent; =pod @@ -259,15 +260,39 @@ sub movemsg { # ======================================================= Display a course list sub discourse { + my $result; + my ($course_personnel, + $current_members, + $expired_members, + $future_members) = &Apache::lonselstudent::get_people_in_class(); + unshift @$current_members, (@$course_personnel); + my %defaultUsers; + + $result = &Apache::lonselstudent::render_student_list($current_members, + "compemail", + "current", + \%defaultUsers, + 1,"selectedusers",1); + + return $result; +} + +# --------------------------------- No longer needed ..old display course list. +sub discourse_obsolete { my $r=shift; - my $classlist = &Apache::loncoursedata::get_classlist(); - my $now=time; + my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist(); + my ($classgroups,$studentgroups) = + &Apache::loncoursedata::get_group_memberships($classlist,$keylist); my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All', 'cfs' => 'Check Section/Group', 'cfn' => 'Uncheck All'); + if (defined($env{'form.group'})) { + $r->print(''."\n"); + } $r->print(< -   -  + 

ENDDISHEADER my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); - $r->print(''); - foreach my $role (sort keys %coursepersonnel) { - foreach (split(/\,/,$coursepersonnel{$role})) { - my ($puname,$pudom)=split(/\:/,$_); - $r->print(''. - ''); - } - } - $r->print('
('.$_.'),'.$role.'
'); - my $sort = sub { - my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]); - if (!$aname) { $aname=$a; } - my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]); - if (!$bname) { $bname=$b; } - return $aname cmp $bname; - }; - foreach my $student (sort $sort (keys(%{$classlist}))) { - my $info=$classlist->{$student}; - my ($sname,$sdom,$status,$fullname,$section) = - (@{$info}[&Apache::loncoursedata::CL_SNAME(), - &Apache::loncoursedata::CL_SDOM(), - &Apache::loncoursedata::CL_STATUS(), - &Apache::loncoursedata::CL_FULLNAME(), - &Apache::loncoursedata::CL_SECTION()]); - next if ($status ne 'Active'); - next if ($env{'request.course.sec'} && - $section ne $env{'request.course.sec'}); - my $key = 'send_to_&&&'.$section.'&&&_'.$student; - if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } - $r->print(''); + $r->print(&Apache::loncommon::start_data_table()); + if (keys(%coursepersonnel) > 0) { + $r->print('

Non-students

'); + $r->print(&Apache::loncommon::start_data_table()); + $r->print(''); + foreach my $role (sort(keys(%coursepersonnel))) { + foreach my $user (split(/\,/,$coursepersonnel{$role})) { + my ($puname,$pudom)=split(/\:/,$user); + $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(''. + ''); + $r->print(&Apache::loncommon::end_data_table_row()); + } + } + $r->print(&Apache::loncommon::end_data_table()); + } + if (keys(%{$classlist}) > 0) { + $r->print('

Students

'); + $r->print(&Apache::loncommon::start_data_table()); + $r->print(''); + my $sort = sub { + my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]); + if (!$aname) { $aname=$a; } + my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]); + if (!$bname) { $bname=$b; } + return $aname cmp $bname; + }; + foreach my $student (sort $sort (keys(%{$classlist}))) { + my $info=$classlist->{$student}; + my ($sname,$sdom,$status,$fullname,$section) = + (@{$info}[&Apache::loncoursedata::CL_SNAME(), + &Apache::loncoursedata::CL_SDOM(), + &Apache::loncoursedata::CL_STATUS(), + &Apache::loncoursedata::CL_FULLNAME(), + &Apache::loncoursedata::CL_SECTION()]); + next if ($status ne 'Active'); + next if ($env{'request.course.sec'} && + $section ne $env{'request.course.sec'}); + my @studentsgroups = + &Apache::loncoursedata::get_students_groups($student,$status, + $classgroups); + my $grouplist = join(', ',@studentsgroups); + my $key = 'send_to_&&&'.$section.'&&&_'.$student; + if (! defined($fullname) || $fullname eq '') {$fullname = $sname;} + my $checked = ''; + my $groupcount = 0; + my $groupitems; + $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(''); + $r->print(&Apache::loncommon::end_data_table_row()); + } + $r->print(&Apache::loncommon::end_data_table()); } - $r->print('
'.$sname.':'.$sdom.''.$section. - '
NameUsername:DomainRole
('.$user.'),'.$role.'
NameUsername:DomainSectionGroups
'.$groupitems. + ''.$sname.':'.$sdom.''.$section. + ''.$grouplist.'
'); } # ==================================================== Display Critical Message @@ -612,7 +676,7 @@ sub disfolder { my $numblocked = 0; &blockcheck(\%setters,\$startblock,\$endblock); $r->print(< +