File:
[LON-CAPA] /
loncom /
auth /
lonlogout.pm
Revision
1.38:
download - view:
text,
annotated -
select for diffs
Sat May 16 13:50:04 2009 UTC (15 years, 4 months ago) by
droeschl
Branches:
MAIN
CVS tags:
version_2_9_99_0,
version_2_10_0_RC2,
version_2_10_0_RC1,
version_2_10_0,
bz6209-base,
bz6209,
bz5969,
bz2851,
HEAD,
GCI_3,
BZ5971-printing-apage
Changes related to modification of LON-CAPA screen header.
Nav_bar wont be shown on logout page anymore. This fixes a display issue.
1: # The LearningOnline Network
2: # Logout Handler
3: #
4: # $Id: lonlogout.pm,v 1.38 2009/05/16 13:50:04 droeschl Exp $
5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28:
29: =head1 NAME
30:
31: Apache::lonlogout
32:
33: =head1 SYNOPSIS
34:
35:
36: This is part of the LearningOnline Network with CAPA project
37: described at http://www.lon-capa.org.
38:
39:
40: =cut
41:
42: package Apache::lonlogout;
43:
44: use strict;
45: use Apache::Constants qw(:common);
46: use Apache::File;
47: use Apache::lonnet;
48: use Apache::lonmenu;
49: use CGI::Cookie();
50: use Apache::lonlocal;
51:
52: sub handler {
53: my $r = shift;
54:
55: #Check for cookie
56: my $requrl=$r->uri;
57: my $handle = &Apache::lonnet::check_for_valid_session($r);
58: #check if cookie still valid
59: if ($handle eq '') {
60: $r->log_reason("Cookie $handle not valid", $r->filename);
61: return FORBIDDEN;
62: }
63:
64: #we've got a valid user
65: #any locks in place?
66: my $locknum=&Apache::lonnet::get_locks();
67: if ($locknum) { return 409; }
68: #nope, go ahead
69: my @profile;
70: my $lonidsdir=$r->dir_config('lonIDsDir');
71: &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
72: unlink("$lonidsdir/$handle.id");
73: my %temp=('logout' => time);
74: &Apache::lonnet::put('email_status',\%temp);
75: &Apache::lonnet::log($env{'user.domain'},
76: $env{'user.name'},
77: $env{'user.home'},
78: "Logout $ENV{'REMOTE_ADDR'}");
79:
80: &Apache::loncommon::content_type($r,'text/html');
81:
82: #expire the cookie
83: my $c = new CGI::Cookie(-name => 'lonID',
84: -value => '',
85: -expires => '-10y',);
86: $r->header_out('Set-cookie' => $c);
87:
88: $r->send_http_header;
89: return OK if $r->header_only;
90: # -------------------------------------------------------- Menu script and info
91:
92: my $windowinfo=&Apache::lonmenu::close();
93: $windowinfo.=&Apache::lonnavmaps::close();
94: # ---------------------------------------------------------------- Get handover
95: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['handover']);
96: my $switch='';
97: my $start_page='';
98: my $relogmessage='';
99: if ($env{'form.handover'}) {
100: $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.
101: $env{'form.handover'}.'" />';
102: $start_page=&Apache::loncommon::start_page('Switching Server ...',
103: $switch);
104: } else {
105: $start_page=&Apache::loncommon::start_page('Logged Out',undef,
106: {'no_inline_link' => 1,
107: 'no_nav_bar' => 1,});
108:
109: $relogmessage.='<h1>'.&mt('Goodbye').'</h1>'
110: .'<p>'.&mt('Thank you for using LON-CAPA.').'</p>';
111:
112: if (!$env{'request.sso.norelogin'}) {
113: my $relogin_server;
114: if ($env{'request.sso.reloginserver'}) {
115: $relogin_server = $env{'request.sso.reloginserver'};
116: }
117: my $login_url = $relogin_server.'/adm/'.
118: ($env{'request.sso.login'} ? 'roles': 'login');
119:
120: $relogmessage.='<p>'.&mt('You have been successfully logged out.').' '
121: .&mt('You can [_1]close this window[_2] now.'
122: ,'','') # ,'<a href="javascript:self.close();">','</a>')
123: .'</p>';
124: =pod
125:
126: =head1 NOTES:
127:
128: '<a href="javascript:self.close();">','</a>'
129:
130: Due to security reasons in new web browsers a window could only be closed with java script, if this window has also been opend with javascript. This is not done here which means that in most cases the close link will not work. Unless we find another solution, this link should not be offered. (Stefan Bisitz, 2008-08-01)
131:
132: =cut
133: $relogmessage.='<p>'.&mt('[_1]Log in again[_2]'
134: ,'<a href="'.$login_url.'?domain='.$env{'user.domain'}.'">','</a>')
135: .'</p>';
136: }
137: my $domain = $env{'user.domain'};
138: if ($env{'request.sso.login'}
139: && defined($r->dir_config("lonSSOUserLogoutMessageFile_$domain"))) {
140: open(my $fh,$r->dir_config("lonSSOUserLogoutMessageFile_$domain"));
141: $relogmessage.= join('',<$fh>);
142: }
143: if ($env{'request.sso.login'}
144: && defined($r->dir_config('lonSSOUserLogoutMessageFile'))) {
145: open(my $fh,$r->dir_config('lonSSOUserLogoutMessageFile'));
146: $relogmessage.= join('',<$fh>);
147: }
148:
149: }
150: my $end_page=&Apache::loncommon::end_page();
151: # --------------------------------------------------------------- Screen Output
152: $r->print(<<ENDDOCUMENT);
153: $start_page
154: $windowinfo
155: $relogmessage
156: $end_page
157: ENDDOCUMENT
158: $r->register_cleanup(\&flush_course_logs);
159: return OK;
160: }
161:
162: sub flush_course_logs {
163: &Apache::lonnet::flushcourselogs();
164: return OK;
165: }
166:
167: 1;
168: __END__
169:
170:
171:
172:
173:
174:
175:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>