[LON-CAPA-cvs] cvs: loncom(loncapaMITrelate_1) /auth lonroles.pm /interface lonuserutils.pm

raeburn raeburn at source.lon-capa.org
Wed Feb 8 11:27:35 EST 2012


raeburn		Wed Feb  8 16:27:35 2012 EDT

  Modified files:              (Branch: loncapaMITrelate_1)
    /loncom/interface	lonuserutils.pm 
    /loncom/auth	lonroles.pm 
  Log:
  - Customization for MITrelate
   - Keep track of last course "login".
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.136 loncom/interface/lonuserutils.pm:1.136.6.1
--- loncom/interface/lonuserutils.pm:1.136	Fri Aug  5 14:46:58 2011
+++ loncom/interface/lonuserutils.pm	Wed Feb  8 16:27:28 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.136 2011/08/05 14:46:58 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.136.6.1 2012/02/08 16:27:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2321,6 +2321,7 @@
                        'type'       => "enroll type/action",
                        'email'      => "e-mail address",
                        'photo'      => "photo",
+                       'lastlogin'  => "last login"
                        'extent'     => "extent",
                        'pr'         => "Proceed",
                        'ca'         => "check all",
@@ -2369,6 +2370,9 @@
             push(@cols,'groups');
         }
         push(@cols,'email');
+        if ($context eq 'course') {
+            push(@cols,'lastlogin');
+        }
     }
 
     my $rolefilter = $env{'form.showrole'};
@@ -2593,6 +2597,11 @@
                                                 Future  => 'Future',
                                                 Expired => 'Expired',
                                                );
+    # If this is for a single course get last course "log-in".
+    my %crslogins;
+    if ($context eq 'course') {
+        %crslogins=&Apache::lonnet::dump('nohist_crslastlogin',$cdom,$cnum);
+    }
     # Get groups, role, permanent e-mail so we can sort on them if
     # necessary.
     foreach my $user (keys(%{$userlist})) {
@@ -2741,6 +2750,12 @@
                 $in{'end'} = &Apache::lonlocal::locallocaltime($in{'end'});
             }
         }
+        if ($context eq 'course') {
+            my $lastlogin = $crslogins{$in{'username'}.':'.$in{'domain'}.':'.$in{'section'}.':'.$role};
+            if ($lastlogin ne '') {
+                $in{'lastlogin'} = &Apache::lonlocal::locallocaltime($lastlogin);
+            }
+        }
         if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll' || $mode eq 'pickauthor') {
             $r->print(&Apache::loncommon::start_data_table_row());
             my $checkval;
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.256.2.6.2.1 loncom/auth/lonroles.pm:1.256.2.6.2.2
--- loncom/auth/lonroles.pm:1.256.2.6.2.1	Wed Feb  8 00:22:15 2012
+++ loncom/auth/lonroles.pm	Wed Feb  8 16:27:35 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.256.2.6.2.1 2012/02/08 00:22:15 raeburn Exp $
+# $Id: lonroles.pm,v 1.256.2.6.2.2 2012/02/08 16:27:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -514,6 +514,11 @@
                         my $msg;
 			my ($furl,$ferr)=
 			    &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
+                        unless (($ferr) || ($env{'form.switchrole'})) {
+                            &Apache::lonnet::put('nohist_crslastlogin',
+                                {$env{'user.name'}.':'.$env{'user.domain'}.
+                                ':'.$csec.':'.$role => $now},$cdom,$cnum);
+                        }
 			if (($env{'form.orgurl'}) && 
 			    ($env{'form.orgurl'}!~/^\/adm\/flip/)) {
 			    my $dest=$env{'form.orgurl'};




More information about the LON-CAPA-cvs mailing list