216 |
22 Mar 05 |
nicklas |
1 |
<%-- $Id$ |
216 |
22 Mar 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
216 |
22 Mar 05 |
nicklas |
5 |
|
2304 |
22 May 06 |
jari |
6 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
7 |
Available at http://base.thep.lu.se/ |
216 |
22 Mar 05 |
nicklas |
8 |
|
216 |
22 Mar 05 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
216 |
22 Mar 05 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
216 |
22 Mar 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
216 |
22 Mar 05 |
nicklas |
13 |
|
216 |
22 Mar 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
216 |
22 Mar 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
216 |
22 Mar 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
216 |
22 Mar 05 |
nicklas |
17 |
GNU General Public License for more details. |
216 |
22 Mar 05 |
nicklas |
18 |
|
216 |
22 Mar 05 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
216 |
22 Mar 05 |
nicklas |
21 |
------------------------------------------------------------------ |
216 |
22 Mar 05 |
nicklas |
22 |
|
216 |
22 Mar 05 |
nicklas |
23 |
Logout from BASE. |
216 |
22 Mar 05 |
nicklas |
24 |
|
216 |
22 Mar 05 |
nicklas |
25 |
@param noconfirm |
216 |
22 Mar 05 |
nicklas |
26 |
If specified on the URL we display a confirmation dialogue |
216 |
22 Mar 05 |
nicklas |
27 |
otherwise we just log out and forward to the /main.jsp page |
216 |
22 Mar 05 |
nicklas |
28 |
|
216 |
22 Mar 05 |
nicklas |
29 |
@author Nicklas |
216 |
22 Mar 05 |
nicklas |
30 |
@version 2.0 |
216 |
22 Mar 05 |
nicklas |
31 |
--%> |
5426 |
24 Sep 10 |
nicklas |
32 |
<%@ page pageEncoding="UTF-8" session="false" |
419 |
19 Apr 05 |
nicklas |
33 |
import="net.sf.basedb.core.SessionControl" |
2818 |
30 Oct 06 |
nicklas |
34 |
import="net.sf.basedb.core.User" |
2818 |
30 Oct 06 |
nicklas |
35 |
import="net.sf.basedb.util.Values" |
419 |
19 Apr 05 |
nicklas |
36 |
import="net.sf.basedb.clients.web.Base" |
2818 |
30 Oct 06 |
nicklas |
37 |
import="net.sf.basedb.clients.web.WebException" |
2818 |
30 Oct 06 |
nicklas |
38 |
import="net.sf.basedb.clients.web.util.HTML" |
216 |
22 Mar 05 |
nicklas |
39 |
%> |
216 |
22 Mar 05 |
nicklas |
40 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
216 |
22 Mar 05 |
nicklas |
41 |
<% |
6540 |
26 Sep 14 |
nicklas |
42 |
final SessionControl sc = Base.getSessionControl(pageContext, false); |
6540 |
26 Sep 14 |
nicklas |
43 |
final boolean noconfirm = sc == null || !sc.isLoggedIn() || |
6540 |
26 Sep 14 |
nicklas |
44 |
Values.getBoolean(request.getParameter("noconfirm")); |
6540 |
26 Sep 14 |
nicklas |
45 |
final String ID = sc == null ? "" : sc.getId(); |
6520 |
18 Aug 14 |
nicklas |
46 |
if (noconfirm) |
216 |
22 Mar 05 |
nicklas |
47 |
{ |
2818 |
30 Oct 06 |
nicklas |
48 |
// Redirect to main login page |
2818 |
30 Oct 06 |
nicklas |
49 |
String redirect = "common/close_popup.jsp?ID="+ID+"&wait=0&redirect_opener=../main.jsp?ID="+ID;; |
6540 |
26 Sep 14 |
nicklas |
50 |
if (sc != null) |
2818 |
30 Oct 06 |
nicklas |
51 |
{ |
6540 |
26 Sep 14 |
nicklas |
52 |
if (sc.isImpersonated()) |
2818 |
30 Oct 06 |
nicklas |
53 |
{ |
7605 |
26 Feb 19 |
nicklas |
54 |
SessionControl original = sc.getSessionSetting("impersonate.originalSessionControl"); |
6540 |
26 Sep 14 |
nicklas |
55 |
boolean revert = Values.getBoolean(request.getParameter("revert")); |
6540 |
26 Sep 14 |
nicklas |
56 |
if (revert) |
6540 |
26 Sep 14 |
nicklas |
57 |
{ |
6540 |
26 Sep 14 |
nicklas |
58 |
redirect = "common/close_popup.jsp?ID="+original.getId()+"&wait=0&redirect_opener=../my_base/index.jsp?ID="+original.getId(); |
6540 |
26 Sep 14 |
nicklas |
59 |
} |
6540 |
26 Sep 14 |
nicklas |
60 |
else |
6540 |
26 Sep 14 |
nicklas |
61 |
{ |
6540 |
26 Sep 14 |
nicklas |
62 |
original.logout(); |
6540 |
26 Sep 14 |
nicklas |
63 |
} |
2818 |
30 Oct 06 |
nicklas |
64 |
} |
6540 |
26 Sep 14 |
nicklas |
65 |
sc.logout(); |
2818 |
30 Oct 06 |
nicklas |
66 |
} |
2818 |
30 Oct 06 |
nicklas |
67 |
response.sendRedirect(redirect); |
216 |
22 Mar 05 |
nicklas |
68 |
return; |
216 |
22 Mar 05 |
nicklas |
69 |
} |
6540 |
26 Sep 14 |
nicklas |
70 |
String title = sc != null && sc.isImpersonated() ? "Logout impersonated?" : "Logout?"; |
216 |
22 Mar 05 |
nicklas |
71 |
%> |
2818 |
30 Oct 06 |
nicklas |
72 |
<base:page type="popup" title="<%=title%>"> |
6167 |
12 Oct 12 |
nicklas |
73 |
<base:head scripts="~logout.js" /> |
6520 |
18 Aug 14 |
nicklas |
74 |
<base:body data-read-only="1"> |
5902 |
08 Dec 11 |
nicklas |
75 |
<h1><%=title%></h1> |
5902 |
08 Dec 11 |
nicklas |
76 |
<div class="content"> |
6607 |
19 Nov 14 |
nicklas |
77 |
<table class="fullcc bg-filled-50 bottomborder"><tr><td> |
6162 |
10 Oct 12 |
nicklas |
78 |
<form action="logout.jsp" method="post" name="logout"> |
2818 |
30 Oct 06 |
nicklas |
79 |
<input type="hidden" name="ID" value="<%=ID%>"> |
2818 |
30 Oct 06 |
nicklas |
80 |
<input type="hidden" name="noconfirm" value="1"> |
5902 |
08 Dec 11 |
nicklas |
81 |
<div id="confirm"> |
5902 |
08 Dec 11 |
nicklas |
82 |
<b>Are you sure you want to logout? </b> |
5902 |
08 Dec 11 |
nicklas |
83 |
<br> |
5902 |
08 Dec 11 |
nicklas |
84 |
All unsaved data will be lost! |
5902 |
08 Dec 11 |
nicklas |
85 |
<% |
5902 |
08 Dec 11 |
nicklas |
86 |
if (sc.isImpersonated()) |
2818 |
30 Oct 06 |
nicklas |
87 |
{ |
7605 |
26 Feb 19 |
nicklas |
88 |
User originalUser = sc.getSessionSetting("impersonate.originalUser"); |
5902 |
08 Dec 11 |
nicklas |
89 |
if (originalUser != null) |
5902 |
08 Dec 11 |
nicklas |
90 |
{ |
5902 |
08 Dec 11 |
nicklas |
91 |
%> |
5902 |
08 Dec 11 |
nicklas |
92 |
<p> |
5902 |
08 Dec 11 |
nicklas |
93 |
<input type="checkbox" name="revert" id="revert" value="1" checked><label for="revert">Revert to |
5902 |
08 Dec 11 |
nicklas |
94 |
<%=HTML.encodeTags(originalUser.getName())%></label> |
5902 |
08 Dec 11 |
nicklas |
95 |
<% |
5902 |
08 Dec 11 |
nicklas |
96 |
} |
2818 |
30 Oct 06 |
nicklas |
97 |
} |
5902 |
08 Dec 11 |
nicklas |
98 |
%> |
5902 |
08 Dec 11 |
nicklas |
99 |
</div> |
5902 |
08 Dec 11 |
nicklas |
100 |
<div id="logout" style="display: none;"> |
5902 |
08 Dec 11 |
nicklas |
101 |
<b>Logging out...</b> |
5902 |
08 Dec 11 |
nicklas |
102 |
</div> |
5902 |
08 Dec 11 |
nicklas |
103 |
</form> |
5902 |
08 Dec 11 |
nicklas |
104 |
</td></tr></table> |
415 |
18 Apr 05 |
nicklas |
105 |
</div> |
5902 |
08 Dec 11 |
nicklas |
106 |
<base:buttongroup subclass="dialogbuttons" id="dialogbuttons"> |
6167 |
12 Oct 12 |
nicklas |
107 |
<base:button id="btnLogout" title="Yes" /> |
6167 |
12 Oct 12 |
nicklas |
108 |
<base:button id="close" title="No" /> |
5902 |
08 Dec 11 |
nicklas |
109 |
</base:buttongroup> |
415 |
18 Apr 05 |
nicklas |
110 |
</base:body> |
216 |
22 Mar 05 |
nicklas |
111 |
</base:page> |