703 |
01 Jun 05 |
nicklas |
1 |
<%-- $Id$ |
703 |
01 Jun 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 |
703 |
01 Jun 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/ |
703 |
01 Jun 05 |
nicklas |
8 |
|
1777 |
17 Jan 06 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
703 |
01 Jun 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 |
703 |
01 Jun 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
703 |
01 Jun 05 |
nicklas |
13 |
|
703 |
01 Jun 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
703 |
01 Jun 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
703 |
01 Jun 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
703 |
01 Jun 05 |
nicklas |
17 |
GNU General Public License for more details. |
703 |
01 Jun 05 |
nicklas |
18 |
|
703 |
01 Jun 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/>. |
703 |
01 Jun 05 |
nicklas |
21 |
------------------------------------------------------------------ |
703 |
01 Jun 05 |
nicklas |
22 |
|
703 |
01 Jun 05 |
nicklas |
23 |
|
703 |
01 Jun 05 |
nicklas |
24 |
@author Nicklas |
703 |
01 Jun 05 |
nicklas |
25 |
@version 2.0 |
703 |
01 Jun 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
6328 |
15 Oct 13 |
olle |
28 |
import="net.sf.basedb.core.AnnotationType" |
703 |
01 Jun 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
703 |
01 Jun 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
703 |
01 Jun 05 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
1777 |
17 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.ItemContext" |
703 |
01 Jun 05 |
nicklas |
33 |
import="net.sf.basedb.core.Permission" |
703 |
01 Jun 05 |
nicklas |
34 |
import="net.sf.basedb.core.Hardware" |
5630 |
13 May 11 |
nicklas |
35 |
import="net.sf.basedb.core.ItemSubtype" |
1418 |
07 Oct 05 |
nicklas |
36 |
import="net.sf.basedb.core.ItemQuery" |
5643 |
26 May 11 |
nicklas |
37 |
import="net.sf.basedb.core.Include" |
1418 |
07 Oct 05 |
nicklas |
38 |
import="net.sf.basedb.core.ItemResultList" |
1777 |
17 Jan 06 |
nicklas |
39 |
import="net.sf.basedb.core.PermissionDeniedException" |
703 |
01 Jun 05 |
nicklas |
40 |
import="net.sf.basedb.core.query.Orders" |
1418 |
07 Oct 05 |
nicklas |
41 |
import="net.sf.basedb.core.query.Hql" |
703 |
01 Jun 05 |
nicklas |
42 |
import="net.sf.basedb.clients.web.Base" |
703 |
01 Jun 05 |
nicklas |
43 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
44 |
import="net.sf.basedb.util.Values" |
5506 |
19 Nov 10 |
nicklas |
45 |
import="net.sf.basedb.core.plugin.GuiContext" |
5506 |
19 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5506 |
19 Nov 10 |
nicklas |
47 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5506 |
19 Nov 10 |
nicklas |
48 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
49 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5506 |
19 Nov 10 |
nicklas |
50 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
703 |
01 Jun 05 |
nicklas |
51 |
%> |
703 |
01 Jun 05 |
nicklas |
52 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
703 |
01 Jun 05 |
nicklas |
53 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6147 |
21 Sep 12 |
nicklas |
54 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
703 |
01 Jun 05 |
nicklas |
55 |
<% |
1777 |
17 Jan 06 |
nicklas |
56 |
final Item itemType = Item.HARDWARE; |
1777 |
17 Jan 06 |
nicklas |
57 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1777 |
17 Jan 06 |
nicklas |
58 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1777 |
17 Jan 06 |
nicklas |
59 |
final int itemId = cc.getId(); |
703 |
01 Jun 05 |
nicklas |
60 |
final String ID = sc.getId(); |
703 |
01 Jun 05 |
nicklas |
61 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
62 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
703 |
01 Jun 05 |
nicklas |
63 |
try |
703 |
01 Jun 05 |
nicklas |
64 |
{ |
703 |
01 Jun 05 |
nicklas |
65 |
String title = null; |
703 |
01 Jun 05 |
nicklas |
66 |
Hardware hardware = null; |
5643 |
26 May 11 |
nicklas |
67 |
boolean readCurrentSubtype = true; |
5643 |
26 May 11 |
nicklas |
68 |
int currentSubtypeId = 0; |
1777 |
17 Jan 06 |
nicklas |
69 |
|
1777 |
17 Jan 06 |
nicklas |
70 |
if (itemId == 0) |
703 |
01 Jun 05 |
nicklas |
71 |
{ |
703 |
01 Jun 05 |
nicklas |
72 |
title = "Create hardware"; |
1777 |
17 Jan 06 |
nicklas |
73 |
cc.removeObject("item"); |
5643 |
26 May 11 |
nicklas |
74 |
currentSubtypeId = Values.getInt(request.getParameter("subtype_id")); |
5643 |
26 May 11 |
nicklas |
75 |
if (currentSubtypeId == 0) |
2442 |
28 Jun 06 |
nicklas |
76 |
{ |
5643 |
26 May 11 |
nicklas |
77 |
int recentSubtypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); |
5643 |
26 May 11 |
nicklas |
78 |
currentSubtypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentSubtypeId); |
2442 |
28 Jun 06 |
nicklas |
79 |
} |
703 |
01 Jun 05 |
nicklas |
80 |
} |
703 |
01 Jun 05 |
nicklas |
81 |
else |
703 |
01 Jun 05 |
nicklas |
82 |
{ |
1777 |
17 Jan 06 |
nicklas |
83 |
hardware = Hardware.getById(dc, itemId); |
5643 |
26 May 11 |
nicklas |
84 |
hardware.checkPermission(Permission.WRITE); |
1777 |
17 Jan 06 |
nicklas |
85 |
cc.setObject("item", hardware); |
703 |
01 Jun 05 |
nicklas |
86 |
title = "Edit hardware -- " + HTML.encodeTags(hardware.getName()); |
1777 |
17 Jan 06 |
nicklas |
87 |
try |
1777 |
17 Jan 06 |
nicklas |
88 |
{ |
5643 |
26 May 11 |
nicklas |
89 |
ItemSubtype subtype = hardware.getItemSubtype(); |
5643 |
26 May 11 |
nicklas |
90 |
if (subtype != null) currentSubtypeId = subtype.getId(); |
1777 |
17 Jan 06 |
nicklas |
91 |
} |
1777 |
17 Jan 06 |
nicklas |
92 |
catch (PermissionDeniedException ex) |
1777 |
17 Jan 06 |
nicklas |
93 |
{ |
5643 |
26 May 11 |
nicklas |
94 |
readCurrentSubtype = false; |
1777 |
17 Jan 06 |
nicklas |
95 |
} |
703 |
01 Jun 05 |
nicklas |
96 |
} |
703 |
01 Jun 05 |
nicklas |
97 |
|
1777 |
17 Jan 06 |
nicklas |
98 |
// Query to retrieve file types |
5643 |
26 May 11 |
nicklas |
99 |
final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); |
5643 |
26 May 11 |
nicklas |
100 |
subtypesQuery.include(Include.ALL); |
6296 |
13 Jun 13 |
nicklas |
101 |
|
5506 |
19 Nov 10 |
nicklas |
102 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), hardware); |
7604 |
25 Feb 19 |
nicklas |
103 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
703 |
01 Jun 05 |
nicklas |
104 |
%> |
6296 |
13 Jun 13 |
nicklas |
105 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6332 |
16 Oct 13 |
olle |
106 |
<base:head scripts="tabcontrol-2.js,subtypes.js,~hardware.js" styles="tabcontrol.css"> |
5506 |
19 Nov 10 |
nicklas |
107 |
<ext:scripts context="<%=jspContext%>" /> |
5506 |
19 Nov 10 |
nicklas |
108 |
<ext:stylesheets context="<%=jspContext%>" /> |
703 |
01 Jun 05 |
nicklas |
109 |
</base:head> |
6296 |
13 Jun 13 |
nicklas |
110 |
<base:body> |
5921 |
10 Jan 12 |
nicklas |
111 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
112 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="hardware"> |
1777 |
17 Jan 06 |
nicklas |
113 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1777 |
17 Jan 06 |
nicklas |
114 |
|
5921 |
10 Jan 12 |
nicklas |
115 |
<t:tabcontrol id="settings" |
5921 |
10 Jan 12 |
nicklas |
116 |
subclass="content dialogtabcontrol" |
5506 |
19 Nov 10 |
nicklas |
117 |
position="bottom" remember="<%=hardware != null%>" |
5506 |
19 Nov 10 |
nicklas |
118 |
extensions="<%=invoker%>"> |
6296 |
13 Jun 13 |
nicklas |
119 |
<t:tab id="info" title="Hardware" helpid="hardware.edit"> |
5921 |
10 Jan 12 |
nicklas |
120 |
<table class="fullform input100 smaller"> |
703 |
01 Jun 05 |
nicklas |
121 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
122 |
<th>Name</th> |
6296 |
13 Jun 13 |
nicklas |
123 |
<td><input class="text required auto-init" type="text" name="name" data-auto-init="<%=hardware == null ? "focus-select" : "focus" %>" |
1777 |
17 Jan 06 |
nicklas |
124 |
value="<%=HTML.encodeTags(hardware == null ? Values.getString(cc.getPropertyValue("name"), "New hardware") : hardware.getName())%>" |
5921 |
10 Jan 12 |
nicklas |
125 |
maxlength="<%=Hardware.MAX_NAME_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
126 |
<td></td> |
703 |
01 Jun 05 |
nicklas |
127 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
128 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
129 |
<th>Type</th> |
5921 |
10 Jan 12 |
nicklas |
130 |
<td> |
6296 |
13 Jun 13 |
nicklas |
131 |
<select name="subtype_id" id="subtype_id" |
6058 |
13 Jun 12 |
nicklas |
132 |
<%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%> |
6058 |
13 Jun 12 |
nicklas |
133 |
> |
703 |
01 Jun 05 |
nicklas |
134 |
<% |
5643 |
26 May 11 |
nicklas |
135 |
if (!readCurrentSubtype) |
703 |
01 Jun 05 |
nicklas |
136 |
{ |
703 |
01 Jun 05 |
nicklas |
137 |
%> |
703 |
01 Jun 05 |
nicklas |
138 |
<option value="-1">- denied - |
703 |
01 Jun 05 |
nicklas |
139 |
<% |
703 |
01 Jun 05 |
nicklas |
140 |
} |
703 |
01 Jun 05 |
nicklas |
141 |
else |
703 |
01 Jun 05 |
nicklas |
142 |
{ |
5643 |
26 May 11 |
nicklas |
143 |
%> |
5643 |
26 May 11 |
nicklas |
144 |
<option value="0">-none- |
5643 |
26 May 11 |
nicklas |
145 |
<% |
5643 |
26 May 11 |
nicklas |
146 |
for (ItemSubtype subtype : subtypesQuery.list(dc)) |
703 |
01 Jun 05 |
nicklas |
147 |
{ |
5643 |
26 May 11 |
nicklas |
148 |
int id = subtype.getId(); |
5643 |
26 May 11 |
nicklas |
149 |
if (id != currentSubtypeId && subtype.isRemoved()) continue; |
703 |
01 Jun 05 |
nicklas |
150 |
%> |
5643 |
26 May 11 |
nicklas |
151 |
<option value="<%=id == currentSubtypeId && hardware != null ? -id : id%>" |
5643 |
26 May 11 |
nicklas |
152 |
<%=id == currentSubtypeId ? "selected" : ""%> |
5643 |
26 May 11 |
nicklas |
153 |
title="<%=HTML.encodeTags(subtype.getDescription()) %>" |
5643 |
26 May 11 |
nicklas |
154 |
><%=HTML.encodeTags(subtype.getName())%> |
703 |
01 Jun 05 |
nicklas |
155 |
<% |
703 |
01 Jun 05 |
nicklas |
156 |
} |
703 |
01 Jun 05 |
nicklas |
157 |
} |
703 |
01 Jun 05 |
nicklas |
158 |
%> |
703 |
01 Jun 05 |
nicklas |
159 |
</select> |
703 |
01 Jun 05 |
nicklas |
160 |
</td> |
5921 |
10 Jan 12 |
nicklas |
161 |
<td></td> |
703 |
01 Jun 05 |
nicklas |
162 |
</tr> |
5643 |
26 May 11 |
nicklas |
163 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
164 |
<th>Version</th> |
6217 |
14 Dec 12 |
nicklas |
165 |
<td><input class="text" type="text" name="version" |
5643 |
26 May 11 |
nicklas |
166 |
value="<%=HTML.encodeTags(hardware == null ? cc.getPropertyValue("versionString") : hardware.getVersionString())%>" |
5921 |
10 Jan 12 |
nicklas |
167 |
maxlength="<%=Hardware.MAX_VERSIONSTRING_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
168 |
<td></td> |
5643 |
26 May 11 |
nicklas |
169 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
170 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
171 |
<th>Description</th> |
5921 |
10 Jan 12 |
nicklas |
172 |
<td> |
6217 |
14 Dec 12 |
nicklas |
173 |
<textarea class="text" rows="6" name="description" id="description" |
1777 |
17 Jan 06 |
nicklas |
174 |
><%=HTML.encodeTags(hardware == null ? cc.getPropertyValue("description") : hardware.getDescription())%></textarea> |
703 |
01 Jun 05 |
nicklas |
175 |
</td> |
5921 |
10 Jan 12 |
nicklas |
176 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
177 |
<base:zoom textarea="description" title="Description" /> |
5921 |
10 Jan 12 |
nicklas |
178 |
</td> |
703 |
01 Jun 05 |
nicklas |
179 |
</tr> |
5964 |
15 Feb 12 |
nicklas |
180 |
<% |
5964 |
15 Feb 12 |
nicklas |
181 |
if (sc.getActiveProjectId() != 0 && hardware == null && sc.getActiveProjectPermissions().contains(Permission.WRITE)) |
5964 |
15 Feb 12 |
nicklas |
182 |
{ |
5964 |
15 Feb 12 |
nicklas |
183 |
%> |
5964 |
15 Feb 12 |
nicklas |
184 |
<tr> |
5964 |
15 Feb 12 |
nicklas |
185 |
<th></th> |
6058 |
13 Jun 12 |
nicklas |
186 |
<td style="white-space: nowrap; overflow: hidden; padding-bottom: 2px;"> |
5964 |
15 Feb 12 |
nicklas |
187 |
<input type="checkbox" id="setAsProjectDefault" name="setAsProjectDefault" value="1" |
6058 |
13 Jun 12 |
nicklas |
188 |
checked><label for="setAsProjectDefault">Add as project default</label><br> |
6058 |
13 Jun 12 |
nicklas |
189 |
<input type="checkbox" id="replaceExistingDefault" name="replaceExistingDefault" value="1" |
6058 |
13 Jun 12 |
nicklas |
190 |
checked><label for="replaceExistingDefault">Replace existing default</label> |
6058 |
13 Jun 12 |
nicklas |
191 |
<span id="currentDefault" style="font-style: italic;"></span> |
5964 |
15 Feb 12 |
nicklas |
192 |
</td> |
5964 |
15 Feb 12 |
nicklas |
193 |
<td></td> |
5964 |
15 Feb 12 |
nicklas |
194 |
</tr> |
5964 |
15 Feb 12 |
nicklas |
195 |
<% |
5964 |
15 Feb 12 |
nicklas |
196 |
} |
5964 |
15 Feb 12 |
nicklas |
197 |
%> |
703 |
01 Jun 05 |
nicklas |
198 |
</table> |
703 |
01 Jun 05 |
nicklas |
199 |
</t:tab> |
6328 |
15 Oct 13 |
olle |
200 |
<t:tab id="annotations" title="Annotations" helpid="annotations.edit"> |
6328 |
15 Oct 13 |
olle |
201 |
<jsp:include page="../../common/annotations/annotate_frameset.jsp"> |
6328 |
15 Oct 13 |
olle |
202 |
<jsp:param name="item_type" value="<%=itemType.name()%>" /> |
6328 |
15 Oct 13 |
olle |
203 |
<jsp:param name="item_id" value="<%=itemId%>" /> |
6328 |
15 Oct 13 |
olle |
204 |
<jsp:param name="ID" value="<%=ID%>" /> |
6328 |
15 Oct 13 |
olle |
205 |
</jsp:include> |
6328 |
15 Oct 13 |
olle |
206 |
</t:tab> |
703 |
01 Jun 05 |
nicklas |
207 |
</t:tabcontrol> |
5921 |
10 Jan 12 |
nicklas |
208 |
</form> |
5921 |
10 Jan 12 |
nicklas |
209 |
|
5921 |
10 Jan 12 |
nicklas |
210 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
211 |
<base:icon image="required.png" />= required information |
5921 |
10 Jan 12 |
nicklas |
212 |
</div> |
703 |
01 Jun 05 |
nicklas |
213 |
|
5921 |
10 Jan 12 |
nicklas |
214 |
<base:buttongroup subclass="dialogbuttons"> |
6296 |
13 Jun 13 |
nicklas |
215 |
<base:button id="btnSave" title="Save" /> |
6296 |
13 Jun 13 |
nicklas |
216 |
<base:button id="close" title="Cancel" /> |
5921 |
10 Jan 12 |
nicklas |
217 |
</base:buttongroup> |
703 |
01 Jun 05 |
nicklas |
218 |
</base:body> |
703 |
01 Jun 05 |
nicklas |
219 |
</base:page> |
703 |
01 Jun 05 |
nicklas |
220 |
<% |
703 |
01 Jun 05 |
nicklas |
221 |
} |
703 |
01 Jun 05 |
nicklas |
222 |
finally |
703 |
01 Jun 05 |
nicklas |
223 |
{ |
703 |
01 Jun 05 |
nicklas |
224 |
if (dc != null) dc.close(); |
703 |
01 Jun 05 |
nicklas |
225 |
} |
703 |
01 Jun 05 |
nicklas |
226 |
%> |