1 | <%-- $Id: edit_labeledextract.jsp 2969 2006-11-28 12:40:05Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) Authors contributing to this file. |
---|
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 2 |
---|
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 this program; if not, write to the Free Software |
---|
20 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
21 | Boston, MA 02111-1307, USA. |
---|
22 | ------------------------------------------------------------------ |
---|
23 | |
---|
24 | |
---|
25 | @author Nicklas |
---|
26 | @version 2.0 |
---|
27 | --%> |
---|
28 | <%@ page |
---|
29 | import="net.sf.basedb.core.SessionControl" |
---|
30 | import="net.sf.basedb.core.DbControl" |
---|
31 | import="net.sf.basedb.core.Item" |
---|
32 | import="net.sf.basedb.core.ItemContext" |
---|
33 | import="net.sf.basedb.core.SystemItems" |
---|
34 | import="net.sf.basedb.core.Permission" |
---|
35 | import="net.sf.basedb.core.LabeledExtract" |
---|
36 | import="net.sf.basedb.core.Extract" |
---|
37 | import="net.sf.basedb.core.Label" |
---|
38 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
39 | import="net.sf.basedb.core.Protocol" |
---|
40 | import="net.sf.basedb.core.ProtocolType" |
---|
41 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
42 | import="net.sf.basedb.core.BaseException" |
---|
43 | import="net.sf.basedb.core.ItemQuery" |
---|
44 | import="net.sf.basedb.core.ItemResultList" |
---|
45 | import="net.sf.basedb.core.Include" |
---|
46 | import="net.sf.basedb.core.query.Orders" |
---|
47 | import="net.sf.basedb.core.query.Hql" |
---|
48 | import="net.sf.basedb.clients.web.Base" |
---|
49 | import="net.sf.basedb.clients.web.util.HTML" |
---|
50 | import="net.sf.basedb.util.Values" |
---|
51 | import="java.util.List" |
---|
52 | import="java.util.Set" |
---|
53 | import="java.util.HashSet" |
---|
54 | import="java.util.Date" |
---|
55 | %> |
---|
56 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
57 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
58 | <% |
---|
59 | final Item itemType = Item.LABELEDEXTRACT; |
---|
60 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
61 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
62 | final int itemId = cc.getId(); |
---|
63 | final String ID = sc.getId(); |
---|
64 | final float scale = Base.getScale(sc); |
---|
65 | final DbControl dc = sc.newDbControl(); |
---|
66 | try |
---|
67 | { |
---|
68 | String title = null; |
---|
69 | LabeledExtract extract = null; |
---|
70 | BioMaterialEvent creationEvent = null; |
---|
71 | boolean isPooled = false; |
---|
72 | |
---|
73 | boolean readCurrentProtocol = true; |
---|
74 | Protocol currentProtocol = null; |
---|
75 | boolean readCurrentLabel = true; |
---|
76 | Label currentLabel = null; |
---|
77 | boolean readCurrentExtract = true; |
---|
78 | Extract currentExtract = null; |
---|
79 | Float usedFromExtract = null; |
---|
80 | ItemQuery<LabeledExtract> extractsQuery = null; |
---|
81 | String name = null; |
---|
82 | |
---|
83 | // Load recently used items |
---|
84 | List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL); |
---|
85 | List<Extract> recentExtracts = (List<Extract>)cc.getRecent(dc, Item.EXTRACT); |
---|
86 | List<Label> recentLabels = (List<Label>)cc.getRecent(dc, Item.LABEL); |
---|
87 | |
---|
88 | if (itemId == 0) |
---|
89 | { |
---|
90 | title = "Create labeled extract"; |
---|
91 | cc.removeObject("item"); |
---|
92 | if (cc.getPropertyFilter("creationEvent.protocol.name") != null) |
---|
93 | { |
---|
94 | currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name")); |
---|
95 | } |
---|
96 | if (cc.getPropertyFilter("label.name") != null) |
---|
97 | { |
---|
98 | currentLabel = Base.getFirstMatching(dc, Label.getQuery(), "name", cc.getPropertyFilter("label.name")); |
---|
99 | } |
---|
100 | int labelId = Values.getInt(request.getParameter("label_id")); |
---|
101 | if (labelId != 0) |
---|
102 | { |
---|
103 | currentLabel = Label.getById(dc, labelId); |
---|
104 | } |
---|
105 | if (currentLabel == null && recentLabels.size() > 0) currentLabel = recentLabels.get(0); |
---|
106 | int extractId = Values.getInt(request.getParameter("extract_id")); |
---|
107 | if (extractId != 0) |
---|
108 | { |
---|
109 | currentExtract = Extract.getById(dc, extractId); |
---|
110 | isPooled = false; |
---|
111 | name = currentExtract.getName() +".lbe"+ (currentExtract.countLabeledExtracts() + 1); |
---|
112 | } |
---|
113 | else if (Values.getBoolean(request.getParameter("pooled"))) |
---|
114 | { |
---|
115 | isPooled = true; |
---|
116 | name = Values.getString(cc.getPropertyValue("name"), "New pooled labeled extract"); |
---|
117 | } |
---|
118 | else |
---|
119 | { |
---|
120 | isPooled = Values.getBoolean(cc.getPropertyValue("pooled")); |
---|
121 | name = Values.getString(cc.getPropertyValue("name"), "New labeled extract"); |
---|
122 | } |
---|
123 | } |
---|
124 | else |
---|
125 | { |
---|
126 | extract = LabeledExtract.getById(dc, itemId); |
---|
127 | cc.setObject("item", extract); |
---|
128 | title = "Edit labeled extract -- " + HTML.encodeTags(extract.getName()); |
---|
129 | |
---|
130 | creationEvent = extract.getCreationEvent(); |
---|
131 | isPooled = extract.isPooled(); |
---|
132 | name = extract.getName(); |
---|
133 | |
---|
134 | try |
---|
135 | { |
---|
136 | currentProtocol = creationEvent.getProtocol(); |
---|
137 | } |
---|
138 | catch (PermissionDeniedException ex) |
---|
139 | { |
---|
140 | readCurrentProtocol = false; |
---|
141 | } |
---|
142 | |
---|
143 | try |
---|
144 | { |
---|
145 | currentLabel = extract.getLabel(); |
---|
146 | } |
---|
147 | catch (PermissionDeniedException ex) |
---|
148 | { |
---|
149 | readCurrentLabel = false; |
---|
150 | } |
---|
151 | |
---|
152 | try |
---|
153 | { |
---|
154 | currentExtract = extract.getExtract(); |
---|
155 | if (currentExtract != null) usedFromExtract = creationEvent.getUsedQuantity(currentExtract); |
---|
156 | } |
---|
157 | catch (PermissionDeniedException ex) |
---|
158 | { |
---|
159 | readCurrentExtract = false; |
---|
160 | } |
---|
161 | |
---|
162 | // Query to retrieve pooled extracts |
---|
163 | extractsQuery = (ItemQuery<LabeledExtract>)creationEvent.getSources(); |
---|
164 | extractsQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); |
---|
165 | extractsQuery.order(Orders.asc(Hql.property("name"))); |
---|
166 | |
---|
167 | } |
---|
168 | if (extract != null && !extract.hasPermission(Permission.WRITE)) |
---|
169 | { |
---|
170 | throw new PermissionDeniedException(Permission.WRITE, itemType.toString()); |
---|
171 | } |
---|
172 | |
---|
173 | final ItemQuery<Label> labelsQuery = Label.getQuery(); |
---|
174 | labelsQuery.order(Orders.asc(Hql.property("name"))); |
---|
175 | labelsQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT); |
---|
176 | labelsQuery.setCacheResult(true); |
---|
177 | labelsQuery.setItemPermission(Permission.USE); |
---|
178 | final ItemResultList<Label> labels = labelsQuery.list(dc); |
---|
179 | |
---|
180 | final String clazz = "class=\"text\""; |
---|
181 | final String requiredClazz = "class=\"text required\""; |
---|
182 | %> |
---|
183 | |
---|
184 | <base:page type="popup" title="<%=title%>"> |
---|
185 | <base:head scripts="tabcontrol.js,annotations.js,linkitems.js" styles="tabcontrol.css"> |
---|
186 | <script language="JavaScript"> |
---|
187 | // Validate the "LabeledExtract" tab |
---|
188 | function validateLabeledExtract() |
---|
189 | { |
---|
190 | var frm = document.forms['labeledextract']; |
---|
191 | if (Main.trimString(frm.name.value) == '') |
---|
192 | { |
---|
193 | alert("You must enter a name"); |
---|
194 | frm.name.focus(); |
---|
195 | return false; |
---|
196 | } |
---|
197 | return true; |
---|
198 | } |
---|
199 | |
---|
200 | // Submit the form |
---|
201 | function saveSettings() |
---|
202 | { |
---|
203 | var frm = document.forms['labeledextract']; |
---|
204 | if (TabControl.validateActiveTab('settings')) |
---|
205 | { |
---|
206 | if (annotationsLoaded) |
---|
207 | { |
---|
208 | Annotations.addModifiedAnnotationsToForm(frames.annotations, frm); |
---|
209 | } |
---|
210 | if (inheritedAnnotationsLoaded) |
---|
211 | { |
---|
212 | Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm); |
---|
213 | } |
---|
214 | frm.modifiedLabeledExtracts.value = Link.exportModified(frm, 'E', true).join(','); |
---|
215 | frm.removedLabeledExtracts.value = Link.getActionIds(-1, 'E').join(','); |
---|
216 | frm.submit(); |
---|
217 | } |
---|
218 | } |
---|
219 | |
---|
220 | var annotationsLoaded = false; |
---|
221 | var inheritedAnnotationsLoaded = false; |
---|
222 | var parentsChanged = false; |
---|
223 | function switchTab(tabControlId, tabId) |
---|
224 | { |
---|
225 | if (TabControl.setActiveTab(tabControlId, tabId)) |
---|
226 | { |
---|
227 | if (tabId == 'annotations' && !annotationsLoaded) |
---|
228 | { |
---|
229 | Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>); |
---|
230 | annotationsLoaded = true; |
---|
231 | } |
---|
232 | else if (tabId == 'inheritedAnnotations' && |
---|
233 | (parentsChanged || !inheritedAnnotationsLoaded)) |
---|
234 | { |
---|
235 | Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents()); |
---|
236 | inheritedAnnotationsLoaded = true; |
---|
237 | parentsChanged = false; |
---|
238 | } |
---|
239 | } |
---|
240 | } |
---|
241 | |
---|
242 | function getParents() |
---|
243 | { |
---|
244 | var frm = document.forms['labeledextract']; |
---|
245 | var parents = new Array(); |
---|
246 | if (frm.pooled[0].checked) |
---|
247 | { |
---|
248 | var extractId = Math.abs(parseInt(frm.extract_id[frm.extract_id.selectedIndex].value)); |
---|
249 | if (extractId > 0) parents[parents.length] = 'EXTRACT:'+extractId; |
---|
250 | } |
---|
251 | else |
---|
252 | { |
---|
253 | var ids = Link.getListIds(frm.labeledextracts, 'E'); |
---|
254 | if (ids.length > 0) |
---|
255 | { |
---|
256 | parents[parents.length] = 'LABELEDEXTRACT:'+ids.join(':'); |
---|
257 | } |
---|
258 | } |
---|
259 | return parents; |
---|
260 | } |
---|
261 | |
---|
262 | function selectProtocolOnClick() |
---|
263 | { |
---|
264 | var frm = document.forms['labeledextract']; |
---|
265 | var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; |
---|
266 | if (frm.protocol_id.length > 1) |
---|
267 | { |
---|
268 | var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
---|
269 | url += '&item_id='+id; |
---|
270 | } |
---|
271 | url += '&filter:INT:protocolType=<%=SystemItems.getId(ProtocolType.LABELING)%>'; |
---|
272 | Main.openPopup(url, 'SelectProtocol', 1000, 700); |
---|
273 | } |
---|
274 | function setProtocolCallback(id, name) |
---|
275 | { |
---|
276 | var frm = document.forms['labeledextract']; |
---|
277 | var list = frm.protocol_id; |
---|
278 | if (list.length < 2 || list[1].value == '0') // > |
---|
279 | { |
---|
280 | Forms.addListOption(list, 1, new Option()); |
---|
281 | } |
---|
282 | list[1].value = id; |
---|
283 | list[1].text = name; |
---|
284 | list.selectedIndex = 1; |
---|
285 | } |
---|
286 | |
---|
287 | function pooledOnClick() |
---|
288 | { |
---|
289 | var frm = document.forms['labeledextract']; |
---|
290 | var isPooled = frm.pooled[1].checked |
---|
291 | frm.extract_id.disabled = isPooled; |
---|
292 | frm.used_from_extract.disabled = isPooled; |
---|
293 | frm.labeledextracts.disabled = !isPooled; |
---|
294 | frm.used_quantity.disabled = !isPooled; |
---|
295 | parentsChanged = true; |
---|
296 | } |
---|
297 | function extractOnChange() |
---|
298 | { |
---|
299 | parentsChanged = true; |
---|
300 | } |
---|
301 | function selectExtractOnClick() |
---|
302 | { |
---|
303 | var frm = document.forms['labeledextract']; |
---|
304 | if (frm.pooled[1].checked) |
---|
305 | { |
---|
306 | alert('This is a pooled labeled extract, which cannot have an extract as it\'s parent'); |
---|
307 | return; |
---|
308 | } |
---|
309 | var url = '../extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setExtractCallback'; |
---|
310 | if (frm.extract_id.length > 1) |
---|
311 | { |
---|
312 | var id = Math.abs(parseInt(frm.extract_id[1].value)); |
---|
313 | url += '&item_id='+id; |
---|
314 | } |
---|
315 | Main.openPopup(url, 'SelectExtract', 1000, 700); |
---|
316 | } |
---|
317 | function setExtractCallback(id, name) |
---|
318 | { |
---|
319 | var frm = document.forms['labeledextract']; |
---|
320 | var list = frm.extract_id; |
---|
321 | if (list.length < 2 || list[1].value == '0') // > |
---|
322 | { |
---|
323 | Forms.addListOption(list, 1, new Option()); |
---|
324 | } |
---|
325 | list[1].value = id; |
---|
326 | list[1].text = name; |
---|
327 | list.selectedIndex = 1; |
---|
328 | parentsChanged = true; |
---|
329 | } |
---|
330 | |
---|
331 | function addLabeledExtractsOnClick() |
---|
332 | { |
---|
333 | var frm = document.forms['labeledextract']; |
---|
334 | if (!frm.pooled[1].checked) |
---|
335 | { |
---|
336 | alert('This is not a pooled labeled extract'); |
---|
337 | return; |
---|
338 | } |
---|
339 | Main.openPopup('index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addLabeledExtractCallback', 'AddLabeledExtracts', 1000, 700); |
---|
340 | } |
---|
341 | function addLabeledExtractCallback(labeledExtractId, name) |
---|
342 | { |
---|
343 | var item = Link.getItem('E', labeledExtractId); |
---|
344 | if (!item) item = new Item('E', labeledExtractId, name+' [-]', '', ''); |
---|
345 | Link.addItem(document.forms['labeledextract'].labeledextracts, item); |
---|
346 | parentsChanged = true; |
---|
347 | } |
---|
348 | function labeledExtractsOnChange() |
---|
349 | { |
---|
350 | var frm = document.forms['labeledextract']; |
---|
351 | var item = frm.labeledextracts[frm.labeledextracts.selectedIndex].item; |
---|
352 | if (item && item.id) |
---|
353 | { |
---|
354 | frm.used_quantity.value = item.value; |
---|
355 | frm.used_quantity.focus(); |
---|
356 | } |
---|
357 | else |
---|
358 | { |
---|
359 | frm.used_quantity.value = ''; |
---|
360 | } |
---|
361 | } |
---|
362 | function usedQuantityOnBlur() |
---|
363 | { |
---|
364 | var frm = document.forms['labeledextract']; |
---|
365 | var usedQuantity = frm.used_quantity.value; |
---|
366 | var displayQuantity = usedQuantity == '' ? '-' : usedQuantity+' µg'; |
---|
367 | for (var i = 0; i < frm.labeledextracts.length; i++) // > |
---|
368 | { |
---|
369 | var option = frm.labeledextracts[i]; |
---|
370 | if (option.selected && option.item.id) |
---|
371 | { |
---|
372 | option.item.value = usedQuantity; |
---|
373 | var text = option.text.replace(/\[.*\]/, '['+displayQuantity+']'); |
---|
374 | option.text = text; |
---|
375 | } |
---|
376 | } |
---|
377 | } |
---|
378 | function usedFromExtractOnBlur() |
---|
379 | { |
---|
380 | var frm = document.forms['labeledextract']; |
---|
381 | |
---|
382 | var extractId = parseInt(frm.extract_id[frm.extract_id.selectedIndex].value); |
---|
383 | if (extractId < 0) |
---|
384 | { |
---|
385 | frm.extract_id[frm.extract_id.selectedIndex].value = -extractId; |
---|
386 | } |
---|
387 | } |
---|
388 | |
---|
389 | function removeOnClick() |
---|
390 | { |
---|
391 | Link.removeSelected(document.forms['labeledextract'].labeledextracts); |
---|
392 | parentsChanged = true; |
---|
393 | } |
---|
394 | |
---|
395 | function init() |
---|
396 | { |
---|
397 | <% |
---|
398 | if (extract == null) |
---|
399 | { |
---|
400 | %> |
---|
401 | var frm = document.forms['labeledextract']; |
---|
402 | frm.name.focus(); |
---|
403 | frm.name.select(); |
---|
404 | <% |
---|
405 | } |
---|
406 | %> |
---|
407 | initLabeledExtracts(); |
---|
408 | pooledOnClick(); |
---|
409 | } |
---|
410 | function initLabeledExtracts() |
---|
411 | { |
---|
412 | var extracts = document.forms['labeledextract'].labeledextracts; |
---|
413 | <% |
---|
414 | if (extract != null && extract.isPooled()) |
---|
415 | { |
---|
416 | ItemResultList<LabeledExtract> extracts = extractsQuery.list(dc); |
---|
417 | for (LabeledExtract e : extracts) |
---|
418 | { |
---|
419 | String usedQuantity = Values.formatNumber(creationEvent.getUsedQuantity(e), -1); |
---|
420 | %> |
---|
421 | Link.addNewItem(extracts, new Item('E', <%=e.getId()%>, '<%=HTML.javaScriptEncode(e.getName())%> [<%=usedQuantity%> µg]', '<%=usedQuantity%>')); |
---|
422 | <% |
---|
423 | } |
---|
424 | } |
---|
425 | else if (extract == null && Values.getBoolean(request.getParameter("pooled"))) |
---|
426 | { |
---|
427 | for (int id : cc.getSelected()) |
---|
428 | { |
---|
429 | LabeledExtract e = LabeledExtract.getById(dc, id); |
---|
430 | %> |
---|
431 | Link.addItem(extracts, new Item('E', <%=e.getId()%>, '<%=HTML.javaScriptEncode(e.getName())%> [-]', '', '')); |
---|
432 | <% |
---|
433 | } |
---|
434 | } |
---|
435 | %> |
---|
436 | } |
---|
437 | </script> |
---|
438 | </base:head> |
---|
439 | <base:body onload="init()"> |
---|
440 | <p> |
---|
441 | <form action="index.jsp?ID=<%=ID%>" method="post" name="labeledextract" onsubmit="return false;"> |
---|
442 | <input type="hidden" name="cmd" value="UpdateItem"> |
---|
443 | |
---|
444 | <h3 class="docked"><%=title%> <base:help tabcontrol="settings"/></h3> |
---|
445 | <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" |
---|
446 | position="bottom" remember="<%=extract != null%>" switch="switchTab"> |
---|
447 | <t:tab id="info" title="Labeled extract" validate="validateLabeledExtract()" helpid="labeledextract.edit"> |
---|
448 | <table class="form" cellspacing=0> |
---|
449 | <tr> |
---|
450 | <td class="prompt">Name</td> |
---|
451 | <td><input <%=requiredClazz%> type="text" name="name" |
---|
452 | value="<%=HTML.encodeTags(name)%>" |
---|
453 | size="40" maxlength="<%=Extract.MAX_NAME_LENGTH%>"></td> |
---|
454 | </tr> |
---|
455 | <tr> |
---|
456 | <td class="prompt">External ID</td> |
---|
457 | <td><input <%=clazz%> type="text" name="external_id" |
---|
458 | value="<%=HTML.encodeTags(extract == null ? Values.getString(cc.getPropertyValue("externalId"), "") : extract.getExternalId())%>" |
---|
459 | size="40" maxlength="<%=Extract.MAX_EXTERNAL_ID_LENGTH%>"></td> |
---|
460 | </tr> |
---|
461 | <tr> |
---|
462 | <td class="prompt">Label</td> |
---|
463 | <td> |
---|
464 | <select name="label_id" size="1" |
---|
465 | <%=!readCurrentLabel ? "disabled readonly class=\"disabled\"" : "class=\"required\""%> |
---|
466 | style="width: 20em;"> |
---|
467 | <% |
---|
468 | if (!readCurrentLabel) |
---|
469 | { |
---|
470 | %> |
---|
471 | <option value="-1">- denied - |
---|
472 | <% |
---|
473 | } |
---|
474 | else |
---|
475 | { |
---|
476 | for (Label label : labels) |
---|
477 | { |
---|
478 | boolean current = label.equals(currentLabel); |
---|
479 | %> |
---|
480 | <option value="<%=current && extract != null ? -label.getId() : label.getId()%>" |
---|
481 | <%=current ? "selected" : ""%>><%=HTML.encodeTags(label.getName())%> |
---|
482 | <% |
---|
483 | } |
---|
484 | } |
---|
485 | %> |
---|
486 | </select> |
---|
487 | </td> |
---|
488 | </tr> |
---|
489 | <tr> |
---|
490 | <td class="prompt">Original quantity</td> |
---|
491 | <td><input <%=clazz%> type="text" name="original_quantity" |
---|
492 | value="<%=Values.formatNumber(extract == null ? Values.getFloat(cc.getPropertyValue("originalQuantity"), null): extract.getOriginalQuantity(), -1)%>" size="12" |
---|
493 | maxlength="10" onkeypress="return Numbers.numberOnly(event)"> (µg)</td> |
---|
494 | </tr> |
---|
495 | <tr> |
---|
496 | <td class="prompt">Remaining quantity</td> |
---|
497 | <td><%=Values.formatNumber(extract == null ? null : extract.getRemainingQuantity(), 2, " µg")%></td> |
---|
498 | </tr> |
---|
499 | <tr> |
---|
500 | <td class="prompt">Created</td> |
---|
501 | <td> |
---|
502 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
503 | <tr> |
---|
504 | <td> |
---|
505 | <input <%=clazz%> type="text" name="event_date" |
---|
506 | value="<%=Values.formatDate(creationEvent == null ? Values.getDate(cc.getPropertyValue("creationEvent.eventDate"), new Date()): creationEvent.getEventDate())%>" |
---|
507 | size="12" maxlength="10" onkeypress="return Dates.dateOnly(event)"> |
---|
508 | (yyyy-mm-dd) |
---|
509 | </td> |
---|
510 | <td> |
---|
511 | <base:button |
---|
512 | onclick="Dates.selectDate('Date', 'extract', 'event_date')" |
---|
513 | image="calendar.png" |
---|
514 | title="Calendar…" |
---|
515 | tooltip="Select a date from a calendar" |
---|
516 | /> |
---|
517 | </td> |
---|
518 | </tr> |
---|
519 | </table> |
---|
520 | </td> |
---|
521 | </tr> |
---|
522 | <tr> |
---|
523 | <td class="prompt">Registered</td> |
---|
524 | <td><%=Values.formatDate(creationEvent == null ? new Date() : creationEvent.getEntryDate())%></td> |
---|
525 | </tr> |
---|
526 | <tr> |
---|
527 | <td class="prompt">Protocol</td> |
---|
528 | <td> |
---|
529 | <base:select |
---|
530 | id="protocol_id" |
---|
531 | clazz="selectionlist" |
---|
532 | required="false" |
---|
533 | current="<%=currentProtocol%>" |
---|
534 | denied="<%=!readCurrentProtocol%>" |
---|
535 | recent="<%=recentProtocols%>" |
---|
536 | newitem="<%=extract == null%>" |
---|
537 | onselect="selectProtocolOnClick()" |
---|
538 | /> |
---|
539 | </td> |
---|
540 | </tr> |
---|
541 | <tr valign=top> |
---|
542 | <td class="prompt">Description</td> |
---|
543 | <td nowrap> |
---|
544 | <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual" |
---|
545 | ><%=HTML.encodeTags(extract == null ? cc.getPropertyValue("description") : extract.getDescription())%></textarea> |
---|
546 | <a href="javascript:Main.zoom('Description', 'extract', 'description')" |
---|
547 | title="Edit in larger window"><base:icon image="zoom.gif" /></a> |
---|
548 | </td> |
---|
549 | </tr> |
---|
550 | </table> |
---|
551 | <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> |
---|
552 | </t:tab> |
---|
553 | |
---|
554 | <t:tab id="parents" title="Parents" helpid="labeledextract.parent"> |
---|
555 | <table class="form" cellspacing=0> |
---|
556 | <tr> |
---|
557 | <td class="prompt">Pooled</td> |
---|
558 | <td> |
---|
559 | <input type="radio" name="pooled" value="0" onclick="pooledOnClick()" |
---|
560 | <%=!isPooled ? "checked" : ""%> |
---|
561 | >no |
---|
562 | <input type="radio" name="pooled" value="1" onclick="pooledOnClick()" |
---|
563 | <%=isPooled ? "checked" : ""%> |
---|
564 | >yes |
---|
565 | </td> |
---|
566 | </tr> |
---|
567 | <tr valign="top"> |
---|
568 | <td class="prompt">Extract</td> |
---|
569 | <td> |
---|
570 | <base:select |
---|
571 | id="extract_id" |
---|
572 | clazz="selectionlist" |
---|
573 | required="false" |
---|
574 | current="<%=currentExtract%>" |
---|
575 | denied="<%=!readCurrentExtract%>" |
---|
576 | recent="<%=recentExtracts%>" |
---|
577 | selectrecent="false" |
---|
578 | newitem="<%=extract == null%>" |
---|
579 | onselect="selectExtractOnClick()" |
---|
580 | onchange="extractOnChange()" |
---|
581 | /> |
---|
582 | Used |
---|
583 | <input <%=clazz%> type="text" name="used_from_extract" value="<%=Values.formatNumber(usedFromExtract, -1)%>" |
---|
584 | size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)" |
---|
585 | onblur="usedFromExtractOnBlur()"> (µg) |
---|
586 | </td> |
---|
587 | </tr> |
---|
588 | <tr valign="top"> |
---|
589 | <td class="prompt">Labeled extracts</td> |
---|
590 | <td> |
---|
591 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
592 | <tr valign="top"> |
---|
593 | <td> |
---|
594 | <select name="labeledextracts" size="5" multiple style="width: 20em;" |
---|
595 | onchange="labeledExtractsOnChange()"> |
---|
596 | </select> <br> |
---|
597 | Used |
---|
598 | <input <%=clazz%> type="text" name="used_quantity" value="" |
---|
599 | size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)" |
---|
600 | onkeyup="usedQuantityOnBlur()" |
---|
601 | > (µg) |
---|
602 | <input type="hidden" name="modifiedLabeledExtracts" value=""> |
---|
603 | <input type="hidden" name="removedLabeledExtracts" value=""> |
---|
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 | </table> |
---|
624 | </t:tab> |
---|
625 | |
---|
626 | <t:tab id="annotations" title="Annotations" helpid="annotations.edit"> |
---|
627 | <iframe name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" |
---|
628 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
629 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
630 | </t:tab> |
---|
631 | |
---|
632 | <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited"> |
---|
633 | |
---|
634 | <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" |
---|
635 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
636 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
637 | </t:tab> |
---|
638 | </t:tabcontrol> |
---|
639 | |
---|
640 | <table align="center"> |
---|
641 | <tr> |
---|
642 | <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td> |
---|
643 | <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td> |
---|
644 | </tr> |
---|
645 | </table> |
---|
646 | </form> |
---|
647 | </base:body> |
---|
648 | </base:page> |
---|
649 | <% |
---|
650 | } |
---|
651 | finally |
---|
652 | { |
---|
653 | if (dc != null) dc.close(); |
---|
654 | } |
---|
655 | %> |
---|