[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm lonmsgdisplay.pm lonstatistics.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 11 May 2006 20:05:03 -0000


raeburn		Thu May 11 16:05:03 2006 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm loncoursedata.pm 
                     	lonmsgdisplay.pm 
  Log:
  Include keylist as argument passed to loncoursedata::get_group_memberships().  Used to add comma-separated list of active groups to a students classlist data in $classlist->{$student}->[index], where index is set so as to add to the end of the existing array.
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.133 loncom/interface/lonstatistics.pm:1.134
--- loncom/interface/lonstatistics.pm:1.133	Tue May  9 10:38:10 2006
+++ loncom/interface/lonstatistics.pm	Thu May 11 16:05:02 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.133 2006/05/09 14:38:10 albertel Exp $
+# $Id: lonstatistics.pm,v 1.134 2006/05/11 20:05:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -235,6 +235,7 @@
     if (%curr_groups) {
         ($classgroups,$studentgroups) = 
 	    &Apache::loncoursedata::get_group_memberships($classlist,
+                                                          $field_names,
 							  $cdom,$cnum);
     }
     my $now = time;
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.169 loncom/interface/loncoursedata.pm:1.170
--- loncom/interface/loncoursedata.pm:1.169	Tue May  9 10:38:09 2006
+++ loncom/interface/loncoursedata.pm	Thu May 11 16:05:03 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.169 2006/05/09 14:38:09 albertel Exp $
+# $Id: loncoursedata.pm,v 1.170 2006/05/11 20:05:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1024,8 +1024,9 @@
         "(student_id,group_id) VALUES ";
     my $cdom = $env{'course.'.$courseid.'.domain'};
     my $cnum = $env{'course.'.$courseid.'.num'};
-    my $classlist = &get_classlist($cdom,$cnum);
+    my ($classlist,$keylist) = &get_classlist($cdom,$cnum);
     my ($classgroups,$studentgroups) = &get_group_memberships($classlist,
+                                                              $keylist,
                                                               $cdom,$cnum);
     my $record_count = 0;
     foreach my $student (sort(keys(%{$classgroups}))) {
@@ -3141,7 +3142,7 @@
 }
 
 sub get_group_memberships {
-    my ($classlist,$cdom,$cnum) = @_;
+    my ($classlist,$keylist,$cdom,$cnum) = @_;
     my $cid = $cdom.'_'.$cnum;
     if (!defined($cdom) || !defined($cnum)) {
         $cid =  $env{'request.course.id'};
@@ -3153,6 +3154,7 @@
     my $access_end = $env{'course.'.$cid.'.default_enrollment_end_date'};
     my %curr_groups =&Apache::loncommon::coursegroups($cdom,$cnum);
     if (%curr_groups) {
+        my $grpindex = scalar(@{$keylist});
         my %groupmemberhash = 
 	    &Apache::lonnet::get_group_membership($cdom,$cnum);
         foreach my $student (keys(%{$classlist})) {
@@ -3194,6 +3196,9 @@
             }
             if (!$hasgroup) {
                 $studentgroups{'none'} ++;
+            } else {
+                $classlist->{$student}->[$grpindex] = join(',',
+                              sort(keys(%{$classgroups{$student}{'active'}})));
             }
         }
     }
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.23 loncom/interface/lonmsgdisplay.pm:1.24
--- loncom/interface/lonmsgdisplay.pm:1.23	Thu May 11 15:04:31 2006
+++ loncom/interface/lonmsgdisplay.pm	Thu May 11 16:05:03 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.23 2006/05/11 19:04:31 www Exp $
+# $Id: lonmsgdisplay.pm,v 1.24 2006/05/11 20:05:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -260,9 +260,9 @@
 
 sub discourse {
     my $r=shift;
-    my $classlist = &Apache::loncoursedata::get_classlist();
+    my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist();
     my ($classgroups,$studentgroups) = 
-	&Apache::loncoursedata::get_group_memberships($classlist);
+	&Apache::loncoursedata::get_group_memberships($classlist,$keylist);
     my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All',
             'cfs' => 'Check Section/Group',
             'cfn' => 'Uncheck All');