[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 28 Sep 2004 14:12:40 -0000


matthew		Tue Sep 28 10:12:40 2004 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  use loncoursedata::get_classlist instead of doing the classlist dump ourselves.
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.108 loncom/interface/lonmsg.pm:1.109
--- loncom/interface/lonmsg.pm:1.108	Mon Sep 20 11:01:56 2004
+++ loncom/interface/lonmsg.pm	Tue Sep 28 10:12:40 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.108 2004/09/20 15:01:56 www Exp $
+# $Id: lonmsg.pm,v 1.109 2004/09/28 14:12:40 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -600,10 +600,7 @@
 
 sub discourse {
     my $r=shift;
-    my %courselist=&Apache::lonnet::dump(
-                   'classlist',
-		   $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
-		   $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+    my $classlist = &Apache::loncoursedata::get_classlist();
     my $now=time;
     my %lt=&Apache::lonlocal::texthash('cfa' => 'Check for All',
             'cfs' => 'Check for Section/Group',
@@ -645,39 +642,36 @@
 <input type="button" onClick="uncheckall()" value="$lt{'cfn'}" />
 <p>
 ENDDISHEADER
-    my %coursepersonnel=
-       &Apache::lonnet::get_course_adv_roles();
+    my %coursepersonnel=&Apache::lonnet::get_course_adv_roles();
+    $r->print('<table>');
     foreach my $role (sort keys %coursepersonnel) {
-       foreach (split(/\,/,$coursepersonnel{$role})) {
-	   my ($puname,$pudom)=split(/\:/,$_);
-	   $r->print(
-             '<br /><input type="checkbox" name="send_to_&&&&&&_'.
-             $puname.':'.$pudom.'" /> '.
-		     &Apache::loncommon::plainname($puname,
-                          $pudom).' ('.$_.'), <i>'.$role.'</i>');
-	}
+        foreach (split(/\,/,$coursepersonnel{$role})) {
+            my ($puname,$pudom)=split(/\:/,$_);
+            $r->print('<tr><td><label>'.
+                      '<input type="checkbox" name="send_to_&&&&&&_'.
+                      $puname.':'.$pudom.'" /> '.
+                      &Apache::loncommon::plainname($puname,$pudom).
+                      '</label></td>'.
+                      '<td>('.$_.'),</td><td><i>'.$role.'</i></td></tr>');
+        }
     }
-
-    foreach (sort keys %courselist) {
-        my ($end,$start)=split(/\:/,$courselist{$_});
-        my $active=1;
-        if (($end) && ($now>$end)) { $active=0; }
-        if ($active) {
-           my ($sname,$sdom)=split(/\:/,$_);
-           my %reply=&Apache::lonnet::get('environment',
-              ['firstname','middlename','lastname','generation'],
-              $sdom,$sname);
-           my $section=&Apache::lonnet::usection
-	       ($sdom,$sname,$ENV{'request.course.id'});
-           $r->print(
-        '<br><input type=checkbox name="send_to_&&&'.$section.'&&&_'.$_.'"> '.
-		      $reply{'firstname'}.' '. 
-                      $reply{'middlename'}.' '.
-                      $reply{'lastname'}.' '.
-                      $reply{'generation'}.
-                      ' ('.$_.') '.$section);
-        } 
+    $r->print('</table><p><table>');
+    while (my ($student,$info) = each(%$classlist)) {
+        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');
+        my $key = 'send_to_&&&'.$section.'&&&'.$student;
+        if (! defined($fullname) || $fullname eq '') { $fullname = $sname; }
+        $r->print('<tr><td><label>'.
+                  qq{<input type="checkbox" name="$key">}.('&nbsp;'x2).
+                  $fullname.'</td><td>'.$sname.'@'.$sdom.'</td><td>'.$section.
+                  '</td></tr>');
     }
+    $r->print('</table></p>');
 }
 
 # ==================================================== Display Critical Message