1 | <%-- $Id: view_session.jsp 5909 2011-12-14 08:33:07Z 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 | @author Nicklas |
---|
24 | @version 2.0 |
---|
25 | --%> |
---|
26 | <%@ page pageEncoding="UTF-8" session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.SystemItems" |
---|
30 | import="net.sf.basedb.core.Item" |
---|
31 | import="net.sf.basedb.core.ItemContext" |
---|
32 | import="net.sf.basedb.core.Permission" |
---|
33 | import="net.sf.basedb.core.Session" |
---|
34 | import="net.sf.basedb.core.User" |
---|
35 | import="net.sf.basedb.core.Client" |
---|
36 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
37 | import="net.sf.basedb.core.PluginDefinition" |
---|
38 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
39 | import="net.sf.basedb.core.plugin.Plugin" |
---|
40 | import="net.sf.basedb.clients.web.Base" |
---|
41 | import="net.sf.basedb.clients.web.util.HTML" |
---|
42 | import="net.sf.basedb.util.Values" |
---|
43 | import="net.sf.basedb.util.formatter.Formatter" |
---|
44 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
45 | import="java.util.Date" |
---|
46 | import="java.util.Map" |
---|
47 | import="java.util.Set" |
---|
48 | import="java.util.List" |
---|
49 | %> |
---|
50 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
51 | <%! |
---|
52 | private static final Item itemType = Item.SESSION; |
---|
53 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
54 | %> |
---|
55 | <% |
---|
56 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
57 | final String ID = sc.getId(); |
---|
58 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
59 | final int itemId = cc.getId(); |
---|
60 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
61 | final float scale = Base.getScale(sc); |
---|
62 | final DbControl dc = sc.newDbControl(); |
---|
63 | try |
---|
64 | { |
---|
65 | Session s = Session.getById(dc, itemId); |
---|
66 | |
---|
67 | boolean readUser = true; |
---|
68 | User user = null; |
---|
69 | try |
---|
70 | { |
---|
71 | user = s.getUser(); |
---|
72 | } |
---|
73 | catch (Exception ex) |
---|
74 | { |
---|
75 | readUser = false; |
---|
76 | } |
---|
77 | boolean readClient = true; |
---|
78 | Client client = null; |
---|
79 | try |
---|
80 | { |
---|
81 | client = s.getClient(); |
---|
82 | } |
---|
83 | catch (Exception ex) |
---|
84 | { |
---|
85 | readClient = false; |
---|
86 | } |
---|
87 | |
---|
88 | String title = "View session"; |
---|
89 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
90 | %> |
---|
91 | <base:page type="popup" title="<%=title%>"> |
---|
92 | <base:head> |
---|
93 | </base:head> |
---|
94 | <base:body> |
---|
95 | |
---|
96 | <h1><%=title%> <base:help helpid="session.view" /></h1> |
---|
97 | <div class="content"> |
---|
98 | <table class="fullform smaller bottomborder"> |
---|
99 | <tr> |
---|
100 | <th>User</th> |
---|
101 | <td><%=Base.getEncodedName(user, readUser)%></td> |
---|
102 | </tr> |
---|
103 | <tr> |
---|
104 | <th>Client application</th> |
---|
105 | <td><%=Base.getEncodedName(client, !readClient)%></td> |
---|
106 | </tr> |
---|
107 | <tr> |
---|
108 | <th>Login time</th> |
---|
109 | <td><%=dateTimeFormatter.format(s.getLoginTime())%></td> |
---|
110 | </tr> |
---|
111 | <tr> |
---|
112 | <th>Logout time</th> |
---|
113 | <td><%=dateTimeFormatter.format(s.getLogoutTime())%></td> |
---|
114 | </tr> |
---|
115 | <tr> |
---|
116 | <th>Remote ID</th> |
---|
117 | <td><%=HTML.encodeTags(s.getRemoteId())%></td> |
---|
118 | </tr> |
---|
119 | <tr> |
---|
120 | <th>Impersonated</th> |
---|
121 | <td><%=s.getImpersonated()%></td> |
---|
122 | </tr> |
---|
123 | <tr class="dynamic"> |
---|
124 | <th>Comment</th> |
---|
125 | <td><%=HTML.niceFormat(s.getLoginComment())%></td> |
---|
126 | </tr> |
---|
127 | </table> |
---|
128 | </div> |
---|
129 | <base:buttongroup subclass="dialogbuttons"> |
---|
130 | <base:button onclick="window.close()" title="Close" /> |
---|
131 | </base:buttongroup> |
---|
132 | |
---|
133 | </base:body> |
---|
134 | </base:page> |
---|
135 | <% |
---|
136 | } |
---|
137 | finally |
---|
138 | { |
---|
139 | if (dc != null) dc.commit(); |
---|
140 | } |
---|
141 | |
---|
142 | %> |
---|