1 | <%-- $Id: list_bioassays.jsp 6604 2014-11-18 10:39:22Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2011 Nicklas Nordborg |
---|
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 3 |
---|
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 BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | ------------------------------------------------------------------ |
---|
21 | |
---|
22 | --%> |
---|
23 | <%@ page pageEncoding="UTF-8" session="false" |
---|
24 | import="net.sf.basedb.core.SessionControl" |
---|
25 | import="net.sf.basedb.core.DbControl" |
---|
26 | import="net.sf.basedb.core.Item" |
---|
27 | import="net.sf.basedb.core.PhysicalBioAssay" |
---|
28 | import="net.sf.basedb.core.DerivedBioAssay" |
---|
29 | import="net.sf.basedb.core.RawBioAssay" |
---|
30 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
31 | import="net.sf.basedb.core.AnnotationType" |
---|
32 | import="net.sf.basedb.core.AnnotationSet" |
---|
33 | import="net.sf.basedb.core.Annotation" |
---|
34 | import="net.sf.basedb.core.ItemSubtype" |
---|
35 | import="net.sf.basedb.core.ItemQuery" |
---|
36 | import="net.sf.basedb.core.Include" |
---|
37 | import="net.sf.basedb.core.Type" |
---|
38 | import="net.sf.basedb.core.ItemResultIterator" |
---|
39 | import="net.sf.basedb.core.ItemResultList" |
---|
40 | import="net.sf.basedb.core.ItemContext" |
---|
41 | import="net.sf.basedb.core.Nameable" |
---|
42 | import="net.sf.basedb.core.Permission" |
---|
43 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
44 | import="net.sf.basedb.core.PluginDefinition" |
---|
45 | import="net.sf.basedb.core.query.Hql" |
---|
46 | import="net.sf.basedb.core.query.Restrictions" |
---|
47 | import="net.sf.basedb.core.query.Expressions" |
---|
48 | import="net.sf.basedb.core.query.Orders" |
---|
49 | import="net.sf.basedb.core.query.Hql" |
---|
50 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
51 | import="net.sf.basedb.core.plugin.Plugin" |
---|
52 | import="net.sf.basedb.core.snapshot.AnnotationLoaderUtil" |
---|
53 | import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
---|
54 | import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
---|
55 | import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
---|
56 | import="net.sf.basedb.core.snapshot.SnapshotManager" |
---|
57 | import="net.sf.basedb.util.Enumeration" |
---|
58 | import="net.sf.basedb.util.ShareableUtil" |
---|
59 | import="net.sf.basedb.clients.web.Base" |
---|
60 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
61 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
62 | import="net.sf.basedb.clients.web.util.HTML" |
---|
63 | import="net.sf.basedb.util.formatter.Formatter" |
---|
64 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
65 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
66 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
67 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
68 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
69 | import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
---|
70 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
71 | import="net.sf.basedb.util.Values" |
---|
72 | import="java.util.Iterator" |
---|
73 | import="java.util.List" |
---|
74 | import="java.util.Map" |
---|
75 | import="java.util.Date" |
---|
76 | import="java.util.ArrayList" |
---|
77 | %> |
---|
78 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
79 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
80 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
81 | <%! |
---|
82 | private static final Item itemType = Item.DERIVEDBIOASSAY; |
---|
83 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
84 | %> |
---|
85 | <% |
---|
86 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
87 | final String ID = sc.getId(); |
---|
88 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
89 | final boolean createRawBioAssayPermission = sc.hasPermission(Permission.CREATE, Item.RAWBIOASSAY); |
---|
90 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
91 | |
---|
92 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
93 | final String callback = request.getParameter("callback"); |
---|
94 | final String title = mode.generateTitle("derived bioassay", "derived bioassays"); |
---|
95 | final DbControl dc = sc.newDbControl(); |
---|
96 | ItemResultIterator<DerivedBioAssay> bioAssays = null; |
---|
97 | List<AnnotationLoaderUtil> annotationLoaders = new ArrayList<AnnotationLoaderUtil>(); |
---|
98 | try |
---|
99 | { |
---|
100 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
101 | SnapshotManager manager = new SnapshotManager(); |
---|
102 | for (AnnotationType at : annotationTypeQuery.list(dc)) |
---|
103 | { |
---|
104 | annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at)); |
---|
105 | } |
---|
106 | final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); |
---|
107 | |
---|
108 | // Query for parent physical bioassays to the current bioassay |
---|
109 | final ItemQuery<PhysicalBioAssay> physicalBioAssayQuery = PhysicalBioAssay.getQuery(); |
---|
110 | physicalBioAssayQuery.include(cc.getInclude()); |
---|
111 | physicalBioAssayQuery.join(Hql.innerJoin("derivedBioAssays", "dba")); |
---|
112 | physicalBioAssayQuery.restrict(Restrictions.eq(Hql.alias("dba"), Expressions.parameter("bioAssay"))); |
---|
113 | physicalBioAssayQuery.order(Orders.asc(Hql.property("name"))); |
---|
114 | |
---|
115 | // Query for parent bioassays to the current bioassay |
---|
116 | final ItemQuery<DerivedBioAssay> parentQuery = DerivedBioAssay.getQuery(); |
---|
117 | parentQuery.include(cc.getInclude()); |
---|
118 | parentQuery.join(Hql.innerJoin("children", "c")); |
---|
119 | parentQuery.restrict(Restrictions.eq(Hql.alias("c"), Expressions.parameter("bioAssay"))); |
---|
120 | parentQuery.order(Orders.asc(Hql.property("name"))); |
---|
121 | |
---|
122 | // Query for child bioassays to the current bioassay |
---|
123 | final ItemQuery<DerivedBioAssay> childQuery = DerivedBioAssay.getQuery(); |
---|
124 | childQuery.include(cc.getInclude()); |
---|
125 | childQuery.join(Hql.innerJoin("parents", "p")); |
---|
126 | childQuery.restrict(Restrictions.eq(Hql.alias("p"), Expressions.parameter("bioAssay"))); |
---|
127 | childQuery.order(Orders.asc(Hql.property("name"))); |
---|
128 | |
---|
129 | // Query for raw bioassays to the current bioassay |
---|
130 | final ItemQuery<RawBioAssay> rawBioAssayQuery = RawBioAssay.getQuery(); |
---|
131 | rawBioAssayQuery.include(cc.getInclude()); |
---|
132 | rawBioAssayQuery.restrict(Restrictions.eq(Hql.property("parentBioAssay"), Expressions.parameter("bioAssay"))); |
---|
133 | rawBioAssayQuery.order(Orders.asc(Hql.property("name"))); |
---|
134 | |
---|
135 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
136 | try |
---|
137 | { |
---|
138 | final ItemQuery<DerivedBioAssay> query = Base.getConfiguredQuery(dc, cc, true, DerivedBioAssay.getQuery(), mode); |
---|
139 | bioAssays = query.iterate(dc); |
---|
140 | } |
---|
141 | catch (Throwable t) |
---|
142 | { |
---|
143 | cc.setMessage(t.getMessage()); |
---|
144 | t.printStackTrace(); |
---|
145 | } |
---|
146 | int numListed = 0; |
---|
147 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
148 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
149 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
150 | ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
---|
151 | %> |
---|
152 | <base:page title="<%=title==null ? "Derived bioassays" : title%>" type="<%=mode.getPageType()%>" id="list-page"> |
---|
153 | <base:head scripts="table.js,~bioassays.js" styles="table.css,toolbar.css"> |
---|
154 | <ext:scripts context="<%=jspContext%>" /> |
---|
155 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
156 | </base:head> |
---|
157 | |
---|
158 | <base:body> |
---|
159 | <h1><%=title==null ? "Derived bioassays" : title%></h1> |
---|
160 | <div class="content"> |
---|
161 | <tbl:table |
---|
162 | id="bioassays" |
---|
163 | columns="<%=cc.getSetting("columns")%>" |
---|
164 | sortby="<%=cc.getSortProperty()%>" |
---|
165 | direction="<%=cc.getSortDirection()%>" |
---|
166 | action="index.jsp" |
---|
167 | sc="<%=sc%>" |
---|
168 | item="<%=itemType%>" |
---|
169 | subclass="fulltable" |
---|
170 | > |
---|
171 | <tbl:hidden |
---|
172 | name="mode" |
---|
173 | value="<%=mode.getName()%>" |
---|
174 | /> |
---|
175 | <tbl:hidden |
---|
176 | name="callback" |
---|
177 | value="<%=callback%>" |
---|
178 | skip="<%=callback == null%>" |
---|
179 | /> |
---|
180 | <tbl:columndef |
---|
181 | id="name" |
---|
182 | property="name" |
---|
183 | datatype="string" |
---|
184 | title="Name" |
---|
185 | sortable="true" |
---|
186 | filterable="true" |
---|
187 | exportable="true" |
---|
188 | show="always" |
---|
189 | /> |
---|
190 | <tbl:columndef |
---|
191 | id="itemSubtype" |
---|
192 | property="itemSubtype" |
---|
193 | sortproperty="itemSubtype.name" |
---|
194 | exportproperty="itemSubtype.name:string" |
---|
195 | datatype="int" |
---|
196 | enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>" |
---|
197 | title="Type" |
---|
198 | sortable="true" |
---|
199 | filterable="true" |
---|
200 | exportable="true" |
---|
201 | /> |
---|
202 | <tbl:columndef |
---|
203 | id="id" |
---|
204 | clazz="uniquecol" |
---|
205 | property="id" |
---|
206 | datatype="int" |
---|
207 | title="ID" |
---|
208 | sortable="true" |
---|
209 | filterable="true" |
---|
210 | exportable="true" |
---|
211 | /> |
---|
212 | <tbl:columndef |
---|
213 | id="physicalBioAssays" |
---|
214 | property="&physicalBioAssays(name)" |
---|
215 | datatype="string" |
---|
216 | title="Physical bioassays" |
---|
217 | filterable="true" |
---|
218 | exportable="true" |
---|
219 | /> |
---|
220 | <tbl:columndef |
---|
221 | id="parents" |
---|
222 | property="&parents(name)" |
---|
223 | datatype="string" |
---|
224 | title="Parent bioassays" |
---|
225 | filterable="true" |
---|
226 | exportable="true" |
---|
227 | /> |
---|
228 | <tbl:columndef |
---|
229 | id="children" |
---|
230 | title="Child bioassays" |
---|
231 | property="&children(name)" |
---|
232 | datatype="string" |
---|
233 | filterable="true" |
---|
234 | exportable="true" |
---|
235 | /> |
---|
236 | <tbl:columndef |
---|
237 | id="extract" |
---|
238 | property="extract.name" |
---|
239 | datatype="string" |
---|
240 | title="Extract" |
---|
241 | sortable="true" |
---|
242 | filterable="true" |
---|
243 | exportable="true" |
---|
244 | /> |
---|
245 | <tbl:columndef |
---|
246 | id="rawBioAssays" |
---|
247 | title="Raw bioassays" |
---|
248 | property="&rawBioAssays(name)" |
---|
249 | datatype="string" |
---|
250 | filterable="true" |
---|
251 | exportable="true" |
---|
252 | /> |
---|
253 | <tbl:columndef |
---|
254 | id="plugin" |
---|
255 | property="job.pluginDefinition.name" |
---|
256 | datatype="string" |
---|
257 | title="Plugin" |
---|
258 | sortable="true" |
---|
259 | filterable="true" |
---|
260 | exportable="true" |
---|
261 | /> |
---|
262 | <tbl:columndef |
---|
263 | id="protocol" |
---|
264 | property="protocol.name" |
---|
265 | datatype="string" |
---|
266 | title="Protocol" |
---|
267 | sortable="true" |
---|
268 | filterable="true" |
---|
269 | exportable="true" |
---|
270 | /> |
---|
271 | <tbl:columndef |
---|
272 | id="hardware" |
---|
273 | property="hardware.name" |
---|
274 | datatype="string" |
---|
275 | title="Hardware" |
---|
276 | sortable="true" |
---|
277 | filterable="true" |
---|
278 | exportable="true" |
---|
279 | /> |
---|
280 | <tbl:columndef |
---|
281 | id="software" |
---|
282 | property="software.name" |
---|
283 | datatype="string" |
---|
284 | title="Software" |
---|
285 | sortable="true" |
---|
286 | filterable="true" |
---|
287 | exportable="true" |
---|
288 | /> |
---|
289 | <tbl:columndef |
---|
290 | id="entryDate" |
---|
291 | property="entryDate" |
---|
292 | datatype="date" |
---|
293 | title="Registered" |
---|
294 | sortable="true" |
---|
295 | filterable="true" |
---|
296 | exportable="true" |
---|
297 | formatter="<%=dateFormatter%>" |
---|
298 | /> |
---|
299 | <tbl:columndef |
---|
300 | id="owner" |
---|
301 | property="owner.name" |
---|
302 | datatype="string" |
---|
303 | title="Owner" |
---|
304 | sortable="true" |
---|
305 | filterable="true" |
---|
306 | exportable="true" |
---|
307 | /> |
---|
308 | <tbl:columndef |
---|
309 | id="description" |
---|
310 | property="description" |
---|
311 | datatype="string" |
---|
312 | title="Description" |
---|
313 | sortable="true" |
---|
314 | filterable="true" |
---|
315 | exportable="true" |
---|
316 | /> |
---|
317 | <% |
---|
318 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
319 | { |
---|
320 | AnnotationType at = loader.getAnnotationType(); |
---|
321 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
322 | Enumeration<String, String> annotationEnum = null; |
---|
323 | if (at.isEnumeration()) |
---|
324 | { |
---|
325 | annotationEnum = new Enumeration<String, String>(); |
---|
326 | List<?> values = at.getValues(); |
---|
327 | for (Object value : values) |
---|
328 | { |
---|
329 | String encoded = formatter.format(value); |
---|
330 | annotationEnum.add(encoded, encoded); |
---|
331 | } |
---|
332 | } |
---|
333 | %> |
---|
334 | <tbl:columndef |
---|
335 | id="<%="at"+at.getId()%>" |
---|
336 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
337 | property="<%="#"+at.getId()%>" |
---|
338 | annotation="true" |
---|
339 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
340 | enumeration="<%=annotationEnum%>" |
---|
341 | smartenum="<%=at.getDisplayAsList() %>" |
---|
342 | sortable="<%=at.getMultiplicity() == 1%>" |
---|
343 | filterable="true" |
---|
344 | exportable="true" |
---|
345 | formatter="<%=formatter%>" |
---|
346 | unit="<%=at.getDefaultUnit()%>" |
---|
347 | /> |
---|
348 | <% |
---|
349 | } |
---|
350 | %> |
---|
351 | <tbl:columndef |
---|
352 | id="permission" |
---|
353 | title="Permission" |
---|
354 | /> |
---|
355 | <tbl:columndef |
---|
356 | id="sharedTo" |
---|
357 | title="Shared to" |
---|
358 | filterable="true" |
---|
359 | filterproperty="!sharedTo.name" |
---|
360 | datatype="string" |
---|
361 | /> |
---|
362 | <tbl:columndef |
---|
363 | id="xt-columns" |
---|
364 | extensions="<%=columnsInvoker%>" |
---|
365 | jspcontext="<%=jspContext%>" |
---|
366 | /> |
---|
367 | <div class="panelgroup bg-filled-50 bottomborder"> |
---|
368 | <tbl:toolbar |
---|
369 | subclass="bottomborder" |
---|
370 | visible="<%=mode.hasToolbar()%>" |
---|
371 | > |
---|
372 | <tbl:button |
---|
373 | id="btnNewItem" |
---|
374 | disabled="<%=!createPermission%>" |
---|
375 | image="new.png" |
---|
376 | title="New…" |
---|
377 | tooltip="<%=createPermission ? "Create new derived bioassay" : "You do not have permission to create derived bioassays"%>" |
---|
378 | /> |
---|
379 | <tbl:button |
---|
380 | id="btnNewMergedDerivedBioAssay" |
---|
381 | disabled="<%=!createPermission%>" |
---|
382 | image="new_pooled.png" |
---|
383 | title="Merge…" |
---|
384 | tooltip="<%=createPermission ? "Create new merged bioassay" : "You do not have permission to create derived bioassay"%>" |
---|
385 | /> |
---|
386 | <tbl:button |
---|
387 | id="btnDeleteItems" |
---|
388 | image="delete.png" |
---|
389 | title="Delete" |
---|
390 | tooltip="Delete the selected items" |
---|
391 | /> |
---|
392 | <tbl:button |
---|
393 | id="btnRestoreItems" |
---|
394 | image="restore.png" |
---|
395 | title="Restore" |
---|
396 | tooltip="Restore the selected (deleted) items" |
---|
397 | /> |
---|
398 | <tbl:button |
---|
399 | id="btnShareItems" |
---|
400 | image="share.png" |
---|
401 | title="Share…" |
---|
402 | tooltip="Share the selected items" |
---|
403 | /> |
---|
404 | <tbl:button |
---|
405 | id="btnSetOwner" |
---|
406 | image="take_ownership.png" |
---|
407 | title="Set owner…" |
---|
408 | tooltip="Change owner of the selected items" |
---|
409 | /> |
---|
410 | <tbl:button |
---|
411 | id="btnColumns" |
---|
412 | image="columns.png" |
---|
413 | title="Columns…" |
---|
414 | tooltip="Show, hide and re-order columns" |
---|
415 | /> |
---|
416 | <tbl:button |
---|
417 | id="btnImport" |
---|
418 | data-plugin-type="IMPORT" |
---|
419 | image="import.png" |
---|
420 | title="Import…" |
---|
421 | tooltip="Import data" |
---|
422 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
423 | /> |
---|
424 | <tbl:button |
---|
425 | id="btnExport" |
---|
426 | data-plugin-type="EXPORT" |
---|
427 | image="export.png" |
---|
428 | title="Export…" |
---|
429 | tooltip="Export data" |
---|
430 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
431 | /> |
---|
432 | <tbl:button |
---|
433 | id="btnRunPlugin" |
---|
434 | data-plugin-type="OTHER" |
---|
435 | image="runplugin.png" |
---|
436 | title="Run plugin…" |
---|
437 | tooltip="Run a plugin" |
---|
438 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
439 | /> |
---|
440 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
441 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
442 | </tbl:toolbar> |
---|
443 | <tbl:panel> |
---|
444 | <tbl:presetselector /> |
---|
445 | <tbl:navigator |
---|
446 | page="<%=cc.getPage()%>" |
---|
447 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
448 | totalrows="<%=bioAssays == null ? 0 : bioAssays.getTotalCount()%>" |
---|
449 | visible="<%=mode.hasNavigator()%>" |
---|
450 | /> |
---|
451 | </tbl:panel> |
---|
452 | </div> |
---|
453 | <tbl:data> |
---|
454 | <tbl:headers> |
---|
455 | <tbl:headerrow> |
---|
456 | <tbl:header colspan="3" /> |
---|
457 | <tbl:columnheaders /> |
---|
458 | </tbl:headerrow> |
---|
459 | <tbl:headerrow> |
---|
460 | <tbl:header subclass="index" /> |
---|
461 | <tbl:header |
---|
462 | subclass="check" |
---|
463 | visible="<%=mode.hasCheck()%>" |
---|
464 | ><base:icon |
---|
465 | id="check.uncheck" |
---|
466 | image="check_uncheck.png" |
---|
467 | tooltip="Check/uncheck all" |
---|
468 | |
---|
469 | /></tbl:header> |
---|
470 | <tbl:header |
---|
471 | subclass="check" |
---|
472 | visible="<%=mode.hasRadio()%>" |
---|
473 | /> |
---|
474 | <tbl:header |
---|
475 | subclass="icons" |
---|
476 | visible="<%=mode.hasIcons()%>" |
---|
477 | /> |
---|
478 | <tbl:propertyfilter /> |
---|
479 | </tbl:headerrow> |
---|
480 | </tbl:headers> |
---|
481 | <tbl:rows> |
---|
482 | <% |
---|
483 | if (cc.getMessage() != null) |
---|
484 | { |
---|
485 | %> |
---|
486 | <tbl:panel subclass="bg-filled-50"> |
---|
487 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
488 | </tbl:panel> |
---|
489 | <% |
---|
490 | cc.setMessage(null); |
---|
491 | } |
---|
492 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
493 | int selectedItemId = cc.getId(); |
---|
494 | if (bioAssays != null) |
---|
495 | { |
---|
496 | while (bioAssays.hasNext()) |
---|
497 | { |
---|
498 | DerivedBioAssay item = bioAssays.next(); |
---|
499 | int itemId = item.getId(); |
---|
500 | boolean usePermission = item.hasPermission(Permission.USE); |
---|
501 | |
---|
502 | |
---|
503 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
504 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
505 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
506 | String tooltip = mode.isSelectionMode() ? |
---|
507 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
508 | String name = HTML.encodeTags(item.getName()); |
---|
509 | index++; |
---|
510 | numListed++; |
---|
511 | %> |
---|
512 | <tbl:row> |
---|
513 | <tbl:header |
---|
514 | clazz="index" |
---|
515 | ><%=index%></tbl:header> |
---|
516 | <tbl:header |
---|
517 | clazz="check" |
---|
518 | visible="<%=mode.hasCheck()%>" |
---|
519 | ><input |
---|
520 | type="checkbox" |
---|
521 | name="<%=itemId%>" |
---|
522 | value="<%=itemId%>" |
---|
523 | title="<%=name%>" |
---|
524 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
525 | ></tbl:header> |
---|
526 | <tbl:header |
---|
527 | clazz="check" |
---|
528 | visible="<%=mode.hasRadio()%>" |
---|
529 | ><input |
---|
530 | type="radio" |
---|
531 | name="item_id" |
---|
532 | value="<%=itemId%>" |
---|
533 | title="<%=name%>" |
---|
534 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
535 | ></tbl:header> |
---|
536 | <tbl:header |
---|
537 | clazz="icons" |
---|
538 | visible="<%=mode.hasIcons()%>" |
---|
539 | ><base:icon |
---|
540 | image="deleted.png" |
---|
541 | id="<%="delete."+itemId %>" |
---|
542 | subclass="<%=deletePermission ? "table-delete-item" : null %>" |
---|
543 | data-item-id="<%=itemId%>" |
---|
544 | tooltip="This item has been scheduled for deletion" |
---|
545 | visible="<%=item.isRemoved()%>" |
---|
546 | /><base:icon |
---|
547 | image="shared.png" |
---|
548 | id="<%="share."+itemId %>" |
---|
549 | subclass="<%=sharePermission ? "table-share-item" : null %>" |
---|
550 | data-item-id="<%=itemId%>" |
---|
551 | tooltip="This item is shared to other users, groups and/or projects" |
---|
552 | visible="<%=item.isShared()%>" |
---|
553 | /> </tbl:header> |
---|
554 | <tbl:cell column="name"><div |
---|
555 | class="link table-item" |
---|
556 | data-item-id="<%=itemId%>" |
---|
557 | data-no-edit="<%=writePermission ? 0 : 1 %>" |
---|
558 | tabindex="0" |
---|
559 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
560 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
561 | <tbl:cell column="itemSubtype"><base:propertyvalue |
---|
562 | item="<%=item%>" |
---|
563 | property="itemSubtype" |
---|
564 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
565 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
566 | /></tbl:cell> |
---|
567 | <tbl:cell column="children"> |
---|
568 | <% |
---|
569 | childQuery.setParameter("bioAssay", itemId, Type.INT); |
---|
570 | try |
---|
571 | { |
---|
572 | String separator = ""; |
---|
573 | for (DerivedBioAssay child : childQuery.list(dc)) |
---|
574 | { |
---|
575 | out.write(separator); |
---|
576 | if (mode.hasPropertyLink()) |
---|
577 | { |
---|
578 | out.write(Base.getLinkedName(ID, child, false, mode.hasEditLink())); |
---|
579 | } |
---|
580 | else |
---|
581 | { |
---|
582 | out.write(HTML.encodeTags(child.getName())); |
---|
583 | } |
---|
584 | separator = ", "; |
---|
585 | } |
---|
586 | } |
---|
587 | catch (Throwable t) |
---|
588 | { |
---|
589 | %> |
---|
590 | <div class="error"><%=t.getMessage()%></div> |
---|
591 | <% |
---|
592 | } |
---|
593 | %> |
---|
594 | <base:icon |
---|
595 | subclass="link auto-init" |
---|
596 | data-auto-init="new-child-bioassay" |
---|
597 | data-item-id="<%=itemId %>" |
---|
598 | image="add.png" |
---|
599 | tooltip="Create new child bioassay" |
---|
600 | visible="<%=mode.hasEditLink() && createPermission && usePermission %>" |
---|
601 | /> |
---|
602 | </tbl:cell> |
---|
603 | <tbl:cell column="rawBioAssays"> |
---|
604 | <% |
---|
605 | rawBioAssayQuery.setParameter("bioAssay", itemId, Type.INT); |
---|
606 | try |
---|
607 | { |
---|
608 | String separator = ""; |
---|
609 | for (RawBioAssay rba : rawBioAssayQuery.list(dc)) |
---|
610 | { |
---|
611 | out.write(separator); |
---|
612 | if (mode.hasPropertyLink()) |
---|
613 | { |
---|
614 | out.write(Base.getLinkedName(ID, rba, false, mode.hasEditLink())); |
---|
615 | } |
---|
616 | else |
---|
617 | { |
---|
618 | out.write(HTML.encodeTags(rba.getName())); |
---|
619 | } |
---|
620 | separator = ", "; |
---|
621 | } |
---|
622 | } |
---|
623 | catch (Throwable t) |
---|
624 | { |
---|
625 | %> |
---|
626 | <div class="error"><%=t.getMessage()%></div> |
---|
627 | <% |
---|
628 | } |
---|
629 | %> |
---|
630 | <base:icon |
---|
631 | subclass="link auto-init" |
---|
632 | data-auto-init="new-raw-bioassay" |
---|
633 | data-item-id="<%=itemId %>" |
---|
634 | image="add.png" |
---|
635 | tooltip="Create new raw bioassay" |
---|
636 | visible="<%=mode.hasEditLink() && createRawBioAssayPermission && usePermission %>" |
---|
637 | /> |
---|
638 | </tbl:cell> |
---|
639 | <tbl:cell column="physicalBioAssays"> |
---|
640 | <% |
---|
641 | physicalBioAssayQuery.setParameter("bioAssay", itemId, Type.INT); |
---|
642 | try |
---|
643 | { |
---|
644 | String separator = ""; |
---|
645 | for (PhysicalBioAssay pba : physicalBioAssayQuery.list(dc)) |
---|
646 | { |
---|
647 | out.write(separator); |
---|
648 | if (mode.hasPropertyLink()) |
---|
649 | { |
---|
650 | out.write(Base.getLinkedName(ID, pba, false, mode.hasEditLink())); |
---|
651 | } |
---|
652 | else |
---|
653 | { |
---|
654 | out.write(HTML.encodeTags(pba.getName())); |
---|
655 | } |
---|
656 | separator = ", "; |
---|
657 | } |
---|
658 | } |
---|
659 | catch (Throwable t) |
---|
660 | { |
---|
661 | %> |
---|
662 | <div class="error"><%=t.getMessage()%></div> |
---|
663 | <% |
---|
664 | } |
---|
665 | %> |
---|
666 | </tbl:cell> |
---|
667 | <tbl:cell column="parents"> |
---|
668 | <% |
---|
669 | if (!item.isRoot()) |
---|
670 | { |
---|
671 | parentQuery.setParameter("bioAssay", itemId, Type.INT); |
---|
672 | try |
---|
673 | { |
---|
674 | String separator = ""; |
---|
675 | for (DerivedBioAssay dba : parentQuery.list(dc)) |
---|
676 | { |
---|
677 | out.write(separator); |
---|
678 | if (mode.hasPropertyLink()) |
---|
679 | { |
---|
680 | out.write(Base.getLinkedName(ID, dba, false, mode.hasEditLink())); |
---|
681 | } |
---|
682 | else |
---|
683 | { |
---|
684 | out.write(HTML.encodeTags(dba.getName())); |
---|
685 | } |
---|
686 | separator = ", "; |
---|
687 | } |
---|
688 | } |
---|
689 | catch (Throwable t) |
---|
690 | { |
---|
691 | %> |
---|
692 | <div class="error"><%=t.getMessage()%></div> |
---|
693 | <% |
---|
694 | } |
---|
695 | } |
---|
696 | %> |
---|
697 | </tbl:cell> |
---|
698 | <tbl:cell column="extract" |
---|
699 | ><base:propertyvalue |
---|
700 | item="<%=item%>" |
---|
701 | property="extract" |
---|
702 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
703 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
704 | /></tbl:cell> |
---|
705 | <tbl:cell column="plugin" |
---|
706 | ><base:propertyvalue |
---|
707 | item="<%=item%>" |
---|
708 | property="job.pluginDefinition" |
---|
709 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
710 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
711 | /></tbl:cell> |
---|
712 | <tbl:cell column="protocol" |
---|
713 | ><base:propertyvalue |
---|
714 | item="<%=item%>" |
---|
715 | property="protocol" |
---|
716 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
717 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
718 | /></tbl:cell> |
---|
719 | <tbl:cell column="hardware" |
---|
720 | ><base:propertyvalue |
---|
721 | item="<%=item%>" |
---|
722 | property="hardware" |
---|
723 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
724 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
725 | /></tbl:cell> |
---|
726 | <tbl:cell column="software" |
---|
727 | ><base:propertyvalue |
---|
728 | item="<%=item%>" |
---|
729 | property="software" |
---|
730 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
731 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
732 | /></tbl:cell> |
---|
733 | <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" /> |
---|
734 | <tbl:cell column="owner" |
---|
735 | ><base:propertyvalue |
---|
736 | item="<%=item%>" |
---|
737 | property="owner" |
---|
738 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
739 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
740 | /></tbl:cell> |
---|
741 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
742 | <% |
---|
743 | if (item.isAnnotated()) |
---|
744 | { |
---|
745 | AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, item.getAnnotationSet().getId()); |
---|
746 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
747 | { |
---|
748 | if (loader.find(snapshot)) |
---|
749 | { |
---|
750 | %> |
---|
751 | <tbl:cell |
---|
752 | column="<%="at"+loader.getId()%>" |
---|
753 | ><tbl:cellvalue |
---|
754 | list="<%=loader.getValues()%>" |
---|
755 | suffix="<%=loader.getUnitSymbol()%>" |
---|
756 | /></tbl:cell> |
---|
757 | <% |
---|
758 | } |
---|
759 | } |
---|
760 | } |
---|
761 | %> |
---|
762 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
763 | <tbl:cell column="sharedTo"> |
---|
764 | <% |
---|
765 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
766 | while(sharees.hasNext()) |
---|
767 | { |
---|
768 | Nameable n = sharees.next(); |
---|
769 | if (mode.hasPropertyLink()) |
---|
770 | { |
---|
771 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
772 | } |
---|
773 | else |
---|
774 | { |
---|
775 | out.write(HTML.encodeTags(n.getName())); |
---|
776 | } |
---|
777 | out.write(sharees.hasNext() ? ", " : ""); |
---|
778 | } |
---|
779 | %> |
---|
780 | </tbl:cell> |
---|
781 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
782 | <tbl:cell column="xt-columns" /> |
---|
783 | </tbl:xt-cells> |
---|
784 | </tbl:row> |
---|
785 | <% |
---|
786 | } |
---|
787 | } |
---|
788 | if (numListed == 0) |
---|
789 | { |
---|
790 | %> |
---|
791 | <tbl:panel subclass="bg-filled-50"> |
---|
792 | <div class="messagecontainer note"> |
---|
793 | <%=bioAssays == null || bioAssays.getTotalCount() == 0 ? "No bioassays were found" : "No bioassays on this page. Please select another page!" %> |
---|
794 | </div> |
---|
795 | </tbl:panel> |
---|
796 | <% |
---|
797 | } |
---|
798 | %> |
---|
799 | </tbl:rows> |
---|
800 | </tbl:data> |
---|
801 | </tbl:table> |
---|
802 | </div> |
---|
803 | |
---|
804 | <base:buttongroup subclass="dialogbuttons"> |
---|
805 | <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
806 | <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
807 | <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
808 | </base:buttongroup> |
---|
809 | |
---|
810 | </base:body> |
---|
811 | </base:page> |
---|
812 | <% |
---|
813 | } |
---|
814 | finally |
---|
815 | { |
---|
816 | if (bioAssays != null) bioAssays.close(); |
---|
817 | if (dc != null) dc.close(); |
---|
818 | } |
---|
819 | %> |
---|