1 | <%-- $Id: edit_hybridization.jsp 4131 2008-02-08 08:55:48Z 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 | else |
---|
138 | { |
---|
139 | hyb = Hybridization.getById(dc, itemId); |
---|
140 | creationEvent = hyb.getCreationEvent(); |
---|
141 | eventDate = creationEvent.getEventDate(); |
---|
142 | cc.setObject("item", hyb); |
---|
143 | title = "Edit hybridization -- " + HTML.encodeTags(hyb.getName()); |
---|
144 | name = hyb.getName(); |
---|
145 | try |
---|
146 | { |
---|
147 | currentArraySlide = hyb.getArraySlide(); |
---|
148 | } |
---|
149 | catch (PermissionDeniedException ex) |
---|
150 | { |
---|
151 | readCurrentArraySlide = false; |
---|
152 | } |
---|
153 | try |
---|
154 | { |
---|
155 | currentProtocol = creationEvent.getProtocol(); |
---|
156 | } |
---|
157 | catch (PermissionDeniedException ex) |
---|
158 | { |
---|
159 | readCurrentProtocol = false; |
---|
160 | } |
---|
161 | try |
---|
162 | { |
---|
163 | currentHybStation = creationEvent.getHardware(); |
---|
164 | } |
---|
165 | catch (PermissionDeniedException ex) |
---|
166 | { |
---|
167 | readCurrentHybStation = false; |
---|
168 | } |
---|
169 | |
---|
170 | // Query to retrieve source labeled extracts |
---|
171 | labeledExtractsQuery = (ItemQuery<LabeledExtract>)creationEvent.getSources(); |
---|
172 | labeledExtractsQuery.include(Include.ALL); |
---|
173 | labeledExtractsQuery.order(Orders.asc(Hql.property("name"))); |
---|
174 | |
---|
175 | } |
---|
176 | if (hyb != null) hyb.checkPermission(Permission.WRITE); |
---|
177 | |
---|
178 | final String clazz = "class=\"text\""; |
---|
179 | final String requiredClazz = "class=\"text required\""; |
---|
180 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
181 | String dateFormat = FormatterSettings.getDateFormat(sc); |
---|
182 | String jsDateFormat = HTML.javaScriptEncode(dateFormat); |
---|
183 | String htmlDateFormat = HTML.encodeTags(dateFormat); |
---|
184 | %> |
---|
185 | |
---|
186 | <base:page type="popup" title="<%=title%>"> |
---|
187 | <base:head scripts="tabcontrol.js,annotations.js,linkitems.js" styles="tabcontrol.css"> |
---|
188 | <script language="JavaScript"> |
---|
189 | // Validate the "Hybridization" tab |
---|
190 | function validateHybridization() |
---|
191 | { |
---|
192 | var frm = document.forms['hybridization']; |
---|
193 | if (Main.trimString(frm.name.value) == '') |
---|
194 | { |
---|
195 | alert("You must enter a name"); |
---|
196 | frm.name.focus(); |
---|
197 | return false; |
---|
198 | } |
---|
199 | else if (!Numbers.isInteger(frm.numArrays.value)) |
---|
200 | { |
---|
201 | alert("'" + frm.numArrays.value + "' is not a valid number"); |
---|
202 | frm.numArrays.focus(); |
---|
203 | return false; |
---|
204 | } |
---|
205 | else if (parseInt(frm.numArrays.value) <= 0) |
---|
206 | { |
---|
207 | alert("Number of arrays must be > 0"); |
---|
208 | frm.numArrays.focus(); |
---|
209 | return false; |
---|
210 | } |
---|
211 | return true; |
---|
212 | } |
---|
213 | |
---|
214 | // Submit the form |
---|
215 | function saveSettings() |
---|
216 | { |
---|
217 | var frm = document.forms['hybridization']; |
---|
218 | if (TabControl.validateActiveTab('settings')) |
---|
219 | { |
---|
220 | if (annotationsLoaded) |
---|
221 | { |
---|
222 | Annotations.addModifiedAnnotationsToForm(frames.annotations, frm); |
---|
223 | } |
---|
224 | if (inheritedAnnotationsLoaded) |
---|
225 | { |
---|
226 | Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm); |
---|
227 | } |
---|
228 | frm.modifiedLabeledExtracts.value = Link.exportModified(frm, 'L', true).join(','); |
---|
229 | frm.removedLabeledExtracts.value = Link.getActionIds(-1, 'L').join(','); |
---|
230 | frm.submit(); |
---|
231 | } |
---|
232 | } |
---|
233 | |
---|
234 | var annotationsLoaded = false; |
---|
235 | var inheritedAnnotationsLoaded = false; |
---|
236 | var parentsChanged = false; |
---|
237 | var protocolChanged = false; |
---|
238 | function switchTab(tabControlId, tabId) |
---|
239 | { |
---|
240 | if (TabControl.setActiveTab(tabControlId, tabId)) |
---|
241 | { |
---|
242 | if (tabId == 'annotations' && (protocolChanged || !annotationsLoaded)) |
---|
243 | { |
---|
244 | Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=hyb == null ? 0 : hyb.getId()%>, getProtocolId()); |
---|
245 | annotationsLoaded = true; |
---|
246 | protocolChanged = false; |
---|
247 | } |
---|
248 | else if (tabId == 'inheritedAnnotations' && |
---|
249 | (parentsChanged || !inheritedAnnotationsLoaded)) |
---|
250 | { |
---|
251 | Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents()); |
---|
252 | inheritedAnnotationsLoaded = true; |
---|
253 | parentsChanged = false; |
---|
254 | } |
---|
255 | } |
---|
256 | } |
---|
257 | |
---|
258 | function getProtocolId() |
---|
259 | { |
---|
260 | var frm = document.forms['hybridization']; |
---|
261 | var protocolId = 0; |
---|
262 | if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled) |
---|
263 | { |
---|
264 | protocolId = Math.abs(parseInt(frm.protocol_id[frm.protocol_id.selectedIndex].value)); |
---|
265 | } |
---|
266 | return protocolId; |
---|
267 | } |
---|
268 | |
---|
269 | function getParents() |
---|
270 | { |
---|
271 | var frm = document.forms['hybridization']; |
---|
272 | var parents = new Array(); |
---|
273 | |
---|
274 | var arraySlideId = Math.abs(parseInt(frm.arrayslide_id[frm.arrayslide_id.selectedIndex].value)); |
---|
275 | if (arraySlideId > 0) parents[parents.length] = 'ARRAYSLIDE:'+arraySlideId; |
---|
276 | |
---|
277 | var ids = Link.getListIds(frm.labeled_extracts, 'L'); |
---|
278 | if (ids.length > 0) |
---|
279 | { |
---|
280 | parents[parents.length] = 'LABELEDEXTRACT:'+ids.join(':'); |
---|
281 | } |
---|
282 | return parents; |
---|
283 | } |
---|
284 | |
---|
285 | function selectProtocolOnClick() |
---|
286 | { |
---|
287 | var frm = document.forms['hybridization']; |
---|
288 | var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; |
---|
289 | if (frm.protocol_id.length > 1) |
---|
290 | { |
---|
291 | var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
---|
292 | url += '&item_id='+id; |
---|
293 | } |
---|
294 | url += '&filter:INT:protocolType=<%=SystemItems.getId(ProtocolType.HYBRIDIZATION)%>'; |
---|
295 | Main.openPopup(url, 'SelectProtocol', 1000, 700); |
---|
296 | } |
---|
297 | function setProtocolCallback(id, name) |
---|
298 | { |
---|
299 | var frm = document.forms['hybridization']; |
---|
300 | var list = frm.protocol_id; |
---|
301 | if (list.length < 2 || list[1].value == '0') // > |
---|
302 | { |
---|
303 | Forms.addListOption(list, 1, new Option()); |
---|
304 | } |
---|
305 | list[1].value = id; |
---|
306 | list[1].text = name; |
---|
307 | list.selectedIndex = 1; |
---|
308 | protocolChanged = true; |
---|
309 | } |
---|
310 | function protocolOnChange() |
---|
311 | { |
---|
312 | protocolChanged = true; |
---|
313 | } |
---|
314 | |
---|
315 | function selectHybStationOnClick() |
---|
316 | { |
---|
317 | var frm = document.forms['hybridization']; |
---|
318 | var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setHybStationCallback'; |
---|
319 | if (frm.hardware_id.length > 1) |
---|
320 | { |
---|
321 | var id = Math.abs(parseInt(frm.hardware_id[1].value)); |
---|
322 | url += '&item_id='+id; |
---|
323 | } |
---|
324 | url += '&filter:INT:hardwareType=<%=SystemItems.getId(HardwareType.HYBRIDIZATION_STATION)%>'; |
---|
325 | Main.openPopup(url, 'SelectHybStation', 1000, 700); |
---|
326 | } |
---|
327 | function setHybStationCallback(id, name) |
---|
328 | { |
---|
329 | var frm = document.forms['hybridization']; |
---|
330 | var list = frm.hardware_id; |
---|
331 | if (list.length < 2 || list[1].value == '0') // > |
---|
332 | { |
---|
333 | Forms.addListOption(list, 1, new Option()); |
---|
334 | } |
---|
335 | list[1].value = id; |
---|
336 | list[1].text = name; |
---|
337 | list.selectedIndex = 1; |
---|
338 | } |
---|
339 | |
---|
340 | function arraySlideOnChange() |
---|
341 | { |
---|
342 | parentsChanged = true; |
---|
343 | } |
---|
344 | function selectArraySlideOnClick() |
---|
345 | { |
---|
346 | var frm = document.forms['hybridization']; |
---|
347 | var url = '../../lims/arrayslides/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setArraySlideCallback'; |
---|
348 | if (frm.arrayslide_id.length > 1) |
---|
349 | { |
---|
350 | var id = Math.abs(parseInt(frm.arrayslide_id[1].value)); |
---|
351 | url += '&item_id='+id; |
---|
352 | } |
---|
353 | url += '&filter:STRING:hybridization.name=='; |
---|
354 | url += '&filter:BOOLEAN:destroyed=false'; |
---|
355 | Main.openPopup(url, 'SelectArraySlide', 1000, 700); |
---|
356 | } |
---|
357 | function setArraySlideCallback(arraySlideId, name) |
---|
358 | { |
---|
359 | var frm = document.forms['hybridization']; |
---|
360 | if (frm.arrayslide_id.length < 2) // > |
---|
361 | { |
---|
362 | frm.arrayslide_id[frm.arrayslide_id.length] = new Option(); |
---|
363 | } |
---|
364 | frm.arrayslide_id[1].value = arraySlideId; |
---|
365 | frm.arrayslide_id[1].text = name; |
---|
366 | frm.arrayslide_id.selectedIndex = 1; |
---|
367 | parentsChanged = true; |
---|
368 | } |
---|
369 | |
---|
370 | function addLabeledExtractsOnClick() |
---|
371 | { |
---|
372 | var frm = document.forms['hybridization']; |
---|
373 | var ids = Link.getListIds(frm.labeled_extracts, 'L'); |
---|
374 | var excludes = ids.join(','); |
---|
375 | |
---|
376 | var url = '../../biomaterials/labeledextracts/index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addLabeledExtractCallback'; |
---|
377 | url += '&exclude='+excludes; |
---|
378 | Main.openPopup(url, 'AddLabeledExtracts', 1000, 700); |
---|
379 | } |
---|
380 | function addLabeledExtractCallback(labeledExtractId, name) |
---|
381 | { |
---|
382 | var item = Link.getItem('L', labeledExtractId); |
---|
383 | if (!item) item = new Item('L', labeledExtractId, '1: '+name+' [-]', '', ''); |
---|
384 | Link.addItem(document.forms['hybridization'].labeled_extracts, item); |
---|
385 | parentsChanged = true; |
---|
386 | labeledExtractsOnChange(); |
---|
387 | } |
---|
388 | function labeledExtractsOnChange() |
---|
389 | { |
---|
390 | var frm = document.forms['hybridization']; |
---|
391 | var item = frm.labeled_extracts[frm.labeled_extracts.selectedIndex].item; |
---|
392 | if (item && item.id) |
---|
393 | { |
---|
394 | var i = item.value.indexOf(':'); |
---|
395 | frm.used_quantity.value = i > 0 ? item.value.substring(0, i) : item.value; |
---|
396 | frm.array_index.value = i > 0 ? item.value.substring(i+1) : '1'; |
---|
397 | frm.used_quantity.focus(); |
---|
398 | } |
---|
399 | else |
---|
400 | { |
---|
401 | frm.used_quantity.value = ''; |
---|
402 | frm.array_index.value = '1'; |
---|
403 | } |
---|
404 | } |
---|
405 | function usedQuantityOnBlur() |
---|
406 | { |
---|
407 | var frm = document.forms['hybridization']; |
---|
408 | var usedQuantity = frm.used_quantity.value; |
---|
409 | var arrayIndex = frm.array_index.value; |
---|
410 | var numArrays = parseInt(frm.numArrays.value); |
---|
411 | if (arrayIndex != '' && (arrayIndex > numArrays || arrayIndex <= 0)) |
---|
412 | { |
---|
413 | alert('Array index must be between 1 and ' + numArrays); |
---|
414 | return; |
---|
415 | } |
---|
416 | if (arrayIndex == '') arrayIndex = 1; |
---|
417 | var displayQuantity = usedQuantity == '' ? '-' : usedQuantity+' µg'; |
---|
418 | for (var i = 0; i < frm.labeled_extracts.length; i++) // > |
---|
419 | { |
---|
420 | var option = frm.labeled_extracts[i]; |
---|
421 | if (option.selected && option.item.id) |
---|
422 | { |
---|
423 | option.item.value = usedQuantity + ':' + arrayIndex; |
---|
424 | var text = option.text.replace(/\[.*\]/, '['+displayQuantity+']'); |
---|
425 | text = text.replace(/\d*\:/, arrayIndex + ':'); |
---|
426 | option.text = text; |
---|
427 | } |
---|
428 | } |
---|
429 | } |
---|
430 | function arrayIndexOnBlur() |
---|
431 | { |
---|
432 | usedQuantityOnBlur(); |
---|
433 | } |
---|
434 | |
---|
435 | function removeOnClick() |
---|
436 | { |
---|
437 | Link.removeSelected(document.forms['hybridization'].labeled_extracts); |
---|
438 | parentsChanged = true; |
---|
439 | } |
---|
440 | |
---|
441 | |
---|
442 | function init() |
---|
443 | { |
---|
444 | var frm = document.forms['hybridization']; |
---|
445 | var labeledExtracts = frm.labeled_extracts; |
---|
446 | <% |
---|
447 | if (hyb == null) |
---|
448 | { |
---|
449 | %> |
---|
450 | frm.name.focus(); |
---|
451 | frm.name.select(); |
---|
452 | <% |
---|
453 | if (Values.getBoolean(request.getParameter("useParents"))) |
---|
454 | { |
---|
455 | ItemContext lc = sc.getCurrentContext(Item.LABELEDEXTRACT); |
---|
456 | for (int id : lc.getSelected()) |
---|
457 | { |
---|
458 | LabeledExtract e = LabeledExtract.getById(dc, id); |
---|
459 | %> |
---|
460 | Link.addItem(labeledExtracts, new Item('L', <%=e.getId()%>, '1: <%=HTML.javaScriptEncode(e.getName())%> [-]', '', '')); |
---|
461 | <% |
---|
462 | } |
---|
463 | } |
---|
464 | } |
---|
465 | else |
---|
466 | { |
---|
467 | ItemResultList<LabeledExtract> labeledExtracts = labeledExtractsQuery.list(dc); |
---|
468 | for (LabeledExtract le : labeledExtracts) |
---|
469 | { |
---|
470 | String usedQuantity = Values.formatNumber(creationEvent.getUsedQuantity(le), -1); |
---|
471 | int arrayIndex = creationEvent.getSourceGroup(le); |
---|
472 | %> |
---|
473 | Link.addNewItem(labeledExtracts, new Item('L', <%=le.getId()%>, '<%=arrayIndex + ": " + HTML.javaScriptEncode(le.getName())%> [<%=usedQuantity%> µg]', '<%=usedQuantity%>:<%=arrayIndex%>')); |
---|
474 | <% |
---|
475 | } |
---|
476 | } |
---|
477 | %> |
---|
478 | } |
---|
479 | </script> |
---|
480 | </base:head> |
---|
481 | <base:body onload="init()"> |
---|
482 | <p> |
---|
483 | <form action="index.jsp?ID=<%=ID%>" method="post" name="hybridization" onsubmit="return false;"> |
---|
484 | <input type="hidden" name="cmd" value="UpdateItem"> |
---|
485 | |
---|
486 | <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3> |
---|
487 | <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" |
---|
488 | position="bottom" remember="<%=hyb != null%>" switch="switchTab"> |
---|
489 | <t:tab id="info" title="Hybridization" validate="validateHybridization()" helpid="hybridization.edit"> |
---|
490 | <table class="form" cellspacing=0> |
---|
491 | <tr> |
---|
492 | <td class="prompt">Name</td> |
---|
493 | <td><input <%=requiredClazz%> type="text" name="name" |
---|
494 | value="<%=name%>" |
---|
495 | size="40" maxlength="<%=Hybridization.MAX_NAME_LENGTH%>"></td> |
---|
496 | </tr> |
---|
497 | <tr> |
---|
498 | <td class="prompt">Arrays</td> |
---|
499 | <td><input <%=requiredClazz%> type="text" name="numArrays" |
---|
500 | value="<%=hyb == null ? Values.getString(cc.getPropertyValue("numArrays"), "1") : hyb.getNumArrays()%>" |
---|
501 | size="12" maxlength="10" onkeypress="return Numbers.integerOnly(event)"></td> |
---|
502 | </tr> |
---|
503 | <tr> |
---|
504 | <td class="prompt">Created</td> |
---|
505 | <td> |
---|
506 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
507 | <tr> |
---|
508 | <td> |
---|
509 | <input <%=clazz%> type="text" name="event_date" |
---|
510 | value="<%=HTML.encodeTags(dateFormatter.format(eventDate == null ? new Date() : eventDate))%>" |
---|
511 | size="20" maxlength="20" title="Enter date in format: <%=htmlDateFormat%>"> |
---|
512 | |
---|
513 | </td> |
---|
514 | <td> |
---|
515 | <base:button |
---|
516 | onclick="<%="Dates.selectDate('Created', 'hybridization', 'event_date', null, '"+jsDateFormat+"')"%>" |
---|
517 | image="calendar.png" |
---|
518 | title="Calendar…" |
---|
519 | tooltip="Select a date from a calendar" |
---|
520 | /> |
---|
521 | </td> |
---|
522 | </tr> |
---|
523 | </table> |
---|
524 | </td> |
---|
525 | </tr> |
---|
526 | <tr> |
---|
527 | <td class="prompt">Registered</td> |
---|
528 | <td><%=dateFormatter.format(creationEvent == null ? new Date() : creationEvent.getEntryDate())%></td> |
---|
529 | </tr> |
---|
530 | <tr> |
---|
531 | <td class="prompt">Protocol</td> |
---|
532 | <td> |
---|
533 | <base:select |
---|
534 | id="protocol_id" |
---|
535 | clazz="selectionlist" |
---|
536 | required="false" |
---|
537 | current="<%=currentProtocol%>" |
---|
538 | denied="<%=!readCurrentProtocol%>" |
---|
539 | recent="<%=recentProtocols%>" |
---|
540 | defaultitem="<%=defaultProtocol%>" |
---|
541 | newitem="<%=hyb == null%>" |
---|
542 | onselect="selectProtocolOnClick()" |
---|
543 | onchange="protocolOnChange()" |
---|
544 | /> |
---|
545 | </td> |
---|
546 | </tr> |
---|
547 | <tr> |
---|
548 | <td class="prompt">Hardware</td> |
---|
549 | <td> |
---|
550 | <base:select |
---|
551 | id="hardware_id" |
---|
552 | clazz="selectionlist" |
---|
553 | required="false" |
---|
554 | current="<%=currentHybStation%>" |
---|
555 | denied="<%=!readCurrentHybStation%>" |
---|
556 | recent="<%=recentStations%>" |
---|
557 | defaultitem="<%=defaultHybStation%>" |
---|
558 | newitem="<%=hyb == null%>" |
---|
559 | onselect="selectHybStationOnClick()" |
---|
560 | /> |
---|
561 | </td> |
---|
562 | </tr> |
---|
563 | <tr> |
---|
564 | <td class="prompt">Array slide</td> |
---|
565 | <td> |
---|
566 | <base:select |
---|
567 | id="arrayslide_id" |
---|
568 | clazz="selectionlist" |
---|
569 | required="false" |
---|
570 | current="<%=currentArraySlide%>" |
---|
571 | denied="<%=!readCurrentArraySlide%>" |
---|
572 | newitem="<%=hyb == null%>" |
---|
573 | onselect="selectArraySlideOnClick()" |
---|
574 | /> |
---|
575 | </td> |
---|
576 | </tr> |
---|
577 | <tr valign=top> |
---|
578 | <td class="prompt">Description</td> |
---|
579 | <td nowrap> |
---|
580 | <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual" |
---|
581 | ><%=HTML.encodeTags(hyb == null ? cc.getPropertyValue("description") : hyb.getDescription())%></textarea> |
---|
582 | <a href="javascript:Main.zoom('Description', 'hybridization', 'description')" |
---|
583 | title="Edit in larger window"><base:icon image="zoom.gif" /></a> |
---|
584 | </td> |
---|
585 | </tr> |
---|
586 | </table> |
---|
587 | <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> |
---|
588 | </t:tab> |
---|
589 | |
---|
590 | <t:tab id="labeledExtracts" title="Labeled extracts" helpid="hybridization.labeledextracts"> |
---|
591 | <input type="hidden" name="modifiedLabeledExtracts" value=""> |
---|
592 | <input type="hidden" name="removedLabeledExtracts" value=""> |
---|
593 | |
---|
594 | <table class="form" cellspacing=0> |
---|
595 | <tr valign="top"> |
---|
596 | <td class="prompt">Labeled extracts</td> |
---|
597 | <td> |
---|
598 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
599 | <tr valign="top"> |
---|
600 | <td> |
---|
601 | <select name="labeled_extracts" size="5" multiple style="width: 20em;" |
---|
602 | onchange="labeledExtractsOnChange()"> |
---|
603 | </select> <br> |
---|
604 | </td> |
---|
605 | <td> |
---|
606 | <table border="0"> |
---|
607 | <tr><td width="150"><base:button |
---|
608 | onclick="addLabeledExtractsOnClick()" |
---|
609 | title="Add labeled extracts…" |
---|
610 | tooltip="Add labeled extracts" |
---|
611 | /></td></tr> |
---|
612 | <tr><td width="150"><base:button |
---|
613 | onclick="removeOnClick()" |
---|
614 | title="Remove" |
---|
615 | tooltip="Remove the selected labeled extracts" |
---|
616 | /></td></tr> |
---|
617 | </table> |
---|
618 | </td> |
---|
619 | </tr> |
---|
620 | </table> |
---|
621 | </td> |
---|
622 | </tr> |
---|
623 | |
---|
624 | <tr> |
---|
625 | <td style="text-align: right; padding-right: 5px;">- used quantity</td> |
---|
626 | <td> |
---|
627 | <input <%=clazz%> type="text" name="used_quantity" value="" |
---|
628 | size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)" |
---|
629 | onkeyup="usedQuantityOnBlur()" |
---|
630 | > (µg) |
---|
631 | </td> |
---|
632 | </tr> |
---|
633 | |
---|
634 | <tr> |
---|
635 | <td style="text-align: right; padding-right: 5px;">- array index</td> |
---|
636 | <td> |
---|
637 | <input <%=clazz%> type="text" name="array_index" value="" |
---|
638 | size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)" |
---|
639 | onkeyup="arrayIndexOnBlur()" |
---|
640 | > |
---|
641 | </td> |
---|
642 | </tr> |
---|
643 | |
---|
644 | </table> |
---|
645 | </t:tab> |
---|
646 | |
---|
647 | <t:tab id="annotations" title="Annotations & parameters" |
---|
648 | helpid="annotations.edit" tooltip="Enter values for annotations and protocol parameters"> |
---|
649 | <iframe name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" |
---|
650 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
651 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
652 | </t:tab> |
---|
653 | |
---|
654 | <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited"> |
---|
655 | |
---|
656 | <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" |
---|
657 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
658 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
659 | </t:tab> |
---|
660 | </t:tabcontrol> |
---|
661 | |
---|
662 | <table align="center"> |
---|
663 | <tr> |
---|
664 | <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td> |
---|
665 | <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td> |
---|
666 | </tr> |
---|
667 | </table> |
---|
668 | </form> |
---|
669 | </base:body> |
---|
670 | </base:page> |
---|
671 | <% |
---|
672 | } |
---|
673 | finally |
---|
674 | { |
---|
675 | if (dc != null) dc.close(); |
---|
676 | } |
---|
677 | %> |
---|