--- loncom/auth/lonlogout.pm 2008/11/20 15:19:22 1.35 +++ loncom/auth/lonlogout.pm 2012/08/06 23:14:04 1.45.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Logout Handler # -# $Id: lonlogout.pm,v 1.35 2008/11/20 15:19:22 jms Exp $ +# $Id: lonlogout.pm,v 1.45.2.1 2012/08/06 23:14:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,6 +26,19 @@ # http://www.lon-capa.org/ # +=head1 NAME + +Apache::lonlogout + +=head1 SYNOPSIS + + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + + +=cut + package Apache::lonlogout; use strict; @@ -77,7 +90,6 @@ sub handler { # -------------------------------------------------------- Menu script and info my $windowinfo=&Apache::lonmenu::close(); - $windowinfo.=&Apache::lonnavmaps::close(); # ---------------------------------------------------------------- Get handover &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['handover']); my $switch=''; @@ -85,24 +97,53 @@ sub handler { my $relogmessage=''; if ($env{'form.handover'}) { $switch=''; + $env{'form.handover'}.'" />'; $start_page=&Apache::loncommon::start_page('Switching Server ...', $switch); } else { $start_page=&Apache::loncommon::start_page('Logged Out',undef, - {'no_inline_link' => 1,}); + {'no_inline_link' => 1, + 'no_nav_bar' => 1,}); $relogmessage.='

'.&mt('Goodbye').'

' .'

'.&mt('Thank you for using LON-CAPA.').'

'; + my $domain = $env{'user.domain'}; if (!$env{'request.sso.norelogin'}) { - my $relogin_server; + my ($relogin_server,$login_url); if ($env{'request.sso.reloginserver'}) { $relogin_server = $env{'request.sso.reloginserver'}; - } - my $login_url = $relogin_server.'/adm/'. - ($env{'request.sso.login'} ? 'roles': 'login'); - + } else { + my %domdefaults = &Apache::lonnet::get_domain_defaults($domain); + if ($domdefaults{'portal_def'}) { + $login_url = $domdefaults{'portal_def'}; + } else { + my $checkloginvia = 1; + my ($lonhost,$server,$path,$isredirect) = + &Apache::lonnet::choose_server($domain,$checkloginvia); + if ($server && $lonhost) { + $login_url = $Apache::lonnet::protocol{$lonhost}. + '://'.$server.$path; + if (($path eq '') && (!$isredirect)) { + my $serverhomeID = + &Apache::lonnet::get_server_homeID($server); + my $serverhomedom = + &Apache::lonnet::host_domain($serverhomeID); + if ($serverhomedom ne $domain) { + $path = '/adm/login'; + $login_url .= $path; + } + } + if ($path eq '/adm/login' && $domain ne '') { + $login_url .= '?domain='.$domain; + } + } + } + } + if ($login_url eq '') { + $login_url = $relogin_server.'/adm/'. + ($env{'request.sso.login'} ? 'roles': 'login?domain='.$domain); + } $relogmessage.='

'.&mt('You have been successfully logged out.').' ' .&mt('You can [_1]close this window[_2] now.' ,'','') # ,'','') @@ -117,10 +158,9 @@ Due to security reasons in new web brows =cut $relogmessage.='

'.&mt('[_1]Log in again[_2]' - ,'','') + ,'','') .'

'; } - my $domain = $env{'user.domain'}; if ($env{'request.sso.login'} && defined($r->dir_config("lonSSOUserLogoutMessageFile_$domain"))) { open(my $fh,$r->dir_config("lonSSOUserLogoutMessageFile_$domain")); @@ -154,21 +194,6 @@ sub flush_course_logs { __END__ -=head1 NAME - -Apache::lonlogout - -=head1 SYNOPSIS - - -This is part of the LearningOnline Network with CAPA project -described at http://www.lon-capa.org. - -=head1 HANDLER SUBROUTINE - - -=cut -