--- loncom/auth/lonroles.pm 2012/02/08 00:22:15 1.256.2.6.2.1 +++ loncom/auth/lonroles.pm 2012/02/09 01:11:52 1.256.2.6.2.3 @@ -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.3 2012/02/09 01:11:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -514,6 +514,11 @@ ENDENTERKEY 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'}; @@ -873,6 +878,27 @@ ENDHEADER } $r->print(&Apache::loncommon::end_page()); return OK; + } elsif ($countactive==1 && $countfuture==0) { # Only one choice + my $needs_switchserver; + if ($env{'user.author'}) { + $needs_switchserver = &check_needs_switchserver($possiblerole); + } + if ((!$needs_switchserver) && ($env{'request.role'} eq 'cm')) { + $r->print('