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