556 |
11 May 05 |
nicklas |
1 |
<%-- $Id$ |
556 |
11 May 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, Martin Svensson |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg, Martin Svensson |
556 |
11 May 05 |
nicklas |
6 |
|
2304 |
22 May 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
556 |
11 May 05 |
nicklas |
9 |
|
556 |
11 May 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
556 |
11 May 05 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
556 |
11 May 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
556 |
11 May 05 |
nicklas |
14 |
|
556 |
11 May 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
556 |
11 May 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
556 |
11 May 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
556 |
11 May 05 |
nicklas |
18 |
GNU General Public License for more details. |
556 |
11 May 05 |
nicklas |
19 |
|
556 |
11 May 05 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
556 |
11 May 05 |
nicklas |
22 |
------------------------------------------------------------------ |
556 |
11 May 05 |
nicklas |
23 |
|
556 |
11 May 05 |
nicklas |
24 |
|
556 |
11 May 05 |
nicklas |
25 |
@author Nicklas |
556 |
11 May 05 |
nicklas |
26 |
@version 2.0 |
556 |
11 May 05 |
nicklas |
27 |
--%> |
5426 |
24 Sep 10 |
nicklas |
28 |
<%@ page pageEncoding="UTF-8" session="false" |
556 |
11 May 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
556 |
11 May 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
556 |
11 May 05 |
nicklas |
31 |
import="net.sf.basedb.core.SystemItems" |
556 |
11 May 05 |
nicklas |
32 |
import="net.sf.basedb.core.Item" |
3467 |
08 Jun 07 |
nicklas |
33 |
import="net.sf.basedb.core.Type" |
1968 |
10 Feb 06 |
nicklas |
34 |
import="net.sf.basedb.core.ItemContext" |
556 |
11 May 05 |
nicklas |
35 |
import="net.sf.basedb.core.Permission" |
1968 |
10 Feb 06 |
nicklas |
36 |
import="net.sf.basedb.core.Group" |
556 |
11 May 05 |
nicklas |
37 |
import="net.sf.basedb.core.User" |
556 |
11 May 05 |
nicklas |
38 |
import="net.sf.basedb.core.Quota" |
1970 |
13 Feb 06 |
nicklas |
39 |
import="net.sf.basedb.core.Role" |
1970 |
13 Feb 06 |
nicklas |
40 |
import="net.sf.basedb.core.Directory" |
3535 |
28 Jun 07 |
martin |
41 |
import="net.sf.basedb.core.ExtendedProperties" |
3535 |
28 Jun 07 |
martin |
42 |
import="net.sf.basedb.core.ExtendedProperty" |
563 |
12 May 05 |
nicklas |
43 |
import="net.sf.basedb.core.QuotaType" |
1968 |
10 Feb 06 |
nicklas |
44 |
import="net.sf.basedb.core.Location" |
1970 |
13 Feb 06 |
nicklas |
45 |
import="net.sf.basedb.core.Include" |
1418 |
07 Oct 05 |
nicklas |
46 |
import="net.sf.basedb.core.ItemQuery" |
1418 |
07 Oct 05 |
nicklas |
47 |
import="net.sf.basedb.core.ItemResultList" |
556 |
11 May 05 |
nicklas |
48 |
import="net.sf.basedb.core.PermissionDeniedException" |
556 |
11 May 05 |
nicklas |
49 |
import="net.sf.basedb.core.query.Orders" |
1418 |
07 Oct 05 |
nicklas |
50 |
import="net.sf.basedb.core.query.Hql" |
1970 |
13 Feb 06 |
nicklas |
51 |
import="net.sf.basedb.core.query.Restrictions" |
1970 |
13 Feb 06 |
nicklas |
52 |
import="net.sf.basedb.core.query.Expressions" |
556 |
11 May 05 |
nicklas |
53 |
import="net.sf.basedb.clients.web.Base" |
556 |
11 May 05 |
nicklas |
54 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
55 |
import="net.sf.basedb.util.Values" |
2942 |
22 Nov 06 |
nicklas |
56 |
import="net.sf.basedb.util.formatter.Formatter" |
6223 |
15 Jan 13 |
nicklas |
57 |
import="net.sf.basedb.util.json.JsonUtil" |
6223 |
15 Jan 13 |
nicklas |
58 |
import="net.sf.basedb.util.json.JsonConverter" |
6223 |
15 Jan 13 |
nicklas |
59 |
import="net.sf.basedb.util.json.NameableConverter" |
2942 |
22 Nov 06 |
nicklas |
60 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
2942 |
22 Nov 06 |
nicklas |
61 |
import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
5506 |
19 Nov 10 |
nicklas |
62 |
import="net.sf.basedb.core.plugin.GuiContext" |
5506 |
19 Nov 10 |
nicklas |
63 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5506 |
19 Nov 10 |
nicklas |
64 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5506 |
19 Nov 10 |
nicklas |
65 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
66 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5506 |
19 Nov 10 |
nicklas |
67 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
2942 |
22 Nov 06 |
nicklas |
68 |
import="java.util.Date" |
3535 |
28 Jun 07 |
martin |
69 |
import="java.util.List" |
6223 |
15 Jan 13 |
nicklas |
70 |
import="org.json.simple.JSONArray" |
6223 |
15 Jan 13 |
nicklas |
71 |
import="org.json.simple.JSONObject" |
556 |
11 May 05 |
nicklas |
72 |
%> |
556 |
11 May 05 |
nicklas |
73 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
556 |
11 May 05 |
nicklas |
74 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6147 |
21 Sep 12 |
nicklas |
75 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
556 |
11 May 05 |
nicklas |
76 |
<% |
1970 |
13 Feb 06 |
nicklas |
77 |
final Item itemType = Item.USER; |
1968 |
10 Feb 06 |
nicklas |
78 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1968 |
10 Feb 06 |
nicklas |
79 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1968 |
10 Feb 06 |
nicklas |
80 |
final int itemId = cc.getId(); |
6174 |
17 Oct 12 |
nicklas |
81 |
final int cloneId = Values.getInt(request.getParameter("clone_id")); |
556 |
11 May 05 |
nicklas |
82 |
final String ID = sc.getId(); |
556 |
11 May 05 |
nicklas |
83 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
84 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
556 |
11 May 05 |
nicklas |
85 |
try |
556 |
11 May 05 |
nicklas |
86 |
{ |
556 |
11 May 05 |
nicklas |
87 |
String title = null; |
1970 |
13 Feb 06 |
nicklas |
88 |
User user = null; |
3535 |
28 Jun 07 |
martin |
89 |
|
3535 |
28 Jun 07 |
martin |
90 |
List<ExtendedProperty> extendedProperties = ExtendedProperties.getProperties("UserData"); |
6223 |
15 Jan 13 |
nicklas |
91 |
JSONArray jsonExtendedProperties = JsonUtil.toArray(extendedProperties, new JsonConverter<ExtendedProperty>() |
6223 |
15 Jan 13 |
nicklas |
92 |
{ |
6223 |
15 Jan 13 |
nicklas |
93 |
public Object convert(ExtendedProperty ep) |
6223 |
15 Jan 13 |
nicklas |
94 |
{ |
6223 |
15 Jan 13 |
nicklas |
95 |
JSONObject json = new JSONObject(); |
6223 |
15 Jan 13 |
nicklas |
96 |
json.put("name", ep.getName()); |
6223 |
15 Jan 13 |
nicklas |
97 |
json.put("valueType", ep.getType().name()); |
6223 |
15 Jan 13 |
nicklas |
98 |
json.put("title", ep.getTitle()); |
6223 |
15 Jan 13 |
nicklas |
99 |
json.put("nullable", ep.isNullable()); |
6223 |
15 Jan 13 |
nicklas |
100 |
return json; |
6223 |
15 Jan 13 |
nicklas |
101 |
} |
6223 |
15 Jan 13 |
nicklas |
102 |
}); |
1968 |
10 Feb 06 |
nicklas |
103 |
|
1986 |
14 Feb 06 |
nicklas |
104 |
final QuotaType total = QuotaType.getById(dc, SystemItems.getId(QuotaType.TOTAL)); |
1968 |
10 Feb 06 |
nicklas |
105 |
Quota currentQuota = null; |
1970 |
13 Feb 06 |
nicklas |
106 |
Group currentQuotaGroup = null; |
1970 |
13 Feb 06 |
nicklas |
107 |
Directory homeDirectory = null; |
1970 |
13 Feb 06 |
nicklas |
108 |
|
1970 |
13 Feb 06 |
nicklas |
109 |
// Query to retrieve group membership |
1968 |
10 Feb 06 |
nicklas |
110 |
ItemQuery<Group> groupQuery = null; |
1970 |
13 Feb 06 |
nicklas |
111 |
// Query to retrieve role membership |
1970 |
13 Feb 06 |
nicklas |
112 |
ItemQuery<Role> roleQuery = null; |
1968 |
10 Feb 06 |
nicklas |
113 |
|
6174 |
17 Oct 12 |
nicklas |
114 |
if (itemId == 0 && cloneId == 0) |
556 |
11 May 05 |
nicklas |
115 |
{ |
1970 |
13 Feb 06 |
nicklas |
116 |
title = "Create user"; |
1968 |
10 Feb 06 |
nicklas |
117 |
cc.removeObject("item"); |
1968 |
10 Feb 06 |
nicklas |
118 |
if (cc.getPropertyFilter("quota.name") != null) |
1968 |
10 Feb 06 |
nicklas |
119 |
{ |
1968 |
10 Feb 06 |
nicklas |
120 |
currentQuota = Base.getFirstMatching(dc, Quota.getQuery(), "name", cc.getPropertyFilter("quota.name")); |
1968 |
10 Feb 06 |
nicklas |
121 |
} |
2103 |
22 Mar 06 |
martin |
122 |
else |
2103 |
22 Mar 06 |
martin |
123 |
{ |
2103 |
22 Mar 06 |
martin |
124 |
currentQuota = Quota.getById(dc, SystemItems.getId(Quota.DEFAULT)); |
2103 |
22 Mar 06 |
martin |
125 |
} |
1970 |
13 Feb 06 |
nicklas |
126 |
if (cc.getPropertyFilter("quotaGroup.name") != null) |
1970 |
13 Feb 06 |
nicklas |
127 |
{ |
1970 |
13 Feb 06 |
nicklas |
128 |
currentQuotaGroup = Base.getFirstMatching(dc, Group.getQuery(), "name", cc.getPropertyFilter("quotaGroup.name")); |
1970 |
13 Feb 06 |
nicklas |
129 |
} |
3467 |
08 Jun 07 |
nicklas |
130 |
|
3467 |
08 Jun 07 |
nicklas |
131 |
groupQuery = Group.getQuery(); |
3467 |
08 Jun 07 |
nicklas |
132 |
groupQuery.restrict( |
3467 |
08 Jun 07 |
nicklas |
133 |
Restrictions.eq( |
3467 |
08 Jun 07 |
nicklas |
134 |
Hql.property("default"), |
3467 |
08 Jun 07 |
nicklas |
135 |
Expressions.parameter("isDefault", true, Type.BOOLEAN) |
3467 |
08 Jun 07 |
nicklas |
136 |
) |
3467 |
08 Jun 07 |
nicklas |
137 |
); |
3467 |
08 Jun 07 |
nicklas |
138 |
groupQuery.order(Orders.asc(Hql.property("name"))); |
3467 |
08 Jun 07 |
nicklas |
139 |
roleQuery = Role.getQuery(); |
3467 |
08 Jun 07 |
nicklas |
140 |
roleQuery.restrict( |
3467 |
08 Jun 07 |
nicklas |
141 |
Restrictions.eq( |
3467 |
08 Jun 07 |
nicklas |
142 |
Hql.property("default"), |
3467 |
08 Jun 07 |
nicklas |
143 |
Expressions.parameter("isDefault", true, Type.BOOLEAN) |
3467 |
08 Jun 07 |
nicklas |
144 |
) |
3467 |
08 Jun 07 |
nicklas |
145 |
); |
3467 |
08 Jun 07 |
nicklas |
146 |
roleQuery.order(Orders.asc(Hql.property("name"))); |
556 |
11 May 05 |
nicklas |
147 |
} |
6174 |
17 Oct 12 |
nicklas |
148 |
else if (cloneId != 0) |
6174 |
17 Oct 12 |
nicklas |
149 |
{ |
6174 |
17 Oct 12 |
nicklas |
150 |
cc.removeObject("item"); |
6174 |
17 Oct 12 |
nicklas |
151 |
user = User.getById(dc, cloneId); |
6174 |
17 Oct 12 |
nicklas |
152 |
title = "Create user -- cloned from " + HTML.encodeTags(user.getName()); |
6174 |
17 Oct 12 |
nicklas |
153 |
try |
6174 |
17 Oct 12 |
nicklas |
154 |
{ |
6174 |
17 Oct 12 |
nicklas |
155 |
currentQuota = user.getQuota(); |
6174 |
17 Oct 12 |
nicklas |
156 |
} |
6174 |
17 Oct 12 |
nicklas |
157 |
catch (PermissionDeniedException ex) |
6174 |
17 Oct 12 |
nicklas |
158 |
{} |
6174 |
17 Oct 12 |
nicklas |
159 |
try |
6174 |
17 Oct 12 |
nicklas |
160 |
{ |
6174 |
17 Oct 12 |
nicklas |
161 |
currentQuotaGroup = user.getQuotaGroup(); |
6174 |
17 Oct 12 |
nicklas |
162 |
} |
6174 |
17 Oct 12 |
nicklas |
163 |
catch (PermissionDeniedException ex) |
6174 |
17 Oct 12 |
nicklas |
164 |
{} |
6174 |
17 Oct 12 |
nicklas |
165 |
groupQuery = user.getGroups(); |
6174 |
17 Oct 12 |
nicklas |
166 |
groupQuery.include(Include.ALL); |
6174 |
17 Oct 12 |
nicklas |
167 |
groupQuery.order(Orders.asc(Hql.property("name"))); |
6174 |
17 Oct 12 |
nicklas |
168 |
roleQuery = user.getRoles(); |
6174 |
17 Oct 12 |
nicklas |
169 |
roleQuery.include(Include.ALL); |
6174 |
17 Oct 12 |
nicklas |
170 |
roleQuery.order(Orders.asc(Hql.property("name"))); |
6174 |
17 Oct 12 |
nicklas |
171 |
} |
556 |
11 May 05 |
nicklas |
172 |
else |
556 |
11 May 05 |
nicklas |
173 |
{ |
1970 |
13 Feb 06 |
nicklas |
174 |
user = User.getById(dc, itemId); |
1970 |
13 Feb 06 |
nicklas |
175 |
cc.setObject("item", user); |
1970 |
13 Feb 06 |
nicklas |
176 |
title = "Edit user -- " + HTML.encodeTags(user.getName()); |
1968 |
10 Feb 06 |
nicklas |
177 |
|
1968 |
10 Feb 06 |
nicklas |
178 |
try |
1968 |
10 Feb 06 |
nicklas |
179 |
{ |
1970 |
13 Feb 06 |
nicklas |
180 |
currentQuota = user.getQuota(); |
1968 |
10 Feb 06 |
nicklas |
181 |
} |
1968 |
10 Feb 06 |
nicklas |
182 |
catch (PermissionDeniedException ex) |
1968 |
10 Feb 06 |
nicklas |
183 |
{} |
1970 |
13 Feb 06 |
nicklas |
184 |
try |
1970 |
13 Feb 06 |
nicklas |
185 |
{ |
1970 |
13 Feb 06 |
nicklas |
186 |
currentQuotaGroup = user.getQuotaGroup(); |
1970 |
13 Feb 06 |
nicklas |
187 |
} |
1970 |
13 Feb 06 |
nicklas |
188 |
catch (PermissionDeniedException ex) |
1970 |
13 Feb 06 |
nicklas |
189 |
{} |
1970 |
13 Feb 06 |
nicklas |
190 |
try |
1970 |
13 Feb 06 |
nicklas |
191 |
{ |
1970 |
13 Feb 06 |
nicklas |
192 |
homeDirectory = user.getHomeDirectory(); |
1970 |
13 Feb 06 |
nicklas |
193 |
} |
1970 |
13 Feb 06 |
nicklas |
194 |
catch (PermissionDeniedException ex) |
1970 |
13 Feb 06 |
nicklas |
195 |
{} |
1970 |
13 Feb 06 |
nicklas |
196 |
|
1970 |
13 Feb 06 |
nicklas |
197 |
groupQuery = user.getGroups(); |
3890 |
30 Oct 07 |
nicklas |
198 |
groupQuery.include(Include.ALL); |
1968 |
10 Feb 06 |
nicklas |
199 |
groupQuery.order(Orders.asc(Hql.property("name"))); |
1970 |
13 Feb 06 |
nicklas |
200 |
roleQuery = user.getRoles(); |
3890 |
30 Oct 07 |
nicklas |
201 |
roleQuery.include(Include.ALL); |
1970 |
13 Feb 06 |
nicklas |
202 |
roleQuery.order(Orders.asc(Hql.property("name"))); |
6174 |
17 Oct 12 |
nicklas |
203 |
user.checkPermission(Permission.WRITE); |
556 |
11 May 05 |
nicklas |
204 |
} |
1968 |
10 Feb 06 |
nicklas |
205 |
|
556 |
11 May 05 |
nicklas |
206 |
final boolean readQuota = sc.hasPermission(Permission.READ, Item.QUOTA); |
635 |
23 May 05 |
nicklas |
207 |
final boolean useQuota = sc.hasPermission(Permission.USE, Item.QUOTA); |
1970 |
13 Feb 06 |
nicklas |
208 |
final boolean createDirectories = sc.hasPermission(Permission.CREATE, Item.DIRECTORY); |
1970 |
13 Feb 06 |
nicklas |
209 |
final boolean readDirectories = sc.hasPermission(Permission.READ, Item.DIRECTORY); |
1970 |
13 Feb 06 |
nicklas |
210 |
final boolean readGroups = sc.hasPermission(Permission.READ, Item.GROUP); |
1970 |
13 Feb 06 |
nicklas |
211 |
final boolean useGroups = sc.hasPermission(Permission.USE, Item.GROUP); |
583 |
13 May 05 |
nicklas |
212 |
final boolean writeGroups = sc.hasPermission(Permission.WRITE, Item.GROUP); |
1970 |
13 Feb 06 |
nicklas |
213 |
final boolean writeRoles = sc.hasPermission(Permission.WRITE, Item.ROLE); |
1970 |
13 Feb 06 |
nicklas |
214 |
final boolean writeMembership = writeGroups && writeRoles; |
1968 |
10 Feb 06 |
nicklas |
215 |
|
556 |
11 May 05 |
nicklas |
216 |
// Query to retrieve quota |
1418 |
07 Oct 05 |
nicklas |
217 |
final ItemQuery<Quota> quotaQuery = Quota.getQuery(); |
3890 |
30 Oct 07 |
nicklas |
218 |
quotaQuery.include(Include.ALL); |
1418 |
07 Oct 05 |
nicklas |
219 |
quotaQuery.order(Orders.asc(Hql.property("name"))); |
959 |
19 Jul 05 |
nicklas |
220 |
quotaQuery.setCacheResult(true); |
556 |
11 May 05 |
nicklas |
221 |
|
1970 |
13 Feb 06 |
nicklas |
222 |
// Query to retrieve quota groups |
1970 |
13 Feb 06 |
nicklas |
223 |
final ItemQuery<Group> quotaGroupQuery = Group.getQuery(); |
3890 |
30 Oct 07 |
nicklas |
224 |
quotaGroupQuery.include(Include.ALL); |
1970 |
13 Feb 06 |
nicklas |
225 |
quotaGroupQuery.order(Orders.asc(Hql.property("name"))); |
1970 |
13 Feb 06 |
nicklas |
226 |
quotaGroupQuery.restrict(Restrictions.neq(Hql.property("quota"), null)); |
1970 |
13 Feb 06 |
nicklas |
227 |
quotaGroupQuery.setCacheResult(true); |
1970 |
13 Feb 06 |
nicklas |
228 |
|
1970 |
13 Feb 06 |
nicklas |
229 |
// Query to retrieve home directories |
1970 |
13 Feb 06 |
nicklas |
230 |
final ItemQuery<Directory> directoryQuery = Directory.getQuery(); |
3890 |
30 Oct 07 |
nicklas |
231 |
directoryQuery.include(Include.ALL); |
1970 |
13 Feb 06 |
nicklas |
232 |
directoryQuery.order(Orders.asc(Hql.property("name"))); |
1970 |
13 Feb 06 |
nicklas |
233 |
directoryQuery.restrict( |
1970 |
13 Feb 06 |
nicklas |
234 |
Restrictions.eq( |
1970 |
13 Feb 06 |
nicklas |
235 |
Hql.property("parent"), |
1970 |
13 Feb 06 |
nicklas |
236 |
Expressions.integer(SystemItems.getId(Directory.HOME)) |
1970 |
13 Feb 06 |
nicklas |
237 |
) |
1970 |
13 Feb 06 |
nicklas |
238 |
); |
1970 |
13 Feb 06 |
nicklas |
239 |
directoryQuery.setCacheResult(true); |
1970 |
13 Feb 06 |
nicklas |
240 |
|
6223 |
15 Jan 13 |
nicklas |
241 |
// Load group membership as JSON objects |
6291 |
11 Jun 13 |
nicklas |
242 |
JSONObject jsonGroups = new JSONObject(); |
6291 |
11 Jun 13 |
nicklas |
243 |
jsonGroups.put("itemType", "GROUP"); |
6291 |
11 Jun 13 |
nicklas |
244 |
jsonGroups.put("name", "Groups"); |
6223 |
15 Jan 13 |
nicklas |
245 |
if (groupQuery != null) |
6223 |
15 Jan 13 |
nicklas |
246 |
{ |
7604 |
25 Feb 19 |
nicklas |
247 |
jsonGroups.put("items", JsonUtil.toArray(groupQuery.iterate(dc), new NameableConverter<Group>())); |
6223 |
15 Jan 13 |
nicklas |
248 |
} |
6223 |
15 Jan 13 |
nicklas |
249 |
|
6223 |
15 Jan 13 |
nicklas |
250 |
// Load role membership as JSON objects |
6291 |
11 Jun 13 |
nicklas |
251 |
JSONObject jsonRoles = new JSONObject(); |
6291 |
11 Jun 13 |
nicklas |
252 |
jsonRoles.put("itemType", "ROLE"); |
6291 |
11 Jun 13 |
nicklas |
253 |
jsonRoles.put("name", "Roles"); |
6223 |
15 Jan 13 |
nicklas |
254 |
if (roleQuery != null) |
6223 |
15 Jan 13 |
nicklas |
255 |
{ |
7604 |
25 Feb 19 |
nicklas |
256 |
jsonRoles.put("items", JsonUtil.toArray(roleQuery.iterate(dc), new NameableConverter<Role>())); |
6223 |
15 Jan 13 |
nicklas |
257 |
} |
6217 |
14 Dec 12 |
nicklas |
258 |
|
6291 |
11 Jun 13 |
nicklas |
259 |
JSONArray jsonMembers = new JSONArray(); |
6291 |
11 Jun 13 |
nicklas |
260 |
jsonMembers.add(jsonGroups); |
6291 |
11 Jun 13 |
nicklas |
261 |
jsonMembers.add(jsonRoles); |
6291 |
11 Jun 13 |
nicklas |
262 |
|
2942 |
22 Nov 06 |
nicklas |
263 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
2942 |
22 Nov 06 |
nicklas |
264 |
String dateFormat = FormatterSettings.getDateFormat(sc); |
2942 |
22 Nov 06 |
nicklas |
265 |
String htmlDateFormat = HTML.encodeTags(dateFormat); |
5432 |
29 Sep 10 |
nicklas |
266 |
Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
5432 |
29 Sep 10 |
nicklas |
267 |
String dateTimeFormat = FormatterSettings.getDateTimeFormat(sc); |
5432 |
29 Sep 10 |
nicklas |
268 |
String htmlDateTimeFormat = HTML.encodeTags(dateTimeFormat); |
6174 |
17 Oct 12 |
nicklas |
269 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), itemId == 0 ? null : user); |
7604 |
25 Feb 19 |
nicklas |
270 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
556 |
11 May 05 |
nicklas |
271 |
%> |
6223 |
15 Jan 13 |
nicklas |
272 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6291 |
11 Jun 13 |
nicklas |
273 |
<base:head scripts="tabcontrol-2.js,linkitems-2.js,~users.js" styles="tabcontrol.css"> |
5506 |
19 Nov 10 |
nicklas |
274 |
<ext:scripts context="<%=jspContext%>" /> |
5506 |
19 Nov 10 |
nicklas |
275 |
<ext:stylesheets context="<%=jspContext%>" /> |
556 |
11 May 05 |
nicklas |
276 |
</base:head> |
6223 |
15 Jan 13 |
nicklas |
277 |
<base:body> |
5921 |
10 Jan 12 |
nicklas |
278 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6223 |
15 Jan 13 |
nicklas |
279 |
|
6387 |
18 Dec 13 |
nicklas |
280 |
<div id="page-data" class="datacontainer" |
6223 |
15 Jan 13 |
nicklas |
281 |
data-date-format="<%=htmlDateFormat%>" |
6223 |
15 Jan 13 |
nicklas |
282 |
data-datetime-format="<%=htmlDateTimeFormat%>" |
6223 |
15 Jan 13 |
nicklas |
283 |
data-extended-properties="<%=HTML.encodeTags(jsonExtendedProperties.toJSONString())%>" |
6223 |
15 Jan 13 |
nicklas |
284 |
></div> |
6223 |
15 Jan 13 |
nicklas |
285 |
|
6162 |
10 Oct 12 |
nicklas |
286 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="user"> |
1968 |
10 Feb 06 |
nicklas |
287 |
<input type="hidden" name="cmd" value="UpdateItem"> |
6223 |
15 Jan 13 |
nicklas |
288 |
<input type="hidden" name="item_id" value="<%=itemId%>"> |
7496 |
11 Jul 18 |
nicklas |
289 |
|
5921 |
10 Jan 12 |
nicklas |
290 |
<t:tabcontrol id="settings" |
5921 |
10 Jan 12 |
nicklas |
291 |
subclass="content dialogtabcontrol" |
6174 |
17 Oct 12 |
nicklas |
292 |
position="bottom" remember="<%=itemId != 0%>" |
5506 |
19 Nov 10 |
nicklas |
293 |
extensions="<%=invoker%>"> |
6223 |
15 Jan 13 |
nicklas |
294 |
<t:tab id="info" title="User" helpid="user.edit"> |
5921 |
10 Jan 12 |
nicklas |
295 |
<table class="fullform input100"> |
556 |
11 May 05 |
nicklas |
296 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
297 |
<th>Name</th> |
6223 |
15 Jan 13 |
nicklas |
298 |
<td><input class="text required auto-init" data-auto-init="<%=user == null ? "focus-select" : "focus" %>" |
6223 |
15 Jan 13 |
nicklas |
299 |
type="text" name="name" |
6174 |
17 Oct 12 |
nicklas |
300 |
value="<%=HTML.encodeTags(itemId == 0 ? Values.getString(cc.getPropertyValue("name"), "New user") : user.getName())%>" |
1970 |
13 Feb 06 |
nicklas |
301 |
size="40" maxlength="<%=User.MAX_NAME_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
302 |
<td></td> |
556 |
11 May 05 |
nicklas |
303 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
304 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
305 |
<th>Login</th> |
6217 |
14 Dec 12 |
nicklas |
306 |
<td><input class="text required" type="text" name="login" |
6174 |
17 Oct 12 |
nicklas |
307 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("login") : user.getLogin())%>" |
5921 |
10 Jan 12 |
nicklas |
308 |
maxlength="<%=User.MAX_LOGIN_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
309 |
<td></td> |
556 |
11 May 05 |
nicklas |
310 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
311 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
312 |
<th>External ID</th> |
6217 |
14 Dec 12 |
nicklas |
313 |
<td><input class="text" type="text" name="external_id" |
6174 |
17 Oct 12 |
nicklas |
314 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("externalId") : user.getExternalId())%>" |
5921 |
10 Jan 12 |
nicklas |
315 |
maxlength="<%=User.MAX_EXTERNAL_ID_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
316 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
317 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
318 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
319 |
<th>New password</th> |
6217 |
14 Dec 12 |
nicklas |
320 |
<td><input class="text <%=itemId == 0 ? "required" : ""%>" type="password" name="new_password" value="" maxlength="30" style="max-width: 20em;" |
5921 |
10 Jan 12 |
nicklas |
321 |
<%=itemId == 0 ? "" : "placeholder=\"leave empty to keep the password\"" %> |
5921 |
10 Jan 12 |
nicklas |
322 |
></td> |
5921 |
10 Jan 12 |
nicklas |
323 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
324 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
325 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
326 |
<th class="subprompt">Retype password</th> |
6217 |
14 Dec 12 |
nicklas |
327 |
<td><input class="text <%=itemId == 0 ? "required" : ""%>" type="password" name="retype_password" value="" maxlength="30" style="max-width: 20em;"></td> |
5921 |
10 Jan 12 |
nicklas |
328 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
329 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
330 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
331 |
<th>Quota</th> |
5921 |
10 Jan 12 |
nicklas |
332 |
<td> |
5921 |
10 Jan 12 |
nicklas |
333 |
<select name="quota_id" <%=!useQuota ? "disabled readonly class=\"disabled\"" : "class=\"required selectionlist\""%>> |
556 |
11 May 05 |
nicklas |
334 |
<% |
556 |
11 May 05 |
nicklas |
335 |
if (!readQuota) |
556 |
11 May 05 |
nicklas |
336 |
{ |
556 |
11 May 05 |
nicklas |
337 |
%> |
556 |
11 May 05 |
nicklas |
338 |
<option value="-1">- denied - |
556 |
11 May 05 |
nicklas |
339 |
<% |
556 |
11 May 05 |
nicklas |
340 |
} |
1970 |
13 Feb 06 |
nicklas |
341 |
ItemResultList<Quota> quotas = quotaQuery.list(dc); |
1970 |
13 Feb 06 |
nicklas |
342 |
for (Quota quota : quotas) |
1970 |
13 Feb 06 |
nicklas |
343 |
{ |
2197 |
27 Apr 06 |
nicklas |
344 |
boolean current = quota.equals(currentQuota); |
3890 |
30 Oct 07 |
nicklas |
345 |
if (!current && quota.isRemoved()) continue; |
2197 |
27 Apr 06 |
nicklas |
346 |
int id = quota.getId(); |
1970 |
13 Feb 06 |
nicklas |
347 |
long totalBytes = quota.getQuotaValue(total, Location.PRIMARY); |
1970 |
13 Feb 06 |
nicklas |
348 |
String fTotal = totalBytes == Quota.UNLIMITED ? "unlimited" : Values.formatBytes(totalBytes); |
1970 |
13 Feb 06 |
nicklas |
349 |
%> |
2197 |
27 Apr 06 |
nicklas |
350 |
<option |
6174 |
17 Oct 12 |
nicklas |
351 |
value="<%=current && itemId != 0 ? -id : id%>" |
2197 |
27 Apr 06 |
nicklas |
352 |
<%=current ? "selected" : ""%> |
2197 |
27 Apr 06 |
nicklas |
353 |
><%=HTML.encodeTags(quota.getName())%> (<%=fTotal%> total) |
1970 |
13 Feb 06 |
nicklas |
354 |
<% |
1970 |
13 Feb 06 |
nicklas |
355 |
} |
1970 |
13 Feb 06 |
nicklas |
356 |
%> |
6147 |
21 Sep 12 |
nicklas |
357 |
</select> |
1970 |
13 Feb 06 |
nicklas |
358 |
</td> |
5921 |
10 Jan 12 |
nicklas |
359 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
360 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
361 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
362 |
<th>Quota group</th> |
5921 |
10 Jan 12 |
nicklas |
363 |
<td> |
5921 |
10 Jan 12 |
nicklas |
364 |
<select name="quotagroup_id" <%=!useGroups ? "disabled readonly class=\"disabled\"" : "class=\"selectionlist\""%>> |
1970 |
13 Feb 06 |
nicklas |
365 |
<% |
1970 |
13 Feb 06 |
nicklas |
366 |
if (!readGroups) |
1970 |
13 Feb 06 |
nicklas |
367 |
{ |
1970 |
13 Feb 06 |
nicklas |
368 |
%> |
1970 |
13 Feb 06 |
nicklas |
369 |
<option value="-1">- denied - |
1970 |
13 Feb 06 |
nicklas |
370 |
<% |
1970 |
13 Feb 06 |
nicklas |
371 |
} |
563 |
12 May 05 |
nicklas |
372 |
else |
563 |
12 May 05 |
nicklas |
373 |
{ |
563 |
12 May 05 |
nicklas |
374 |
%> |
563 |
12 May 05 |
nicklas |
375 |
<option value="0">- none - |
563 |
12 May 05 |
nicklas |
376 |
<% |
1970 |
13 Feb 06 |
nicklas |
377 |
ItemResultList<Group> quotaGroups = quotaGroupQuery.list(dc); |
1970 |
13 Feb 06 |
nicklas |
378 |
for (Group quotaGroup : quotaGroups) |
563 |
12 May 05 |
nicklas |
379 |
{ |
2197 |
27 Apr 06 |
nicklas |
380 |
boolean current = quotaGroup.equals(currentQuotaGroup); |
3890 |
30 Oct 07 |
nicklas |
381 |
if (!current && quotaGroup.isRemoved()) continue; |
2197 |
27 Apr 06 |
nicklas |
382 |
int id = quotaGroup.getId(); |
1970 |
13 Feb 06 |
nicklas |
383 |
Quota quota = quotaGroup.getQuota(); |
563 |
12 May 05 |
nicklas |
384 |
long totalBytes = quota.getQuotaValue(total, Location.PRIMARY); |
563 |
12 May 05 |
nicklas |
385 |
String fTotal = totalBytes == Quota.UNLIMITED ? "unlimited" : Values.formatBytes(totalBytes); |
563 |
12 May 05 |
nicklas |
386 |
%> |
2197 |
27 Apr 06 |
nicklas |
387 |
<option |
6174 |
17 Oct 12 |
nicklas |
388 |
value="<%=current && itemId != 0 ? -id : id %>" |
2197 |
27 Apr 06 |
nicklas |
389 |
<%=current ? "selected" : ""%> |
2197 |
27 Apr 06 |
nicklas |
390 |
><%=HTML.encodeTags(quotaGroup.getName())%> (<%=fTotal%> total) |
563 |
12 May 05 |
nicklas |
391 |
<% |
563 |
12 May 05 |
nicklas |
392 |
} |
563 |
12 May 05 |
nicklas |
393 |
} |
563 |
12 May 05 |
nicklas |
394 |
%> |
6147 |
21 Sep 12 |
nicklas |
395 |
</select> |
563 |
12 May 05 |
nicklas |
396 |
</td> |
5921 |
10 Jan 12 |
nicklas |
397 |
<td></td> |
563 |
12 May 05 |
nicklas |
398 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
399 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
400 |
<th>Home directory</th> |
5921 |
10 Jan 12 |
nicklas |
401 |
<td> |
5921 |
10 Jan 12 |
nicklas |
402 |
<select name="homedirectory_id" <%=!readDirectories ? "disabled readonly class=\"disabled\"" : "class=\"selectionlist\""%>> |
1970 |
13 Feb 06 |
nicklas |
403 |
<% |
1970 |
13 Feb 06 |
nicklas |
404 |
if (!readDirectories) |
1970 |
13 Feb 06 |
nicklas |
405 |
{ |
1970 |
13 Feb 06 |
nicklas |
406 |
%> |
1970 |
13 Feb 06 |
nicklas |
407 |
<option value="-1">- denied - |
1970 |
13 Feb 06 |
nicklas |
408 |
<% |
1970 |
13 Feb 06 |
nicklas |
409 |
} |
1970 |
13 Feb 06 |
nicklas |
410 |
else |
1970 |
13 Feb 06 |
nicklas |
411 |
{ |
1970 |
13 Feb 06 |
nicklas |
412 |
%> |
1970 |
13 Feb 06 |
nicklas |
413 |
<option value="0">- none - |
1970 |
13 Feb 06 |
nicklas |
414 |
<% |
6174 |
17 Oct 12 |
nicklas |
415 |
if (createDirectories && itemId == 0) |
1970 |
13 Feb 06 |
nicklas |
416 |
{ |
1970 |
13 Feb 06 |
nicklas |
417 |
%> |
1970 |
13 Feb 06 |
nicklas |
418 |
<option value="new">- create new (empty) - |
1970 |
13 Feb 06 |
nicklas |
419 |
<option value="template" selected>- create new from template - |
1970 |
13 Feb 06 |
nicklas |
420 |
<% |
1970 |
13 Feb 06 |
nicklas |
421 |
} |
1970 |
13 Feb 06 |
nicklas |
422 |
ItemResultList<Directory> directories = directoryQuery.list(dc); |
1970 |
13 Feb 06 |
nicklas |
423 |
for (Directory d : directories) |
1970 |
13 Feb 06 |
nicklas |
424 |
{ |
2197 |
27 Apr 06 |
nicklas |
425 |
int id = d.getId(); |
2197 |
27 Apr 06 |
nicklas |
426 |
boolean current = d.equals(homeDirectory); |
3890 |
30 Oct 07 |
nicklas |
427 |
if (!current && d.isRemoved()) continue; |
1970 |
13 Feb 06 |
nicklas |
428 |
%> |
2197 |
27 Apr 06 |
nicklas |
429 |
<option |
6174 |
17 Oct 12 |
nicklas |
430 |
value="<%=current && itemId != 0 ? -id : id%>" |
2197 |
27 Apr 06 |
nicklas |
431 |
<%=current ? "selected" : ""%> |
2197 |
27 Apr 06 |
nicklas |
432 |
><%=HTML.encodeTags(d.getName())%> |
1970 |
13 Feb 06 |
nicklas |
433 |
<% |
1970 |
13 Feb 06 |
nicklas |
434 |
} |
1970 |
13 Feb 06 |
nicklas |
435 |
} |
1970 |
13 Feb 06 |
nicklas |
436 |
%> |
6147 |
21 Sep 12 |
nicklas |
437 |
</select> |
1970 |
13 Feb 06 |
nicklas |
438 |
</td> |
5921 |
10 Jan 12 |
nicklas |
439 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
440 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
441 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
442 |
<th>Expiration date</th> |
1970 |
13 Feb 06 |
nicklas |
443 |
<td> |
5921 |
10 Jan 12 |
nicklas |
444 |
<table> |
5921 |
10 Jan 12 |
nicklas |
445 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
446 |
<td> |
6217 |
14 Dec 12 |
nicklas |
447 |
<input class="text" type="text" name="expiration_date" id="expiration_date" style="width: 15em;" |
5921 |
10 Jan 12 |
nicklas |
448 |
value="<%=HTML.encodeTags(dateFormatter.format( |
7605 |
26 Feb 19 |
nicklas |
449 |
user == null ? cc.getPropertyObject("expirationDate") : user.getExpirationDate()) |
5921 |
10 Jan 12 |
nicklas |
450 |
)%>" |
5921 |
10 Jan 12 |
nicklas |
451 |
maxlength="20" title="Enter date in format: <%=htmlDateFormat%>"> |
5921 |
10 Jan 12 |
nicklas |
452 |
</td> |
5921 |
10 Jan 12 |
nicklas |
453 |
<td> |
6216 |
14 Dec 12 |
nicklas |
454 |
<base:calendar textarea="expiration_date" title="Expiration date" /> |
5921 |
10 Jan 12 |
nicklas |
455 |
</td> |
5921 |
10 Jan 12 |
nicklas |
456 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
457 |
</table> |
1970 |
13 Feb 06 |
nicklas |
458 |
</td> |
5921 |
10 Jan 12 |
nicklas |
459 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
460 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
461 |
<tr> |
7410 |
09 Oct 17 |
nicklas |
462 |
<th><label for="use_device_verification">2-factor login</label></th> |
7404 |
04 Oct 17 |
nicklas |
463 |
<td><input type="checkbox" name="use_device_verification" id="use_device_verification" value="1" |
7404 |
04 Oct 17 |
nicklas |
464 |
<%=(user != null && user.getUseDeviceVerification()) || |
7404 |
04 Oct 17 |
nicklas |
465 |
(user == null && Values.getBoolean(cc.getPropertyValue("useDeviceVerification"))) ? "checked" : ""%> |
7404 |
04 Oct 17 |
nicklas |
466 |
>(Requires a valid email address) |
7404 |
04 Oct 17 |
nicklas |
467 |
</td> |
7404 |
04 Oct 17 |
nicklas |
468 |
<td></td> |
7404 |
04 Oct 17 |
nicklas |
469 |
</tr> |
7404 |
04 Oct 17 |
nicklas |
470 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
471 |
<th><label for="multiuser_account">Multi-user account</label></th> |
5921 |
10 Jan 12 |
nicklas |
472 |
<td><input type="checkbox" name="multiuser_account" id="multiuser_account" value="1" |
1970 |
13 Feb 06 |
nicklas |
473 |
<%=(user != null && user.isMultiuserAccount()) || |
1970 |
13 Feb 06 |
nicklas |
474 |
(user == null && Values.getBoolean(cc.getPropertyValue("multiuserAccount"))) ? "checked" : ""%>></td> |
5921 |
10 Jan 12 |
nicklas |
475 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
476 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
477 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
478 |
<th><label for="disabled">Disabled</label></th> |
5921 |
10 Jan 12 |
nicklas |
479 |
<td><input type="checkbox" name="disabled" id="disabled" value="1" |
6174 |
17 Oct 12 |
nicklas |
480 |
<%=(itemId != 0 && user.isDisabled()) || |
6174 |
17 Oct 12 |
nicklas |
481 |
(itemId == 0 && Values.getBoolean(cc.getPropertyValue("disabled"))) ? "checked" : ""%>></td> |
5921 |
10 Jan 12 |
nicklas |
482 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
483 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
484 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
485 |
<th>Description</th> |
5921 |
10 Jan 12 |
nicklas |
486 |
<td> |
6217 |
14 Dec 12 |
nicklas |
487 |
<textarea class="text" rows="6" name="description" id="description" |
6174 |
17 Oct 12 |
nicklas |
488 |
><%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("description") : user.getDescription())%></textarea> |
5921 |
10 Jan 12 |
nicklas |
489 |
</td> |
5921 |
10 Jan 12 |
nicklas |
490 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
491 |
<base:zoom textarea="description" title="Description" /> |
5921 |
10 Jan 12 |
nicklas |
492 |
</td> |
5921 |
10 Jan 12 |
nicklas |
493 |
</tr> |
556 |
11 May 05 |
nicklas |
494 |
</table> |
556 |
11 May 05 |
nicklas |
495 |
</t:tab> |
556 |
11 May 05 |
nicklas |
496 |
|
2434 |
27 Jun 06 |
nicklas |
497 |
<t:tab id="contact" title="Contact information" |
6224 |
15 Jan 13 |
nicklas |
498 |
tooltip="Email, adress, organisation, etc." |
6224 |
15 Jan 13 |
nicklas |
499 |
helpid="user.edit.contact"> |
5921 |
10 Jan 12 |
nicklas |
500 |
<table class="fullform input100"> |
1970 |
13 Feb 06 |
nicklas |
501 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
502 |
<th>Email</th> |
6217 |
14 Dec 12 |
nicklas |
503 |
<td><input class="text" type="text" name="email" |
6174 |
17 Oct 12 |
nicklas |
504 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("email") : user.getEmail())%>" |
5921 |
10 Jan 12 |
nicklas |
505 |
maxlength="<%=User.MAX_EMAIL_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
506 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
507 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
508 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
509 |
<th>Organisation</th> |
6217 |
14 Dec 12 |
nicklas |
510 |
<td><input class="text" type="text" name="organisation" |
6174 |
17 Oct 12 |
nicklas |
511 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("organisation") : user.getOrganisation())%>" |
5921 |
10 Jan 12 |
nicklas |
512 |
maxlength="<%=User.MAX_ORGANISATION_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
513 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
514 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
515 |
<tr class="big"> |
5921 |
10 Jan 12 |
nicklas |
516 |
<th>Address</th> |
1970 |
13 Feb 06 |
nicklas |
517 |
<td> |
6217 |
14 Dec 12 |
nicklas |
518 |
<textarea class="text" rows="6" name="address" id="address" |
6174 |
17 Oct 12 |
nicklas |
519 |
wrap="off"><%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("address") : user.getAddress())%></textarea> |
1970 |
13 Feb 06 |
nicklas |
520 |
</td> |
5921 |
10 Jan 12 |
nicklas |
521 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
522 |
<base:zoom textarea="address" title="Address" /> |
5921 |
10 Jan 12 |
nicklas |
523 |
</td> |
1970 |
13 Feb 06 |
nicklas |
524 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
525 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
526 |
<th>Phone</th> |
6217 |
14 Dec 12 |
nicklas |
527 |
<td><input class="text" type="text" name="phone" |
6174 |
17 Oct 12 |
nicklas |
528 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("phone") : user.getPhone())%>" |
5921 |
10 Jan 12 |
nicklas |
529 |
maxlength="<%=User.MAX_PHONE_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
530 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
531 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
532 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
533 |
<th>Fax</th> |
6217 |
14 Dec 12 |
nicklas |
534 |
<td><input class="text" type="text" name="fax" |
6174 |
17 Oct 12 |
nicklas |
535 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("fax") : user.getFax())%>" |
5921 |
10 Jan 12 |
nicklas |
536 |
maxlength="<%=User.MAX_FAX_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
537 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
538 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
539 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
540 |
<th>Url</th> |
6217 |
14 Dec 12 |
nicklas |
541 |
<td><input class="text" type="text" name="url" |
6174 |
17 Oct 12 |
nicklas |
542 |
value="<%=HTML.encodeTags(itemId == 0 ? cc.getPropertyValue("url") : user.getUrl())%>" |
5921 |
10 Jan 12 |
nicklas |
543 |
maxlength="<%=User.MAX_URL_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
544 |
<td></td> |
1970 |
13 Feb 06 |
nicklas |
545 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
546 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
547 |
<th></th> |
5921 |
10 Jan 12 |
nicklas |
548 |
<td colspan="2"></td> |
1970 |
13 Feb 06 |
nicklas |
549 |
</tr> |
1970 |
13 Feb 06 |
nicklas |
550 |
</table> |
1970 |
13 Feb 06 |
nicklas |
551 |
</t:tab> |
3539 |
29 Jun 07 |
martin |
552 |
<% |
3539 |
29 Jun 07 |
martin |
553 |
if (extendedProperties != null) |
3539 |
29 Jun 07 |
martin |
554 |
{ |
3539 |
29 Jun 07 |
martin |
555 |
%> |
3539 |
29 Jun 07 |
martin |
556 |
<t:tab id="extended" title="Additional info" |
6224 |
15 Jan 13 |
nicklas |
557 |
helpid="user.edit.additional"> |
5921 |
10 Jan 12 |
nicklas |
558 |
<table class="fullform input100"> |
3539 |
29 Jun 07 |
martin |
559 |
<% |
7496 |
11 Jul 18 |
nicklas |
560 |
for (ExtendedProperty ep : extendedProperties) |
3539 |
29 Jun 07 |
martin |
561 |
{ |
3539 |
29 Jun 07 |
martin |
562 |
String name = ep.getName(); |
6223 |
15 Jan 13 |
nicklas |
563 |
String fieldName = "ep."+name; |
3539 |
29 Jun 07 |
martin |
564 |
Type type = ep.getType(); |
3539 |
29 Jun 07 |
martin |
565 |
boolean required = !ep.isNullable(); |
6174 |
17 Oct 12 |
nicklas |
566 |
Object value = itemId == 0 ? cc.getPropertyValue(name) : user.getExtended(name); |
6217 |
14 Dec 12 |
nicklas |
567 |
String theClazz = required ? "text required" : "text"; |
5921 |
10 Jan 12 |
nicklas |
568 |
boolean addZoom = false; |
3539 |
29 Jun 07 |
martin |
569 |
%> |
5921 |
10 Jan 12 |
nicklas |
570 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
571 |
<th><%=HTML.encodeTags(ep.getTitle())%></th> |
3539 |
29 Jun 07 |
martin |
572 |
<td> |
3535 |
28 Jun 07 |
martin |
573 |
<% |
3539 |
29 Jun 07 |
martin |
574 |
if (type == Type.INT || type == Type.LONG) |
3535 |
28 Jun 07 |
martin |
575 |
{ |
3535 |
28 Jun 07 |
martin |
576 |
%> |
6223 |
15 Jan 13 |
nicklas |
577 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
6223 |
15 Jan 13 |
nicklas |
578 |
style="width: 15m;" value="<%=value == null ? "" : value%>" maxlength="20"> |
3535 |
28 Jun 07 |
martin |
579 |
<% |
3535 |
28 Jun 07 |
martin |
580 |
} |
3539 |
29 Jun 07 |
martin |
581 |
else if (type == Type.FLOAT || type == Type.DOUBLE) |
3539 |
29 Jun 07 |
martin |
582 |
{ |
3539 |
29 Jun 07 |
martin |
583 |
%> |
6223 |
15 Jan 13 |
nicklas |
584 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
6223 |
15 Jan 13 |
nicklas |
585 |
value="<%=value == null ? "" : value%>" style="width: 15m;" maxlength="20"> |
3539 |
29 Jun 07 |
martin |
586 |
<% |
3539 |
29 Jun 07 |
martin |
587 |
} |
3539 |
29 Jun 07 |
martin |
588 |
else if (type == Type.STRING) |
3539 |
29 Jun 07 |
martin |
589 |
{ |
3539 |
29 Jun 07 |
martin |
590 |
%> |
6223 |
15 Jan 13 |
nicklas |
591 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
3539 |
29 Jun 07 |
martin |
592 |
value="<%=HTML.encodeTags((String)value)%>" |
5921 |
10 Jan 12 |
nicklas |
593 |
maxlength="<%=ep.getLength()%>" |
3539 |
29 Jun 07 |
martin |
594 |
> |
3539 |
29 Jun 07 |
martin |
595 |
<% |
3539 |
29 Jun 07 |
martin |
596 |
} |
3539 |
29 Jun 07 |
martin |
597 |
else if (type == Type.TEXT) |
3539 |
29 Jun 07 |
martin |
598 |
{ |
5921 |
10 Jan 12 |
nicklas |
599 |
addZoom = true; |
3539 |
29 Jun 07 |
martin |
600 |
%> |
6223 |
15 Jan 13 |
nicklas |
601 |
<textarea class="<%=theClazz%>" name="<%=fieldName%>" id="<%=fieldName%>" rows="6" |
3539 |
29 Jun 07 |
martin |
602 |
><%=HTML.encodeTags((String)value)%></textarea> |
3539 |
29 Jun 07 |
martin |
603 |
<% |
3539 |
29 Jun 07 |
martin |
604 |
} |
3539 |
29 Jun 07 |
martin |
605 |
else if (type == Type.BOOLEAN) |
3539 |
29 Jun 07 |
martin |
606 |
{ |
3539 |
29 Jun 07 |
martin |
607 |
Boolean b = (Boolean)value; |
3539 |
29 Jun 07 |
martin |
608 |
if (!required) |
3539 |
29 Jun 07 |
martin |
609 |
{ |
3539 |
29 Jun 07 |
martin |
610 |
%> |
6223 |
15 Jan 13 |
nicklas |
611 |
<input type="radio" name="<%=fieldName%>" id="<%=fieldName%>.null" value="" |
3539 |
29 Jun 07 |
martin |
612 |
<%=b == null ? "checked" : ""%> |
6223 |
15 Jan 13 |
nicklas |
613 |
><label for="<%=fieldName%>.null"><i>- not specified -</i></label><br> |
3539 |
29 Jun 07 |
martin |
614 |
<% |
3539 |
29 Jun 07 |
martin |
615 |
} |
3539 |
29 Jun 07 |
martin |
616 |
%> |
6223 |
15 Jan 13 |
nicklas |
617 |
<input type="radio" name="<%=fieldName%>" id="<%=fieldName%>.true" value="true" |
3539 |
29 Jun 07 |
martin |
618 |
<%=b != null && b == true ? "checked" : ""%> |
7501 |
09 Aug 18 |
nicklas |
619 |
><label for="<%=fieldName%>.true">true</label> |
6223 |
15 Jan 13 |
nicklas |
620 |
<input type="radio" name="<%=fieldName%>" id="<%=fieldName%>.false" value="false" |
7501 |
09 Aug 18 |
nicklas |
621 |
<%=b != null && b == false || required && b == null ? "checked" : ""%> |
6223 |
15 Jan 13 |
nicklas |
622 |
><label for="<%=fieldName%>.false">false</label> |
3539 |
29 Jun 07 |
martin |
623 |
<% |
3539 |
29 Jun 07 |
martin |
624 |
} |
3539 |
29 Jun 07 |
martin |
625 |
else if (type == Type.DATE) |
3539 |
29 Jun 07 |
martin |
626 |
{ |
3539 |
29 Jun 07 |
martin |
627 |
%> |
3539 |
29 Jun 07 |
martin |
628 |
<table> |
3539 |
29 Jun 07 |
martin |
629 |
<tr> |
3539 |
29 Jun 07 |
martin |
630 |
<td> |
6223 |
15 Jan 13 |
nicklas |
631 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
5921 |
10 Jan 12 |
nicklas |
632 |
value="<%=dateFormatter.format((Date)value)%>" style="width: 15em;" |
5921 |
10 Jan 12 |
nicklas |
633 |
maxlength="20" title="Enter date in format: <%=htmlDateFormat%>" |
3539 |
29 Jun 07 |
martin |
634 |
> |
3539 |
29 Jun 07 |
martin |
635 |
</td> |
3539 |
29 Jun 07 |
martin |
636 |
<td> |
6223 |
15 Jan 13 |
nicklas |
637 |
<base:calendar textarea="<%=fieldName%>" title="<%=HTML.encodeTags(ep.getTitle())%>" /> |
3539 |
29 Jun 07 |
martin |
638 |
</td> |
3539 |
29 Jun 07 |
martin |
639 |
</tr> |
3539 |
29 Jun 07 |
martin |
640 |
</table> |
3539 |
29 Jun 07 |
martin |
641 |
<% |
3539 |
29 Jun 07 |
martin |
642 |
} |
5432 |
29 Sep 10 |
nicklas |
643 |
else if (type == Type.TIMESTAMP) |
5432 |
29 Sep 10 |
nicklas |
644 |
{ |
5432 |
29 Sep 10 |
nicklas |
645 |
%> |
5432 |
29 Sep 10 |
nicklas |
646 |
<table> |
5432 |
29 Sep 10 |
nicklas |
647 |
<tr> |
5432 |
29 Sep 10 |
nicklas |
648 |
<td> |
6223 |
15 Jan 13 |
nicklas |
649 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
5921 |
10 Jan 12 |
nicklas |
650 |
value="<%=dateTimeFormatter.format((Date)value)%>" style="width: 15em;" |
5921 |
10 Jan 12 |
nicklas |
651 |
maxlength="20" title="Enter timestamp in format: <%=htmlDateTimeFormat%>" |
5432 |
29 Sep 10 |
nicklas |
652 |
> |
5432 |
29 Sep 10 |
nicklas |
653 |
</td> |
5432 |
29 Sep 10 |
nicklas |
654 |
<td> |
6223 |
15 Jan 13 |
nicklas |
655 |
<base:calendar textarea="<%=fieldName%>" title="<%=HTML.encodeTags(ep.getTitle()) %>" |
6216 |
14 Dec 12 |
nicklas |
656 |
data-use-time="1" |
5432 |
29 Sep 10 |
nicklas |
657 |
tooltip="Select a timestamp from a calendar" |
5432 |
29 Sep 10 |
nicklas |
658 |
/> |
5432 |
29 Sep 10 |
nicklas |
659 |
</td> |
5432 |
29 Sep 10 |
nicklas |
660 |
</tr> |
5432 |
29 Sep 10 |
nicklas |
661 |
</table> |
5432 |
29 Sep 10 |
nicklas |
662 |
<% |
5432 |
29 Sep 10 |
nicklas |
663 |
} |
3535 |
28 Jun 07 |
martin |
664 |
%> |
3535 |
28 Jun 07 |
martin |
665 |
</td> |
5921 |
10 Jan 12 |
nicklas |
666 |
<td style="width: 20px;"> |
5921 |
10 Jan 12 |
nicklas |
667 |
<%if (addZoom) |
5921 |
10 Jan 12 |
nicklas |
668 |
{ |
5921 |
10 Jan 12 |
nicklas |
669 |
%> |
6223 |
15 Jan 13 |
nicklas |
670 |
<base:zoom textarea="<%=fieldName%>" title="<%=HTML.encodeTags(ep.getTitle()) %>" /> |
5921 |
10 Jan 12 |
nicklas |
671 |
<% |
5921 |
10 Jan 12 |
nicklas |
672 |
} |
5921 |
10 Jan 12 |
nicklas |
673 |
%> |
5921 |
10 Jan 12 |
nicklas |
674 |
</td> |
3539 |
29 Jun 07 |
martin |
675 |
</tr> |
3539 |
29 Jun 07 |
martin |
676 |
<% |
3539 |
29 Jun 07 |
martin |
677 |
} |
3539 |
29 Jun 07 |
martin |
678 |
%> |
5921 |
10 Jan 12 |
nicklas |
679 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
680 |
<th></th> |
5921 |
10 Jan 12 |
nicklas |
681 |
<td colspan="2"></td> |
5921 |
10 Jan 12 |
nicklas |
682 |
</tr> |
3539 |
29 Jun 07 |
martin |
683 |
</table> |
3539 |
29 Jun 07 |
martin |
684 |
</t:tab> |
3539 |
29 Jun 07 |
martin |
685 |
<% |
3539 |
29 Jun 07 |
martin |
686 |
} |
3539 |
29 Jun 07 |
martin |
687 |
%> |
2434 |
27 Jun 06 |
nicklas |
688 |
<t:tab id="members" title="Membership" tooltip="Manage group and role membership" |
6224 |
15 Jan 13 |
nicklas |
689 |
helpid="user.edit.membership"> |
5922 |
11 Jan 12 |
nicklas |
690 |
<table class="fullform input100"> |
5921 |
10 Jan 12 |
nicklas |
691 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
692 |
<th>Member in</th> |
5921 |
10 Jan 12 |
nicklas |
693 |
<td> |
5921 |
10 Jan 12 |
nicklas |
694 |
<div class="selectionlist"> |
5921 |
10 Jan 12 |
nicklas |
695 |
<table> |
5921 |
10 Jan 12 |
nicklas |
696 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
697 |
<td> |
6291 |
11 Jun 13 |
nicklas |
698 |
<select name="membership" id="membership" |
6291 |
11 Jun 13 |
nicklas |
699 |
class="auto-init" |
6291 |
11 Jun 13 |
nicklas |
700 |
data-auto-init="link-container" |
6291 |
11 Jun 13 |
nicklas |
701 |
data-initial-items="<%=HTML.encodeTags(jsonMembers.toJSONString()) %>" |
6291 |
11 Jun 13 |
nicklas |
702 |
data-initial-action="<%=itemId == 0 ? 1 : 0 %>" |
6291 |
11 Jun 13 |
nicklas |
703 |
size="15" multiple <%=!writeMembership ? "disabled readonly class=\"disabled\"" : ""%>> |
5921 |
10 Jan 12 |
nicklas |
704 |
</select> |
5921 |
10 Jan 12 |
nicklas |
705 |
</td> |
5921 |
10 Jan 12 |
nicklas |
706 |
<td style="vertical-align: top;"> |
5921 |
10 Jan 12 |
nicklas |
707 |
<base:buttongroup vertical="true"> |
5921 |
10 Jan 12 |
nicklas |
708 |
<base:button |
6223 |
15 Jan 13 |
nicklas |
709 |
id="btnAddGroups" |
6291 |
11 Jun 13 |
nicklas |
710 |
subclass="leftaligned auto-init" |
6291 |
11 Jun 13 |
nicklas |
711 |
data-auto-init="add-link" |
6291 |
11 Jun 13 |
nicklas |
712 |
data-list-id="membership" |
6291 |
11 Jun 13 |
nicklas |
713 |
data-item-type="GROUP" |
5921 |
10 Jan 12 |
nicklas |
714 |
title="Add groups…" |
5921 |
10 Jan 12 |
nicklas |
715 |
tooltip="Add groups to this user" |
5921 |
10 Jan 12 |
nicklas |
716 |
disabled="<%=!writeMembership %>" |
5921 |
10 Jan 12 |
nicklas |
717 |
/> |
5921 |
10 Jan 12 |
nicklas |
718 |
<base:button |
6223 |
15 Jan 13 |
nicklas |
719 |
id="btnAddRoles" |
6291 |
11 Jun 13 |
nicklas |
720 |
subclass="leftaligned auto-init" |
6291 |
11 Jun 13 |
nicklas |
721 |
data-auto-init="add-link" |
6291 |
11 Jun 13 |
nicklas |
722 |
data-list-id="membership" |
6291 |
11 Jun 13 |
nicklas |
723 |
data-item-type="ROLE" |
5921 |
10 Jan 12 |
nicklas |
724 |
title="Add roles…" |
5921 |
10 Jan 12 |
nicklas |
725 |
tooltip="Add roles to this user" |
5921 |
10 Jan 12 |
nicklas |
726 |
disabled="<%=!writeMembership %>" |
5921 |
10 Jan 12 |
nicklas |
727 |
/> |
5921 |
10 Jan 12 |
nicklas |
728 |
<base:button |
6223 |
15 Jan 13 |
nicklas |
729 |
id="btnRemoveMembership" |
6291 |
11 Jun 13 |
nicklas |
730 |
subclass="leftaligned auto-init" |
6291 |
11 Jun 13 |
nicklas |
731 |
data-auto-init="remove-link" |
6291 |
11 Jun 13 |
nicklas |
732 |
data-list-id="membership" |
5921 |
10 Jan 12 |
nicklas |
733 |
title="Remove" |
5921 |
10 Jan 12 |
nicklas |
734 |
tooltip="Remove the user from the selected items" |
5921 |
10 Jan 12 |
nicklas |
735 |
disabled="<%=!writeMembership%>" |
5921 |
10 Jan 12 |
nicklas |
736 |
/> |
5921 |
10 Jan 12 |
nicklas |
737 |
</base:buttongroup> |
5921 |
10 Jan 12 |
nicklas |
738 |
</td> |
5921 |
10 Jan 12 |
nicklas |
739 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
740 |
</table> |
5921 |
10 Jan 12 |
nicklas |
741 |
</div> |
5921 |
10 Jan 12 |
nicklas |
742 |
</td> |
1970 |
13 Feb 06 |
nicklas |
743 |
</tr> |
583 |
13 May 05 |
nicklas |
744 |
</table> |
1970 |
13 Feb 06 |
nicklas |
745 |
|
556 |
11 May 05 |
nicklas |
746 |
</t:tab> |
556 |
11 May 05 |
nicklas |
747 |
</t:tabcontrol> |
5921 |
10 Jan 12 |
nicklas |
748 |
</form> |
5921 |
10 Jan 12 |
nicklas |
749 |
|
5921 |
10 Jan 12 |
nicklas |
750 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
751 |
<base:icon image="required.png" />= required information |
5921 |
10 Jan 12 |
nicklas |
752 |
</div> |
1968 |
10 Feb 06 |
nicklas |
753 |
|
5921 |
10 Jan 12 |
nicklas |
754 |
<base:buttongroup subclass="dialogbuttons"> |
6223 |
15 Jan 13 |
nicklas |
755 |
<base:button id="btnSave" title="Save" /> |
6223 |
15 Jan 13 |
nicklas |
756 |
<base:button id="close" title="Cancel" /> |
5921 |
10 Jan 12 |
nicklas |
757 |
</base:buttongroup> |
556 |
11 May 05 |
nicklas |
758 |
</base:body> |
556 |
11 May 05 |
nicklas |
759 |
</base:page> |
556 |
11 May 05 |
nicklas |
760 |
<% |
556 |
11 May 05 |
nicklas |
761 |
} |
556 |
11 May 05 |
nicklas |
762 |
finally |
556 |
11 May 05 |
nicklas |
763 |
{ |
556 |
11 May 05 |
nicklas |
764 |
if (dc != null) dc.close(); |
556 |
11 May 05 |
nicklas |
765 |
} |
556 |
11 May 05 |
nicklas |
766 |
%> |