613 |
18 May 05 |
nicklas |
1 |
<%-- $Id$ |
613 |
18 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 |
613 |
18 May 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/ |
613 |
18 May 05 |
nicklas |
8 |
|
613 |
18 May 05 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
613 |
18 May 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 |
613 |
18 May 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
613 |
18 May 05 |
nicklas |
13 |
|
613 |
18 May 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
613 |
18 May 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
613 |
18 May 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
613 |
18 May 05 |
nicklas |
17 |
GNU General Public License for more details. |
613 |
18 May 05 |
nicklas |
18 |
|
613 |
18 May 05 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
613 |
18 May 05 |
nicklas |
21 |
------------------------------------------------------------------ |
613 |
18 May 05 |
nicklas |
22 |
|
613 |
18 May 05 |
nicklas |
23 |
|
613 |
18 May 05 |
nicklas |
24 |
@author Nicklas |
613 |
18 May 05 |
nicklas |
25 |
@version 2.0 |
613 |
18 May 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
613 |
18 May 05 |
nicklas |
28 |
import="net.sf.basedb.core.SessionControl" |
613 |
18 May 05 |
nicklas |
29 |
import="net.sf.basedb.core.DbControl" |
613 |
18 May 05 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
2004 |
16 Feb 06 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
613 |
18 May 05 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
613 |
18 May 05 |
nicklas |
33 |
import="net.sf.basedb.core.Client" |
2004 |
16 Feb 06 |
nicklas |
34 |
import="net.sf.basedb.core.ItemQuery" |
2004 |
16 Feb 06 |
nicklas |
35 |
import="net.sf.basedb.core.ItemResultList" |
2004 |
16 Feb 06 |
nicklas |
36 |
import="net.sf.basedb.core.PermissionDeniedException" |
613 |
18 May 05 |
nicklas |
37 |
import="net.sf.basedb.core.query.Orders" |
2004 |
16 Feb 06 |
nicklas |
38 |
import="net.sf.basedb.core.query.Hql" |
613 |
18 May 05 |
nicklas |
39 |
import="net.sf.basedb.clients.web.Base" |
613 |
18 May 05 |
nicklas |
40 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
41 |
import="net.sf.basedb.util.Values" |
5506 |
19 Nov 10 |
nicklas |
42 |
import="net.sf.basedb.core.plugin.GuiContext" |
5506 |
19 Nov 10 |
nicklas |
43 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5506 |
19 Nov 10 |
nicklas |
44 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5506 |
19 Nov 10 |
nicklas |
45 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5506 |
19 Nov 10 |
nicklas |
47 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
613 |
18 May 05 |
nicklas |
48 |
%> |
613 |
18 May 05 |
nicklas |
49 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
613 |
18 May 05 |
nicklas |
50 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6147 |
21 Sep 12 |
nicklas |
51 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
613 |
18 May 05 |
nicklas |
52 |
<% |
2004 |
16 Feb 06 |
nicklas |
53 |
final Item itemType = Item.CLIENT; |
2004 |
16 Feb 06 |
nicklas |
54 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2004 |
16 Feb 06 |
nicklas |
55 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
2004 |
16 Feb 06 |
nicklas |
56 |
final int itemId = cc.getId(); |
613 |
18 May 05 |
nicklas |
57 |
final String ID = sc.getId(); |
613 |
18 May 05 |
nicklas |
58 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
59 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
613 |
18 May 05 |
nicklas |
60 |
try |
613 |
18 May 05 |
nicklas |
61 |
{ |
613 |
18 May 05 |
nicklas |
62 |
String title = null; |
613 |
18 May 05 |
nicklas |
63 |
Client client = null; |
2004 |
16 Feb 06 |
nicklas |
64 |
|
2004 |
16 Feb 06 |
nicklas |
65 |
if (itemId == 0) |
613 |
18 May 05 |
nicklas |
66 |
{ |
2004 |
16 Feb 06 |
nicklas |
67 |
title = "Create client application"; |
2004 |
16 Feb 06 |
nicklas |
68 |
cc.removeObject("item"); |
613 |
18 May 05 |
nicklas |
69 |
} |
613 |
18 May 05 |
nicklas |
70 |
else |
613 |
18 May 05 |
nicklas |
71 |
{ |
2004 |
16 Feb 06 |
nicklas |
72 |
client = Client.getById(dc, itemId); |
2004 |
16 Feb 06 |
nicklas |
73 |
cc.setObject("item", client); |
2004 |
16 Feb 06 |
nicklas |
74 |
title = "Edit client application -- " + HTML.encodeTags(client.getName()); |
613 |
18 May 05 |
nicklas |
75 |
} |
2004 |
16 Feb 06 |
nicklas |
76 |
if (client != null && !client.hasPermission(Permission.WRITE)) |
2004 |
16 Feb 06 |
nicklas |
77 |
{ |
2004 |
16 Feb 06 |
nicklas |
78 |
throw new PermissionDeniedException(Permission.WRITE, itemType.toString()); |
2004 |
16 Feb 06 |
nicklas |
79 |
} |
2004 |
16 Feb 06 |
nicklas |
80 |
|
6217 |
14 Dec 12 |
nicklas |
81 |
|
6217 |
14 Dec 12 |
nicklas |
82 |
|
5506 |
19 Nov 10 |
nicklas |
83 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), client); |
7604 |
25 Feb 19 |
nicklas |
84 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
613 |
18 May 05 |
nicklas |
85 |
%> |
6295 |
13 Jun 13 |
nicklas |
86 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6295 |
13 Jun 13 |
nicklas |
87 |
<base:head scripts="tabcontrol-2.js,~clients.js" styles="tabcontrol.css"> |
5506 |
19 Nov 10 |
nicklas |
88 |
<ext:scripts context="<%=jspContext%>" /> |
5506 |
19 Nov 10 |
nicklas |
89 |
<ext:stylesheets context="<%=jspContext%>" /> |
613 |
18 May 05 |
nicklas |
90 |
</base:head> |
6295 |
13 Jun 13 |
nicklas |
91 |
<base:body> |
5921 |
10 Jan 12 |
nicklas |
92 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
93 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="client"> |
2004 |
16 Feb 06 |
nicklas |
94 |
<input type="hidden" name="cmd" value="UpdateItem"> |
2004 |
16 Feb 06 |
nicklas |
95 |
|
5921 |
10 Jan 12 |
nicklas |
96 |
<t:tabcontrol id="settings" |
5921 |
10 Jan 12 |
nicklas |
97 |
subclass="content dialogtabcontrol" |
5506 |
19 Nov 10 |
nicklas |
98 |
position="bottom" remember="<%=client != null%>" |
5506 |
19 Nov 10 |
nicklas |
99 |
extensions="<%=invoker%>"> |
6295 |
13 Jun 13 |
nicklas |
100 |
<t:tab id="info" title="Client application" helpid="client.edit"> |
5921 |
10 Jan 12 |
nicklas |
101 |
<table class="fullform input100 smaller"> |
613 |
18 May 05 |
nicklas |
102 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
103 |
<th>Name</th> |
6295 |
13 Jun 13 |
nicklas |
104 |
<td><input class="text required auto-init" type="text" name="name" data-auto-init="<%=client == null ? "focus-select" : "focus" %>" |
2004 |
16 Feb 06 |
nicklas |
105 |
value="<%=HTML.encodeTags(client == null ? Values.getString(cc.getPropertyValue("name"), "New client application") : client.getName())%>" |
5921 |
10 Jan 12 |
nicklas |
106 |
maxlength="<%=Client.MAX_NAME_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
107 |
<td></td> |
613 |
18 May 05 |
nicklas |
108 |
</tr> |
613 |
18 May 05 |
nicklas |
109 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
110 |
<th>External Id</th> |
6217 |
14 Dec 12 |
nicklas |
111 |
<td><input class="text required" type="text" name="external_id" |
2004 |
16 Feb 06 |
nicklas |
112 |
value="<%=HTML.encodeTags(client == null ? cc.getPropertyValue("externalId") : client.getExternalId())%>" |
5921 |
10 Jan 12 |
nicklas |
113 |
maxlength="<%=Client.MAX_EXTERNAL_ID_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
114 |
<td></td> |
613 |
18 May 05 |
nicklas |
115 |
</tr> |
7403 |
04 Oct 17 |
nicklas |
116 |
<tr> |
7403 |
04 Oct 17 |
nicklas |
117 |
<th></th> |
7403 |
04 Oct 17 |
nicklas |
118 |
<td><input type="checkbox" name="supports_device_verification" id="supports_device_verification" value="1" |
7403 |
04 Oct 17 |
nicklas |
119 |
<%=(client != null && client.getSupportsDeviceVerification()) || |
7403 |
04 Oct 17 |
nicklas |
120 |
(client == null && Values.getBoolean(cc.getPropertyValue("supportsDeviceVerification"))) ? "checked" : ""%> |
7412 |
11 Oct 17 |
nicklas |
121 |
><label for="supports_device_verification">Supports 2-factor login</label> |
7403 |
04 Oct 17 |
nicklas |
122 |
</td> |
7403 |
04 Oct 17 |
nicklas |
123 |
<td></td> |
7403 |
04 Oct 17 |
nicklas |
124 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
125 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
126 |
<th>Description</th> |
5921 |
10 Jan 12 |
nicklas |
127 |
<td> |
6217 |
14 Dec 12 |
nicklas |
128 |
<textarea class="text" rows="6" name="description" id="description" |
2004 |
16 Feb 06 |
nicklas |
129 |
><%=HTML.encodeTags(client == null ? cc.getPropertyValue("description") : client.getDescription())%></textarea> |
613 |
18 May 05 |
nicklas |
130 |
</td> |
5921 |
10 Jan 12 |
nicklas |
131 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
132 |
<base:zoom textarea="description" title="Description" /> |
5921 |
10 Jan 12 |
nicklas |
133 |
</td> |
613 |
18 May 05 |
nicklas |
134 |
</tr> |
613 |
18 May 05 |
nicklas |
135 |
</table> |
613 |
18 May 05 |
nicklas |
136 |
</t:tab> |
613 |
18 May 05 |
nicklas |
137 |
</t:tabcontrol> |
5921 |
10 Jan 12 |
nicklas |
138 |
</form> |
5921 |
10 Jan 12 |
nicklas |
139 |
|
5921 |
10 Jan 12 |
nicklas |
140 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
141 |
<base:icon image="required.png" />= required information |
5921 |
10 Jan 12 |
nicklas |
142 |
</div> |
613 |
18 May 05 |
nicklas |
143 |
|
5921 |
10 Jan 12 |
nicklas |
144 |
<base:buttongroup subclass="dialogbuttons"> |
6295 |
13 Jun 13 |
nicklas |
145 |
<base:button id="btnSave" title="Save" /> |
6295 |
13 Jun 13 |
nicklas |
146 |
<base:button id="close" title="Cancel" /> |
5921 |
10 Jan 12 |
nicklas |
147 |
</base:buttongroup> |
613 |
18 May 05 |
nicklas |
148 |
</base:body> |
613 |
18 May 05 |
nicklas |
149 |
</base:page> |
613 |
18 May 05 |
nicklas |
150 |
<% |
613 |
18 May 05 |
nicklas |
151 |
} |
613 |
18 May 05 |
nicklas |
152 |
finally |
613 |
18 May 05 |
nicklas |
153 |
{ |
613 |
18 May 05 |
nicklas |
154 |
if (dc != null) dc.close(); |
613 |
18 May 05 |
nicklas |
155 |
} |
613 |
18 May 05 |
nicklas |
156 |
%> |