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

raeburn raeburn@source.lon-capa.org
Thu, 05 Mar 2009 23:58:00 -0000


raeburn		Thu Mar  5 23:58:00 2009 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - status check was failing in display of userlists for some languages.
    - Revert part of &mt() changes in rev 1.72.
  - delay localization until display generation phase.
  - status now also localized for users with student roles, when displaying "Any Status".
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.82 loncom/interface/lonuserutils.pm:1.83
--- loncom/interface/lonuserutils.pm:1.82	Thu Feb 19 11:07:20 2009
+++ loncom/interface/lonuserutils.pm	Thu Mar  5 23:58:00 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.82 2009/02/19 11:07:20 weissno Exp $
+# $Id: lonuserutils.pm,v 1.83 2009/03/05 23:58:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1914,15 +1914,15 @@
 sub process_date_info {
     my ($userdata) = @_;
     my $now = time;
-    $userdata->{'status'} = &mt('Active');
+    $userdata->{'status'} = 'Active';
     if ($userdata->{'start'} > 0) {
         if ($now < $userdata->{'start'}) {
-            $userdata->{'status'} = &mt('Future');
+            $userdata->{'status'} = 'Future';
         }
     }
     if ($userdata->{'end'} > 0) {
         if ($now > $userdata->{'end'}) {
-            $userdata->{'status'} = &mt('Expired');
+            $userdata->{'status'} = 'Expired';
         }
     }
     return;
@@ -2309,6 +2309,11 @@
             $grpfilter = 'all';
         }
     }
+    my %ltstatus = &Apache::lonlocal::texthash(
+                                                Active  => 'Active',
+                                                Future  => 'Future',
+                                                Expired => 'Expired',
+                                               );
     # Get groups, role, permanent e-mail so we can sort on them if
     # necessary.
     foreach my $user (keys(%{$userlist})) {
@@ -2521,6 +2526,12 @@
                     $r->print('<td>'.&print_username_link($mode,\%in).'</td>');
                 } elsif (($item eq 'start' || $item eq 'end') && ($actionselect)) {
                     $r->print('<td>'.$in{$item}.'<input type="hidden" name="'.$checkval.'_'.$item.'" value="'.$sdata->[$index{$item}].'" /></td>'."\n");
+                } elsif ($item eq 'status') {
+                    my $showitem = $in{$item};
+                    if (defined($ltstatus{$in{$item}})) {
+                        $showitem = $ltstatus{$in{$item}};
+                    }
+                    $r->print('<td>'.$showitem.'</td>'."\n");
                 } else {
                     $r->print('<td>'.$in{$item}.'</td>'."\n");
                 }