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