1 | <%-- $Id: edit_hybridization.jsp 4133 2008-02-08 10:54:05Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2005 Nicklas Nordborg, Gregory Vincic |
---|
4 | Copyright (C) 2006 Johan Enell, Jari Hakkinen, Nicklas Nordborg, Martin Svensson |
---|
5 | |
---|
6 | This file is part of BASE - BioArray Software Environment. |
---|
7 | Available at http://base.thep.lu.se/ |
---|
8 | |
---|
9 | BASE is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License |
---|
11 | as published by the Free Software Foundation; either version 2 |
---|
12 | of the License, or (at your option) any later version. |
---|
13 | |
---|
14 | BASE is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with this program; if not, write to the Free Software |
---|
21 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
22 | Boston, MA 02111-1307, USA. |
---|
23 | ------------------------------------------------------------------ |
---|
24 | |
---|
25 | |
---|
26 | @author Nicklas |
---|
27 | @version 2.0 |
---|
28 | --%> |
---|
29 | <%@ page session="false" |
---|
30 | import="net.sf.basedb.core.SessionControl" |
---|
31 | import="net.sf.basedb.core.DbControl" |
---|
32 | import="net.sf.basedb.core.Item" |
---|
33 | import="net.sf.basedb.core.ItemContext" |
---|
34 | import="net.sf.basedb.core.SystemItems" |
---|
35 | import="net.sf.basedb.core.Permission" |
---|
36 | import="net.sf.basedb.core.Include" |
---|
37 | import="net.sf.basedb.core.Hardware" |
---|
38 | import="net.sf.basedb.core.HardwareType" |
---|
39 | import="net.sf.basedb.core.Hybridization" |
---|
40 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
41 | import="net.sf.basedb.core.ArraySlide" |
---|
42 | import="net.sf.basedb.core.Protocol" |
---|
43 | import="net.sf.basedb.core.ProtocolType" |
---|
44 | import="net.sf.basedb.core.Project" |
---|
45 | import="net.sf.basedb.core.LabeledExtract" |
---|
46 | import="net.sf.basedb.core.ItemQuery" |
---|
47 | import="net.sf.basedb.core.ItemResultList" |
---|
48 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
49 | import="net.sf.basedb.core.BaseException" |
---|
50 | import="net.sf.basedb.core.query.Orders" |
---|
51 | import="net.sf.basedb.core.query.Hql" |
---|
52 | import="net.sf.basedb.clients.web.Base" |
---|
53 | import="net.sf.basedb.clients.web.util.HTML" |
---|
54 | import="net.sf.basedb.util.Values" |
---|
55 | import="net.sf.basedb.util.formatter.Formatter" |
---|
56 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
57 | import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
---|
58 | import="java.util.List" |
---|
59 | import="java.util.Set" |
---|
60 | import="java.util.HashSet" |
---|
61 | import="java.util.Date" |
---|
62 | %> |
---|
63 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
64 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
65 | <% |
---|
66 | final Item itemType = Item.HYBRIDIZATION; |
---|
67 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
68 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
69 | final int itemId = cc.getId(); |
---|
70 | final String ID = sc.getId(); |
---|
71 | final float scale = Base.getScale(sc); |
---|
72 | final DbControl dc = sc.newDbControl(); |
---|
73 | try |
---|
74 | { |
---|
75 | String title = null; |
---|
76 | String name = null; |
---|
77 | Hybridization hyb = null; |
---|
78 | BioMaterialEvent creationEvent = null; |
---|
79 | Date eventDate = null; |
---|
80 | ItemQuery<LabeledExtract> labeledExtractsQuery = null; |
---|
81 | |
---|
82 | boolean readCurrentArraySlide = true; |
---|
83 | ArraySlide currentArraySlide = null; |
---|
84 | |
---|
85 | boolean readCurrentProtocol = true; |
---|
86 | Protocol currentProtocol = null; |
---|
87 | Protocol defaultProtocol = null; |
---|
88 | |
---|
89 | boolean readCurrentHybStation = true; |
---|
90 | Hardware currentHybStation = null; |
---|
91 | Hardware defaultHybStation = null; |
---|
92 | |
---|
93 | // Load recently used items |
---|
94 | List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL); |
---|
95 | List<Hardware> recentStations = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE); |
---|
96 | |
---|
97 | int activeProjectId = sc.getActiveProjectId(); |
---|
98 | if (activeProjectId > 0) |
---|
99 | { |
---|
100 | Project activeProject = Project.getById(dc, activeProjectId); |
---|
101 | try |
---|
102 | { |
---|
103 | defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.HYBRIDIZATION_PROTOCOL); |
---|
104 | } |
---|
105 | catch (PermissionDeniedException pdex) |
---|
106 | { |
---|
107 | defaultProtocol = null; |
---|
108 | } |
---|
109 | try |
---|
110 | { |
---|
111 | defaultHybStation = (Hardware)activeProject.getDefaultItem(dc, Project.Default.HYBRIDIZATION_HARDWARE); |
---|
112 | } |
---|
113 | catch (PermissionDeniedException pdex) |
---|
114 | { |
---|
115 | defaultHybStation = null; |
---|
116 | } |
---|
117 | } |
---|
118 | if (itemId == 0) |
---|
119 | { |
---|
120 | title = "Create hybridization"; |
---|
121 | cc.removeObject("item"); |
---|
122 | if (cc.getPropertyFilter("creationEvent.protocol.name") != null) |
---|
123 | { |
---|
124 | currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name")); |
---|
125 | } |
---|
126 | if (cc.getPropertyFilter("creationEvent.hardware.name") != null) |
---|
127 | { |
---|
128 | currentHybStation = Base.getFirstMatching(dc, Hardware.getQuery(), "name", cc.getPropertyFilter("creationEvent.hardware.name")); |
---|
129 | } |
---|
130 | if (cc.getPropertyFilter("arraySlide.name") != null) |
---|
131 | { |
---|
132 | currentArraySlide = Base.getFirstMatching(dc, ArraySlide.getQuery(), "name", cc.getPropertyFilter("arraySlide.name")); |
---|
133 | } |
---|
134 | name = Values.getString(cc.getPropertyValue("name"), "New hybridization"); |
---|
135 | eventDate = (Date)cc.getPropertyObject("creationEvent.eventDate"); |
---|
136 | |
---|
137 | if (Values.getBoolean(request.getParameter("useParents"))) |
---|
138 | { |
---|
139 | labeledExtractsQuery = LabeledExtract.getQuery(); |
---|
140 | labeledExtractsQuery.include(Include.ALL); |
---|
141 | labeledExtractsQuery.order(Orders.asc(Hql.property("name"))); |
---|
142 | } |
---|
143 | |
---|
144 | } |
---|
145 | else |
---|
146 | { |
---|
147 | hyb = Hybridization.getById(dc, itemId); |
---|
148 | creationEvent = hyb.getCreationEvent(); |
---|
149 | eventDate = creationEvent.getEventDate(); |
---|
150 | cc.setObject("item", hyb); |
---|
151 | title = "Edit hybridization -- " + HTML.encodeTags(hyb.getName()); |
---|
152 | name = hyb.getName(); |
---|
153 | try |
---|
154 | { |
---|
155 | currentArraySlide = hyb.getArraySlide(); |
---|
156 | } |
---|
157 | catch (PermissionDeniedException ex) |
---|
158 | { |
---|
159 | readCurrentArraySlide = false; |
---|
160 | } |
---|
161 | try |
---|
162 | { |
---|
163 | currentProtocol = creationEvent.getProtocol(); |
---|
164 | } |
---|
165 | catch (PermissionDeniedException ex) |
---|
166 | { |
---|
167 | readCurrentProtocol = false; |
---|
168 | } |
---|
169 | try |
---|
170 | { |
---|
171 | currentHybStation = creationEvent.getHardware(); |
---|
172 | } |
---|
173 | catch (PermissionDeniedException ex) |
---|
174 | { |
---|
175 | readCurrentHybStation = false; |
---|
176 | } |
---|
177 | |
---|
178 | // Query to retrieve source labeled extracts |
---|
179 | labeledExtractsQuery = (ItemQuery<LabeledExtract>)creationEvent.getSources(); |
---|
180 | labeledExtractsQuery.include(Include.ALL); |
---|
181 | labeledExtractsQuery.order(Orders.asc(Hql.property("name"))); |
---|
182 | |
---|
183 | } |
---|
184 | if (hyb != null) hyb.checkPermission(Permission.WRITE); |
---|
185 | |
---|
186 | final String clazz = "class=\"text\""; |
---|
187 | final String requiredClazz = "class=\"text required\""; |
---|
188 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
189 | String dateFormat = FormatterSettings.getDateFormat(sc); |
---|
190 | String jsDateFormat = HTML.javaScriptEncode(dateFormat); |
---|
191 | String htmlDateFormat = HTML.encodeTags(dateFormat); |
---|
192 | %> |
---|
193 | |
---|
194 | <base:page type="popup" title="<%=title%>"> |
---|
195 | <base:head scripts="tabcontrol.js,annotations.js,linkitems.js" styles="tabcontrol.css"> |
---|
196 | <script language="JavaScript"> |
---|
197 | // Validate the "Hybridization" tab |
---|
198 | function validateHybridization() |
---|
199 | { |
---|
200 | var frm = document.forms['hybridization']; |
---|
201 | if (Main.trimString(frm.name.value) == '') |
---|
202 | { |
---|
203 | alert("You must enter a name"); |
---|
204 | frm.name.focus(); |
---|
205 | return false; |
---|
206 | } |
---|
207 | else if (!Numbers.isInteger(frm.numArrays.value)) |
---|
208 | { |
---|
209 | alert("'" + frm.numArrays.value + "' is not a valid number"); |
---|
210 | frm.numArrays.focus(); |
---|
211 | return false; |
---|
212 | } |
---|
213 | else if (parseInt(frm.numArrays.value) <= 0) |
---|
214 | { |
---|
215 | alert("Number of arrays must be > 0"); |
---|
216 | frm.numArrays.focus(); |
---|
217 | return false; |
---|
218 | } |
---|
219 | return true; |
---|
220 | } |
---|
221 | |
---|
222 | // Submit the form |
---|
223 | function saveSettings() |
---|
224 | { |
---|
225 | var frm = document.forms['hybridization']; |
---|
226 | if (TabControl.validateActiveTab('settings')) |
---|
227 | { |
---|
228 | if (annotationsLoaded) |
---|
229 | { |
---|
230 | Annotations.addModifiedAnnotationsToForm(frames.annotations, frm); |
---|
231 | } |
---|
232 | if (inheritedAnnotationsLoaded) |
---|
233 | { |
---|
234 | Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm); |
---|
235 | } |
---|
236 | frm.modifiedLabeledExtracts.value = Link.exportModified(frm, 'L', true).join(','); |
---|
237 | frm.removedLabeledExtracts.value = Link.getActionIds(-1, 'L').join(','); |
---|
238 | frm.submit(); |
---|
239 | } |
---|
240 | } |
---|
241 | |
---|
242 | var annotationsLoaded = false; |
---|
243 | var inheritedAnnotationsLoaded = false; |
---|
244 | var parentsChanged = false; |
---|
245 | var protocolChanged = false; |
---|
246 | function switchTab(tabControlId, tabId) |
---|
247 | { |
---|
248 | if (TabControl.setActiveTab(tabControlId, tabId)) |
---|
249 | { |
---|
250 | if (tabId == 'annotations' && (protocolChanged || !annotationsLoaded)) |
---|
251 | { |
---|
252 | Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=hyb == null ? 0 : hyb.getId()%>, getProtocolId()); |
---|
253 | annotationsLoaded = true; |
---|
254 | protocolChanged = false; |
---|
255 | } |
---|
256 | else if (tabId == 'inheritedAnnotations' && |
---|
257 | (parentsChanged || !inheritedAnnotationsLoaded)) |
---|
258 | { |
---|
259 | Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents()); |
---|
260 | inheritedAnnotationsLoaded = true; |
---|
261 | parentsChanged = false; |
---|
262 | } |
---|
263 | } |
---|
264 | } |
---|
265 | |
---|
266 | function getProtocolId() |
---|
267 | { |
---|
268 | var frm = document.forms['hybridization']; |
---|
269 | var protocolId = 0; |
---|
270 | if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled) |
---|
271 | { |
---|
272 | protocolId = Math.abs(parseInt(frm.protocol_id[frm.protocol_id.selectedIndex].value)); |
---|
273 | } |
---|
274 | return protocolId; |
---|
275 | } |
---|
276 | |
---|
277 | function getParents() |
---|
278 | { |
---|
279 | var frm = document.forms['hybridization']; |
---|
280 | var parents = new Array(); |
---|
281 | |
---|
282 | var arraySlideId = Math.abs(parseInt(frm.arrayslide_id[frm.arrayslide_id.selectedIndex].value)); |
---|
283 | if (arraySlideId > 0) parents[parents.length] = 'ARRAYSLIDE:'+arraySlideId; |
---|
284 | |
---|
285 | var ids = Link.getListIds(frm.labeled_extracts, 'L'); |
---|
286 | if (ids.length > 0) |
---|
287 | { |
---|
288 | parents[parents.length] = 'LABELEDEXTRACT:'+ids.join(':'); |
---|
289 | } |
---|
290 | return parents; |
---|
291 | } |
---|
292 | |
---|
293 | function selectProtocolOnClick() |
---|
294 | { |
---|
295 | var frm = document.forms['hybridization']; |
---|
296 | var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; |
---|
297 | if (frm.protocol_id.length > 1) |
---|
298 | { |
---|
299 | var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
---|
300 | url += '&item_id='+id; |
---|
301 | } |
---|
302 | url += '&filter:INT:protocolType=<%=SystemItems.getId(ProtocolType.HYBRIDIZATION)%>'; |
---|
303 | Main.openPopup(url, 'SelectProtocol', 1000, 700); |
---|
304 | } |
---|
305 | function setProtocolCallback(id, name) |
---|
306 | { |
---|
307 | var frm = document.forms['hybridization']; |
---|
308 | var list = frm.protocol_id; |
---|
309 | if (list.length < 2 || list[1].value == '0') // > |
---|
310 | { |
---|
311 | Forms.addListOption(list, 1, new Option()); |
---|
312 | } |
---|
313 | list[1].value = id; |
---|
314 | list[1].text = name; |
---|
315 | list.selectedIndex = 1; |
---|
316 | protocolChanged = true; |
---|
317 | } |
---|
318 | function protocolOnChange() |
---|
319 | { |
---|
320 | protocolChanged = true; |
---|
321 | } |
---|
322 | |
---|
323 | function selectHybStationOnClick() |
---|
324 | { |
---|
325 | var frm = document.forms['hybridization']; |
---|
326 | var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setHybStationCallback'; |
---|
327 | if (frm.hardware_id.length > 1) |
---|
328 | { |
---|
329 | var id = Math.abs(parseInt(frm.hardware_id[1].value)); |
---|
330 | url += '&item_id='+id; |
---|
331 | } |
---|
332 | url += '&filter:INT:hardwareType=<%=SystemItems.getId(HardwareType.HYBRIDIZATION_STATION)%>'; |
---|
333 | Main.openPopup(url, 'SelectHybStation', 1000, 700); |
---|
334 | } |
---|
335 | function setHybStationCallback(id, name) |
---|
336 | { |
---|
337 | var frm = document.forms['hybridization']; |
---|
338 | var list = frm.hardware_id; |
---|
339 | if (list.length < 2 || list[1].value == '0') // > |
---|
340 | { |
---|
341 | Forms.addListOption(list, 1, new Option()); |
---|
342 | } |
---|
343 | list[1].value = id; |
---|
344 | list[1].text = name; |
---|
345 | list.selectedIndex = 1; |
---|
346 | } |
---|
347 | |
---|
348 | function arraySlideOnChange() |
---|
349 | { |
---|
350 | parentsChanged = true; |
---|
351 | } |
---|
352 | function selectArraySlideOnClick() |
---|
353 | { |
---|
354 | var frm = document.forms['hybridization']; |
---|
355 | var url = '../../lims/arrayslides/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setArraySlideCallback'; |
---|
356 | if (frm.arrayslide_id.length > 1) |
---|
357 | { |
---|
358 | var id = Math.abs(parseInt(frm.arrayslide_id[1].value)); |
---|
359 | url += '&item_id='+id; |
---|
360 | } |
---|
361 | url += '&filter:STRING:hybridization.name=='; |
---|
362 | url += '&filter:BOOLEAN:destroyed=false'; |
---|
363 | Main.openPopup(url, 'SelectArraySlide', 1000, 700); |
---|
364 | } |
---|
365 | function setArraySlideCallback(arraySlideId, name) |
---|
366 | { |
---|
367 | var frm = document.forms['hybridization']; |
---|
368 | if (frm.arrayslide_id.length < 2) // > |
---|
369 | { |
---|
370 | frm.arrayslide_id[frm.arrayslide_id.length] = new Option(); |
---|
371 | } |
---|
372 | frm.arrayslide_id[1].value = arraySlideId; |
---|
373 | frm.arrayslide_id[1].text = name; |
---|
374 | frm.arrayslide_id.selectedIndex = 1; |
---|
375 | parentsChanged = true; |
---|
376 | } |
---|
377 | |
---|
378 | function addLabeledExtractsOnClick() |
---|
379 | { |
---|
380 | var frm = document.forms['hybridization']; |
---|
381 | var ids = Link.getListIds(frm.labeled_extracts, 'L'); |
---|
382 | var excludes = ids.join(','); |
---|
383 | |
---|
384 | var url = '../../biomaterials/labeledextracts/index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addLabeledExtractCallback'; |
---|
385 | url += '&exclude='+excludes; |
---|
386 | Main.openPopup(url, 'AddLabeledExtracts', 1000, 700); |
---|
387 | } |
---|
388 | function addLabeledExtractCallback(labeledExtractId, name) |
---|
389 | { |
---|
390 | var item = Link.getItem('L', labeledExtractId); |
---|
391 | if (!item) item = new Item('L', labeledExtractId, '1: '+name+' [-]', '', ''); |
---|
392 | Link.addItem(document.forms['hybridization'].labeled_extracts, item); |
---|
393 | parentsChanged = true; |
---|
394 | labeledExtractsOnChange(); |
---|
395 | } |
---|
396 | function labeledExtractsOnChange() |
---|
397 | { |
---|
398 | var frm = document.forms['hybridization']; |
---|
399 | var item = frm.labeled_extracts[frm.labeled_extracts.selectedIndex].item; |
---|
400 | if (item && item.id) |
---|
401 | { |
---|
402 | var i = item.value.indexOf(':'); |
---|
403 | frm.used_quantity.value = i >= 0 ? item.value.substring(0, i) : item.value; |
---|
404 | frm.array_index.value = i > 0 ? item.value.substring(i+1) : '1'; |
---|
405 | frm.used_quantity.focus(); |
---|
406 | } |
---|
407 | else |
---|
408 | { |
---|
409 | frm.used_quantity.value = ''; |
---|
410 | frm.array_index.value = '1'; |
---|
411 | } |
---|
412 | } |
---|
413 | function usedQuantityOnBlur() |
---|
414 | { |
---|
415 | var frm = document.forms['hybridization']; |
---|
416 | var usedQuantity = frm.used_quantity.value; |
---|
417 | var arrayIndex = frm.array_index.value; |
---|
418 | var numArrays = parseInt(frm.numArrays.value); |
---|
419 | if (arrayIndex != '' && (arrayIndex > numArrays || arrayIndex <= 0)) |
---|
420 | { |
---|
421 | alert('Array index must be between 1 and ' + numArrays); |
---|
422 | return; |
---|
423 | } |
---|
424 | if (arrayIndex == '') arrayIndex = 1; |
---|
425 | var displayQuantity = usedQuantity == '' ? '-' : usedQuantity+' µg'; |
---|
426 | for (var i = 0; i < frm.labeled_extracts.length; i++) // > |
---|
427 | { |
---|
428 | var option = frm.labeled_extracts[i]; |
---|
429 | if (option.selected && option.item.id) |
---|
430 | { |
---|
431 | option.item.value = usedQuantity + ':' + arrayIndex; |
---|
432 | var text = option.text.replace(/\[.*\]/, '['+displayQuantity+']'); |
---|
433 | text = text.replace(/\d*\:/, arrayIndex + ':'); |
---|
434 | option.text = text; |
---|
435 | } |
---|
436 | } |
---|
437 | } |
---|
438 | function arrayIndexOnBlur() |
---|
439 | { |
---|
440 | usedQuantityOnBlur(); |
---|
441 | } |
---|
442 | |
---|
443 | function removeOnClick() |
---|
444 | { |
---|
445 | Link.removeSelected(document.forms['hybridization'].labeled_extracts); |
---|
446 | parentsChanged = true; |
---|
447 | } |
---|
448 | |
---|
449 | |
---|
450 | function init() |
---|
451 | { |
---|
452 | var frm = document.forms['hybridization']; |
---|
453 | var labeledExtracts = frm.labeled_extracts; |
---|
454 | <% |
---|
455 | if (hyb == null) |
---|
456 | { |
---|
457 | %> |
---|
458 | frm.name.focus(); |
---|
459 | frm.name.select(); |
---|
460 | <% |
---|
461 | } |
---|
462 | if (labeledExtractsQuery != null) |
---|
463 | { |
---|
464 | ItemResultList<LabeledExtract> labeledExtracts = labeledExtractsQuery.list(dc); |
---|
465 | for (LabeledExtract le : labeledExtracts) |
---|
466 | { |
---|
467 | if (hyb == null) |
---|
468 | { |
---|
469 | %> |
---|
470 | Link.addItem(labeledExtracts, new Item('L', <%=le.getId()%>, '1: <%=HTML.javaScriptEncode(le.getName())%> [-]', ':1')); |
---|
471 | <% |
---|
472 | } |
---|
473 | else |
---|
474 | { |
---|
475 | Float used = creationEvent.getUsedQuantity(le); |
---|
476 | String usedQuantity = Values.formatNumber(used, -1); |
---|
477 | String usedWithUnit = used == null ? "-" : usedQuantity + " µg"; |
---|
478 | int arrayIndex = creationEvent.getSourceGroup(le); |
---|
479 | %> |
---|
480 | Link.addNewItem(labeledExtracts, new Item('L', <%=le.getId()%>, '<%=arrayIndex + ": " + HTML.javaScriptEncode(le.getName())%> [<%=usedWithUnit%>]', '<%=usedQuantity%>:<%=arrayIndex%>')); |
---|
481 | <% |
---|
482 | } |
---|
483 | } |
---|
484 | } |
---|
485 | %> |
---|
486 | } |
---|
487 | </script> |
---|
488 | </base:head> |
---|
489 | <base:body onload="init()"> |
---|
490 | <p> |
---|
491 | <form action="index.jsp?ID=<%=ID%>" method="post" name="hybridization" onsubmit="return false;"> |
---|
492 | <input type="hidden" name="cmd" value="UpdateItem"> |
---|
493 | |
---|
494 | <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3> |
---|
495 | <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" |
---|
496 | position="bottom" remember="<%=hyb != null%>" switch="switchTab"> |
---|
497 | <t:tab id="info" title="Hybridization" validate="validateHybridization()" helpid="hybridization.edit"> |
---|
498 | <table class="form" cellspacing=0> |
---|
499 | <tr> |
---|
500 | <td class="prompt">Name</td> |
---|
501 | <td><input <%=requiredClazz%> type="text" name="name" |
---|
502 | value="<%=name%>" |
---|
503 | size="40" maxlength="<%=Hybridization.MAX_NAME_LENGTH%>"></td> |
---|
504 | </tr> |
---|
505 | <tr> |
---|
506 | <td class="prompt">Arrays</td> |
---|
507 | <td><input <%=requiredClazz%> type="text" name="numArrays" |
---|
508 | value="<%=hyb == null ? Values.getString(cc.getPropertyValue("numArrays"), "1") : hyb.getNumArrays()%>" |
---|
509 | size="12" maxlength="10" onkeypress="return Numbers.integerOnly(event)"></td> |
---|
510 | </tr> |
---|
511 | <tr> |
---|
512 | <td class="prompt">Created</td> |
---|
513 | <td> |
---|
514 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
515 | <tr> |
---|
516 | <td> |
---|
517 | <input <%=clazz%> type="text" name="event_date" |
---|
518 | value="<%=HTML.encodeTags(dateFormatter.format(eventDate == null ? new Date() : eventDate))%>" |
---|
519 | size="20" maxlength="20" title="Enter date in format: <%=htmlDateFormat%>"> |
---|
520 | |
---|
521 | </td> |
---|
522 | <td> |
---|
523 | <base:button |
---|
524 | onclick="<%="Dates.selectDate('Created', 'hybridization', 'event_date', null, '"+jsDateFormat+"')"%>" |
---|
525 | image="calendar.png" |
---|
526 | title="Calendar…" |
---|
527 | tooltip="Select a date from a calendar" |
---|
528 | /> |
---|
529 | </td> |
---|
530 | </tr> |
---|
531 | </table> |
---|
532 | </td> |
---|
533 | </tr> |
---|
534 | <tr> |
---|
535 | <td class="prompt">Registered</td> |
---|
536 | <td><%=dateFormatter.format(creationEvent == null ? new Date() : creationEvent.getEntryDate())%></td> |
---|
537 | </tr> |
---|
538 | <tr> |
---|
539 | <td class="prompt">Protocol</td> |
---|
540 | <td> |
---|
541 | <base:select |
---|
542 | id="protocol_id" |
---|
543 | clazz="selectionlist" |
---|
544 | required="false" |
---|
545 | current="<%=currentProtocol%>" |
---|
546 | denied="<%=!readCurrentProtocol%>" |
---|
547 | recent="<%=recentProtocols%>" |
---|
548 | defaultitem="<%=defaultProtocol%>" |
---|
549 | newitem="<%=hyb == null%>" |
---|
550 | onselect="selectProtocolOnClick()" |
---|
551 | onchange="protocolOnChange()" |
---|
552 | /> |
---|
553 | </td> |
---|
554 | </tr> |
---|
555 | <tr> |
---|
556 | <td class="prompt">Hardware</td> |
---|
557 | <td> |
---|
558 | <base:select |
---|
559 | id="hardware_id" |
---|
560 | clazz="selectionlist" |
---|
561 | required="false" |
---|
562 | current="<%=currentHybStation%>" |
---|
563 | denied="<%=!readCurrentHybStation%>" |
---|
564 | recent="<%=recentStations%>" |
---|
565 | defaultitem="<%=defaultHybStation%>" |
---|
566 | newitem="<%=hyb == null%>" |
---|
567 | onselect="selectHybStationOnClick()" |
---|
568 | /> |
---|
569 | </td> |
---|
570 | </tr> |
---|
571 | <tr> |
---|
572 | <td class="prompt">Array slide</td> |
---|
573 | <td> |
---|
574 | <base:select |
---|
575 | id="arrayslide_id" |
---|
576 | clazz="selectionlist" |
---|
577 | required="false" |
---|
578 | current="<%=currentArraySlide%>" |
---|
579 | denied="<%=!readCurrentArraySlide%>" |
---|
580 | newitem="<%=hyb == null%>" |
---|
581 | onselect="selectArraySlideOnClick()" |
---|
582 | /> |
---|
583 | </td> |
---|
584 | </tr> |
---|
585 | <tr valign=top> |
---|
586 | <td class="prompt">Description</td> |
---|
587 | <td nowrap> |
---|
588 | <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual" |
---|
589 | ><%=HTML.encodeTags(hyb == null ? cc.getPropertyValue("description") : hyb.getDescription())%></textarea> |
---|
590 | <a href="javascript:Main.zoom('Description', 'hybridization', 'description')" |
---|
591 | title="Edit in larger window"><base:icon image="zoom.gif" /></a> |
---|
592 | </td> |
---|
593 | </tr> |
---|
594 | </table> |
---|
595 | <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> |
---|
596 | </t:tab> |
---|
597 | |
---|
598 | <t:tab id="labeledExtracts" title="Labeled extracts" helpid="hybridization.labeledextracts"> |
---|
599 | <input type="hidden" name="modifiedLabeledExtracts" value=""> |
---|
600 | <input type="hidden" name="removedLabeledExtracts" value=""> |
---|
601 | |
---|
602 | <table class="form" cellspacing=0> |
---|
603 | <tr valign="top"> |
---|
604 | <td class="prompt">Labeled extracts</td> |
---|
605 | <td> |
---|
606 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
607 | <tr valign="top"> |
---|
608 | <td> |
---|
609 | <select name="labeled_extracts" size="5" multiple style="width: 20em;" |
---|
610 | onchange="labeledExtractsOnChange()"> |
---|
611 | </select> <br> |
---|
612 | </td> |
---|
613 | <td> |
---|
614 | <table border="0"> |
---|
615 | <tr><td width="150"><base:button |
---|
616 | onclick="addLabeledExtractsOnClick()" |
---|
617 | title="Add labeled extracts…" |
---|
618 | tooltip="Add labeled extracts" |
---|
619 | /></td></tr> |
---|
620 | <tr><td width="150"><base:button |
---|
621 | onclick="removeOnClick()" |
---|
622 | title="Remove" |
---|
623 | tooltip="Remove the selected labeled extracts" |
---|
624 | /></td></tr> |
---|
625 | </table> |
---|
626 | </td> |
---|
627 | </tr> |
---|
628 | </table> |
---|
629 | </td> |
---|
630 | </tr> |
---|
631 | |
---|
632 | <tr> |
---|
633 | <td style="text-align: right; padding-right: 5px;">- used quantity</td> |
---|
634 | <td> |
---|
635 | <input <%=clazz%> type="text" name="used_quantity" value="" |
---|
636 | size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)" |
---|
637 | onkeyup="usedQuantityOnBlur()" |
---|
638 | > (µg) |
---|
639 | </td> |
---|
640 | </tr> |
---|
641 | |
---|
642 | <tr> |
---|
643 | <td style="text-align: right; padding-right: 5px;">- array index</td> |
---|
644 | <td> |
---|
645 | <input <%=clazz%> type="text" name="array_index" value="" |
---|
646 | size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)" |
---|
647 | onkeyup="arrayIndexOnBlur()" |
---|
648 | > |
---|
649 | </td> |
---|
650 | </tr> |
---|
651 | |
---|
652 | </table> |
---|
653 | </t:tab> |
---|
654 | |
---|
655 | <t:tab id="annotations" title="Annotations & parameters" |
---|
656 | helpid="annotations.edit" tooltip="Enter values for annotations and protocol parameters"> |
---|
657 | <iframe name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" |
---|
658 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
659 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
660 | </t:tab> |
---|
661 | |
---|
662 | <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited"> |
---|
663 | |
---|
664 | <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" |
---|
665 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
666 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
667 | </t:tab> |
---|
668 | </t:tabcontrol> |
---|
669 | |
---|
670 | <table align="center"> |
---|
671 | <tr> |
---|
672 | <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td> |
---|
673 | <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td> |
---|
674 | </tr> |
---|
675 | </table> |
---|
676 | </form> |
---|
677 | </base:body> |
---|
678 | </base:page> |
---|
679 | <% |
---|
680 | } |
---|
681 | finally |
---|
682 | { |
---|
683 | if (dc != null) dc.close(); |
---|
684 | } |
---|
685 | %> |
---|