1652 |
22 Nov 05 |
nicklas |
1 |
<%-- $Id$ |
1652 |
22 Nov 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 |
1652 |
22 Nov 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/ |
1652 |
22 Nov 05 |
nicklas |
9 |
|
1652 |
22 Nov 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
1652 |
22 Nov 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 |
1652 |
22 Nov 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
1652 |
22 Nov 05 |
nicklas |
14 |
|
1652 |
22 Nov 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
1652 |
22 Nov 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1652 |
22 Nov 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1652 |
22 Nov 05 |
nicklas |
18 |
GNU General Public License for more details. |
1652 |
22 Nov 05 |
nicklas |
19 |
|
1652 |
22 Nov 05 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1652 |
22 Nov 05 |
nicklas |
22 |
------------------------------------------------------------------ |
1652 |
22 Nov 05 |
nicklas |
23 |
|
1652 |
22 Nov 05 |
nicklas |
24 |
@author Nicklas |
1652 |
22 Nov 05 |
nicklas |
25 |
@version 2.0 |
1652 |
22 Nov 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
1652 |
22 Nov 05 |
nicklas |
28 |
import="net.sf.basedb.core.SessionControl" |
1652 |
22 Nov 05 |
nicklas |
29 |
import="net.sf.basedb.core.DbControl" |
1652 |
22 Nov 05 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
1847 |
26 Jan 06 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
1847 |
26 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.SystemItems" |
1652 |
22 Nov 05 |
nicklas |
33 |
import="net.sf.basedb.core.Permission" |
1847 |
26 Jan 06 |
nicklas |
34 |
import="net.sf.basedb.core.Include" |
1652 |
22 Nov 05 |
nicklas |
35 |
import="net.sf.basedb.core.Plate" |
1652 |
22 Nov 05 |
nicklas |
36 |
import="net.sf.basedb.core.PlateType" |
1652 |
22 Nov 05 |
nicklas |
37 |
import="net.sf.basedb.core.ItemQuery" |
1652 |
22 Nov 05 |
nicklas |
38 |
import="net.sf.basedb.core.ItemResultList" |
1847 |
26 Jan 06 |
nicklas |
39 |
import="net.sf.basedb.core.PermissionDeniedException" |
1847 |
26 Jan 06 |
nicklas |
40 |
import="net.sf.basedb.core.BaseException" |
1652 |
22 Nov 05 |
nicklas |
41 |
import="net.sf.basedb.core.query.Orders" |
1652 |
22 Nov 05 |
nicklas |
42 |
import="net.sf.basedb.core.query.Hql" |
1652 |
22 Nov 05 |
nicklas |
43 |
import="net.sf.basedb.clients.web.Base" |
1652 |
22 Nov 05 |
nicklas |
44 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
45 |
import="net.sf.basedb.util.Values" |
5498 |
17 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.core.plugin.GuiContext" |
5498 |
17 Nov 10 |
nicklas |
47 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5498 |
17 Nov 10 |
nicklas |
48 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5498 |
17 Nov 10 |
nicklas |
49 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
50 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5498 |
17 Nov 10 |
nicklas |
51 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
1660 |
24 Nov 05 |
nicklas |
52 |
import="java.util.List" |
1847 |
26 Jan 06 |
nicklas |
53 |
import="java.util.Set" |
1847 |
26 Jan 06 |
nicklas |
54 |
import="java.util.HashSet" |
1847 |
26 Jan 06 |
nicklas |
55 |
import="java.util.Date" |
1652 |
22 Nov 05 |
nicklas |
56 |
%> |
1652 |
22 Nov 05 |
nicklas |
57 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1652 |
22 Nov 05 |
nicklas |
58 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6312 |
28 Aug 13 |
nicklas |
59 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
1652 |
22 Nov 05 |
nicklas |
60 |
<% |
1652 |
22 Nov 05 |
nicklas |
61 |
final Item itemType = Item.PLATE; |
1847 |
26 Jan 06 |
nicklas |
62 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1847 |
26 Jan 06 |
nicklas |
63 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1847 |
26 Jan 06 |
nicklas |
64 |
final int itemId = cc.getId(); |
1652 |
22 Nov 05 |
nicklas |
65 |
final String ID = sc.getId(); |
1652 |
22 Nov 05 |
nicklas |
66 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
67 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
1652 |
22 Nov 05 |
nicklas |
68 |
try |
1652 |
22 Nov 05 |
nicklas |
69 |
{ |
1652 |
22 Nov 05 |
nicklas |
70 |
String title = null; |
1652 |
22 Nov 05 |
nicklas |
71 |
Plate plate = null; |
1847 |
26 Jan 06 |
nicklas |
72 |
|
1652 |
22 Nov 05 |
nicklas |
73 |
boolean readCurrentPlateType = true; |
1652 |
22 Nov 05 |
nicklas |
74 |
PlateType currentPlateType = null; |
1847 |
26 Jan 06 |
nicklas |
75 |
|
1847 |
26 Jan 06 |
nicklas |
76 |
if (itemId == 0) |
1652 |
22 Nov 05 |
nicklas |
77 |
{ |
1652 |
22 Nov 05 |
nicklas |
78 |
title = "Create plate"; |
1847 |
26 Jan 06 |
nicklas |
79 |
cc.removeObject("item"); |
2446 |
29 Jun 06 |
nicklas |
80 |
|
2446 |
29 Jun 06 |
nicklas |
81 |
int plateTypeId = Values.getInt(request.getParameter("platetype_id")); |
2446 |
29 Jun 06 |
nicklas |
82 |
if (plateTypeId != 0) |
1847 |
26 Jan 06 |
nicklas |
83 |
{ |
2446 |
29 Jun 06 |
nicklas |
84 |
currentPlateType = PlateType.getById(dc, plateTypeId); |
2446 |
29 Jun 06 |
nicklas |
85 |
} |
2446 |
29 Jun 06 |
nicklas |
86 |
else if (cc.getPropertyFilter("plateType.name") != null) |
2446 |
29 Jun 06 |
nicklas |
87 |
{ |
1847 |
26 Jan 06 |
nicklas |
88 |
currentPlateType = Base.getFirstMatching(dc, PlateType.getQuery(), "name", cc.getPropertyFilter("plateType.name")); |
1847 |
26 Jan 06 |
nicklas |
89 |
} |
1652 |
22 Nov 05 |
nicklas |
90 |
} |
1652 |
22 Nov 05 |
nicklas |
91 |
else |
1652 |
22 Nov 05 |
nicklas |
92 |
{ |
1847 |
26 Jan 06 |
nicklas |
93 |
plate = Plate.getById(dc, itemId); |
6312 |
28 Aug 13 |
nicklas |
94 |
plate.checkPermission(Permission.WRITE); |
1847 |
26 Jan 06 |
nicklas |
95 |
cc.setObject("item", plate); |
1652 |
22 Nov 05 |
nicklas |
96 |
title = "Edit plate -- " + HTML.encodeTags(plate.getName()); |
1652 |
22 Nov 05 |
nicklas |
97 |
try |
1652 |
22 Nov 05 |
nicklas |
98 |
{ |
1652 |
22 Nov 05 |
nicklas |
99 |
currentPlateType = plate.getPlateType(); |
1652 |
22 Nov 05 |
nicklas |
100 |
} |
1652 |
22 Nov 05 |
nicklas |
101 |
catch (PermissionDeniedException ex) |
1652 |
22 Nov 05 |
nicklas |
102 |
{ |
1652 |
22 Nov 05 |
nicklas |
103 |
readCurrentPlateType = false; |
1652 |
22 Nov 05 |
nicklas |
104 |
} |
1652 |
22 Nov 05 |
nicklas |
105 |
} |
6217 |
14 Dec 12 |
nicklas |
106 |
|
5498 |
17 Nov 10 |
nicklas |
107 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), plate); |
7604 |
25 Feb 19 |
nicklas |
108 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
1652 |
22 Nov 05 |
nicklas |
109 |
%> |
6312 |
28 Aug 13 |
nicklas |
110 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6312 |
28 Aug 13 |
nicklas |
111 |
<base:head scripts="tabcontrol-2.js,~plates.js" styles="tabcontrol.css"> |
5498 |
17 Nov 10 |
nicklas |
112 |
<ext:scripts context="<%=jspContext%>" /> |
5498 |
17 Nov 10 |
nicklas |
113 |
<ext:stylesheets context="<%=jspContext%>" /> |
1652 |
22 Nov 05 |
nicklas |
114 |
</base:head> |
6312 |
28 Aug 13 |
nicklas |
115 |
<base:body> |
5920 |
10 Jan 12 |
nicklas |
116 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
117 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="plate"> |
1847 |
26 Jan 06 |
nicklas |
118 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1652 |
22 Nov 05 |
nicklas |
119 |
|
5920 |
10 Jan 12 |
nicklas |
120 |
<t:tabcontrol id="settings" |
5920 |
10 Jan 12 |
nicklas |
121 |
subclass="content dialogtabcontrol" |
6312 |
28 Aug 13 |
nicklas |
122 |
position="bottom" remember="<%=plate != null%>" |
5498 |
17 Nov 10 |
nicklas |
123 |
extensions="<%=invoker%>"> |
6312 |
28 Aug 13 |
nicklas |
124 |
<t:tab id="info" title="Plate" helpid="plate.edit"> |
5920 |
10 Jan 12 |
nicklas |
125 |
<table class="fullform input100 smaller"> |
1652 |
22 Nov 05 |
nicklas |
126 |
<tr> |
5920 |
10 Jan 12 |
nicklas |
127 |
<th>Name</th> |
6312 |
28 Aug 13 |
nicklas |
128 |
<td><input class="text required auto-init" data-auto-init="<%=plate == null ? "focus-select" : "focus" %>" type="text" name="name" |
1847 |
26 Jan 06 |
nicklas |
129 |
value="<%=HTML.encodeTags(plate == null ? Values.getString(cc.getPropertyValue("name"), "New plate") : plate.getName())%>" |
5920 |
10 Jan 12 |
nicklas |
130 |
maxlength="<%=Plate.MAX_NAME_LENGTH%>"></td> |
5920 |
10 Jan 12 |
nicklas |
131 |
<td></td> |
1652 |
22 Nov 05 |
nicklas |
132 |
</tr> |
1652 |
22 Nov 05 |
nicklas |
133 |
<tr> |
5920 |
10 Jan 12 |
nicklas |
134 |
<th>Barcode</th> |
6217 |
14 Dec 12 |
nicklas |
135 |
<td><input class="text" type="text" name="barcode" |
1847 |
26 Jan 06 |
nicklas |
136 |
value="<%=HTML.encodeTags(plate == null ? Values.getString(cc.getPropertyValue("barcode"), "") : plate.getBarcode())%>" |
5920 |
10 Jan 12 |
nicklas |
137 |
maxlength="<%=Plate.MAX_BARCODE_LENGTH%>"></td> |
5920 |
10 Jan 12 |
nicklas |
138 |
<td></td> |
1652 |
22 Nov 05 |
nicklas |
139 |
</tr> |
1652 |
22 Nov 05 |
nicklas |
140 |
<tr> |
5920 |
10 Jan 12 |
nicklas |
141 |
<th><label for="destroyed">Destroyed</label></th> |
5812 |
17 Oct 11 |
nicklas |
142 |
<td><input type="checkbox" name="destroyed" id="destroyed" value="1" |
1847 |
26 Jan 06 |
nicklas |
143 |
<%=(plate != null && plate.isDestroyed()) || (plate == null && Values.getBoolean(cc.getPropertyValue("destroyed"))) ? "checked" : ""%>> |
1847 |
26 Jan 06 |
nicklas |
144 |
</td> |
5920 |
10 Jan 12 |
nicklas |
145 |
<td></td> |
1652 |
22 Nov 05 |
nicklas |
146 |
</tr> |
1847 |
26 Jan 06 |
nicklas |
147 |
<tr> |
5920 |
10 Jan 12 |
nicklas |
148 |
<th>Plate type</th> |
1847 |
26 Jan 06 |
nicklas |
149 |
<td> |
1652 |
22 Nov 05 |
nicklas |
150 |
<% |
1847 |
26 Jan 06 |
nicklas |
151 |
if (plate != null) |
1652 |
22 Nov 05 |
nicklas |
152 |
{ |
1652 |
22 Nov 05 |
nicklas |
153 |
%> |
1847 |
26 Jan 06 |
nicklas |
154 |
<%=Base.getEncodedName(currentPlateType, !readCurrentPlateType)%> |
1652 |
22 Nov 05 |
nicklas |
155 |
<% |
1847 |
26 Jan 06 |
nicklas |
156 |
} |
1847 |
26 Jan 06 |
nicklas |
157 |
else |
1847 |
26 Jan 06 |
nicklas |
158 |
{ |
1847 |
26 Jan 06 |
nicklas |
159 |
%> |
5920 |
10 Jan 12 |
nicklas |
160 |
<table> |
1847 |
26 Jan 06 |
nicklas |
161 |
<tr> |
1847 |
26 Jan 06 |
nicklas |
162 |
<td> |
6312 |
28 Aug 13 |
nicklas |
163 |
<select name="platetype_id" id="platetype_id" size="1" |
1847 |
26 Jan 06 |
nicklas |
164 |
<%=!readCurrentPlateType ? "disabled readonly class=\"disabled\"" : "class=\"required\""%> |
1847 |
26 Jan 06 |
nicklas |
165 |
style="width: 20em;"> |
1652 |
22 Nov 05 |
nicklas |
166 |
<% |
1847 |
26 Jan 06 |
nicklas |
167 |
if (!readCurrentPlateType) |
1652 |
22 Nov 05 |
nicklas |
168 |
{ |
1652 |
22 Nov 05 |
nicklas |
169 |
%> |
1847 |
26 Jan 06 |
nicklas |
170 |
<option value="-1">- denied - |
1652 |
22 Nov 05 |
nicklas |
171 |
<% |
1652 |
22 Nov 05 |
nicklas |
172 |
} |
1847 |
26 Jan 06 |
nicklas |
173 |
else |
1847 |
26 Jan 06 |
nicklas |
174 |
{ |
1847 |
26 Jan 06 |
nicklas |
175 |
if (currentPlateType != null) |
1847 |
26 Jan 06 |
nicklas |
176 |
{ |
1847 |
26 Jan 06 |
nicklas |
177 |
%> |
1847 |
26 Jan 06 |
nicklas |
178 |
<option value="<%=currentPlateType.getId()%>" selected><%=HTML.encodeTags(currentPlateType.getName())%> |
1847 |
26 Jan 06 |
nicklas |
179 |
<% |
1847 |
26 Jan 06 |
nicklas |
180 |
} |
1847 |
26 Jan 06 |
nicklas |
181 |
} |
1847 |
26 Jan 06 |
nicklas |
182 |
%> |
1847 |
26 Jan 06 |
nicklas |
183 |
</select> |
1847 |
26 Jan 06 |
nicklas |
184 |
</td> |
6312 |
28 Aug 13 |
nicklas |
185 |
<td><base:button id="platetype_id.select" title="Select…" /></td> |
1847 |
26 Jan 06 |
nicklas |
186 |
</tr> |
1847 |
26 Jan 06 |
nicklas |
187 |
</table> |
1652 |
22 Nov 05 |
nicklas |
188 |
<% |
1652 |
22 Nov 05 |
nicklas |
189 |
} |
1652 |
22 Nov 05 |
nicklas |
190 |
%> |
1652 |
22 Nov 05 |
nicklas |
191 |
</td> |
5920 |
10 Jan 12 |
nicklas |
192 |
<td></td> |
1652 |
22 Nov 05 |
nicklas |
193 |
</tr> |
5920 |
10 Jan 12 |
nicklas |
194 |
<tr class="dynamic"> |
5920 |
10 Jan 12 |
nicklas |
195 |
<th>Description</th> |
5920 |
10 Jan 12 |
nicklas |
196 |
<td> |
6217 |
14 Dec 12 |
nicklas |
197 |
<textarea class="text" rows="6" name="description" id="description" |
1847 |
26 Jan 06 |
nicklas |
198 |
><%=HTML.encodeTags(plate == null ? cc.getPropertyValue("description") : plate.getDescription())%></textarea> |
1652 |
22 Nov 05 |
nicklas |
199 |
</td> |
5920 |
10 Jan 12 |
nicklas |
200 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
201 |
<base:zoom textarea="description" title="Description" /> |
5920 |
10 Jan 12 |
nicklas |
202 |
</td> |
1652 |
22 Nov 05 |
nicklas |
203 |
</tr> |
1652 |
22 Nov 05 |
nicklas |
204 |
</table> |
1652 |
22 Nov 05 |
nicklas |
205 |
</t:tab> |
1847 |
26 Jan 06 |
nicklas |
206 |
|
6312 |
28 Aug 13 |
nicklas |
207 |
<t:tab id="annotations" title="Annotations" helpid="annotations.edit"> |
6254 |
22 Mar 13 |
nicklas |
208 |
<jsp:include page="../../common/annotations/annotate_frameset.jsp"> |
6254 |
22 Mar 13 |
nicklas |
209 |
<jsp:param name="item_type" value="<%=itemType.name()%>" /> |
6254 |
22 Mar 13 |
nicklas |
210 |
<jsp:param name="item_id" value="<%=itemId%>" /> |
6254 |
22 Mar 13 |
nicklas |
211 |
<jsp:param name="ID" value="<%=ID%>" /> |
6254 |
22 Mar 13 |
nicklas |
212 |
</jsp:include> |
6254 |
22 Mar 13 |
nicklas |
213 |
</t:tab> |
5920 |
10 Jan 12 |
nicklas |
214 |
</t:tabcontrol> |
5920 |
10 Jan 12 |
nicklas |
215 |
</form> |
1658 |
24 Nov 05 |
nicklas |
216 |
|
5920 |
10 Jan 12 |
nicklas |
217 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
218 |
<base:icon image="required.png" />= required information |
5920 |
10 Jan 12 |
nicklas |
219 |
</div> |
1652 |
22 Nov 05 |
nicklas |
220 |
|
5920 |
10 Jan 12 |
nicklas |
221 |
<base:buttongroup subclass="dialogbuttons"> |
6312 |
28 Aug 13 |
nicklas |
222 |
<base:button id="btnSave" title="Save" /> |
6312 |
28 Aug 13 |
nicklas |
223 |
<base:button id="close" title="Cancel" /> |
5920 |
10 Jan 12 |
nicklas |
224 |
</base:buttongroup> |
1652 |
22 Nov 05 |
nicklas |
225 |
</base:body> |
1652 |
22 Nov 05 |
nicklas |
226 |
</base:page> |
1652 |
22 Nov 05 |
nicklas |
227 |
<% |
1652 |
22 Nov 05 |
nicklas |
228 |
} |
1652 |
22 Nov 05 |
nicklas |
229 |
finally |
1652 |
22 Nov 05 |
nicklas |
230 |
{ |
1652 |
22 Nov 05 |
nicklas |
231 |
if (dc != null) dc.close(); |
1652 |
22 Nov 05 |
nicklas |
232 |
} |
1652 |
22 Nov 05 |
nicklas |
233 |
%> |