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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 17 Jul 2007 21:24:17 -0000


albertel		Tue Jul 17 17:24:17 2007 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  - BUG#5311 add email address to class list display
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.162 loncom/interface/londropadd.pm:1.163
--- loncom/interface/londropadd.pm:1.162	Mon Jul  2 17:12:06 2007
+++ loncom/interface/londropadd.pm	Tue Jul 17 17:24:17 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.162 2007/07/02 21:12:06 albertel Exp $
+# $Id: londropadd.pm,v 1.163 2007/07/17 21:24:17 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1296,6 +1296,7 @@
                                            'start'  => "start date",
                                            'end'    => "end date",
                                            'type'   => "enroll type/action",
+					   'email'  => "email address",
                                            'photo'  => "photo",
 					   );
         unless ($mode eq 'autoenroll') {
@@ -1348,6 +1349,8 @@
        <a href="javascript:document.studentform.sortby.value='end';document.studentform.submit();">$lt{'end'}</a>
     </th><th>
        <a href="javascript:document.studentform.sortby.value='groups';document.studentform.submit();">$lt{'grp'}</a>
+    </th><th>
+       <a href="javascript:document.studentform.sortby.value='email';document.studentform.submit();">$lt{'email'}</a>
     </th>
 END
         if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
@@ -1391,13 +1394,15 @@
             print $CSVfile '"'.join('","',map {
 		&Apache::loncommon::csv_translate(&mt($_))
                 } ("username","domain","ID","student name",
-                   "section","start date","end date","status","active groups"))
+                   "section","start date","end date","status",
+		   "active groups","email address"))
                   .'"'."\n";
         } else {
             print $CSVfile '"'.join('","',map {
 		&Apache::loncommon::csv_translate(&mt($_))
                 } ("username","domain","ID","student name",
-                   "section","start date","end date","active groups")).'"'."\n";
+                   "section","start date","end date",
+		   "active groups","email address")).'"'."\n";
         }
     } elsif ($mode eq 'excel') {
         # Create the excel spreadsheet
@@ -1413,7 +1418,7 @@
         $excel_sheet->write($row++,0,["username","domain","ID",
                                       "student name","section",
                                       "start date","end date","status",
-                                      "active groups"],
+                                      "active groups","email address"],
                             $format->{'bold'});
     }
     #
@@ -1452,10 +1457,21 @@
         my $name     = $sdata->[$index{'fullname'}];
         my $id       = $sdata->[$index{'id'}];
         my $status   = $sdata->[$index{'status'}];
+        next if (($statusmode ne 'Any') && ($status ne $statusmode));
         my $start    = $sdata->[$index{'start'}];
         my $end      = $sdata->[$index{'end'}];
         my $type     = $sdata->[$index{'type'}];
-        next if (($statusmode ne 'Any') && ($status ne $statusmode));
+
+	my %emails   = &Apache::loncommon::getemails($username,$domain);
+	my $email;
+	foreach my $type ('critnotification', 'permanentemail',
+			  'notification') {
+	    if ($emails{$type} =~ /\S/) {
+		$email = $emails{$type};
+		last;
+	    }
+	}
+
         if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
             if (! defined($start) || $start == 0) {
                 $start = &mt('none');
@@ -1515,6 +1531,7 @@
     <td>$start</td>
     <td>$end</td>
     <td>$active_groups</td>
+    <td>$email</td>
 END
             if ($env{'course.'.$env{'request.course.id'}.
 			 '.internal.showphoto'}) {
@@ -1551,6 +1568,7 @@
                 push @line,&Apache::loncommon::csv_translate($status);
             }
             push @line,&Apache::loncommon::csv_translate($active_groups);
+            push @line,&Apache::loncommon::csv_translate($email);
             print $CSVfile '"'.join('","',@line).'"'."\n";
         } elsif ($mode eq 'excel') {
             $excel_sheet->write($row,0,[$username,$domain,$id,
@@ -1567,6 +1585,7 @@
             }
             $excel_sheet->write($row,$col++,$status);
             $excel_sheet->write($row,$col++,$active_groups);
+            $excel_sheet->write($row,$col++,$email);
             $row++;
         }
     }