--- loncom/auth/lonroles.pm 2004/05/08 14:12:16 1.89 +++ loncom/auth/lonroles.pm 2004/07/21 20:25:10 1.96 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.89 2004/05/08 14:12:16 www Exp $ +# $Id: lonroles.pm,v 1.96 2004/07/21 20:25:10 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,23 +40,34 @@ use Apache::lonannounce; use Apache::lonlocal; sub redirect_user { - my ($r,$title,$url,$msg) = @_; + my ($r,$title,$url,$msg,$launch_nav) = @_; $msg = $title if (! defined($msg)); &Apache::loncommon::content_type($r,'text/html'); &Apache::loncommon::no_cache($r); $r->send_http_header; my $swinfo=&Apache::lonmenu::rawconfig(); + my $navwindow; + if ($launch_nav eq 'on') { + $navwindow.=&Apache::lonnavmaps::launch_win('now'); + } else { + $navwindow.=&Apache::lonnavmaps::close(); + } my $bodytag=&Apache::loncommon::bodytag('Switching Role'); - $r->print (<print(<$title $bodytag - +$navwindow

$msg

+Continue ENDREDIR @@ -129,9 +140,24 @@ sub handler { my $swinfo=&Apache::lonmenu::rawconfig(); my $bodytag=&Apache::loncommon::bodytag ('Verifying Access Key to Unlock this Course'); - my $buttontext=&mt('Re-Enter Key'); - my $message=&mt('Key Verification Failed').'
'. + my $buttontext=&mt('Enter Course'); + my $message=&mt('Successfully registered key'); + my $assignresult= + &Apache::lonnet::assign_access_key( + $ENV{'form.newkey'}, + $authdom,$authnum, + $cdom,$cnum, + $ENV{'user.domain'}, + $ENV{'user.name'}, + 'Assigned from '.$ENV{'REMOTE_ADDR'}.' at '.localtime().' for '. + $trolecode); + unless ($assignresult eq 'ok') { + $assignresult=~s/^error\:\s*//; + $message=&mt($assignresult). + '
'. &mt('Logout').''; + $buttontext=&mt('Re-Enter Key'); + } $r->print(<Verifying Course Access Key @@ -143,7 +169,7 @@ $swinfo
-$message +$message
@@ -228,7 +254,8 @@ ENDENTERKEY # # Send the user to the course they selected &redirect_user($r,&mt('Entering Course'), - $furl,$msg); + $furl,$msg, + $ENV{'environment.remotenavmap'}); return OK; } } @@ -262,10 +289,7 @@ ENDENTERKEY my $swinfo=&Apache::lonmenu::rawconfig(); my $bodytag=&Apache::loncommon::bodytag('User Roles'); - my $helptag='
'.&Apache::loncommon::help_open_topic - ("General_Intro",&mt("Click here for help")).''. - &Apache::loncommon::help_open_faq(1,&mt('Click here for FAQ')).''. - &Apache::loncommon::help_open_bug('',&mt('Click here to report bugs')).'
'; + my $helptag='
'.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).'
'; $r->print(<