1 | <%-- $Id: analysis_tree.jsp 3592 2007-07-23 12:57:39Z 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 | @author Nicklas |
---|
25 | @version 2.0 |
---|
26 | --%> |
---|
27 | <%@ page session="false" |
---|
28 | import="net.sf.basedb.core.SessionControl" |
---|
29 | import="net.sf.basedb.core.DbControl" |
---|
30 | import="net.sf.basedb.core.Item" |
---|
31 | import="net.sf.basedb.core.ItemContext" |
---|
32 | import="net.sf.basedb.core.BasicItem" |
---|
33 | import="net.sf.basedb.core.Experiment" |
---|
34 | import="net.sf.basedb.core.BioAssaySet" |
---|
35 | import="net.sf.basedb.core.Transformation" |
---|
36 | import="net.sf.basedb.core.ExtraValue" |
---|
37 | import="net.sf.basedb.core.ExtraValueType" |
---|
38 | import="net.sf.basedb.core.AnnotationSet" |
---|
39 | import="net.sf.basedb.core.AnnotationType" |
---|
40 | import="net.sf.basedb.core.Job" |
---|
41 | import="net.sf.basedb.core.ItemQuery" |
---|
42 | import="net.sf.basedb.core.Nameable" |
---|
43 | import="net.sf.basedb.core.ItemResultIterator" |
---|
44 | import="net.sf.basedb.core.ItemResultList" |
---|
45 | import="net.sf.basedb.core.Permission" |
---|
46 | import="net.sf.basedb.core.PluginDefinition" |
---|
47 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
48 | import="net.sf.basedb.core.query.Restrictions" |
---|
49 | import="net.sf.basedb.core.query.Expressions" |
---|
50 | import="net.sf.basedb.core.query.Orders" |
---|
51 | import="net.sf.basedb.core.query.Hql" |
---|
52 | import="net.sf.basedb.core.query.Restrictions" |
---|
53 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
54 | import="net.sf.basedb.core.plugin.Plugin" |
---|
55 | import="net.sf.basedb.util.Tree" |
---|
56 | import="net.sf.basedb.util.Enumeration" |
---|
57 | import="net.sf.basedb.clients.web.Base" |
---|
58 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
59 | import="net.sf.basedb.clients.web.util.HTML" |
---|
60 | import="net.sf.basedb.util.Values" |
---|
61 | import="net.sf.basedb.util.formatter.Formatter" |
---|
62 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
63 | import="java.util.Date" |
---|
64 | import="java.util.List" |
---|
65 | import="java.util.ArrayList" |
---|
66 | import="java.util.LinkedList" |
---|
67 | import="java.util.Map" |
---|
68 | import="java.util.HashMap" |
---|
69 | import="java.util.Iterator" |
---|
70 | import="java.util.Collection" |
---|
71 | %> |
---|
72 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
73 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
74 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
75 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
76 | <%! |
---|
77 | private static final Item itemType = Item.BIOASSAYSET; |
---|
78 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
79 | %> |
---|
80 | <%! |
---|
81 | |
---|
82 | private static void addToTree(Tree<BasicItem> tree, BioAssaySet bas) |
---|
83 | { |
---|
84 | if (!tree.contains(bas)) |
---|
85 | { |
---|
86 | Transformation transformation = bas.getTransformation(); |
---|
87 | Tree.Entry<BasicItem> parent = tree.getEntry(transformation); |
---|
88 | if (parent == null) |
---|
89 | { |
---|
90 | addToTree(tree, transformation); |
---|
91 | parent = tree.getEntry(transformation); |
---|
92 | } |
---|
93 | Tree.Entry<BasicItem> basEntry = parent.addChild(bas); |
---|
94 | for (ExtraValue xv : bas.getExtraValues().list(bas.getDbControl())) |
---|
95 | { |
---|
96 | basEntry.addChild(xv); |
---|
97 | } |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | private static void addToTree(Tree<BasicItem> tree, Transformation transformation) |
---|
102 | { |
---|
103 | if (!tree.contains(transformation)) |
---|
104 | { |
---|
105 | BioAssaySet source = transformation.getSource(); |
---|
106 | Tree.Entry<BasicItem> parent = tree.getEntry(source); |
---|
107 | if (parent == null) |
---|
108 | { |
---|
109 | addToTree(tree, source); |
---|
110 | parent = tree.getEntry(source); |
---|
111 | } |
---|
112 | parent.addChild(transformation); |
---|
113 | } |
---|
114 | } |
---|
115 | |
---|
116 | private static Tree<BasicItem> getAnalysisTree(DbControl dc, ItemQuery<BioAssaySet> bioAssaySetQuery, ItemQuery<Transformation> transformationQuery) |
---|
117 | { |
---|
118 | Tree<BasicItem> tree = new Tree<BasicItem>(null); |
---|
119 | ItemResultList<BioAssaySet> allBioAssaySets = bioAssaySetQuery.list(dc); |
---|
120 | List<Integer> ids = new ArrayList<Integer>(allBioAssaySets.size()); |
---|
121 | |
---|
122 | for (BioAssaySet bas : allBioAssaySets) |
---|
123 | { |
---|
124 | addToTree(tree, bas); |
---|
125 | ids.add(bas.getId()); |
---|
126 | } |
---|
127 | |
---|
128 | transformationQuery.restrict( |
---|
129 | Restrictions.in( |
---|
130 | Hql.property("source.id"), |
---|
131 | Expressions.parameter("bioAssaySets", ids) |
---|
132 | ) |
---|
133 | ); |
---|
134 | ItemResultList<Transformation> allTransformations = transformationQuery.list(dc); |
---|
135 | for (Transformation t: allTransformations) |
---|
136 | { |
---|
137 | addToTree(tree, t); |
---|
138 | } |
---|
139 | return tree; |
---|
140 | } |
---|
141 | String generateTree(Tree<BasicItem> tree, BasicItem root, BasicItem parentItem, Collection<String> closed) |
---|
142 | { |
---|
143 | StringBuilder sb = new StringBuilder(); |
---|
144 | Tree.Entry<BasicItem> parentEntry = tree.getEntry(parentItem); |
---|
145 | if (parentEntry == null) return ""; |
---|
146 | |
---|
147 | if (root != null && root == parentItem) |
---|
148 | { |
---|
149 | appendNode(sb, root, null, true); |
---|
150 | } |
---|
151 | |
---|
152 | List<Tree.Entry<BasicItem>> children = parentEntry.getChildren(); |
---|
153 | if (children != null) |
---|
154 | { |
---|
155 | for (Tree.Entry<BasicItem> child : children) |
---|
156 | { |
---|
157 | BasicItem node = child.getNode(); |
---|
158 | String var = node.getType().name() + "_" + node.getId(); |
---|
159 | appendNode(sb, node, parentItem, (closed == null || !closed.contains(var)) && child.getNumChildren() > 0); |
---|
160 | sb.append(generateTree(tree, root, node, closed)); |
---|
161 | } |
---|
162 | } |
---|
163 | return sb.toString(); |
---|
164 | } |
---|
165 | |
---|
166 | void appendNode(StringBuilder sb, BasicItem node, BasicItem parentItem, boolean open) |
---|
167 | { |
---|
168 | int id = node.getId(); |
---|
169 | String var = node.getType().name() + "_" + id; |
---|
170 | String name = ""; |
---|
171 | |
---|
172 | Item nodeType = node.getType(); |
---|
173 | String folderIcon = ""; |
---|
174 | if (nodeType == Item.BIOASSAYSET) |
---|
175 | { |
---|
176 | folderIcon = "BioAssaySet"; |
---|
177 | name = ((BioAssaySet)node).getName(); |
---|
178 | } |
---|
179 | else if (nodeType == Item.TRANSFORMATION) |
---|
180 | { |
---|
181 | Transformation t = (Transformation)node; |
---|
182 | folderIcon = "Transformation"; |
---|
183 | try |
---|
184 | { |
---|
185 | if (t.getJob().getPluginDefinition().supports("net.sf.basedb.core.plugin.AnalysisFilterPlugin")) |
---|
186 | { |
---|
187 | folderIcon = "Filter"; |
---|
188 | } |
---|
189 | } |
---|
190 | catch (Throwable tt) |
---|
191 | {} |
---|
192 | name = t.getName(); |
---|
193 | } |
---|
194 | else if (nodeType == Item.EXTRAVALUE) |
---|
195 | { |
---|
196 | folderIcon = "ExtraValue"; |
---|
197 | try |
---|
198 | { |
---|
199 | name = ((ExtraValue)node).getExtraValueType().getName(); |
---|
200 | } |
---|
201 | catch (PermissionDeniedException ex) |
---|
202 | { |
---|
203 | name = ((ExtraValue)node).getValueType().toString(); |
---|
204 | } |
---|
205 | } |
---|
206 | sb.append("var ").append(var); |
---|
207 | if (parentItem == null) |
---|
208 | { |
---|
209 | sb.append(" = JoustMenu.addMenuItem(-1"); |
---|
210 | } |
---|
211 | else |
---|
212 | { |
---|
213 | String rootVar = parentItem.getType().name() + "_" + parentItem.getId(); |
---|
214 | sb.append(" = JoustMenu.addChildItem(").append(rootVar); |
---|
215 | } |
---|
216 | sb.append(",'").append(folderIcon).append("'"); |
---|
217 | sb.append(",'").append(HTML.javaScriptEncode(name)).append("'"); |
---|
218 | sb.append(", null, '', '").append(var).append("');\n"); |
---|
219 | if (open) |
---|
220 | { |
---|
221 | sb.append("JoustMenu.menuItems[").append(var).append("].isOpen = true;\n"); |
---|
222 | } |
---|
223 | } |
---|
224 | %> |
---|
225 | <% |
---|
226 | final int experimentId = Values.getInt(request.getParameter("experiment_id")); |
---|
227 | final int bioAssaySetId = Values.getInt(request.getParameter("item_id")); |
---|
228 | final int transformationId = Values.getInt(request.getParameter("transformation_id")); |
---|
229 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
230 | final String ID = sc.getId(); |
---|
231 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
232 | final ItemContext tc = sc.getCurrentContext(Item.TRANSFORMATION); |
---|
233 | final ItemContext xvc = sc.getCurrentContext(Item.EXTRAVALUE); |
---|
234 | |
---|
235 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
236 | final String callback = request.getParameter("callback"); |
---|
237 | final String title = mode.generateTitle("bioassay set", "bioassay sets"); |
---|
238 | final DbControl dc = sc.newDbControl(); |
---|
239 | Tree<BasicItem> analysisTree = null; |
---|
240 | ItemResultList<AnnotationType> annotationTypes = null; |
---|
241 | try |
---|
242 | { |
---|
243 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
244 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
245 | final Experiment experiment = Experiment.getById(dc, experimentId); |
---|
246 | final BasicItem root = transformationId == 0 ? |
---|
247 | (bioAssaySetId == 0 ? null : BioAssaySet.getById(dc, bioAssaySetId)) |
---|
248 | : Transformation.getById(dc, transformationId); |
---|
249 | final boolean createPermission = experiment.hasPermission(Permission.USE); |
---|
250 | final boolean deletePermission = createPermission; |
---|
251 | final boolean writePermission = createPermission; |
---|
252 | |
---|
253 | final ItemQuery<BioAssaySet> query = Base.getConfiguredQuery(cc, true, experiment.getBioAssaySets(), mode); |
---|
254 | final ItemQuery<Transformation> transformationQuery = experiment.getTransformations(); |
---|
255 | transformationQuery.include(cc.getInclude()); |
---|
256 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
257 | annotationTypes = annotationTypeQuery.list(dc); |
---|
258 | try |
---|
259 | { |
---|
260 | analysisTree = getAnalysisTree(dc, query, transformationQuery); |
---|
261 | } |
---|
262 | catch (Throwable t) |
---|
263 | { |
---|
264 | cc.setMessage(t.getMessage()); |
---|
265 | } |
---|
266 | // Contains the ID:s of the bioassaysets that are closed in the tree |
---|
267 | Collection<String> closed = (Collection<String>)cc.getObject("closed"); |
---|
268 | int numListed = 0; |
---|
269 | %> |
---|
270 | <base:page type="include"> |
---|
271 | <base:body> |
---|
272 | <script language="JavaScript"> |
---|
273 | var submitPage = '<%=transformationId != 0 ? "../bioassaysets/index.jsp" : "index.jsp"%>'; |
---|
274 | var formId = 'bioAssaySets'; |
---|
275 | function newItem() |
---|
276 | { |
---|
277 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=NewItem&experiment_id=<%=experimentId%>', 'NewBioAssaySet', 740, 540); |
---|
278 | } |
---|
279 | function editBioAssaySet(itemId) |
---|
280 | { |
---|
281 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true); |
---|
282 | } |
---|
283 | function viewBioAssaySet(itemId) |
---|
284 | { |
---|
285 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
286 | } |
---|
287 | function bioAssaySetOnClick(evt, itemId) |
---|
288 | { |
---|
289 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewBioAssaySet, editBioAssaySet, returnSelected); |
---|
290 | } |
---|
291 | function viewTransformation(itemId) |
---|
292 | { |
---|
293 | Main.viewOrEditItem('<%=ID%>', 'TRANSFORMATION', itemId, false); |
---|
294 | } |
---|
295 | function editTransformation(itemId) |
---|
296 | { |
---|
297 | Main.viewOrEditItem('<%=ID%>', 'TRANSFORMATION', itemId, true); |
---|
298 | } |
---|
299 | function transformationOnClick(evt, itemId) |
---|
300 | { |
---|
301 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewTransformation, editTransformation, returnSelected); |
---|
302 | } |
---|
303 | function viewExtraValue(itemId) |
---|
304 | { |
---|
305 | Main.viewOrEditItem('<%=ID%>', 'EXTRAVALUE', itemId, false); |
---|
306 | } |
---|
307 | function editExtraValue(itemId) |
---|
308 | { |
---|
309 | Main.viewOrEditItem('<%=ID%>', 'EXTRAVALUE', itemId, true); |
---|
310 | } |
---|
311 | function extraValueOnClick(evt, itemId) |
---|
312 | { |
---|
313 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewExtraValue, editExtraValue, returnSelected); |
---|
314 | } |
---|
315 | function deleteItems() |
---|
316 | { |
---|
317 | var frm = document.forms[formId]; |
---|
318 | if (Forms.numChecked(frm) == 0) |
---|
319 | { |
---|
320 | alert('Please select at least one item in the list'); |
---|
321 | return; |
---|
322 | } |
---|
323 | if (Forms.numChecked(frm, /^X:/) > 0) |
---|
324 | { |
---|
325 | if (!confirm('Extra values are deleted immediately and cannot be restored. Do you want to continue?')) |
---|
326 | { |
---|
327 | return; |
---|
328 | } |
---|
329 | } |
---|
330 | frm.action = submitPage; |
---|
331 | frm.cmd.value = 'DeleteItems'; |
---|
332 | frm.submit(); |
---|
333 | } |
---|
334 | function restoreItems() |
---|
335 | { |
---|
336 | var frm = document.forms[formId]; |
---|
337 | if (Forms.numChecked(frm) == 0) |
---|
338 | { |
---|
339 | alert('Please select at least one item in the list'); |
---|
340 | return; |
---|
341 | } |
---|
342 | frm.action = submitPage; |
---|
343 | frm.cmd.value = 'RestoreItems'; |
---|
344 | frm.submit(); |
---|
345 | } |
---|
346 | function configureColumns() |
---|
347 | { |
---|
348 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
349 | } |
---|
350 | function runPlugin(cmd) |
---|
351 | { |
---|
352 | Table.submitToPopup(formId, cmd, 740, 540); |
---|
353 | } |
---|
354 | function filter(itemId) |
---|
355 | { |
---|
356 | Main.openPopup('../bioassaysets/index.jsp?ID=<%=ID%>&cmd=NewFilteredBioAssaySet&experiment_id=<%=experimentId%>&item_id='+itemId, 'FilterBioAssaySet', 740, 540); |
---|
357 | } |
---|
358 | function openPlotTool(itemId) |
---|
359 | { |
---|
360 | Main.openPopup('../plotter/index.jsp?ID=<%=ID%>&bioassayset_id='+itemId, 'Plotter', 1000, 700); |
---|
361 | } |
---|
362 | function openExperimentExplorer(itemId) |
---|
363 | { |
---|
364 | location.href = '../explorer/view/index.jsp?ID=<%=ID%>&bioassayset_id='+itemId; |
---|
365 | } |
---|
366 | function launchMeV(itemId) |
---|
367 | { |
---|
368 | location.href = '../../../plugins/org/tigr/microarray/mev/launch_mev.jsp?ID=<%=ID%>&bioassayset_id='+itemId; |
---|
369 | } |
---|
370 | function runAnalysisPlugin(itemId) |
---|
371 | { |
---|
372 | Main.openPopup('../bioassaysets/index.jsp?ID=<%=ID%>&cmd=RunAnalysisPlugin&experiment_id=<%=experimentId%>&item_id='+itemId, 'RunPlugin', 740, 540); |
---|
373 | } |
---|
374 | function runExportPlugin(itemId) |
---|
375 | { |
---|
376 | Main.openPopup('../bioassaysets/index.jsp?ID=<%=ID%>&cmd=ExportItem&experiment_id=<%=experimentId%>&item_id='+itemId, 'Export', 740, 540); |
---|
377 | } |
---|
378 | function copyJob(jobId) |
---|
379 | { |
---|
380 | var url = '../../../common/plugin/index.jsp?ID=<%=ID%>'; |
---|
381 | url += '&cmd=CopyJob&job_id='+jobId; |
---|
382 | url += '&item_type=BIOASSAYSET&context_type=LIST' |
---|
383 | Main.openPopup(url, 'CopyJob', 740, 540); |
---|
384 | } |
---|
385 | function returnSelected() |
---|
386 | { |
---|
387 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
388 | window.close(); |
---|
389 | } |
---|
390 | function presetOnChange() |
---|
391 | { |
---|
392 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
393 | } |
---|
394 | function initTree() |
---|
395 | { |
---|
396 | var bigDir = getRoot()+'images/joust/big/'; |
---|
397 | IconStore.init(bigDir, 18, 22); |
---|
398 | IconStore.addIcon('BioAssaySet', bigDir + 'bioassayset.gif', 18, 22); |
---|
399 | IconStore.addIcon('Transformation', bigDir + 'transformation.gif', 18, 22); |
---|
400 | IconStore.addIcon('Filter', bigDir + 'filter.gif', 18, 22); |
---|
401 | IconStore.addIcon('ExtraValue', bigDir + 'extravalue.gif', 18, 22); |
---|
402 | |
---|
403 | JoustMenu.toggle = function(menuItemIndex) |
---|
404 | { |
---|
405 | var menuItem = this.menuItems[menuItemIndex]; |
---|
406 | if (!menuItem) return; |
---|
407 | // Switch the open/closed status and hide or show the children |
---|
408 | menuItem.isOpen = !menuItem.isOpen; |
---|
409 | if (menuItem.isOpen) |
---|
410 | { |
---|
411 | this.showChildren(menuItemIndex); |
---|
412 | var frm = document.forms[formId]; |
---|
413 | frm.closed.value = frm.closed.value.replace(','+menuItem.externalId+',', ','); |
---|
414 | } |
---|
415 | else |
---|
416 | { |
---|
417 | this.hideChildren(menuItemIndex); |
---|
418 | var frm = document.forms[formId]; |
---|
419 | frm.closed.value += menuItem.externalId+','; |
---|
420 | } |
---|
421 | // alert(document.forms[formId].closed.value); |
---|
422 | this.updateIconsAndText(menuItemIndex); |
---|
423 | } |
---|
424 | |
---|
425 | JoustMenu.drawMenuItems = function(firstIndex, indentString) |
---|
426 | { |
---|
427 | var menuItem = this.menuItems[firstIndex]; |
---|
428 | while (menuItem) |
---|
429 | { |
---|
430 | var html = menuItem.draw(indentString); |
---|
431 | var padIcon = IconStore.getIcon(menuItem.noOutlineIcon == true ? null : menuItem.nextItemIndex == -1 ? 'iconBlank' : 'iconLine'); |
---|
432 | var padHtml = padIcon == null ? '' : padIcon.getImgTag(); |
---|
433 | |
---|
434 | var menuDiv = document.getElementById('tree.'+menuItem.externalId); |
---|
435 | menuDiv.innerHTML = html; |
---|
436 | |
---|
437 | if (menuItem.firstChildIndex != -1) |
---|
438 | { |
---|
439 | this.drawMenuItems(menuItem.firstChildIndex, indentString+padHtml); |
---|
440 | } |
---|
441 | if (!menuItem.isOpen) |
---|
442 | { |
---|
443 | this.hideChildren(menuItem.index); |
---|
444 | } |
---|
445 | menuItem = this.menuItems[menuItem.nextItemIndex]; |
---|
446 | } |
---|
447 | return ''; |
---|
448 | } |
---|
449 | |
---|
450 | JoustMenu.hideChildren = function(menuItemIndex) |
---|
451 | { |
---|
452 | var menuItem = this.menuItems[menuItemIndex]; |
---|
453 | if (menuItem) |
---|
454 | { |
---|
455 | var firstChildIndex = menuItem.firstChildIndex; |
---|
456 | var child = this.menuItems[firstChildIndex]; |
---|
457 | while (child) |
---|
458 | { |
---|
459 | var e = document.getElementById('row.'+child.externalId); |
---|
460 | e.style.display = 'none'; |
---|
461 | this.hideChildren(child.index); |
---|
462 | child = this.menuItems[child.nextItemIndex]; |
---|
463 | } |
---|
464 | } |
---|
465 | } |
---|
466 | |
---|
467 | JoustMenu.showChildren = function(menuItemIndex) |
---|
468 | { |
---|
469 | var menuItem = this.menuItems[menuItemIndex]; |
---|
470 | if (menuItem) |
---|
471 | { |
---|
472 | var firstChildIndex = menuItem.firstChildIndex; |
---|
473 | var child = this.menuItems[firstChildIndex]; |
---|
474 | while (child) |
---|
475 | { |
---|
476 | var e = document.getElementById('row.'+child.externalId); |
---|
477 | e.style.display = Browser.isIE ? 'block' : 'table-row'; |
---|
478 | if (child.isOpen) |
---|
479 | { |
---|
480 | this.showChildren(child.index); |
---|
481 | } |
---|
482 | child = this.menuItems[child.nextItemIndex]; |
---|
483 | } |
---|
484 | } |
---|
485 | } |
---|
486 | |
---|
487 | <%=analysisTree == null ? "" : generateTree(analysisTree, root, root, closed)%> |
---|
488 | JoustMenu.draw('joust'); |
---|
489 | |
---|
490 | } |
---|
491 | </script> |
---|
492 | |
---|
493 | |
---|
494 | <% |
---|
495 | if (cc.getMessage() != null) |
---|
496 | { |
---|
497 | %> |
---|
498 | <div class="error"><%=cc.getMessage()%></div> |
---|
499 | <% |
---|
500 | cc.setMessage(null); |
---|
501 | } |
---|
502 | %> |
---|
503 | <tbl:table |
---|
504 | id="bioAssaySets" |
---|
505 | clazz="itemlist" |
---|
506 | columns="<%=cc.getSetting("columns")%>" |
---|
507 | sortby="<%=cc.getSortProperty()%>" |
---|
508 | direction="<%=cc.getSortDirection()%>" |
---|
509 | title="<%=title%>" |
---|
510 | action="<%=transformationId != 0 ? "../bioassaysets/index.jsp" : "index.jsp"%>" |
---|
511 | sc="<%=sc%>" |
---|
512 | item="<%=itemType%>" |
---|
513 | > |
---|
514 | <tbl:hidden |
---|
515 | name="mode" |
---|
516 | value="<%=mode.getName()%>" |
---|
517 | /> |
---|
518 | <tbl:hidden |
---|
519 | name="experiment_id" |
---|
520 | value="<%=String.valueOf(experimentId)%>" |
---|
521 | /> |
---|
522 | <tbl:hidden |
---|
523 | name="item_id" |
---|
524 | value="<%=String.valueOf(bioAssaySetId)%>" |
---|
525 | skip="<%=bioAssaySetId == 0%>" |
---|
526 | /> |
---|
527 | <tbl:hidden |
---|
528 | name="transformation_id" |
---|
529 | value="<%=String.valueOf(transformationId)%>" |
---|
530 | skip="<%=transformationId == 0%>" |
---|
531 | /> |
---|
532 | <tbl:hidden |
---|
533 | name="callback" |
---|
534 | value="<%=callback%>" |
---|
535 | skip="<%=callback == null%>" |
---|
536 | /> |
---|
537 | <tbl:hidden |
---|
538 | name="closed" |
---|
539 | value="<%=closed == null ? "," : ","+Values.getString(closed, ",", true)+","%>" |
---|
540 | /> |
---|
541 | <tbl:columndef |
---|
542 | id="name" |
---|
543 | property="name" |
---|
544 | datatype="string" |
---|
545 | title="Name" |
---|
546 | sortable="true" |
---|
547 | filterable="true" |
---|
548 | exportable="true" |
---|
549 | show="always" |
---|
550 | /> |
---|
551 | <tbl:columndef |
---|
552 | id="spots" |
---|
553 | property="numSpots" |
---|
554 | datatype="int" |
---|
555 | title="Spots/Values" |
---|
556 | sortable="true" |
---|
557 | filterable="true" |
---|
558 | exportable="true" |
---|
559 | /> |
---|
560 | <tbl:columndef |
---|
561 | id="reporters" |
---|
562 | property="numReporters" |
---|
563 | datatype="int" |
---|
564 | title="Reporters" |
---|
565 | sortable="true" |
---|
566 | filterable="true" |
---|
567 | exportable="true" |
---|
568 | /> |
---|
569 | <tbl:columndef |
---|
570 | id="date" |
---|
571 | property="transformation.job.ended" |
---|
572 | datatype="string" |
---|
573 | title="Date" |
---|
574 | sortable="true" |
---|
575 | filterable="true" |
---|
576 | exportable="true" |
---|
577 | /> |
---|
578 | <tbl:columndef |
---|
579 | id="plugin" |
---|
580 | property="transformation.job.pluginDefinition.name" |
---|
581 | datatype="string" |
---|
582 | title="Plugin" |
---|
583 | sortable="true" |
---|
584 | filterable="true" |
---|
585 | exportable="true" |
---|
586 | /> |
---|
587 | <tbl:columndef |
---|
588 | id="description" |
---|
589 | property="description" |
---|
590 | datatype="string" |
---|
591 | title="Description" |
---|
592 | sortable="true" |
---|
593 | filterable="true" |
---|
594 | exportable="true" |
---|
595 | /> |
---|
596 | <% |
---|
597 | for (AnnotationType at : annotationTypes) |
---|
598 | { |
---|
599 | Enumeration<String, String> annotationEnum = null; |
---|
600 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
601 | if (at.isEnumeration()) |
---|
602 | { |
---|
603 | annotationEnum = new Enumeration<String, String>(); |
---|
604 | List<?> values = at.getValues(); |
---|
605 | for (Object value : values) |
---|
606 | { |
---|
607 | String encoded = formatter.format(value); |
---|
608 | annotationEnum.add(encoded, encoded); |
---|
609 | } |
---|
610 | } |
---|
611 | %> |
---|
612 | <tbl:columndef |
---|
613 | id="<%="at"+at.getId()%>" |
---|
614 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
615 | property="<%="#"+at.getId()%>" |
---|
616 | annotation="true" |
---|
617 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
618 | enumeration="<%=annotationEnum%>" |
---|
619 | sortable="false" |
---|
620 | filterable="true" |
---|
621 | exportable="true" |
---|
622 | formatter="<%=formatter%>" |
---|
623 | /> |
---|
624 | <% |
---|
625 | } |
---|
626 | %> |
---|
627 | <tbl:columndef |
---|
628 | id="tools" |
---|
629 | title="Tools" |
---|
630 | /> |
---|
631 | |
---|
632 | <tbl:toolbar |
---|
633 | visible="<%=mode.hasToolbar()%>" |
---|
634 | > |
---|
635 | <tbl:button |
---|
636 | disabled="<%=createPermission ? false : true%>" |
---|
637 | image="<%=createPermission ? "new.gif" : "new_disabled.gif"%>" |
---|
638 | onclick="newItem()" |
---|
639 | title="New root bioassay set…" |
---|
640 | tooltip="<%=createPermission ? "Create a new root bioassay set" : "You do not have permission to create bioassay sets"%>" |
---|
641 | visible="<%=root == null && pluginCount.containsKey(Plugin.MainType.INTENSITY)%>" |
---|
642 | /> |
---|
643 | <tbl:button |
---|
644 | disabled="<%=deletePermission ? false : true%>" |
---|
645 | image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" |
---|
646 | title="Delete" |
---|
647 | onclick="deleteItems()" |
---|
648 | tooltip="<%=deletePermission ? "Delete the selected items" : "You do not have permission to delete items"%>" |
---|
649 | /> |
---|
650 | <tbl:button |
---|
651 | disabled="<%=writePermission ? false : true%>" |
---|
652 | image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" |
---|
653 | onclick="restoreItems()" |
---|
654 | title="Restore" |
---|
655 | tooltip="<%=writePermission ? "Restore the selected (deleted) items" : "You do not have permission to restore items"%>" |
---|
656 | /> |
---|
657 | <tbl:button |
---|
658 | image="columns.gif" |
---|
659 | onclick="configureColumns()" |
---|
660 | title="Columns…" |
---|
661 | tooltip="Show, hide and re-order columns" |
---|
662 | /> |
---|
663 | <tbl:button |
---|
664 | image="import.gif" |
---|
665 | onclick="runPlugin('ImportItems')" |
---|
666 | title="Import…" |
---|
667 | tooltip="Import data" |
---|
668 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
669 | /> |
---|
670 | <tbl:button |
---|
671 | image="export.gif" |
---|
672 | onclick="runPlugin('ExportItems')" |
---|
673 | title="Export…" |
---|
674 | tooltip="Export data" |
---|
675 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
676 | /> |
---|
677 | <tbl:button |
---|
678 | image="runplugin.gif" |
---|
679 | onclick="runPlugin('RunListPlugin')" |
---|
680 | title="Run plugin…" |
---|
681 | tooltip="Run a plugin" |
---|
682 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
683 | /> |
---|
684 | </tbl:toolbar> |
---|
685 | <tbl:data> |
---|
686 | <tbl:columns> |
---|
687 | <tbl:presetselector |
---|
688 | clazz="columnheader" |
---|
689 | colspan="3" |
---|
690 | onchange="presetOnChange()" |
---|
691 | /> |
---|
692 | </tbl:columns> |
---|
693 | <tr> |
---|
694 | <tbl:header |
---|
695 | clazz="index" |
---|
696 | > </tbl:header> |
---|
697 | <tbl:header |
---|
698 | clazz="check" |
---|
699 | visible="<%=mode.hasCheck()%>" |
---|
700 | ><base:icon |
---|
701 | image="check_uncheck.gif" |
---|
702 | tooltip="Check/uncheck all" |
---|
703 | onclick="Forms.checkUncheck(document.forms[formId])" style="align: left;" |
---|
704 | /></tbl:header> |
---|
705 | <tbl:header |
---|
706 | clazz="check" |
---|
707 | visible="<%=mode.hasRadio()%>" |
---|
708 | /> |
---|
709 | <tbl:header |
---|
710 | clazz="icons" |
---|
711 | visible="<%=mode.hasIcons()%>" |
---|
712 | > </tbl:header> |
---|
713 | <tbl:propertyfilter /> |
---|
714 | </tr> |
---|
715 | |
---|
716 | <tbl:rows> |
---|
717 | <% |
---|
718 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
719 | int selectedItemId = cc.getId(); |
---|
720 | if (analysisTree != null) |
---|
721 | { |
---|
722 | Iterator<Tree.Entry<BasicItem>> baas = analysisTree.entryIterator(root); |
---|
723 | while (baas.hasNext()) |
---|
724 | { |
---|
725 | Tree.Entry<BasicItem> entry = baas.next(); |
---|
726 | BasicItem item = entry.getNode(); |
---|
727 | if (item != null) |
---|
728 | { |
---|
729 | int level = entry.getDepth() - 1; |
---|
730 | int itemId = item.getId(); |
---|
731 | String joustId = item.getType().name() + "_" + itemId; |
---|
732 | String name = ""; |
---|
733 | String description = ""; |
---|
734 | String tooltip = mode.isSelectionMode() ? |
---|
735 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
736 | boolean removed = false; |
---|
737 | Transformation t = null; |
---|
738 | BioAssaySet bas = null; |
---|
739 | ExtraValue xv = null; |
---|
740 | PluginDefinition plugin = null; |
---|
741 | Job job = null; |
---|
742 | String prefix = ""; |
---|
743 | ItemContext ccc = null; |
---|
744 | String view = ""; |
---|
745 | String onClick = ""; |
---|
746 | Item itemType = item.getType(); |
---|
747 | if (itemType == Item.TRANSFORMATION) |
---|
748 | { |
---|
749 | t = (Transformation)item; |
---|
750 | removed = t.isRemoved(); |
---|
751 | prefix = "T:"; |
---|
752 | ccc = tc; |
---|
753 | onClick = "transformationOnClick"; |
---|
754 | name = HTML.encodeTags(t.getName()); |
---|
755 | description = HTML.encodeTags(t.getDescription()); |
---|
756 | try |
---|
757 | { |
---|
758 | job = t.getJob(); |
---|
759 | plugin = job.getPluginDefinition(); |
---|
760 | } |
---|
761 | catch (Throwable ex) |
---|
762 | {} |
---|
763 | } |
---|
764 | else if (itemType == Item.BIOASSAYSET) |
---|
765 | { |
---|
766 | bas = (BioAssaySet)item; |
---|
767 | removed = bas.isRemoved(); |
---|
768 | ccc = cc; |
---|
769 | onClick = "bioAssaySetOnClick"; |
---|
770 | name = HTML.encodeTags(bas.getName()); |
---|
771 | description = HTML.encodeTags(bas.getDescription()); |
---|
772 | } |
---|
773 | else if (itemType == Item.EXTRAVALUE) |
---|
774 | { |
---|
775 | xv = (ExtraValue)item; |
---|
776 | prefix = "X:"; |
---|
777 | removed = false; |
---|
778 | ccc = xvc; |
---|
779 | onClick = "extraValueOnClick"; |
---|
780 | try |
---|
781 | { |
---|
782 | ExtraValueType xvType = xv.getExtraValueType(); |
---|
783 | name = HTML.encodeTags(xvType.getName()); |
---|
784 | description = HTML.encodeTags(xvType.getDescription()); |
---|
785 | } |
---|
786 | catch (PermissionDeniedException ex) |
---|
787 | { |
---|
788 | name = xv.getValueType().toString(); |
---|
789 | description = ""; |
---|
790 | } |
---|
791 | try |
---|
792 | { |
---|
793 | job = xv.getJob(); |
---|
794 | plugin = job.getPluginDefinition(); |
---|
795 | } |
---|
796 | catch (Throwable ex) |
---|
797 | {} |
---|
798 | } |
---|
799 | |
---|
800 | index++; |
---|
801 | numListed++; |
---|
802 | |
---|
803 | %> |
---|
804 | <tbl:row |
---|
805 | id="<%="row."+joustId%>" |
---|
806 | > |
---|
807 | <tbl:header |
---|
808 | clazz="index" |
---|
809 | ><%=index%></tbl:header> |
---|
810 | <tbl:header |
---|
811 | clazz="check" |
---|
812 | visible="<%=mode.hasCheck()%>" |
---|
813 | ><input |
---|
814 | type="checkbox" |
---|
815 | name="<%=prefix+itemId%>" |
---|
816 | value="<%=itemId%>" |
---|
817 | title="<%=name%>" |
---|
818 | <%=ccc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
819 | ></tbl:header> |
---|
820 | <tbl:header |
---|
821 | clazz="check" |
---|
822 | visible="<%=mode.hasRadio()%>" |
---|
823 | ><input |
---|
824 | type="radio" |
---|
825 | name="item_id" |
---|
826 | value="<%=itemId%>" |
---|
827 | title="<%=name%>" |
---|
828 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
829 | ></tbl:header> |
---|
830 | <tbl:header |
---|
831 | clazz="icons" |
---|
832 | visible="<%=mode.hasIcons()%>" |
---|
833 | ><base:icon |
---|
834 | image="deleted.gif" |
---|
835 | tooltip="This item has been scheduled for deletion" |
---|
836 | visible="<%=removed%>" |
---|
837 | /> </tbl:header> |
---|
838 | |
---|
839 | <tbl:cell clazz="joustcell" column="name"> |
---|
840 | <div id="tree.<%=joustId%>" class="link" |
---|
841 | onclick="<%=onClick%>(<%=writePermission ? "event" : null%>, <%=itemId%>)" |
---|
842 | title="<%=tooltip%>"><%=name%> |
---|
843 | </div> |
---|
844 | </tbl:cell> |
---|
845 | <% |
---|
846 | if (t != null) |
---|
847 | { |
---|
848 | %> |
---|
849 | <tbl:cell column="spots"> </tbl:cell> |
---|
850 | <tbl:cell column="reporters"> </tbl:cell> |
---|
851 | <tbl:cell column="tools"> |
---|
852 | <nobr> |
---|
853 | <% |
---|
854 | if (createPermission && job != null && plugin != null && plugin.isInteractive()) |
---|
855 | { |
---|
856 | %> |
---|
857 | <a href="javascript:copyJob(<%=job.getId()%>)" |
---|
858 | title="Copy this transformation"><img |
---|
859 | src="../../../images/copy.gif" border="0"></a> |
---|
860 | <% |
---|
861 | } |
---|
862 | %> |
---|
863 | </nobr> |
---|
864 | </tbl:cell> |
---|
865 | <% |
---|
866 | } |
---|
867 | if (bas != null) |
---|
868 | { |
---|
869 | %> |
---|
870 | <tbl:cell column="spots"><%=bas.getNumSpots()%></tbl:cell> |
---|
871 | <tbl:cell column="reporters"><%=bas.getNumReporters()%></tbl:cell> |
---|
872 | <tbl:cell column="date"> </tbl:cell> |
---|
873 | <tbl:cell column="plugin"> </tbl:cell> |
---|
874 | <% |
---|
875 | AnnotationSet as = bas.isAnnotated() ? bas.getAnnotationSet() : null; |
---|
876 | if (as != null) |
---|
877 | { |
---|
878 | for (AnnotationType at : annotationTypes) |
---|
879 | { |
---|
880 | if (as.hasAnnotation(at)) |
---|
881 | { |
---|
882 | %> |
---|
883 | <tbl:cell column="<%="at"+at.getId()%>" |
---|
884 | ><tbl:cellvalue |
---|
885 | list="<%=as.getAnnotation(at).getValues()%>" |
---|
886 | /></tbl:cell> |
---|
887 | <% |
---|
888 | } |
---|
889 | } |
---|
890 | } |
---|
891 | %> |
---|
892 | <tbl:cell column="tools"> |
---|
893 | <nobr> |
---|
894 | <a href="javascript:openPlotTool(<%=itemId%>)" |
---|
895 | title="A simple plot tool"><img |
---|
896 | src="../../../images/plotter.gif" border="0"></a> |
---|
897 | <a href="javascript:openExperimentExplorer(<%=itemId%>)" |
---|
898 | title="Experiment explorer"><img |
---|
899 | src="../../../images/explorer.png" border="0"></a> |
---|
900 | <a href="javascript:launchMeV(<%=itemId%>)" |
---|
901 | title="MeV: MultiExperiment Viewer"><img |
---|
902 | src="../../../images/tm4.png" border="0"></a> |
---|
903 | <a href="javascript:runExportPlugin(<%=itemId%>)" |
---|
904 | title="Export data"><img |
---|
905 | src="../../../images/export.gif" border="0"></a> |
---|
906 | <% |
---|
907 | if (createPermission) |
---|
908 | { |
---|
909 | %> |
---|
910 | <a href="javascript:filter(<%=itemId%>)" |
---|
911 | title="Create a filtered bioassay set"><img |
---|
912 | src="../../../images/filter.gif" border="0"></a> |
---|
913 | <a href="javascript:runAnalysisPlugin(<%=itemId%>)" title="Run an analysis plugin"><img |
---|
914 | src="../../../images/runplugin.gif" border="0"></a> |
---|
915 | <% |
---|
916 | } |
---|
917 | %> |
---|
918 | </nobr> |
---|
919 | </tbl:cell> |
---|
920 | <% |
---|
921 | } |
---|
922 | if (xv != null) |
---|
923 | { |
---|
924 | %> |
---|
925 | <tbl:cell column="spots"><%=xv.getNumValues()%></tbl:cell> |
---|
926 | <tbl:cell column="reporters"> </tbl:cell> |
---|
927 | <tbl:cell column="tools"> |
---|
928 | <nobr> |
---|
929 | <% |
---|
930 | if (createPermission && job != null && plugin != null && plugin.isInteractive()) |
---|
931 | { |
---|
932 | %> |
---|
933 | <a href="javascript:copyJob(<%=job.getId()%>)" |
---|
934 | title="Copy this extra value"><img |
---|
935 | src="../../../images/copy.gif" border="0"></a> |
---|
936 | <% |
---|
937 | } |
---|
938 | %> |
---|
939 | </nobr> |
---|
940 | </tbl:cell> |
---|
941 | <% |
---|
942 | } |
---|
943 | %> |
---|
944 | <tbl:cell column="date"><%=job == null ? "" : dateTimeFormatter.format(job.getEnded())%></tbl:cell> |
---|
945 | <tbl:cell column="plugin"><%=plugin == null ? "" : Base.getLinkedName(ID, plugin, false, true)%></tbl:cell> |
---|
946 | <tbl:cell column="description"><%=description%></tbl:cell> |
---|
947 | </tbl:row> |
---|
948 | <% |
---|
949 | } |
---|
950 | } |
---|
951 | } |
---|
952 | %> |
---|
953 | </tbl:rows> |
---|
954 | </tbl:data> |
---|
955 | <% |
---|
956 | if (numListed == 0) |
---|
957 | { |
---|
958 | %> |
---|
959 | <tbl:panel>No bioassay sets or transformations were found.</tbl:panel> |
---|
960 | <% |
---|
961 | } |
---|
962 | %> |
---|
963 | </tbl:table> |
---|
964 | |
---|
965 | |
---|
966 | <script language="JavaScript"> |
---|
967 | initTree(); |
---|
968 | </script> |
---|
969 | </base:body> |
---|
970 | </base:page> |
---|
971 | <% |
---|
972 | } |
---|
973 | finally |
---|
974 | { |
---|
975 | if (dc != null) dc.close(); |
---|
976 | } |
---|
977 | %> |
---|