5525 |
06 Dec 10 |
nicklas |
1 |
<%-- $Id$ |
5525 |
06 Dec 10 |
nicklas |
2 |
------------------------------------------------------------------ |
5525 |
06 Dec 10 |
nicklas |
Copyright (C) 2010 Nicklas Nordborg |
5525 |
06 Dec 10 |
nicklas |
4 |
|
5525 |
06 Dec 10 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
5525 |
06 Dec 10 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
5525 |
06 Dec 10 |
nicklas |
7 |
|
5525 |
06 Dec 10 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
5525 |
06 Dec 10 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
5525 |
06 Dec 10 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
5525 |
06 Dec 10 |
nicklas |
11 |
of the License, or (at your option) any later version. |
5525 |
06 Dec 10 |
nicklas |
12 |
|
5525 |
06 Dec 10 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
5525 |
06 Dec 10 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5525 |
06 Dec 10 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5525 |
06 Dec 10 |
nicklas |
16 |
GNU General Public License for more details. |
5525 |
06 Dec 10 |
nicklas |
17 |
|
5525 |
06 Dec 10 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
5525 |
06 Dec 10 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5525 |
06 Dec 10 |
nicklas |
20 |
------------------------------------------------------------------ |
5525 |
06 Dec 10 |
nicklas |
21 |
|
5525 |
06 Dec 10 |
nicklas |
22 |
@author Nicklas |
5525 |
06 Dec 10 |
nicklas |
23 |
--%> |
5525 |
06 Dec 10 |
nicklas |
24 |
<%@ page pageEncoding="UTF-8" session="false" |
5525 |
06 Dec 10 |
nicklas |
25 |
import="net.sf.basedb.core.SessionControl" |
5525 |
06 Dec 10 |
nicklas |
26 |
import="net.sf.basedb.core.DbControl" |
5525 |
06 Dec 10 |
nicklas |
27 |
import="net.sf.basedb.core.Item" |
5525 |
06 Dec 10 |
nicklas |
28 |
import="net.sf.basedb.core.Hardware" |
6997 |
03 Nov 15 |
nicklas |
29 |
import="net.sf.basedb.core.Kit" |
5525 |
06 Dec 10 |
nicklas |
30 |
import="net.sf.basedb.core.Protocol" |
5525 |
06 Dec 10 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
5525 |
06 Dec 10 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
5525 |
06 Dec 10 |
nicklas |
33 |
import="net.sf.basedb.core.Include" |
5525 |
06 Dec 10 |
nicklas |
34 |
import="net.sf.basedb.core.BioPlateEvent" |
5525 |
06 Dec 10 |
nicklas |
35 |
import="net.sf.basedb.core.ItemQuery" |
5525 |
06 Dec 10 |
nicklas |
36 |
import="net.sf.basedb.core.ItemResultList" |
5525 |
06 Dec 10 |
nicklas |
37 |
import="net.sf.basedb.core.PermissionDeniedException" |
5525 |
06 Dec 10 |
nicklas |
38 |
import="net.sf.basedb.core.BaseException" |
5525 |
06 Dec 10 |
nicklas |
39 |
import="net.sf.basedb.core.query.Orders" |
5525 |
06 Dec 10 |
nicklas |
40 |
import="net.sf.basedb.core.query.Hql" |
5525 |
06 Dec 10 |
nicklas |
41 |
import="net.sf.basedb.clients.web.Base" |
5525 |
06 Dec 10 |
nicklas |
42 |
import="net.sf.basedb.clients.web.util.HTML" |
5525 |
06 Dec 10 |
nicklas |
43 |
import="net.sf.basedb.util.Values" |
5525 |
06 Dec 10 |
nicklas |
44 |
import="net.sf.basedb.core.plugin.GuiContext" |
5525 |
06 Dec 10 |
nicklas |
45 |
import="net.sf.basedb.util.formatter.Formatter" |
5525 |
06 Dec 10 |
nicklas |
46 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
5525 |
06 Dec 10 |
nicklas |
47 |
import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
5525 |
06 Dec 10 |
nicklas |
48 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5525 |
06 Dec 10 |
nicklas |
49 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5525 |
06 Dec 10 |
nicklas |
50 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
51 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5525 |
06 Dec 10 |
nicklas |
52 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5525 |
06 Dec 10 |
nicklas |
53 |
import="java.util.List" |
5525 |
06 Dec 10 |
nicklas |
54 |
import="java.util.Set" |
5525 |
06 Dec 10 |
nicklas |
55 |
import="java.util.HashSet" |
5525 |
06 Dec 10 |
nicklas |
56 |
import="java.util.Date" |
5525 |
06 Dec 10 |
nicklas |
57 |
%> |
5525 |
06 Dec 10 |
nicklas |
58 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
5525 |
06 Dec 10 |
nicklas |
59 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6145 |
21 Sep 12 |
nicklas |
60 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
5525 |
06 Dec 10 |
nicklas |
61 |
<% |
5525 |
06 Dec 10 |
nicklas |
62 |
final Item itemType = Item.BIOPLATEEVENT; |
5525 |
06 Dec 10 |
nicklas |
63 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
5525 |
06 Dec 10 |
nicklas |
64 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
5525 |
06 Dec 10 |
nicklas |
65 |
final int itemId = cc.getId(); |
5525 |
06 Dec 10 |
nicklas |
66 |
final String ID = sc.getId(); |
5525 |
06 Dec 10 |
nicklas |
67 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
68 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
5525 |
06 Dec 10 |
nicklas |
69 |
try |
5525 |
06 Dec 10 |
nicklas |
70 |
{ |
5525 |
06 Dec 10 |
nicklas |
71 |
if (itemId == 0) throw new PermissionDeniedException(Permission.CREATE, "bioplate event"); |
5525 |
06 Dec 10 |
nicklas |
72 |
String title = null; |
5525 |
06 Dec 10 |
nicklas |
73 |
BioPlateEvent event = BioPlateEvent.getById(dc, itemId); |
5525 |
06 Dec 10 |
nicklas |
74 |
event.checkPermission(Permission.WRITE); |
5525 |
06 Dec 10 |
nicklas |
75 |
|
5525 |
06 Dec 10 |
nicklas |
76 |
boolean readCurrentHardware = true; |
5525 |
06 Dec 10 |
nicklas |
77 |
Hardware currentHardware = null; |
5525 |
06 Dec 10 |
nicklas |
78 |
boolean readCurrentProtocol = true; |
5525 |
06 Dec 10 |
nicklas |
79 |
Protocol currentProtocol = null; |
6997 |
03 Nov 15 |
nicklas |
80 |
boolean readCurrentKit = true; |
6997 |
03 Nov 15 |
nicklas |
81 |
Kit currentKit = null; |
5525 |
06 Dec 10 |
nicklas |
82 |
|
5525 |
06 Dec 10 |
nicklas |
83 |
// Load recently used items |
7605 |
26 Feb 19 |
nicklas |
84 |
List<Hardware> recentHardware = cc.getRecent(dc, Item.HARDWARE); |
7605 |
26 Feb 19 |
nicklas |
85 |
List<Protocol> recentProtocols = cc.getRecent(dc, Item.PROTOCOL); |
7605 |
26 Feb 19 |
nicklas |
86 |
List<Kit> recentKits = cc.getRecent(dc, Item.KIT); |
5525 |
06 Dec 10 |
nicklas |
87 |
|
5525 |
06 Dec 10 |
nicklas |
88 |
cc.setObject("item", event); |
5525 |
06 Dec 10 |
nicklas |
89 |
title = "Edit bioplate event -- " + HTML.encodeTags(event.getName()); |
5525 |
06 Dec 10 |
nicklas |
90 |
|
5525 |
06 Dec 10 |
nicklas |
91 |
try |
5525 |
06 Dec 10 |
nicklas |
92 |
{ |
5525 |
06 Dec 10 |
nicklas |
93 |
currentHardware = event.getHardware(); |
5525 |
06 Dec 10 |
nicklas |
94 |
} |
5525 |
06 Dec 10 |
nicklas |
95 |
catch (PermissionDeniedException ex) |
5525 |
06 Dec 10 |
nicklas |
96 |
{ |
5525 |
06 Dec 10 |
nicklas |
97 |
readCurrentHardware = false; |
5525 |
06 Dec 10 |
nicklas |
98 |
} |
5525 |
06 Dec 10 |
nicklas |
99 |
try |
5525 |
06 Dec 10 |
nicklas |
100 |
{ |
5525 |
06 Dec 10 |
nicklas |
101 |
currentProtocol = event.getProtocol(); |
5525 |
06 Dec 10 |
nicklas |
102 |
} |
5525 |
06 Dec 10 |
nicklas |
103 |
catch (PermissionDeniedException ex) |
5525 |
06 Dec 10 |
nicklas |
104 |
{ |
5525 |
06 Dec 10 |
nicklas |
105 |
readCurrentProtocol = false; |
5525 |
06 Dec 10 |
nicklas |
106 |
} |
6997 |
03 Nov 15 |
nicklas |
107 |
try |
6997 |
03 Nov 15 |
nicklas |
108 |
{ |
6997 |
03 Nov 15 |
nicklas |
109 |
currentKit = event.getKit(); |
6997 |
03 Nov 15 |
nicklas |
110 |
} |
6997 |
03 Nov 15 |
nicklas |
111 |
catch (PermissionDeniedException ex) |
6997 |
03 Nov 15 |
nicklas |
112 |
{ |
6997 |
03 Nov 15 |
nicklas |
113 |
readCurrentKit = false; |
6997 |
03 Nov 15 |
nicklas |
114 |
} |
5525 |
06 Dec 10 |
nicklas |
115 |
|
5525 |
06 Dec 10 |
nicklas |
116 |
final Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
5525 |
06 Dec 10 |
nicklas |
117 |
final String dateFormat = FormatterSettings.getDateFormat(sc); |
5525 |
06 Dec 10 |
nicklas |
118 |
final String jsDateFormat = HTML.javaScriptEncode(dateFormat); |
5525 |
06 Dec 10 |
nicklas |
119 |
final String htmlDateFormat = HTML.encodeTags(dateFormat); |
5525 |
06 Dec 10 |
nicklas |
120 |
|
5525 |
06 Dec 10 |
nicklas |
121 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), event); |
7604 |
25 Feb 19 |
nicklas |
122 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
5525 |
06 Dec 10 |
nicklas |
123 |
%> |
6306 |
13 Aug 13 |
nicklas |
124 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6306 |
13 Aug 13 |
nicklas |
125 |
<base:head scripts="tabcontrol-2.js,~events.js" styles="tabcontrol.css"> |
5525 |
06 Dec 10 |
nicklas |
126 |
<ext:scripts context="<%=jspContext%>" /> |
5525 |
06 Dec 10 |
nicklas |
127 |
<ext:stylesheets context="<%=jspContext%>" /> |
5525 |
06 Dec 10 |
nicklas |
128 |
</base:head> |
6306 |
13 Aug 13 |
nicklas |
129 |
<base:body> |
5913 |
15 Dec 11 |
nicklas |
130 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
131 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="event"> |
5525 |
06 Dec 10 |
nicklas |
132 |
<input type="hidden" name="cmd" value="UpdateItem"> |
5525 |
06 Dec 10 |
nicklas |
133 |
|
5913 |
15 Dec 11 |
nicklas |
134 |
<t:tabcontrol id="settings" |
5913 |
15 Dec 11 |
nicklas |
135 |
subclass="content dialogtabcontrol" |
5525 |
06 Dec 10 |
nicklas |
136 |
position="bottom" remember="<%=event != null%>" |
5525 |
06 Dec 10 |
nicklas |
137 |
extensions="<%=invoker%>"> |
6306 |
13 Aug 13 |
nicklas |
138 |
<t:tab id="info" title="Bioplate event" helpid="bioplateevent.edit"> |
5913 |
15 Dec 11 |
nicklas |
139 |
<table class="fullform input100"> |
5525 |
06 Dec 10 |
nicklas |
140 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
141 |
<th>Name</th> |
6306 |
13 Aug 13 |
nicklas |
142 |
<td><input class="text required auto-init" data-auto-init="<%=event == null ? "focus-select" : "focus" %>" |
6306 |
13 Aug 13 |
nicklas |
143 |
type="text" name="name" |
5525 |
06 Dec 10 |
nicklas |
144 |
value="<%=HTML.encodeTags(event.getName())%>" |
5913 |
15 Dec 11 |
nicklas |
145 |
maxlength="<%=BioPlateEvent.MAX_NAME_LENGTH%>"></td> |
5913 |
15 Dec 11 |
nicklas |
146 |
<td></td> |
5525 |
06 Dec 10 |
nicklas |
147 |
</tr> |
5525 |
06 Dec 10 |
nicklas |
148 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
149 |
<th>Event date</th> |
5525 |
06 Dec 10 |
nicklas |
150 |
<td> |
5913 |
15 Dec 11 |
nicklas |
151 |
<table> |
5525 |
06 Dec 10 |
nicklas |
152 |
<tr> |
5525 |
06 Dec 10 |
nicklas |
153 |
<td> |
6217 |
14 Dec 12 |
nicklas |
154 |
<input class="text" type="text" name="event_date" id="event_date" style="width: 15em;" |
5525 |
06 Dec 10 |
nicklas |
155 |
value="<%=HTML.encodeTags(dateFormatter.format(event.getEventDate()))%>" |
5913 |
15 Dec 11 |
nicklas |
156 |
maxlength="20" title="Enter date in format: <%=htmlDateFormat%>"> |
5525 |
06 Dec 10 |
nicklas |
157 |
</td> |
5525 |
06 Dec 10 |
nicklas |
158 |
<td> |
6216 |
14 Dec 12 |
nicklas |
159 |
<base:calendar textarea="event_date" title="Event date" /> |
5525 |
06 Dec 10 |
nicklas |
160 |
</td> |
5525 |
06 Dec 10 |
nicklas |
161 |
</tr> |
5525 |
06 Dec 10 |
nicklas |
162 |
</table> |
5525 |
06 Dec 10 |
nicklas |
163 |
</td> |
5913 |
15 Dec 11 |
nicklas |
164 |
<td></td> |
5525 |
06 Dec 10 |
nicklas |
165 |
</tr> |
5525 |
06 Dec 10 |
nicklas |
166 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
167 |
<th>Protocol</th> |
5525 |
06 Dec 10 |
nicklas |
168 |
<td> |
5525 |
06 Dec 10 |
nicklas |
169 |
<base:select |
5525 |
06 Dec 10 |
nicklas |
170 |
id="protocol_id" |
5525 |
06 Dec 10 |
nicklas |
171 |
clazz="selectionlist" |
5525 |
06 Dec 10 |
nicklas |
172 |
required="false" |
5525 |
06 Dec 10 |
nicklas |
173 |
current="<%=currentProtocol%>" |
5525 |
06 Dec 10 |
nicklas |
174 |
denied="<%=!readCurrentProtocol%>" |
5525 |
06 Dec 10 |
nicklas |
175 |
recent="<%=recentProtocols%>" |
5525 |
06 Dec 10 |
nicklas |
176 |
/> |
5525 |
06 Dec 10 |
nicklas |
177 |
</td> |
5913 |
15 Dec 11 |
nicklas |
178 |
<td></td> |
5525 |
06 Dec 10 |
nicklas |
179 |
</tr> |
5525 |
06 Dec 10 |
nicklas |
180 |
<tr> |
6997 |
03 Nov 15 |
nicklas |
181 |
<th>Kit</th> |
6997 |
03 Nov 15 |
nicklas |
182 |
<td> |
6997 |
03 Nov 15 |
nicklas |
183 |
<base:select |
6997 |
03 Nov 15 |
nicklas |
184 |
id="kit_id" |
6997 |
03 Nov 15 |
nicklas |
185 |
clazz="selectionlist" |
6997 |
03 Nov 15 |
nicklas |
186 |
required="false" |
6997 |
03 Nov 15 |
nicklas |
187 |
current="<%=currentKit%>" |
6997 |
03 Nov 15 |
nicklas |
188 |
denied="<%=!readCurrentKit%>" |
6997 |
03 Nov 15 |
nicklas |
189 |
recent="<%=recentKits%>" |
6997 |
03 Nov 15 |
nicklas |
190 |
/> |
6997 |
03 Nov 15 |
nicklas |
191 |
</td> |
6997 |
03 Nov 15 |
nicklas |
192 |
<td></td> |
6997 |
03 Nov 15 |
nicklas |
193 |
</tr> |
6997 |
03 Nov 15 |
nicklas |
194 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
195 |
<th>Hardware</th> |
5525 |
06 Dec 10 |
nicklas |
196 |
<td> |
5525 |
06 Dec 10 |
nicklas |
197 |
<base:select |
5525 |
06 Dec 10 |
nicklas |
198 |
id="hardware_id" |
5525 |
06 Dec 10 |
nicklas |
199 |
clazz="selectionlist" |
5525 |
06 Dec 10 |
nicklas |
200 |
required="false" |
5525 |
06 Dec 10 |
nicklas |
201 |
current="<%=currentHardware%>" |
5525 |
06 Dec 10 |
nicklas |
202 |
denied="<%=!readCurrentHardware%>" |
5525 |
06 Dec 10 |
nicklas |
203 |
recent="<%=recentHardware%>" |
5525 |
06 Dec 10 |
nicklas |
204 |
/> |
5525 |
06 Dec 10 |
nicklas |
205 |
</td> |
5913 |
15 Dec 11 |
nicklas |
206 |
<td></td> |
5525 |
06 Dec 10 |
nicklas |
207 |
</tr> |
5913 |
15 Dec 11 |
nicklas |
208 |
<tr class="dynamic"> |
6145 |
21 Sep 12 |
nicklas |
209 |
<th>Description</th> |
5913 |
15 Dec 11 |
nicklas |
210 |
<td> |
6217 |
14 Dec 12 |
nicklas |
211 |
<textarea class="text" rows="6" name="description" id="description" |
5525 |
06 Dec 10 |
nicklas |
212 |
><%=HTML.encodeTags(event.getDescription())%></textarea> |
5525 |
06 Dec 10 |
nicklas |
213 |
</td> |
5913 |
15 Dec 11 |
nicklas |
214 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
215 |
<base:zoom textarea="description" title="Description" /> |
5913 |
15 Dec 11 |
nicklas |
216 |
</td> |
5525 |
06 Dec 10 |
nicklas |
217 |
</tr> |
5525 |
06 Dec 10 |
nicklas |
218 |
</table> |
5525 |
06 Dec 10 |
nicklas |
219 |
</t:tab> |
5525 |
06 Dec 10 |
nicklas |
220 |
</t:tabcontrol> |
5913 |
15 Dec 11 |
nicklas |
221 |
</form> |
5913 |
15 Dec 11 |
nicklas |
222 |
|
5913 |
15 Dec 11 |
nicklas |
223 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
224 |
<base:icon image="required.png" />= required information |
5913 |
15 Dec 11 |
nicklas |
225 |
</div> |
5525 |
06 Dec 10 |
nicklas |
226 |
|
5913 |
15 Dec 11 |
nicklas |
227 |
<base:buttongroup subclass="dialogbuttons"> |
6306 |
13 Aug 13 |
nicklas |
228 |
<base:button id="btnSave" title="Save" /> |
6306 |
13 Aug 13 |
nicklas |
229 |
<base:button id="close" title="Cancel" /> |
5913 |
15 Dec 11 |
nicklas |
230 |
</base:buttongroup> |
5525 |
06 Dec 10 |
nicklas |
231 |
</base:body> |
5525 |
06 Dec 10 |
nicklas |
232 |
</base:page> |
5525 |
06 Dec 10 |
nicklas |
233 |
<% |
5525 |
06 Dec 10 |
nicklas |
234 |
} |
5525 |
06 Dec 10 |
nicklas |
235 |
finally |
5525 |
06 Dec 10 |
nicklas |
236 |
{ |
5525 |
06 Dec 10 |
nicklas |
237 |
if (dc != null) dc.close(); |
5525 |
06 Dec 10 |
nicklas |
238 |
} |
5525 |
06 Dec 10 |
nicklas |
239 |
%> |