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