1 | <%-- $Id: create_child_bioplate_step1.jsp 5949 2012-02-08 14:35:29Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2011 Nicklas Nordborg |
---|
4 | |
---|
5 | This file is part of BASE - BioArray Software Environment. |
---|
6 | Available at http://base.thep.lu.se/ |
---|
7 | |
---|
8 | BASE is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU General Public License |
---|
10 | as published by the Free Software Foundation; either version 3 |
---|
11 | of the License, or (at your option) any later version. |
---|
12 | |
---|
13 | BASE is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | GNU General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | ------------------------------------------------------------------ |
---|
21 | |
---|
22 | @author Nicklas |
---|
23 | --%> |
---|
24 | <%@ page pageEncoding="UTF-8" session="false" |
---|
25 | import="net.sf.basedb.core.BioPlate" |
---|
26 | import="net.sf.basedb.core.BioPlateEvent" |
---|
27 | import="net.sf.basedb.core.BioPlateEventType" |
---|
28 | import="net.sf.basedb.core.BioPlateType" |
---|
29 | import="net.sf.basedb.core.BioWell" |
---|
30 | import="net.sf.basedb.core.PlateGeometry" |
---|
31 | import="net.sf.basedb.core.MeasuredBioMaterial" |
---|
32 | import="net.sf.basedb.core.Hardware" |
---|
33 | import="net.sf.basedb.core.Protocol" |
---|
34 | import="net.sf.basedb.core.Tag" |
---|
35 | import="net.sf.basedb.core.ItemSubtype" |
---|
36 | import="net.sf.basedb.core.DbControl" |
---|
37 | import="net.sf.basedb.core.Item" |
---|
38 | import="net.sf.basedb.core.ItemContext" |
---|
39 | import="net.sf.basedb.core.ItemQuery" |
---|
40 | import="net.sf.basedb.core.Include" |
---|
41 | import="net.sf.basedb.core.SessionControl" |
---|
42 | import="net.sf.basedb.core.SystemItems" |
---|
43 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
44 | import="net.sf.basedb.core.query.Restrictions" |
---|
45 | import="net.sf.basedb.core.query.Orders" |
---|
46 | import="net.sf.basedb.core.query.Hql" |
---|
47 | import="net.sf.basedb.util.Values" |
---|
48 | import="net.sf.basedb.util.formatter.Formatter" |
---|
49 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
50 | import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
---|
51 | import="net.sf.basedb.clients.web.Base" |
---|
52 | import="net.sf.basedb.clients.web.util.HTML" |
---|
53 | import="java.util.List" |
---|
54 | import="java.util.Date" |
---|
55 | import="java.util.Collections" |
---|
56 | %> |
---|
57 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
58 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
59 | <% |
---|
60 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
61 | final String ID = sc.getId(); |
---|
62 | final float scale = Base.getScale(sc); |
---|
63 | final int sourcePlateId = Values.getInt(request.getParameter("sourceplate_id")); |
---|
64 | final ItemContext cc = sc.getCurrentContext(Item.BIOPLATEEVENT, BioPlateEventType.CREATE_BIOMATERIAL); |
---|
65 | final DbControl dc = sc.newDbControl(); |
---|
66 | try |
---|
67 | { |
---|
68 | BioPlate sourcePlate = BioPlate.getById(dc, sourcePlateId); |
---|
69 | BioPlateType sourceType = sourcePlate.getBioPlateType(); |
---|
70 | Item sourceBioMaterialType = sourceType.getBioMaterialType(); |
---|
71 | PlateGeometry sourceGeometry = sourcePlate.getPlateGeometry(); |
---|
72 | Hardware sourceFreezer = sourcePlate.getFreezer(); |
---|
73 | |
---|
74 | // Load recently used items |
---|
75 | List<Hardware> recentHardware = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE, sourceBioMaterialType.name()); |
---|
76 | List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL, sourceBioMaterialType.name()); |
---|
77 | List<PlateGeometry> recentGeometry = (List<PlateGeometry>)cc.getRecent(dc, Item.PLATEGEOMETRY, sourceBioMaterialType.name()); |
---|
78 | List<BioPlateType> recentPlateTypes = (List<BioPlateType>)cc.getRecent(dc, Item.BIOPLATETYPE, sourceBioMaterialType.name()); |
---|
79 | List<Hardware> recentFreezers = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE, "freezer"); |
---|
80 | |
---|
81 | // Load subtypes |
---|
82 | final List<ItemSubtype> sampleSubtypes = sourceBioMaterialType == Item.SAMPLE ? |
---|
83 | Base.getSubtypesQuery(Item.SAMPLE).list(dc) : null; |
---|
84 | final List<ItemSubtype> extractSubtypes = Base.getSubtypesQuery(Item.EXTRACT).list(dc); |
---|
85 | final List<ItemSubtype> bioAssaySubtypes = sourceBioMaterialType == Item.EXTRACT ? |
---|
86 | Base.getSubtypesQuery(Item.PHYSICALBIOASSAY).list(dc) : null; |
---|
87 | // Find a common itemsubtype (if any) |
---|
88 | ItemSubtype commonSubtype = null; |
---|
89 | boolean first = true; |
---|
90 | for (BioWell well : sourcePlate.getBioWells().list(dc)) |
---|
91 | { |
---|
92 | try |
---|
93 | { |
---|
94 | if (!well.isEmpty()) |
---|
95 | { |
---|
96 | ItemSubtype subtype = well.getBioMaterial().getItemSubtype(); |
---|
97 | if (first) |
---|
98 | { |
---|
99 | commonSubtype = subtype; |
---|
100 | first = false; |
---|
101 | } |
---|
102 | else |
---|
103 | { |
---|
104 | if (subtype == null || !subtype.equals(commonSubtype)) |
---|
105 | { |
---|
106 | commonSubtype = null; |
---|
107 | break; |
---|
108 | } |
---|
109 | } |
---|
110 | } |
---|
111 | } |
---|
112 | catch (PermissionDeniedException ex) |
---|
113 | {} |
---|
114 | } |
---|
115 | |
---|
116 | final String clazz = "class=\"text\""; |
---|
117 | final String requiredClazz = "class=\"text required\""; |
---|
118 | final Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
119 | final String dateFormat = FormatterSettings.getDateFormat(sc); |
---|
120 | final String jsDateFormat = HTML.javaScriptEncode(dateFormat); |
---|
121 | final String htmlDateFormat = HTML.encodeTags(dateFormat); |
---|
122 | %> |
---|
123 | <base:page type="popup" title="Create child bioplate - step 1/2"> |
---|
124 | <base:head scripts="subtypes.js,ajax.js"> |
---|
125 | <script language="javascript"> |
---|
126 | |
---|
127 | function nextStep() |
---|
128 | { |
---|
129 | var frm = document.forms['main']; |
---|
130 | var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
---|
131 | if (Main.trimString(frm.event_name.value) == '') |
---|
132 | { |
---|
133 | alert("You must enter a name for the new event."); |
---|
134 | frm.event_name.focus(); |
---|
135 | return; |
---|
136 | } |
---|
137 | if (Main.trimString(frm.number_of_plates.value) == '') |
---|
138 | { |
---|
139 | alert("You must enter the number of plates that was created."); |
---|
140 | frm.number_of_plates.focus(); |
---|
141 | return; |
---|
142 | } |
---|
143 | if (Main.trimString(frm.plate_name_prefix.value) == '') |
---|
144 | { |
---|
145 | alert("You must enter a name prefix for the new plates."); |
---|
146 | frm.plate_name_prefix.focus(); |
---|
147 | return; |
---|
148 | } |
---|
149 | if (frm.plategeometry_id.length == 0 && childType != 'PHYSICALBIOASSAY') |
---|
150 | { |
---|
151 | alert("You must select a plate geometry"); |
---|
152 | frm.plategeometry_id.focus(); |
---|
153 | return false; |
---|
154 | } |
---|
155 | if (frm.bioplatetype_id.length == 0 && childType != 'PHYSICALBIOASSAY') |
---|
156 | { |
---|
157 | alert("You must select a plate type"); |
---|
158 | frm.bioplatetype_id.focus(); |
---|
159 | return false; |
---|
160 | } |
---|
161 | frm.submit(); |
---|
162 | |
---|
163 | } |
---|
164 | |
---|
165 | function selectHardwareOnClick() |
---|
166 | { |
---|
167 | var frm = document.forms['main']; |
---|
168 | var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setHardwareCallback'; |
---|
169 | if (frm.hardware_id.length > 1) |
---|
170 | { |
---|
171 | var id = Math.abs(parseInt(frm.hardware_id[1].value)); |
---|
172 | url += '&item_id='+id; |
---|
173 | } |
---|
174 | url += '&resetTemporary=1'; |
---|
175 | var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
---|
176 | url += ItemSubtype.createRelatedFilter('main', 'HARDWARE', '', childType+'_subtype_id'); |
---|
177 | Main.openPopup(url, 'SelectHardware', 1050, 700); |
---|
178 | } |
---|
179 | function setHardwareCallback(id, name) |
---|
180 | { |
---|
181 | var frm = document.forms['main']; |
---|
182 | var list = frm.hardware_id; |
---|
183 | if (list.length < 2 || list[1].value == '0') // > |
---|
184 | { |
---|
185 | Forms.addListOption(list, 1, new Option()); |
---|
186 | } |
---|
187 | list[1].value = id; |
---|
188 | list[1].text = name; |
---|
189 | list.selectedIndex = 1; |
---|
190 | } |
---|
191 | |
---|
192 | function selectProtocolOnClick() |
---|
193 | { |
---|
194 | var frm = document.forms['main']; |
---|
195 | var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; |
---|
196 | url += '&resetTemporary=1'; |
---|
197 | if (frm.protocol_id.length > 1) |
---|
198 | { |
---|
199 | var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
---|
200 | url += '&item_id='+id; |
---|
201 | } |
---|
202 | var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
---|
203 | url += ItemSubtype.createRelatedFilter('main', 'PROTOCOL', '', childType+'_subtype_id'); |
---|
204 | Main.openPopup(url, 'SelectProtocol', 1050, 700); |
---|
205 | } |
---|
206 | |
---|
207 | function setProtocolCallback(id, name) |
---|
208 | { |
---|
209 | var frm = document.forms['main']; |
---|
210 | var list = frm.protocol_id; |
---|
211 | if (list.length < 2 || list[1].value == '0') // > |
---|
212 | { |
---|
213 | Forms.addListOption(list, 1, new Option()); |
---|
214 | } |
---|
215 | list[1].value = id; |
---|
216 | list[1].text = name; |
---|
217 | list.selectedIndex = 1; |
---|
218 | } |
---|
219 | |
---|
220 | function selectTagOnClick() |
---|
221 | { |
---|
222 | var frm = document.forms['main']; |
---|
223 | var url = '../tags/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setTagCallback'; |
---|
224 | url += '&resetTemporary=1'; |
---|
225 | if (frm.protocol_id.length > 1) |
---|
226 | { |
---|
227 | var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
---|
228 | url += '&item_id='+id; |
---|
229 | } |
---|
230 | var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
---|
231 | url += ItemSubtype.createRelatedFilter('main', 'TAG', '', childType+'_subtype_id'); |
---|
232 | Main.openPopup(url, 'SelectTag', 1050, 700); |
---|
233 | } |
---|
234 | |
---|
235 | function setTagCallback(id, name) |
---|
236 | { |
---|
237 | var frm = document.forms['main']; |
---|
238 | var list = frm.tag_id; |
---|
239 | if (list.length < 2 || list[1].value == '0') // > |
---|
240 | { |
---|
241 | Forms.addListOption(list, 1, new Option()); |
---|
242 | } |
---|
243 | list[1].value = id; |
---|
244 | list[1].text = name; |
---|
245 | list.selectedIndex = 1; |
---|
246 | } |
---|
247 | |
---|
248 | |
---|
249 | function selectPlateGeometryOnClick() |
---|
250 | { |
---|
251 | var frm = document.forms['main']; |
---|
252 | var url = '../../lims/geometries/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setPlateGeometryCallback'; |
---|
253 | if (frm.plategeometry_id.length > 0) url += '&item_id='+frm.plategeometry_id[0].value; |
---|
254 | url += '&resetTemporary=1'; |
---|
255 | Main.openPopup(url, 'SelectPlateGeometry', 1050, 700); |
---|
256 | } |
---|
257 | function setPlateGeometryCallback(id, name) |
---|
258 | { |
---|
259 | var frm = document.forms['main']; |
---|
260 | var list = frm.plategeometry_id; |
---|
261 | if (list.length < 1 || list[0].value == '0') // > |
---|
262 | { |
---|
263 | Forms.addListOption(list, 0, new Option()); |
---|
264 | } |
---|
265 | list[0].value = id; |
---|
266 | list[0].text = name; |
---|
267 | list.selectedIndex = 0; |
---|
268 | } |
---|
269 | |
---|
270 | var bioMaterialTypes = { 'EXTRACT': <%=Item.EXTRACT.getValue()%>, 'SAMPLE': <%=Item.SAMPLE.getValue()%> }; |
---|
271 | function selectBioPlateTypeOnClick() |
---|
272 | { |
---|
273 | var frm = document.forms['main']; |
---|
274 | var url = '../bioplatetypes/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setBioPlateTypeCallback'; |
---|
275 | if (frm.bioplatetype_id.length > 0) url += '&item_id='+frm.bioplatetype_id[0].value; |
---|
276 | |
---|
277 | url += '&resetTemporary=1'; |
---|
278 | var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
---|
279 | // Restrict to plates that can holds to target biomaterial |
---|
280 | url += '&tmpfilter:INT:bioMaterialType=|'+bioMaterialTypes[childType]; |
---|
281 | var subtypeId = ItemSubtype.getSubtypeId('main', childType+'_subtype_id'); |
---|
282 | // Restrict to plates with the given subtype |
---|
283 | url += '&tmpfilter:INT:itemSubtype='+(subtypeId ? '|' + subtypeId : '='); |
---|
284 | |
---|
285 | Main.openPopup(url, 'SelectBioPlateType', 1050, 700); |
---|
286 | } |
---|
287 | function setBioPlateTypeCallback(bioPlateTypeId, name) |
---|
288 | { |
---|
289 | var frm = document.forms['main']; |
---|
290 | var list = frm.bioplatetype_id; |
---|
291 | if (list.length < 1 || list[0].disabled) // > |
---|
292 | { |
---|
293 | Forms.addListOption(list, 0, new Option()); |
---|
294 | } |
---|
295 | list[0].value = bioPlateTypeId; |
---|
296 | list[0].text = name; |
---|
297 | list.selectedIndex = 0; |
---|
298 | } |
---|
299 | function selectFreezerOnClick() |
---|
300 | { |
---|
301 | var frm = document.forms['main']; |
---|
302 | var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setFreezerCallback'; |
---|
303 | if (frm.freezer_id.length > 1) |
---|
304 | { |
---|
305 | var id = Math.abs(parseInt(frm.freezer_id[1].value)); |
---|
306 | url += '&item_id='+id; |
---|
307 | } |
---|
308 | url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Hardware.FREEZER)%>'; |
---|
309 | Main.openPopup(url, 'SelectFreezer', 1050, 700); |
---|
310 | } |
---|
311 | function setFreezerCallback(freezerId, name) |
---|
312 | { |
---|
313 | var frm = document.forms['main']; |
---|
314 | if (frm.freezer_id.length < 2) // > |
---|
315 | { |
---|
316 | frm.freezer_id[frm.freezer_id.length] = new Option(); |
---|
317 | } |
---|
318 | frm.freezer_id[1].value = freezerId; |
---|
319 | frm.freezer_id[1].text = name; |
---|
320 | frm.freezer_id.selectedIndex = 1; |
---|
321 | } |
---|
322 | function childTypeOnChange() |
---|
323 | { |
---|
324 | var frm = document.forms['main']; |
---|
325 | var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
---|
326 | var isSample = childType == 'SAMPLE'; |
---|
327 | var isExtract = childType == 'EXTRACT'; |
---|
328 | var isBioAssay = childType == 'PHYSICALBIOASSAY'; |
---|
329 | Main.showHide('sampleSubtypesDiv', isSample); |
---|
330 | Main.showHide('extractSubtypesDiv', isExtract); |
---|
331 | Main.showHide('bioAssaySubtypesDiv', isBioAssay); |
---|
332 | Main.showHide('tagDiv', isExtract); |
---|
333 | Main.showHide('originalQuantityDiv', !isBioAssay); |
---|
334 | Main.showHide('freezerDiv', !isBioAssay); |
---|
335 | Main.showHide('plateTypeDiv', !isBioAssay); |
---|
336 | Main.showHide('geometryDiv', !isBioAssay); |
---|
337 | Main.showHide('sizeDiv', isBioAssay); |
---|
338 | } |
---|
339 | |
---|
340 | function init() |
---|
341 | { |
---|
342 | childTypeOnChange(); |
---|
343 | } |
---|
344 | |
---|
345 | </script> |
---|
346 | </base:head> |
---|
347 | <base:body onload="init()"> |
---|
348 | <h1>Create child bioplate - step 1/2 <base:help helpid="bioplateevent.create-child-1" /></h1> |
---|
349 | <form name="main" action="create_child_bioplate_step2.jsp" method="post"> |
---|
350 | <input type="hidden" name="ID" value="<%=ID%>"> |
---|
351 | <input type="hidden" name="sourceplate_id" value="<%=sourcePlateId%>"> |
---|
352 | |
---|
353 | <div class="content bottomborder"> |
---|
354 | <table class="fullform input100"> |
---|
355 | <tbody class="sectionheader"> |
---|
356 | <tr> |
---|
357 | <th colspan="3">Event</th> |
---|
358 | </tr> |
---|
359 | </tbody> |
---|
360 | <tbody> |
---|
361 | <tr> |
---|
362 | <th>Event name</th> |
---|
363 | <td><input <%=requiredClazz%> type="text" name="event_name" |
---|
364 | value="Create child plate" |
---|
365 | maxlength="<%=BioPlateEvent.MAX_NAME_LENGTH%>"> |
---|
366 | </td> |
---|
367 | <td rowspan="4"> |
---|
368 | <table style="width: 100%;"> |
---|
369 | <tr> |
---|
370 | <td> |
---|
371 | <b>Description</b><br> |
---|
372 | <textarea <%=clazz%> rows="4" name="event_description" |
---|
373 | ></textarea> |
---|
374 | </td> |
---|
375 | <td style="width: 20px;"> |
---|
376 | <base:icon |
---|
377 | image="zoom.png" |
---|
378 | onclick="Main.zoom('Event description', 'main', 'event_description')" |
---|
379 | tooltip="Edit in larger window" |
---|
380 | /> |
---|
381 | </td> |
---|
382 | </tr> |
---|
383 | </table> |
---|
384 | </td> |
---|
385 | </tr> |
---|
386 | <tr> |
---|
387 | <th>Event date</th> |
---|
388 | <td> |
---|
389 | <table> |
---|
390 | <tr> |
---|
391 | <td> |
---|
392 | <input <%=clazz%> type="text" name="event_date" style="width: 15em;" |
---|
393 | value="<%=HTML.encodeTags(dateFormatter.format(new Date()))%>" |
---|
394 | maxlength="20" title="Enter date in format: <%=htmlDateFormat%>"> |
---|
395 | </td> |
---|
396 | <td> |
---|
397 | <base:button |
---|
398 | onclick="<%="Dates.selectDate('Event date', 'main', 'event_date', null, '"+jsDateFormat+"')"%>" |
---|
399 | image="calendar.png" |
---|
400 | title="Calendar…" |
---|
401 | tooltip="Select a date from a calendar" |
---|
402 | /> |
---|
403 | </td> |
---|
404 | </tr> |
---|
405 | </table> |
---|
406 | </td> |
---|
407 | </tr> |
---|
408 | <tr> |
---|
409 | <th>Protocol</th> |
---|
410 | <td> |
---|
411 | <base:select |
---|
412 | id="protocol_id" |
---|
413 | clazz="selectionlist" |
---|
414 | required="false" |
---|
415 | current="<%=null%>" |
---|
416 | recent="<%=recentProtocols%>" |
---|
417 | onselect="selectProtocolOnClick()" |
---|
418 | /> |
---|
419 | </td> |
---|
420 | </tr> |
---|
421 | <tr> |
---|
422 | <th>Hardware</th> |
---|
423 | <td> |
---|
424 | <base:select |
---|
425 | id="hardware_id" |
---|
426 | clazz="selectionlist" |
---|
427 | required="false" |
---|
428 | current="<%=null%>" |
---|
429 | recent="<%=recentHardware%>" |
---|
430 | onselect="selectHardwareOnClick()" |
---|
431 | /> |
---|
432 | </td> |
---|
433 | </tr> |
---|
434 | </tbody> |
---|
435 | |
---|
436 | <tbody class="sectionheader"> |
---|
437 | <tr> |
---|
438 | <th colspan="3">Child biomaterial</th> |
---|
439 | </tr> |
---|
440 | </tbody> |
---|
441 | <tbody> |
---|
442 | <tr> |
---|
443 | <th>Type</th> |
---|
444 | <td> |
---|
445 | <select name="child_biomaterial_type" class="required selectionlist" onchange="childTypeOnChange()"> |
---|
446 | <% |
---|
447 | if (sourceBioMaterialType == Item.SAMPLE) |
---|
448 | { |
---|
449 | %> |
---|
450 | <option value="SAMPLE">Sample → Sample |
---|
451 | <option value="EXTRACT" selected>Sample → Extract |
---|
452 | <% |
---|
453 | } |
---|
454 | else if (sourceBioMaterialType == Item.EXTRACT) |
---|
455 | { |
---|
456 | %> |
---|
457 | <option value="EXTRACT">Extract → Extract |
---|
458 | <option value="PHYSICALBIOASSAY" selected>Extract → Physical bioassay |
---|
459 | <% |
---|
460 | } |
---|
461 | %> |
---|
462 | </select> |
---|
463 | </td> |
---|
464 | <td rowspan="5"> |
---|
465 | <table style="width: 100%;"> |
---|
466 | <tr> |
---|
467 | <td> |
---|
468 | <b>Description</b><br> |
---|
469 | <textarea <%=clazz%> rows="4" name="child_description"></textarea> |
---|
470 | </td> |
---|
471 | <td style="width: 20px;"> |
---|
472 | <base:icon |
---|
473 | image="zoom.png" |
---|
474 | onclick="Main.zoom('Biomaterial description', 'main', 'child_description')" |
---|
475 | tooltip="Edit in larger window" |
---|
476 | /> |
---|
477 | </td> |
---|
478 | </tr> |
---|
479 | </table> |
---|
480 | </td> |
---|
481 | </tr> |
---|
482 | <% |
---|
483 | if (sampleSubtypes != null && sampleSubtypes.size() > 0) |
---|
484 | { |
---|
485 | %> |
---|
486 | <tr id="sampleSubtypesDiv" style="display: none;"> |
---|
487 | <th>Subtype</th> |
---|
488 | <td> |
---|
489 | <select name="SAMPLE_subtype_id" class="selectionlist"> |
---|
490 | <option value="0">- none - |
---|
491 | <% |
---|
492 | int currentSubtypeId = 0; |
---|
493 | if (commonSubtype != null) |
---|
494 | { |
---|
495 | List<ItemSubtype> relatedToParent = ItemSubtype.getParentSubtypes(dc, commonSubtype, Item.SAMPLE); |
---|
496 | if (relatedToParent.size() > 0) currentSubtypeId = relatedToParent.get(0).getId(); |
---|
497 | } |
---|
498 | for (ItemSubtype subtype : sampleSubtypes) |
---|
499 | { |
---|
500 | int id = subtype.getId(); |
---|
501 | %> |
---|
502 | <option value="<%=id%>" |
---|
503 | <%=id == currentSubtypeId ? "selected" : ""%> |
---|
504 | title="<%=HTML.encodeTags(subtype.getDescription()) %>" |
---|
505 | ><%=HTML.encodeTags(subtype.getName())%> |
---|
506 | <% |
---|
507 | } |
---|
508 | %> |
---|
509 | </select> |
---|
510 | </td> |
---|
511 | </tr> |
---|
512 | <% |
---|
513 | } |
---|
514 | if (extractSubtypes != null && extractSubtypes.size() > 0) |
---|
515 | { |
---|
516 | %> |
---|
517 | <tr id="extractSubtypesDiv" style="display: none;"> |
---|
518 | <th>Subtype</th> |
---|
519 | <td> |
---|
520 | <select name="EXTRACT_subtype_id" class="selectionlist"> |
---|
521 | <option value="0">- none - |
---|
522 | <% |
---|
523 | int currentSubtypeId = 0; |
---|
524 | if (commonSubtype != null) |
---|
525 | { |
---|
526 | List<ItemSubtype> relatedToParent = ItemSubtype.getParentSubtypes(dc, commonSubtype, Item.EXTRACT); |
---|
527 | if (relatedToParent.size() > 0) currentSubtypeId = relatedToParent.get(0).getId(); |
---|
528 | } |
---|
529 | for (ItemSubtype subtype : extractSubtypes) |
---|
530 | { |
---|
531 | int id = subtype.getId(); |
---|
532 | %> |
---|
533 | <option value="<%=id%>" |
---|
534 | <%=id == currentSubtypeId ? "selected" : ""%> |
---|
535 | title="<%=HTML.encodeTags(subtype.getDescription()) %>" |
---|
536 | ><%=HTML.encodeTags(subtype.getName())%> |
---|
537 | <% |
---|
538 | } |
---|
539 | %> |
---|
540 | </select> |
---|
541 | </td> |
---|
542 | </tr> |
---|
543 | <% |
---|
544 | } |
---|
545 | %> |
---|
546 | <% |
---|
547 | if (bioAssaySubtypes != null && bioAssaySubtypes.size() > 0) |
---|
548 | { |
---|
549 | %> |
---|
550 | <tr id="bioAssaySubtypesDiv" style="display: none;"> |
---|
551 | <th>Subtype</th> |
---|
552 | <td> |
---|
553 | <select name="PHYSICALBIOASSAY_subtype_id" class="selectionlist"> |
---|
554 | <option value="0">- none - |
---|
555 | <% |
---|
556 | int currentSubtypeId = 0; |
---|
557 | if (commonSubtype != null) |
---|
558 | { |
---|
559 | List<ItemSubtype> relatedToParent = ItemSubtype.getParentSubtypes(dc, commonSubtype, Item.PHYSICALBIOASSAY); |
---|
560 | if (relatedToParent.size() > 0) currentSubtypeId = relatedToParent.get(0).getId(); |
---|
561 | } |
---|
562 | for (ItemSubtype subtype : bioAssaySubtypes) |
---|
563 | { |
---|
564 | int id = subtype.getId(); |
---|
565 | %> |
---|
566 | <option value="<%=id%>" |
---|
567 | <%=id == currentSubtypeId ? "selected" : ""%> |
---|
568 | title="<%=HTML.encodeTags(subtype.getDescription()) %>" |
---|
569 | ><%=HTML.encodeTags(subtype.getName())%> |
---|
570 | <% |
---|
571 | } |
---|
572 | %> |
---|
573 | </select> |
---|
574 | </td> |
---|
575 | </tr> |
---|
576 | <% |
---|
577 | } |
---|
578 | %> |
---|
579 | <tr id="tagDiv" style="display: none;"> |
---|
580 | <th>Tag</th> |
---|
581 | <td> |
---|
582 | <base:select |
---|
583 | id="tag_id" |
---|
584 | clazz="selectionlist" |
---|
585 | required="false" |
---|
586 | unselectedtext="<%=sourceBioMaterialType == Item.SAMPLE ? "- none -" : "- same as parent -" %>" |
---|
587 | current="<%=null%>" |
---|
588 | onselect="selectTagOnClick()" |
---|
589 | /> |
---|
590 | </td> |
---|
591 | </tr> |
---|
592 | <tr id="originalQuantityDiv"> |
---|
593 | <th>Original quantity</th> |
---|
594 | <td><input <%=clazz%> type="text" name="original_quantity" style="width: 15em;" |
---|
595 | maxlength="10" onkeypress="return Numbers.numberOnly(event)"> (µg)</td> |
---|
596 | </tr> |
---|
597 | <tr> |
---|
598 | <th>Used from parent</th> |
---|
599 | <td><input <%=clazz%> type="text" name="used_quantity" style="width: 15em;" |
---|
600 | maxlength="10" onkeypress="return Numbers.numberOnly(event)"> (µg)</td> |
---|
601 | </tr> |
---|
602 | </tbody> |
---|
603 | <tbody class="sectionheader"> |
---|
604 | <tr> |
---|
605 | <th colspan="3">Child plates</th> |
---|
606 | </tr> |
---|
607 | </tbody> |
---|
608 | <tbody> |
---|
609 | <tr> |
---|
610 | <th>No. of plates</th> |
---|
611 | <td><input <%=requiredClazz%> type="text" name="number_of_plates" value="1" |
---|
612 | maxlength="2" style="width: 15em;" |
---|
613 | onkeypress="return Numbers.integerOnly(event)"></td> |
---|
614 | <td rowspan="5"> |
---|
615 | <table style="width: 100%;"> |
---|
616 | <tr> |
---|
617 | <td> |
---|
618 | <b>Description</b><br> |
---|
619 | <textarea <%=clazz%> rows="4" name="plate_description"></textarea> |
---|
620 | </td> |
---|
621 | <td style="width: 20px;"> |
---|
622 | <base:icon |
---|
623 | image="zoom.png" |
---|
624 | onclick="Main.zoom('Plate description', 'main', 'plate_description')" |
---|
625 | tooltip="Edit in larger window" |
---|
626 | /> |
---|
627 | </td> |
---|
628 | </tr> |
---|
629 | </table> |
---|
630 | </td> |
---|
631 | </tr> |
---|
632 | <tr> |
---|
633 | <th>Name prefix</th> |
---|
634 | <td><input <%=requiredClazz%> type="text" name="plate_name_prefix" |
---|
635 | value="New plate." |
---|
636 | maxlength="<%=BioPlate.MAX_NAME_LENGTH%>"></td> |
---|
637 | </tr> |
---|
638 | <tr id="geometryDiv"> |
---|
639 | <th>Geometry</th> |
---|
640 | <td> |
---|
641 | <base:select |
---|
642 | id="plategeometry_id" |
---|
643 | clazz="selectionlist" |
---|
644 | required="true" |
---|
645 | current="<%=sourceGeometry%>" |
---|
646 | recent="<%=recentGeometry%>" |
---|
647 | newitem="true" |
---|
648 | onselect="selectPlateGeometryOnClick()" |
---|
649 | /> |
---|
650 | </td> |
---|
651 | </tr> |
---|
652 | <tr id="sizeDiv" style="display: none;"> |
---|
653 | <th>Size of bioassay</th> |
---|
654 | <td><input <%=requiredClazz%> type="text" name="size" style="width: 15em;" |
---|
655 | value="<%=sourceGeometry.getRows() %>" |
---|
656 | maxlength="10" onkeypress="return Numbers.numberOnly(event)"></td> |
---|
657 | </tr> |
---|
658 | <tr id="plateTypeDiv"> |
---|
659 | <th>Plate type</th> |
---|
660 | <td> |
---|
661 | <base:select |
---|
662 | id="bioplatetype_id" |
---|
663 | clazz="selectionlist" |
---|
664 | required="true" |
---|
665 | current="<%=null%>" |
---|
666 | recent="<%=recentPlateTypes%>" |
---|
667 | newitem="true" |
---|
668 | onselect="selectBioPlateTypeOnClick()" |
---|
669 | /> |
---|
670 | </td> |
---|
671 | </tr> |
---|
672 | <tr id="freezerDiv"> |
---|
673 | <th>Freezer</th> |
---|
674 | <td> |
---|
675 | <base:select |
---|
676 | id="freezer_id" |
---|
677 | clazz="selectionlist" |
---|
678 | required="false" |
---|
679 | current="<%=sourceFreezer%>" |
---|
680 | recent="<%=recentFreezers%>" |
---|
681 | newitem="true" |
---|
682 | onselect="selectFreezerOnClick()" |
---|
683 | onchange="freezerOnChange()" |
---|
684 | /> |
---|
685 | </td> |
---|
686 | </tr> |
---|
687 | </tbody> |
---|
688 | <tr class="dynamic"> |
---|
689 | <th></th> |
---|
690 | <td colspan="2"></td> |
---|
691 | </tr> |
---|
692 | </table> |
---|
693 | </div> |
---|
694 | </form> |
---|
695 | |
---|
696 | <base:buttongroup subclass="dialogbuttons"> |
---|
697 | <base:button onclick="nextStep()" title="Next" /> |
---|
698 | <base:button onclick="window.close()" title="Cancel" /> |
---|
699 | </base:buttongroup> |
---|
700 | |
---|
701 | </base:body> |
---|
702 | </base:page> |
---|
703 | <% |
---|
704 | } |
---|
705 | finally |
---|
706 | { |
---|
707 | if (dc != null) dc.close(); |
---|
708 | } |
---|
709 | %> |
---|