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

www lon-capa-cvs-allow@mail.lon-capa.org
Thu, 27 Sep 2007 18:58:52 -0000


www		Thu Sep 27 14:58:52 2007 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Bug #5437: show clicker IDs in classlist
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.169 loncom/interface/londropadd.pm:1.170
--- loncom/interface/londropadd.pm:1.169	Thu Aug 30 23:22:51 2007
+++ loncom/interface/londropadd.pm	Thu Sep 27 14:58:52 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.169 2007/08/31 03:22:51 raeburn Exp $
+# $Id: londropadd.pm,v 1.170 2007/09/27 18:58:52 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1365,6 +1365,11 @@
     }
     my $displayphotos = $env{'form.displayphotos'};
 
+    if (! exists($env{'form.displayclickers'})) {
+        $env{'form.displayclickers'} = 'off';
+    }
+    my $displayclickers = $env{'form.displayclickers'};
+
     # Print out header 
     unless ($mode eq 'autoenroll') {
         $r->print(<<END);
@@ -1374,6 +1379,7 @@
     $r->print(<<END);
 <input type="hidden" name="sortby" value="$sortby" />
 <input type="hidden" name="displayphotos" value="$displayphotos" />
+<input type="hidden" name="displayclickers" value="$displayclickers" />
 END
     if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') {
         if ($linkto eq 'aboutme') {
@@ -1391,6 +1397,7 @@
                                            'end'    => "end date",
                                            'type'   => "enroll type/action",
 					   'email'  => "email address",
+                                           'clicker'=> "clicker id",
                                            'photo'  => "photo",
 					   );
         unless ($mode eq 'autoenroll') {
@@ -1447,6 +1454,24 @@
        <a href="javascript:document.studentform.sortby.value='email';document.studentform.submit();">$lt{'email'}</a>
     </th>
 END
+
+# Clicker display on or off?
+
+        my %clicker_options = &Apache::lonlocal::texthash(
+                                                          'on' => 'Show',
+                                                          'off' => 'Hide',
+                                                         );
+        my $clickerchg = 'on';
+        if ($displayclickers eq 'on') {
+            $clickerchg = 'off';
+        }
+        $r->print('    <th>'."\n".'     '.
+            '<a href="javascript:document.studentform.displayclickers.value='.
+                      "'".$clickerchg."'".';document.studentform.submit();">'.
+                      $clicker_options{$clickerchg}.'</a>&nbsp;'.$lt{'clicker'}."\n".
+                      '    </th>'."\n");
+
+# Photo display on or off?
         if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
             my %photo_options = &Apache::lonlocal::texthash(
                                                             'on' => 'Show',
@@ -1463,6 +1488,9 @@
                       '    </th>'."\n");
         }
         $r->print("  </tr>\n");
+
+# Done with the HTML header line
+
     } elsif ($mode eq 'csv') {
 	#
 	# Open a file
@@ -1515,6 +1543,9 @@
                                       "active groups","email address"],
                             $format->{'bold'});
     }
+
+# Done with header lines in all formats
+
     #
     # Sort the students
     my %index;
@@ -1623,6 +1654,19 @@
     <td>$active_groups</td>
     <td>$email</td>
 END
+
+# Clickers
+            if ($displayclickers eq 'on') {
+               my $clickers =
+               (&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
+               if ($clickers!~/\w/) { $clickers='-'; }
+               $r->print('<td>'.$clickers.'</td>');
+            } else {
+                $r->print('    <td>&nbsp;</td>  ');
+            }
+
+# Photos
+
             if ($env{'course.'.$env{'request.course.id'}.
 			 '.internal.showphoto'}) {
                 if ($displayphotos eq 'on') {