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

droeschl lon-capa-cvs-allow@mail.lon-capa.org
Fri, 12 Sep 2008 04:44:14 -0000


droeschl		Fri Sep 12 00:44:14 2008 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  Bug #5778: Clicker column is now shown in csv and excel export of a classlist.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.66 loncom/interface/lonuserutils.pm:1.67
--- loncom/interface/lonuserutils.pm:1.66	Thu Sep 11 20:55:37 2008
+++ loncom/interface/lonuserutils.pm	Fri Sep 12 00:44:13 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.66 2008/09/12 00:55:37 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.67 2008/09/12 04:44:13 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2046,6 +2046,7 @@
                        'aboutme'    => "Display a user's personal page",
                        'owin'       => "Open in a new window",
                        'modify'     => "Modify a user's information",
+                       'clicker'    => "Clicker-ID",
                       );
     if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
         $lt{'extent'} = &mt('Course(s): description, section(s), status');
@@ -2249,12 +2250,14 @@
             $CSVfile = undef;
         }
         #
+        push @cols,'clicker';
         # Write headers and data to file
         print $CSVfile '"'.$results_description.'"'."\n"; 
         print $CSVfile '"'.join('","',map {
             &Apache::loncommon::csv_translate($lt{$_})
-            } (@cols)).'"'."\n";
+            } (@cols))."\"\n";
     } elsif ($mode eq 'excel') {
+        push @cols,'clicker';
         # Create the excel spreadsheet
         ($excel_workbook,$excel_filename,$format) =
             &Apache::loncommon::create_workbook($r);
@@ -2263,6 +2266,7 @@
         $excel_sheet->write($row++,0,$results_description,$format->{'h2'});
         #
         my @colnames = map {$lt{$_}} (@cols);
+
         $excel_sheet->write($row++,0,\@colnames,$format->{'bold'});
     }
 
@@ -2414,7 +2418,10 @@
         foreach my $item (@{$keylist}) {
             $in{$item} = $sdata->[$index{$item}];
         }
-        my $role = $in{'role'};
+        my $clickers = (&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1];
+        if ($clickers!~/\w/) { $clickers='-'; }
+        $in{'clicker'} = $clickers; 
+	my $role = $in{'role'};
         $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}]); 
         if (! defined($in{'start'}) || $in{'start'} == 0) {
             $in{'start'} = &mt('none');
@@ -2534,7 +2541,7 @@
             foreach my $item (@cols) {
                 push @line,&Apache::loncommon::csv_translate($in{$item});
             }
-            print $CSVfile '"'.join('","',@line).'"'."\n";
+            print $CSVfile '"'.join('","',@line)."\"\n";
         } elsif ($mode eq 'excel') {
             my $col = 0;
             foreach my $item (@cols) {