1 | <%-- $Id: edit_rawbioassay.jsp 3400 2007-05-29 06:47:04Z 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 session="false" |
---|
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.RawBioAssay" |
---|
36 | import="net.sf.basedb.core.Affymetrix" |
---|
37 | import="net.sf.basedb.core.Scan" |
---|
38 | import="net.sf.basedb.core.Protocol" |
---|
39 | import="net.sf.basedb.core.ProtocolType" |
---|
40 | import="net.sf.basedb.core.Project" |
---|
41 | import="net.sf.basedb.core.Software" |
---|
42 | import="net.sf.basedb.core.SoftwareType" |
---|
43 | import="net.sf.basedb.core.ArrayDesign" |
---|
44 | import="net.sf.basedb.core.File" |
---|
45 | import="net.sf.basedb.core.FileType" |
---|
46 | import="net.sf.basedb.core.RawDataType" |
---|
47 | import="net.sf.basedb.core.RawDataTypes" |
---|
48 | import="net.sf.basedb.core.ItemQuery" |
---|
49 | import="net.sf.basedb.core.ItemResultList" |
---|
50 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
51 | import="net.sf.basedb.core.BaseException" |
---|
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="java.util.List" |
---|
56 | import="java.util.Set" |
---|
57 | import="java.util.HashSet" |
---|
58 | %> |
---|
59 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
60 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
61 | <% |
---|
62 | final Item itemType = Item.RAWBIOASSAY; |
---|
63 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
64 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
65 | final int itemId = cc.getId(); |
---|
66 | final String ID = sc.getId(); |
---|
67 | final float scale = Base.getScale(sc); |
---|
68 | final DbControl dc = sc.newDbControl(); |
---|
69 | try |
---|
70 | { |
---|
71 | String title = null; |
---|
72 | RawBioAssay rawBioAssay = null; |
---|
73 | String name = null; |
---|
74 | boolean readCurrentCelFile = true; |
---|
75 | File currentCelFile = null; |
---|
76 | boolean readCurrentScan = true; |
---|
77 | Scan currentScan = null; |
---|
78 | boolean readCurrentProtocol = true; |
---|
79 | Protocol currentProtocol = null; |
---|
80 | Protocol defaultProtocol = null; |
---|
81 | boolean readCurrentSoftware = true; |
---|
82 | Software currentSoftware = null; |
---|
83 | Software defaultSoftware = null; |
---|
84 | boolean readCurrentArrayDesign = true; |
---|
85 | ArrayDesign currentArrayDesign = null; |
---|
86 | ArrayDesign defaultArrayDesign = null; |
---|
87 | RawDataType currentRawDataType = null; |
---|
88 | RawDataType defaultRawDataType = null; |
---|
89 | |
---|
90 | // Load recently used items |
---|
91 | List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL); |
---|
92 | List<Scan> recentScans = (List<Scan>)cc.getRecent(dc, Item.SCAN); |
---|
93 | List<Software> recentSoftware = (List<Software>)cc.getRecent(dc, Item.SOFTWARE); |
---|
94 | List<ArrayDesign> recentArrayDesigns = (List<ArrayDesign>)cc.getRecent(dc, Item.ARRAYDESIGN); |
---|
95 | List<File> recentFiles = (List<File>)cc.getRecent(dc, Item.FILE); |
---|
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.FEATURE_EXTRACTION_PROTOCOL); |
---|
104 | } |
---|
105 | catch (PermissionDeniedException pdex) |
---|
106 | { |
---|
107 | defaultProtocol = null; |
---|
108 | } |
---|
109 | try |
---|
110 | { |
---|
111 | defaultSoftware = (Software)activeProject.getDefaultItem(dc, Project.Default.SOFTWARE); |
---|
112 | } |
---|
113 | catch (PermissionDeniedException pdex) |
---|
114 | { |
---|
115 | defaultSoftware = null; |
---|
116 | } |
---|
117 | try |
---|
118 | { |
---|
119 | defaultArrayDesign = (ArrayDesign)activeProject.getDefaultItem(dc, Project.Default.ARRAYDESIGN); |
---|
120 | } |
---|
121 | catch (PermissionDeniedException pdex) |
---|
122 | { |
---|
123 | defaultArrayDesign = null; |
---|
124 | } |
---|
125 | defaultRawDataType = activeProject.getDefaultRawDataType(); |
---|
126 | } |
---|
127 | if (itemId == 0) |
---|
128 | { |
---|
129 | title = "Create raw bioassay"; |
---|
130 | cc.removeObject("item"); |
---|
131 | currentRawDataType = RawDataTypes.getRawDataType(cc.getPropertyValue("rawDataType")); |
---|
132 | if (currentRawDataType == null) |
---|
133 | { |
---|
134 | currentRawDataType = RawDataTypes.getRawDataType(cc.getRecent("RawDataType", 0)); |
---|
135 | } |
---|
136 | |
---|
137 | int scanId = Values.getInt(request.getParameter("scan_id")); |
---|
138 | if (scanId != 0) |
---|
139 | { |
---|
140 | currentScan = Scan.getById(dc, scanId); |
---|
141 | } |
---|
142 | else if (cc.getPropertyFilter("scan.name") != null) |
---|
143 | { |
---|
144 | currentScan = Base.getFirstMatching(dc, Scan.getQuery(), "name", cc.getPropertyFilter("scan.name")); |
---|
145 | } |
---|
146 | |
---|
147 | if (currentScan != null) |
---|
148 | { |
---|
149 | name = currentScan.getName() + ".r" + (currentScan.countRawBioAssays() + 1); |
---|
150 | } |
---|
151 | else |
---|
152 | { |
---|
153 | name = Values.getString(cc.getPropertyValue("name"), "New raw bioassay"); |
---|
154 | } |
---|
155 | if (cc.getPropertyFilter("protocol.name") != null) |
---|
156 | { |
---|
157 | currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("protocol.name")); |
---|
158 | } |
---|
159 | |
---|
160 | if (cc.getPropertyFilter("software.name") != null) |
---|
161 | { |
---|
162 | currentSoftware = Base.getFirstMatching(dc, Software.getQuery(), "name", cc.getPropertyFilter("software.name")); |
---|
163 | } |
---|
164 | if (currentScan != null) |
---|
165 | { |
---|
166 | try |
---|
167 | { |
---|
168 | currentArrayDesign = currentScan.getArrayDesign(); |
---|
169 | } |
---|
170 | catch (PermissionDeniedException ex) |
---|
171 | {} |
---|
172 | } |
---|
173 | if (currentArrayDesign == null && cc.getPropertyFilter("arrayDesign.name") != null) |
---|
174 | { |
---|
175 | currentArrayDesign = Base.getFirstMatching(dc, ArrayDesign.getQuery(), "name", cc.getPropertyFilter("arrayDesign.name")); |
---|
176 | } |
---|
177 | currentRawDataType = currentRawDataType != null ? currentRawDataType : defaultRawDataType; |
---|
178 | } |
---|
179 | else |
---|
180 | { |
---|
181 | rawBioAssay = RawBioAssay.getById(dc, itemId); |
---|
182 | cc.setObject("item", rawBioAssay); |
---|
183 | name = rawBioAssay.getName(); |
---|
184 | currentRawDataType = rawBioAssay.getRawDataType(); |
---|
185 | title = "Edit raw bioassay -- " + HTML.encodeTags(rawBioAssay.getName()); |
---|
186 | |
---|
187 | if (currentRawDataType.isAffymetrix()) |
---|
188 | { |
---|
189 | try |
---|
190 | { |
---|
191 | currentCelFile = Affymetrix.getCelFile(rawBioAssay); |
---|
192 | } |
---|
193 | catch (PermissionDeniedException ex) |
---|
194 | { |
---|
195 | readCurrentCelFile = false; |
---|
196 | } |
---|
197 | } |
---|
198 | |
---|
199 | try |
---|
200 | { |
---|
201 | currentScan = rawBioAssay.getScan(); |
---|
202 | } |
---|
203 | catch (PermissionDeniedException ex) |
---|
204 | { |
---|
205 | readCurrentScan = false; |
---|
206 | } |
---|
207 | try |
---|
208 | { |
---|
209 | currentProtocol = rawBioAssay.getProtocol(); |
---|
210 | } |
---|
211 | catch (PermissionDeniedException ex) |
---|
212 | { |
---|
213 | readCurrentProtocol = false; |
---|
214 | } |
---|
215 | try |
---|
216 | { |
---|
217 | currentSoftware = rawBioAssay.getSoftware(); |
---|
218 | } |
---|
219 | catch (PermissionDeniedException ex) |
---|
220 | { |
---|
221 | readCurrentSoftware = false; |
---|
222 | } |
---|
223 | try |
---|
224 | { |
---|
225 | currentArrayDesign = rawBioAssay.getArrayDesign(); |
---|
226 | } |
---|
227 | catch (PermissionDeniedException ex) |
---|
228 | { |
---|
229 | readCurrentArrayDesign = false; |
---|
230 | } |
---|
231 | } |
---|
232 | if (rawBioAssay != null) rawBioAssay.checkPermission(Permission.WRITE); |
---|
233 | final String clazz = "class=\"text\""; |
---|
234 | final String requiredClazz = "class=\"text required\""; |
---|
235 | %> |
---|
236 | |
---|
237 | <base:page type="popup" title="<%=title%>"> |
---|
238 | <base:head scripts="tabcontrol.js,annotations.js" styles="tabcontrol.css"> |
---|
239 | <script language="JavaScript"> |
---|
240 | // Validate the "RawBioAssay" tab |
---|
241 | function validateRawBioAssay() |
---|
242 | { |
---|
243 | var frm = document.forms['rawbioassay']; |
---|
244 | if (Main.trimString(frm.name.value) == '') |
---|
245 | { |
---|
246 | alert("You must enter a name"); |
---|
247 | frm.name.focus(); |
---|
248 | return false; |
---|
249 | } |
---|
250 | if (frm.rawdatatype) |
---|
251 | { |
---|
252 | var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex].value; |
---|
253 | if (isAffymetrix[rawDataType]) |
---|
254 | { |
---|
255 | var celFileId = frm.celfile_id[frm.celfile_id.selectedIndex].value; |
---|
256 | var arrayDesignId = frm.arraydesign_id[frm.arraydesign_id.selectedIndex].value; |
---|
257 | if (celFileId != 0 && arrayDesignId == 0) |
---|
258 | { |
---|
259 | alert('You must select an array design if a CEL file is specified'); |
---|
260 | return false; |
---|
261 | } |
---|
262 | } |
---|
263 | } |
---|
264 | return true; |
---|
265 | } |
---|
266 | |
---|
267 | // Submit the form |
---|
268 | function saveSettings() |
---|
269 | { |
---|
270 | var frm = document.forms['rawbioassay']; |
---|
271 | if (TabControl.validateActiveTab('settings')) |
---|
272 | { |
---|
273 | if (annotationsLoaded) |
---|
274 | { |
---|
275 | Annotations.addModifiedAnnotationsToForm(frames.annotations, frm); |
---|
276 | } |
---|
277 | if (inheritedAnnotationsLoaded) |
---|
278 | { |
---|
279 | Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm); |
---|
280 | } |
---|
281 | frm.submit(); |
---|
282 | } |
---|
283 | } |
---|
284 | |
---|
285 | var annotationsLoaded = false; |
---|
286 | var inheritedAnnotationsLoaded = false; |
---|
287 | var parentsChanged = false; |
---|
288 | var protocolChanged = false; |
---|
289 | function switchTab(tabControlId, tabId) |
---|
290 | { |
---|
291 | if (TabControl.setActiveTab(tabControlId, tabId)) |
---|
292 | { |
---|
293 | if (tabId == 'annotations' && (protocolChanged || !annotationsLoaded)) |
---|
294 | { |
---|
295 | Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=rawBioAssay == null ? 0 : rawBioAssay.getId()%>, getProtocolId()); |
---|
296 | annotationsLoaded = true; |
---|
297 | protocolChanged = false; |
---|
298 | } |
---|
299 | else if (tabId == 'inheritedAnnotations' && |
---|
300 | (parentsChanged || !inheritedAnnotationsLoaded)) |
---|
301 | { |
---|
302 | Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents()); |
---|
303 | inheritedAnnotationsLoaded = true; |
---|
304 | parentsChanged = false; |
---|
305 | } |
---|
306 | } |
---|
307 | } |
---|
308 | |
---|
309 | function getProtocolId() |
---|
310 | { |
---|
311 | var frm = document.forms['rawbioassay']; |
---|
312 | var protocolId = 0; |
---|
313 | if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled) |
---|
314 | { |
---|
315 | protocolId = Math.abs(parseInt(frm.protocol_id[frm.protocol_id.selectedIndex].value)); |
---|
316 | } |
---|
317 | return protocolId; |
---|
318 | } |
---|
319 | |
---|
320 | function getParents() |
---|
321 | { |
---|
322 | var frm = document.forms['rawbioassay']; |
---|
323 | var parents = new Array(); |
---|
324 | |
---|
325 | var scanId = Math.abs(parseInt(frm.scan_id[frm.scan_id.selectedIndex].value)); |
---|
326 | if (scanId > 0) parents[parents.length] = 'SCAN:'+scanId; |
---|
327 | if (frm.arraydesign_id) |
---|
328 | { |
---|
329 | var arrayDesignId = Math.abs(parseInt(frm.arraydesign_id[frm.arraydesign_id.selectedIndex].value)); |
---|
330 | if (arrayDesignId > 0) parents[parents.length] = 'ARRAYDESIGN:'+arrayDesignId; |
---|
331 | } |
---|
332 | return parents; |
---|
333 | } |
---|
334 | |
---|
335 | function selectProtocolOnClick() |
---|
336 | { |
---|
337 | var frm = document.forms['rawbioassay']; |
---|
338 | var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; |
---|
339 | if (frm.protocol_id.length > 1) |
---|
340 | { |
---|
341 | var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
---|
342 | url += '&item_id='+id; |
---|
343 | } |
---|
344 | url += '&filter:INT:protocolType=<%=SystemItems.getId(ProtocolType.FEATURE_EXTRACTION)%>'; |
---|
345 | Main.openPopup(url, 'SelectProtocol', 1000, 700); |
---|
346 | } |
---|
347 | function setProtocolCallback(id, name) |
---|
348 | { |
---|
349 | var frm = document.forms['rawbioassay']; |
---|
350 | var list = frm.protocol_id; |
---|
351 | if (list.length < 2 || list[1].value == '0') // > |
---|
352 | { |
---|
353 | Forms.addListOption(list, 1, new Option()); |
---|
354 | } |
---|
355 | list[1].value = id; |
---|
356 | list[1].text = name; |
---|
357 | list.selectedIndex = 1; |
---|
358 | protocolChanged = true; |
---|
359 | } |
---|
360 | function protocolOnChange() |
---|
361 | { |
---|
362 | protocolChanged = true; |
---|
363 | } |
---|
364 | |
---|
365 | function scanOnChange() |
---|
366 | { |
---|
367 | parentsChanged = true; |
---|
368 | } |
---|
369 | function selectScanOnClick() |
---|
370 | { |
---|
371 | var frm = document.forms['rawbioassay']; |
---|
372 | var url = '../scans/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setScanCallback'; |
---|
373 | if (frm.scan_id.length > 1) |
---|
374 | { |
---|
375 | var id = Math.abs(parseInt(frm.scan_id[1].value)); |
---|
376 | url += '&item_id='+id; |
---|
377 | } |
---|
378 | Main.openPopup(url, 'SelectScan', 1000, 700); |
---|
379 | } |
---|
380 | function setScanCallback(id, name) |
---|
381 | { |
---|
382 | var frm = document.forms['rawbioassay']; |
---|
383 | var list = frm.scan_id; |
---|
384 | if (list.length < 2 || list[1].value == '0') // > |
---|
385 | { |
---|
386 | Forms.addListOption(list, 1, new Option()); |
---|
387 | } |
---|
388 | list[1].value = id; |
---|
389 | list[1].text = name; |
---|
390 | list.selectedIndex = 1; |
---|
391 | parentsChanged = true; |
---|
392 | } |
---|
393 | |
---|
394 | function selectSoftwareOnClick() |
---|
395 | { |
---|
396 | var frm = document.forms['rawbioassay']; |
---|
397 | var url = '../../admin/software/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setSoftwareCallback'; |
---|
398 | if (frm.software_id.length > 1) |
---|
399 | { |
---|
400 | var id = Math.abs(parseInt(frm.software_id[1].value)); |
---|
401 | url += '&item_id='+id; |
---|
402 | } |
---|
403 | url += '&filter:INT:softwareType=<%=SystemItems.getId(SoftwareType.FEATURE_EXTRACTION)%>'; |
---|
404 | Main.openPopup(url, 'SelectSoftware', 1000, 700); |
---|
405 | } |
---|
406 | function setSoftwareCallback(id, name) |
---|
407 | { |
---|
408 | var frm = document.forms['rawbioassay']; |
---|
409 | var list = frm.software_id; |
---|
410 | if (list.length < 2 || list[1].value == '0') // > |
---|
411 | { |
---|
412 | Forms.addListOption(list, 1, new Option()); |
---|
413 | } |
---|
414 | list[1].value = id; |
---|
415 | list[1].text = name; |
---|
416 | list.selectedIndex = 1; |
---|
417 | } |
---|
418 | |
---|
419 | function arrayDesignOnChange() |
---|
420 | { |
---|
421 | parentsChanged = true; |
---|
422 | } |
---|
423 | function selectArrayDesignOnClick() |
---|
424 | { |
---|
425 | var frm = document.forms['rawbioassay']; |
---|
426 | var url = '../../lims/arraydesigns/index.jsp?ID=<%=ID%>&mode=selectone&callback=setArrayDesignCallback'; |
---|
427 | if (frm.arraydesign_id.length > 1) |
---|
428 | { |
---|
429 | var id = Math.abs(parseInt(frm.arraydesign_id[1].value)); |
---|
430 | url += '&item_id='+id; |
---|
431 | } |
---|
432 | Main.openPopup(url, 'SelectArrayDesign', 1000, 700); |
---|
433 | } |
---|
434 | function setArrayDesignCallback(id, name) |
---|
435 | { |
---|
436 | var frm = document.forms['rawbioassay']; |
---|
437 | var list = frm.arraydesign_id; |
---|
438 | if (list.length < 2 || list[1].value == '0') // > |
---|
439 | { |
---|
440 | Forms.addListOption(list, 1, new Option()); |
---|
441 | } |
---|
442 | list[1].value = id; |
---|
443 | list[1].text = name; |
---|
444 | list.selectedIndex = 1; |
---|
445 | parentsChanged = true; |
---|
446 | } |
---|
447 | |
---|
448 | var isAffymetrix = new Array(); |
---|
449 | <% |
---|
450 | for (RawDataType rdt : RawDataTypes.getRawDataTypes()) |
---|
451 | { |
---|
452 | %> |
---|
453 | isAffymetrix['<%=rdt.getId()%>'] = <%=rdt.isAffymetrix() ? "true" : "false" %>; |
---|
454 | <% |
---|
455 | } |
---|
456 | %> |
---|
457 | |
---|
458 | function selectCelFileOnClick() |
---|
459 | { |
---|
460 | var frm = document.forms['rawbioassay']; |
---|
461 | |
---|
462 | if (frm.rawdatatype) |
---|
463 | { |
---|
464 | var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex].value; |
---|
465 | if (!isAffymetrix[rawDataType]) |
---|
466 | { |
---|
467 | alert('CEL-files are only used for Affymetrix data types.'); |
---|
468 | return; |
---|
469 | } |
---|
470 | } |
---|
471 | |
---|
472 | var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setCelFileCallback'; |
---|
473 | if (frm.celfile_id.length > 1) |
---|
474 | { |
---|
475 | var id = Math.abs(parseInt(frm.celfile_id[1].value)); |
---|
476 | url += '&item_id='+id; |
---|
477 | } |
---|
478 | url += '&filter:STRING:name=%25.cel'; |
---|
479 | Main.openPopup(url, 'SelectFile', 1000, 700); |
---|
480 | } |
---|
481 | function setCelFileCallback(id, name) |
---|
482 | { |
---|
483 | var frm = document.forms['rawbioassay']; |
---|
484 | var list = frm.celfile_id; |
---|
485 | if (list.length < 2 || list[1].value == '0') // > |
---|
486 | { |
---|
487 | Forms.addListOption(list, 1, new Option()); |
---|
488 | } |
---|
489 | list[1].value = id; |
---|
490 | list[1].text = name; |
---|
491 | list.selectedIndex = 1; |
---|
492 | } |
---|
493 | |
---|
494 | function rawDataTypeOnChange() |
---|
495 | { |
---|
496 | var frm = document.forms['rawbioassay']; |
---|
497 | if (frm.rawdatatype) |
---|
498 | { |
---|
499 | var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex].value; |
---|
500 | if (isAffymetrix[rawDataType]) |
---|
501 | { |
---|
502 | frm.celfile_id.disabled = false; |
---|
503 | } |
---|
504 | else |
---|
505 | { |
---|
506 | frm.celfile_id.disabled = true; |
---|
507 | } |
---|
508 | } |
---|
509 | } |
---|
510 | |
---|
511 | function init() |
---|
512 | { |
---|
513 | <% |
---|
514 | if (rawBioAssay == null) |
---|
515 | { |
---|
516 | %> |
---|
517 | var frm = document.forms['rawbioassay']; |
---|
518 | frm.name.focus(); |
---|
519 | frm.name.select(); |
---|
520 | <% |
---|
521 | } |
---|
522 | %> |
---|
523 | rawDataTypeOnChange(); |
---|
524 | } |
---|
525 | </script> |
---|
526 | </base:head> |
---|
527 | <base:body onload="init()"> |
---|
528 | <p> |
---|
529 | <form action="index.jsp?ID=<%=ID%>" method="post" name="rawbioassay" onsubmit="return false;"> |
---|
530 | <input type="hidden" name="cmd" value="UpdateItem"> |
---|
531 | |
---|
532 | <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3> |
---|
533 | <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" |
---|
534 | position="bottom" remember="<%=rawBioAssay != null%>" switch="switchTab"> |
---|
535 | <t:tab id="info" title="Raw bioassay" validate="validateRawBioAssay()" helpid="rawbioassay.edit"> |
---|
536 | <table class="form" cellspacing=0> |
---|
537 | <tr> |
---|
538 | <td class="prompt">Name</td> |
---|
539 | <td><input <%=requiredClazz%> type="text" name="name" |
---|
540 | value="<%=HTML.encodeTags(name)%>" |
---|
541 | size="40" maxlength="<%=RawBioAssay.MAX_NAME_LENGTH%>"></td> |
---|
542 | </tr> |
---|
543 | <tr> |
---|
544 | <td class="prompt">Raw data type</td> |
---|
545 | <td> |
---|
546 | <% |
---|
547 | if (rawBioAssay == null || !rawBioAssay.hasData()) |
---|
548 | { |
---|
549 | %> |
---|
550 | <select name="rawdatatype" class="required" onchange="rawDataTypeOnChange()"> |
---|
551 | <% |
---|
552 | for (RawDataType rdt : RawDataTypes.getRawDataTypes()) |
---|
553 | { |
---|
554 | String selected = rdt.equals(currentRawDataType) ? "selected" : ""; |
---|
555 | %> |
---|
556 | <option value="<%=rdt.getId()%>" <%=selected%>><%=HTML.encodeTags(rdt.getName())%> |
---|
557 | <% |
---|
558 | } |
---|
559 | %> |
---|
560 | </select> |
---|
561 | <% |
---|
562 | } |
---|
563 | else |
---|
564 | { |
---|
565 | %> |
---|
566 | <%=HTML.encodeTags(currentRawDataType.getName())%> |
---|
567 | <% |
---|
568 | } |
---|
569 | %> |
---|
570 | |
---|
571 | </td> |
---|
572 | </tr> |
---|
573 | |
---|
574 | <tr> |
---|
575 | <td class="prompt">Array design</td> |
---|
576 | <td> |
---|
577 | <% |
---|
578 | if (rawBioAssay == null || !rawBioAssay.hasData()) |
---|
579 | { |
---|
580 | %> |
---|
581 | <base:select |
---|
582 | id="arraydesign_id" |
---|
583 | clazz="selectionlist" |
---|
584 | required="false" |
---|
585 | current="<%=currentArrayDesign%>" |
---|
586 | denied="<%=!readCurrentArrayDesign%>" |
---|
587 | recent="<%=recentArrayDesigns%>" |
---|
588 | defaultitem="<%=defaultArrayDesign%>" |
---|
589 | newitem="<%=rawBioAssay == null%>" |
---|
590 | onselect="selectArrayDesignOnClick()" |
---|
591 | onchange="arrayDesignOnChange()" |
---|
592 | /> |
---|
593 | <% |
---|
594 | } |
---|
595 | else |
---|
596 | { |
---|
597 | %> |
---|
598 | <%=readCurrentArrayDesign ? |
---|
599 | (currentArrayDesign != null ? HTML.encodeTags(currentArrayDesign.getName()) : "<i>- none -</i>") |
---|
600 | : "<i>- denied - </i>"%> |
---|
601 | <% |
---|
602 | } |
---|
603 | %> |
---|
604 | </td> |
---|
605 | </tr> |
---|
606 | <% |
---|
607 | if (rawBioAssay == null || !rawBioAssay.hasData() || rawBioAssay.getRawDataType().isAffymetrix()) |
---|
608 | { |
---|
609 | %> |
---|
610 | <tr id="celFile"> |
---|
611 | <td class="prompt">CEL file</td> |
---|
612 | <td> |
---|
613 | <base:select |
---|
614 | id="celfile_id" |
---|
615 | clazz="selectionlist" |
---|
616 | required="false" |
---|
617 | current="<%=currentCelFile%>" |
---|
618 | denied="<%=!readCurrentCelFile%>" |
---|
619 | recent="<%=recentFiles%>" |
---|
620 | newitem="<%=rawBioAssay == null%>" |
---|
621 | onselect="selectCelFileOnClick()" |
---|
622 | /> |
---|
623 | </td> |
---|
624 | </tr> |
---|
625 | <% |
---|
626 | } |
---|
627 | %> |
---|
628 | |
---|
629 | <tr> |
---|
630 | <td class="prompt">Protocol</td> |
---|
631 | <td> |
---|
632 | <base:select |
---|
633 | id="protocol_id" |
---|
634 | clazz="selectionlist" |
---|
635 | required="false" |
---|
636 | current="<%=currentProtocol%>" |
---|
637 | denied="<%=!readCurrentProtocol%>" |
---|
638 | recent="<%=recentProtocols%>" |
---|
639 | defaultitem="<%=defaultProtocol%>" |
---|
640 | newitem="<%=rawBioAssay == null%>" |
---|
641 | onselect="selectProtocolOnClick()" |
---|
642 | onchange="protocolOnChange()" |
---|
643 | /> |
---|
644 | </td> |
---|
645 | </tr> |
---|
646 | <tr> |
---|
647 | <td class="prompt">Scan</td> |
---|
648 | <td> |
---|
649 | <base:select |
---|
650 | id="scan_id" |
---|
651 | clazz="selectionlist" |
---|
652 | required="false" |
---|
653 | current="<%=currentScan%>" |
---|
654 | denied="<%=!readCurrentScan%>" |
---|
655 | recent="<%=recentScans%>" |
---|
656 | newitem="<%=rawBioAssay == null%>" |
---|
657 | onselect="selectScanOnClick()" |
---|
658 | /> |
---|
659 | </td> |
---|
660 | </tr> |
---|
661 | <tr> |
---|
662 | <td class="prompt">Software</td> |
---|
663 | <td> |
---|
664 | <base:select |
---|
665 | id="software_id" |
---|
666 | clazz="selectionlist" |
---|
667 | required="false" |
---|
668 | current="<%=currentSoftware%>" |
---|
669 | denied="<%=!readCurrentSoftware%>" |
---|
670 | recent="<%=recentSoftware%>" |
---|
671 | defaultitem="<%=defaultSoftware%>" |
---|
672 | newitem="<%=rawBioAssay == null%>" |
---|
673 | onselect="selectSoftwareOnClick()" |
---|
674 | /> |
---|
675 | </td> |
---|
676 | </tr> |
---|
677 | <tr valign=top> |
---|
678 | <td class="prompt">Description</td> |
---|
679 | <td nowrap> |
---|
680 | <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual" |
---|
681 | ><%=HTML.encodeTags(rawBioAssay == null ? cc.getPropertyValue("description") : rawBioAssay.getDescription())%></textarea> |
---|
682 | <a href="javascript:Main.zoom('Description', 'rawbioassay', 'description')" |
---|
683 | title="Edit in larger window"><base:icon image="zoom.gif" /></a> |
---|
684 | </td> |
---|
685 | </tr> |
---|
686 | </table> |
---|
687 | <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> |
---|
688 | </t:tab> |
---|
689 | |
---|
690 | <t:tab id="annotations" title="Annotations & parameters" |
---|
691 | helpid="annotations.edit" tooltip="Enter values for annotations and protocol parameters"> |
---|
692 | <iframe name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" |
---|
693 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
694 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
695 | </t:tab> |
---|
696 | |
---|
697 | <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited"> |
---|
698 | <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" |
---|
699 | width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 |
---|
700 | marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> |
---|
701 | </t:tab> |
---|
702 | </t:tabcontrol> |
---|
703 | |
---|
704 | <table align="center"> |
---|
705 | <tr> |
---|
706 | <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td> |
---|
707 | <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td> |
---|
708 | </tr> |
---|
709 | </table> |
---|
710 | </form> |
---|
711 | </base:body> |
---|
712 | </base:page> |
---|
713 | <% |
---|
714 | } |
---|
715 | finally |
---|
716 | { |
---|
717 | if (dc != null) dc.close(); |
---|
718 | } |
---|
719 | %> |
---|