--- loncom/auth/switchserver.pm 2007/11/14 02:54:11 1.18 +++ loncom/auth/switchserver.pm 2009/04/14 23:52:07 1.22 @@ -1,7 +1,7 @@ # The LearningOnline Network # Switch Servers Handler # -# $Id: switchserver.pm,v 1.18 2007/11/14 02:54:11 albertel Exp $ +# $Id: switchserver.pm,v 1.22 2009/04/14 23:52:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -73,7 +73,7 @@ sub handler { if (!defined($handle)) { return FORBIDDEN; } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['otherserver','role']); + ['otherserver','role','origurl','symb']); my $switch_to=&Apache::lonnet::hostname($env{'form.otherserver'}); if (! $env{'form.otherserver'}) { @@ -92,7 +92,7 @@ sub handler { if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') { - my $url = 'http://'.$switch_to.'/'.$r->uri; + my $url = 'http://'.$switch_to.$r->uri; return &do_redirect($r,$url,1) } @@ -115,8 +115,11 @@ sub handler { -value => '', -expires => '-10y',); $r->header_out('Set-cookie' => $c); - $r->send_http_header; - return OK if $r->header_only; + + if ($r->header_only) { + $r->send_http_header; + return OK; + } # -------------------------------------------------------- Menu script and info my $windowinfo= @@ -129,6 +132,12 @@ sub handler { 'username' => $env{'user.name'}, 'role' => $env{'form.role'}, 'server' => $r->dir_config('lonHostID')); + if ($env{'form.origurl'}) { + $info{'origurl'} = $env{'form.origurl'}; + } + if ($env{'form.symb'}) { + $info{'symb'} = $env{'form.symb'}; + } if ($env{'request.sso.login'}) { $info{'sso.login'} = $env{'request.sso.login'}; } @@ -138,8 +147,8 @@ sub handler { my $token = &Apache::lonnet::tmpput(\%info,$env{'form.otherserver'}); my $url ='http://'.$switch_to.'/adm/login?'. 'domain='.$env{'user.domain'}. - '&username='.$env{'user.name'}. - '&token='.$token; + '&username='.$env{'user.name'}. + '&token='.$token; # --------------------------------------------------------------- Screen Output &Apache::lonnet::flushcourselogs(); return &do_redirect($r,$url,0,$windowinfo);