1 | <%-- $Id: logout.jsp 5900 2011-12-07 13:43:15Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2005 Nicklas Nordborg |
---|
4 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
---|
5 | |
---|
6 | This file is part of BASE - BioArray Software Environment. |
---|
7 | Available at http://base.thep.lu.se/ |
---|
8 | |
---|
9 | BASE is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License |
---|
11 | as published by the Free Software Foundation; either version 3 |
---|
12 | of the License, or (at your option) any later version. |
---|
13 | |
---|
14 | BASE is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ------------------------------------------------------------------ |
---|
22 | |
---|
23 | Logout from BASE. |
---|
24 | |
---|
25 | @param noconfirm |
---|
26 | If specified on the URL we display a confirmation dialogue |
---|
27 | otherwise we just log out and forward to the /main.jsp page |
---|
28 | |
---|
29 | @author Nicklas |
---|
30 | @version 2.0 |
---|
31 | --%> |
---|
32 | <%@ page pageEncoding="UTF-8" session="false" |
---|
33 | import="net.sf.basedb.core.SessionControl" |
---|
34 | import="net.sf.basedb.core.User" |
---|
35 | import="net.sf.basedb.util.Values" |
---|
36 | import="net.sf.basedb.clients.web.Base" |
---|
37 | import="net.sf.basedb.clients.web.WebException" |
---|
38 | import="net.sf.basedb.clients.web.util.HTML" |
---|
39 | %> |
---|
40 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
41 | <% |
---|
42 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
43 | final String ID = sc.getId(); |
---|
44 | final String noconfirm = request.getParameter("noconfirm"); |
---|
45 | if (noconfirm != null) |
---|
46 | { |
---|
47 | // Redirect to main login page |
---|
48 | String redirect = "common/close_popup.jsp?ID="+ID+"&wait=0&redirect_opener=../main.jsp?ID="+ID;; |
---|
49 | if (sc.isImpersonated()) |
---|
50 | { |
---|
51 | SessionControl original = (SessionControl)sc.getSessionSetting("impersonate.originalSessionControl"); |
---|
52 | boolean revert = Values.getBoolean(request.getParameter("revert")); |
---|
53 | if (revert) |
---|
54 | { |
---|
55 | redirect = "common/close_popup.jsp?ID="+original.getId()+"&wait=0&redirect_opener=../my_base/index.jsp?ID="+original.getId(); |
---|
56 | } |
---|
57 | else |
---|
58 | { |
---|
59 | original.logout(); |
---|
60 | } |
---|
61 | } |
---|
62 | sc.logout(); |
---|
63 | response.sendRedirect(redirect); |
---|
64 | return; |
---|
65 | } |
---|
66 | String title = sc.isImpersonated() ? "Logout impersonated?" : "Logout?"; |
---|
67 | %> |
---|
68 | <base:page type="popup" title="<%=title%>"> |
---|
69 | <base:head > |
---|
70 | <script language="JavaScript"> |
---|
71 | function beginLogout() |
---|
72 | { |
---|
73 | Main.hide('confirm'); |
---|
74 | Main.show('logout'); |
---|
75 | setTimeout("document.forms['logout'].submit()", 800); |
---|
76 | } |
---|
77 | </script> |
---|
78 | </base:head> |
---|
79 | <base:body> |
---|
80 | <br> |
---|
81 | <form action="logout.jsp" method="post" name="logout" onsubmit="return false;"> |
---|
82 | <input type="hidden" name="ID" value="<%=ID%>"> |
---|
83 | <input type="hidden" name="noconfirm" value="1"> |
---|
84 | |
---|
85 | <div id="confirm"> |
---|
86 | <base:note type="question" title="<%=title%>"> |
---|
87 | Are you sure you want to logout? All unsaved data will be lost! |
---|
88 | <br> |
---|
89 | </base:note> |
---|
90 | <p> |
---|
91 | <table align="center"> |
---|
92 | <tr> |
---|
93 | <td> |
---|
94 | <% |
---|
95 | if (sc.isImpersonated()) |
---|
96 | { |
---|
97 | User originalUser = (User)sc.getSessionSetting("impersonate.originalUser"); |
---|
98 | if (originalUser != null) |
---|
99 | { |
---|
100 | %> |
---|
101 | <input type="checkbox" name="revert" id="revert" value="1" checked><label for="revert">Revert to |
---|
102 | <%=HTML.encodeTags(originalUser.getName())%></label> |
---|
103 | <% |
---|
104 | } |
---|
105 | } |
---|
106 | %> |
---|
107 | </td> |
---|
108 | </tr> |
---|
109 | </table> |
---|
110 | |
---|
111 | <base:buttongroup subclass="dialogbuttons"> |
---|
112 | <base:button onclick="beginLogout()" title="Yes" /> |
---|
113 | <base:button onclick="window.close()" title="No" /> |
---|
114 | </base:buttongroup> |
---|
115 | |
---|
116 | </div> |
---|
117 | |
---|
118 | <div id="logout" style="display: none;"> |
---|
119 | <base:note type="info" title="Logging out..."> |
---|
120 | Logging out... |
---|
121 | </base:note> |
---|
122 | </div> |
---|
123 | |
---|
124 | </form> |
---|
125 | |
---|
126 | </base:body> |
---|
127 | </base:page> |
---|