1 | <%-- $Id: list_bioplates.jsp 6604 2014-11-18 10:39:22Z 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.AnnotationType" |
---|
31 | import="net.sf.basedb.core.AnnotationSet" |
---|
32 | import="net.sf.basedb.core.Annotation" |
---|
33 | import="net.sf.basedb.core.BioPlate" |
---|
34 | import="net.sf.basedb.core.PlateGeometry" |
---|
35 | import="net.sf.basedb.core.BioWell" |
---|
36 | import="net.sf.basedb.core.ItemQuery" |
---|
37 | import="net.sf.basedb.core.Include" |
---|
38 | import="net.sf.basedb.core.Type" |
---|
39 | import="net.sf.basedb.core.ItemSubtype" |
---|
40 | import="net.sf.basedb.core.ItemResultIterator" |
---|
41 | import="net.sf.basedb.core.ItemResultList" |
---|
42 | import="net.sf.basedb.core.ItemContext" |
---|
43 | import="net.sf.basedb.core.Nameable" |
---|
44 | import="net.sf.basedb.core.Permission" |
---|
45 | import="net.sf.basedb.core.PluginDefinition" |
---|
46 | import="net.sf.basedb.core.Metadata" |
---|
47 | import="net.sf.basedb.core.Metadata.PropertyPath" |
---|
48 | import="net.sf.basedb.core.query.Hql" |
---|
49 | import="net.sf.basedb.core.query.Restrictions" |
---|
50 | import="net.sf.basedb.core.query.Expressions" |
---|
51 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
52 | import="net.sf.basedb.core.plugin.Plugin" |
---|
53 | import="net.sf.basedb.core.query.Orders" |
---|
54 | import="net.sf.basedb.core.query.Hql" |
---|
55 | import="net.sf.basedb.core.snapshot.AnnotationLoaderUtil" |
---|
56 | import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
---|
57 | import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
---|
58 | import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
---|
59 | import="net.sf.basedb.core.snapshot.SnapshotManager" |
---|
60 | import="net.sf.basedb.util.Enumeration" |
---|
61 | import="net.sf.basedb.util.ShareableUtil" |
---|
62 | import="net.sf.basedb.clients.web.Base" |
---|
63 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
64 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
65 | import="net.sf.basedb.clients.web.util.HTML" |
---|
66 | import="net.sf.basedb.util.formatter.Formatter" |
---|
67 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
68 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
69 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
70 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
71 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
72 | import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
---|
73 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
74 | import="net.sf.basedb.util.Values" |
---|
75 | import="java.util.Iterator" |
---|
76 | import="java.util.List" |
---|
77 | import="java.util.Map" |
---|
78 | import="java.util.Date" |
---|
79 | import="java.util.ArrayList" |
---|
80 | %> |
---|
81 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
82 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
83 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
84 | <%! |
---|
85 | private static final Item itemType = Item.BIOPLATE; |
---|
86 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
87 | |
---|
88 | private static Enumeration<String, String> bioMaterialTypes = new Enumeration<String, String>(); |
---|
89 | static |
---|
90 | { |
---|
91 | bioMaterialTypes.add("", "-any-"); |
---|
92 | bioMaterialTypes.add(Integer.toString(Item.SAMPLE.getValue()), Item.SAMPLE.toString()); |
---|
93 | bioMaterialTypes.add(Integer.toString(Item.EXTRACT.getValue()), Item.EXTRACT.toString()); |
---|
94 | } |
---|
95 | %> |
---|
96 | <% |
---|
97 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
98 | final String ID = sc.getId(); |
---|
99 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
100 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
101 | |
---|
102 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
103 | final String callback = request.getParameter("callback"); |
---|
104 | final String title = mode.generateTitle("bioplate", "bioplates"); |
---|
105 | final DbControl dc = sc.newDbControl(); |
---|
106 | ItemResultIterator<BioPlate> bioplates = null; |
---|
107 | List<AnnotationLoaderUtil> annotationLoaders = new ArrayList<AnnotationLoaderUtil>(); |
---|
108 | try |
---|
109 | { |
---|
110 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
111 | SnapshotManager manager = new SnapshotManager(); |
---|
112 | for (AnnotationType at : annotationTypeQuery.list(dc)) |
---|
113 | { |
---|
114 | annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at)); |
---|
115 | } |
---|
116 | |
---|
117 | final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(null); |
---|
118 | subtypesQuery.restrict( |
---|
119 | Restrictions.in( |
---|
120 | Hql.property("itemType"), |
---|
121 | Expressions.integer(Item.SAMPLE.getValue()), Expressions.integer(Item.EXTRACT.getValue()) |
---|
122 | )); |
---|
123 | |
---|
124 | final ItemQuery<PlateGeometry> geometryQuery = PlateGeometry.getQuery(); |
---|
125 | geometryQuery.order(Orders.asc(Hql.property("name"))); |
---|
126 | geometryQuery.setCacheResult(true); |
---|
127 | |
---|
128 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
129 | try |
---|
130 | { |
---|
131 | final ItemQuery<BioPlate> query = Base.getConfiguredQuery(dc, cc, true, BioPlate.getQuery(), mode); |
---|
132 | bioplates = query.iterate(dc); |
---|
133 | } |
---|
134 | catch (Throwable t) |
---|
135 | { |
---|
136 | cc.setMessage(t.getMessage()); |
---|
137 | t.printStackTrace(); |
---|
138 | } |
---|
139 | int numListed = 0; |
---|
140 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
141 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
142 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
143 | ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
---|
144 | %> |
---|
145 | <base:page title="<%=title==null ? "Bioplates" : title%>" type="<%=mode.getPageType()%>" id="list-page"> |
---|
146 | <base:head scripts="table.js,~bioplates.js" styles="table.css,toolbar.css"> |
---|
147 | <ext:scripts context="<%=jspContext%>" /> |
---|
148 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
149 | </base:head> |
---|
150 | <base:body> |
---|
151 | <h1><%=title==null ? "Bioplates" : title%></h1> |
---|
152 | <div class="content"> |
---|
153 | <tbl:table |
---|
154 | id="bioplates" |
---|
155 | columns="<%=cc.getSetting("columns")%>" |
---|
156 | sortby="<%=cc.getSortProperty()%>" |
---|
157 | direction="<%=cc.getSortDirection()%>" |
---|
158 | action="index.jsp" |
---|
159 | sc="<%=sc%>" |
---|
160 | item="<%=itemType%>" |
---|
161 | subclass="fulltable" |
---|
162 | > |
---|
163 | <tbl:hidden |
---|
164 | name="mode" |
---|
165 | value="<%=mode.getName()%>" |
---|
166 | /> |
---|
167 | <tbl:hidden |
---|
168 | name="callback" |
---|
169 | value="<%=callback%>" |
---|
170 | skip="<%=callback == null%>" |
---|
171 | /> |
---|
172 | <tbl:columndef |
---|
173 | id="name" |
---|
174 | property="name" |
---|
175 | datatype="string" |
---|
176 | title="Name" |
---|
177 | sortable="true" |
---|
178 | filterable="true" |
---|
179 | exportable="true" |
---|
180 | show="always" |
---|
181 | /> |
---|
182 | <tbl:columndef |
---|
183 | id="id" |
---|
184 | clazz="uniquecol" |
---|
185 | property="id" |
---|
186 | datatype="int" |
---|
187 | title="ID" |
---|
188 | sortable="true" |
---|
189 | filterable="true" |
---|
190 | exportable="true" |
---|
191 | /> |
---|
192 | <tbl:columndef |
---|
193 | id="barcode" |
---|
194 | property="barcode" |
---|
195 | datatype="string" |
---|
196 | title="Barcode" |
---|
197 | sortable="true" |
---|
198 | filterable="true" |
---|
199 | exportable="true" |
---|
200 | /> |
---|
201 | <tbl:columndef |
---|
202 | id="destroyed" |
---|
203 | property="destroyed" |
---|
204 | datatype="boolean" |
---|
205 | title="Destroyed" |
---|
206 | sortable="true" |
---|
207 | filterable="true" |
---|
208 | exportable="true" |
---|
209 | /> |
---|
210 | <tbl:columndef |
---|
211 | id="eventDate" |
---|
212 | property="eventDate" |
---|
213 | datatype="date" |
---|
214 | title="Created" |
---|
215 | sortable="true" |
---|
216 | filterable="true" |
---|
217 | exportable="true" |
---|
218 | formatter="<%=dateFormatter%>" |
---|
219 | /> |
---|
220 | <tbl:columndef |
---|
221 | id="entryDate" |
---|
222 | property="entryDate" |
---|
223 | datatype="date" |
---|
224 | title="Registered" |
---|
225 | sortable="true" |
---|
226 | filterable="true" |
---|
227 | exportable="true" |
---|
228 | formatter="<%=dateFormatter%>" |
---|
229 | /> |
---|
230 | <tbl:columndef |
---|
231 | id="freeWells" |
---|
232 | property="freeWells" |
---|
233 | datatype="int" |
---|
234 | title="Free (total) wells" |
---|
235 | sortable="true" |
---|
236 | filterable="true" |
---|
237 | exportable="true" |
---|
238 | /> |
---|
239 | <% |
---|
240 | Enumeration<String, String> geometries = new Enumeration<String, String>(); |
---|
241 | ItemResultList<PlateGeometry> plateGeometries = geometryQuery.list(dc); |
---|
242 | for (PlateGeometry pg : plateGeometries) |
---|
243 | { |
---|
244 | geometries.add(Integer.toString(pg.getId()), HTML.encodeTags(pg.getName())); |
---|
245 | } |
---|
246 | %> |
---|
247 | <tbl:columndef |
---|
248 | id="plateGeometry" |
---|
249 | property="plateGeometry" |
---|
250 | sortproperty="plateGeometry.name" |
---|
251 | exportproperty="plateGeometry.name:string" |
---|
252 | datatype="int" |
---|
253 | enumeration="<%=geometries%>" |
---|
254 | title="Geometry" |
---|
255 | sortable="true" |
---|
256 | filterable="true" |
---|
257 | exportable="true" |
---|
258 | /> |
---|
259 | <tbl:columndef |
---|
260 | id="bioPlateType" |
---|
261 | property="bioPlateType.name" |
---|
262 | datatype="string" |
---|
263 | title="Bioplate type" |
---|
264 | sortable="true" |
---|
265 | filterable="true" |
---|
266 | exportable="true" |
---|
267 | /> |
---|
268 | <tbl:columndef |
---|
269 | id="bioMaterialType" |
---|
270 | property="bioPlateType.bioMaterialType" |
---|
271 | title="Biomaterial type" |
---|
272 | datatype="int" |
---|
273 | sortable="true" |
---|
274 | filterable="true" |
---|
275 | exportable="true" |
---|
276 | enumeration="<%=bioMaterialTypes%>" |
---|
277 | /> |
---|
278 | <tbl:columndef |
---|
279 | id="bioMaterialSubtype" |
---|
280 | property="bioPlateType.itemSubtype" |
---|
281 | sortproperty="bioPlateType.itemSubtype.name" |
---|
282 | exportproperty="bioPlateType.itemSubtype.name:string" |
---|
283 | datatype="int" |
---|
284 | enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-any-")%>" |
---|
285 | title="Biomaterial subtype" |
---|
286 | sortable="true" |
---|
287 | filterable="true" |
---|
288 | exportable="true" |
---|
289 | /> |
---|
290 | <tbl:columndef |
---|
291 | id="freezer" |
---|
292 | property="freezer.name" |
---|
293 | datatype="string" |
---|
294 | title="Storage location" |
---|
295 | sortable="true" |
---|
296 | filterable="true" |
---|
297 | exportable="true" |
---|
298 | /> |
---|
299 | <tbl:columndef |
---|
300 | id="section" |
---|
301 | property="section" |
---|
302 | datatype="string" |
---|
303 | title="Section" |
---|
304 | sortable="true" |
---|
305 | filterable="true" |
---|
306 | exportable="true" |
---|
307 | /> |
---|
308 | <tbl:columndef |
---|
309 | id="tray" |
---|
310 | property="tray" |
---|
311 | datatype="string" |
---|
312 | title="Tray" |
---|
313 | sortable="true" |
---|
314 | filterable="true" |
---|
315 | exportable="true" |
---|
316 | /> |
---|
317 | <tbl:columndef |
---|
318 | id="position" |
---|
319 | property="position" |
---|
320 | datatype="string" |
---|
321 | title="Position" |
---|
322 | sortable="true" |
---|
323 | filterable="true" |
---|
324 | exportable="true" |
---|
325 | /> |
---|
326 | <tbl:columndef |
---|
327 | id="owner" |
---|
328 | property="owner.name" |
---|
329 | datatype="string" |
---|
330 | title="Owner" |
---|
331 | sortable="true" |
---|
332 | filterable="true" |
---|
333 | exportable="true" |
---|
334 | /> |
---|
335 | <tbl:columndef |
---|
336 | id="description" |
---|
337 | property="description" |
---|
338 | datatype="string" |
---|
339 | title="Description" |
---|
340 | sortable="true" |
---|
341 | filterable="true" |
---|
342 | exportable="true" |
---|
343 | /> |
---|
344 | <% |
---|
345 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
346 | { |
---|
347 | AnnotationType at = loader.getAnnotationType(); |
---|
348 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
349 | Enumeration<String, String> annotationEnum = null; |
---|
350 | if (at.isEnumeration()) |
---|
351 | { |
---|
352 | annotationEnum = new Enumeration<String, String>(); |
---|
353 | List<?> values = at.getValues(); |
---|
354 | for (Object value : values) |
---|
355 | { |
---|
356 | String encoded = formatter.format(value); |
---|
357 | annotationEnum.add(encoded, encoded); |
---|
358 | } |
---|
359 | } |
---|
360 | %> |
---|
361 | <tbl:columndef |
---|
362 | id="<%="at"+at.getId()%>" |
---|
363 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
364 | property="<%="#"+at.getId()%>" |
---|
365 | annotation="true" |
---|
366 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
367 | enumeration="<%=annotationEnum%>" |
---|
368 | smartenum="<%=at.getDisplayAsList() %>" |
---|
369 | sortable="<%=at.getMultiplicity() == 1%>" |
---|
370 | filterable="true" |
---|
371 | exportable="true" |
---|
372 | formatter="<%=formatter%>" |
---|
373 | unit="<%=at.getDefaultUnit()%>" |
---|
374 | /> |
---|
375 | <% |
---|
376 | } |
---|
377 | %> |
---|
378 | <tbl:columndef |
---|
379 | id="permission" |
---|
380 | title="Permission" |
---|
381 | /> |
---|
382 | <tbl:columndef |
---|
383 | id="sharedTo" |
---|
384 | title="Shared to" |
---|
385 | filterable="true" |
---|
386 | filterproperty="!sharedTo.name" |
---|
387 | datatype="string" |
---|
388 | /> |
---|
389 | <tbl:columndef |
---|
390 | id="xt-columns" |
---|
391 | extensions="<%=columnsInvoker%>" |
---|
392 | jspcontext="<%=jspContext%>" |
---|
393 | /> |
---|
394 | <div class="panelgroup bg-filled-50 bottomborder"> |
---|
395 | <tbl:toolbar |
---|
396 | visible="<%=mode.hasToolbar()%>" |
---|
397 | subclass="bottomborder" |
---|
398 | > |
---|
399 | <tbl:button |
---|
400 | id="btnNewItem" |
---|
401 | disabled="<%=!createPermission%>" |
---|
402 | image="new.png" |
---|
403 | title="New…" |
---|
404 | tooltip="<%=createPermission ? "Create new bioplate" : "You do not have permission to create bioplate"%>" |
---|
405 | /> |
---|
406 | <tbl:button |
---|
407 | id="btnDeleteItems" |
---|
408 | image="delete.png" |
---|
409 | title="Delete" |
---|
410 | tooltip="Delete the selected items" |
---|
411 | /> |
---|
412 | <tbl:button |
---|
413 | id="btnRestoreItems" |
---|
414 | image="restore.png" |
---|
415 | title="Restore" |
---|
416 | tooltip="Restore the selected (deleted) items" |
---|
417 | /> |
---|
418 | <tbl:button |
---|
419 | id="btnShareItems" |
---|
420 | image="share.png" |
---|
421 | title="Share…" |
---|
422 | tooltip="Share the selected items" |
---|
423 | /> |
---|
424 | <tbl:button |
---|
425 | id="btnSetOwner" |
---|
426 | image="take_ownership.png" |
---|
427 | title="Set owner…" |
---|
428 | tooltip="Change owner of the selected items" |
---|
429 | /> |
---|
430 | <tbl:button |
---|
431 | id="btnColumns" |
---|
432 | image="columns.png" |
---|
433 | title="Columns…" |
---|
434 | tooltip="Show, hide and re-order columns" |
---|
435 | /> |
---|
436 | <tbl:button |
---|
437 | id="btnImport" |
---|
438 | data-plugin-type="IMPORT" |
---|
439 | image="import.png" |
---|
440 | title="Import…" |
---|
441 | tooltip="Import data" |
---|
442 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
443 | /> |
---|
444 | <tbl:button |
---|
445 | id="btnExport" |
---|
446 | data-plugin-type="EXPORT" |
---|
447 | image="export.png" |
---|
448 | title="Export…" |
---|
449 | tooltip="Export data" |
---|
450 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
451 | /> |
---|
452 | <tbl:button |
---|
453 | id="btnRunPlugin" |
---|
454 | data-plugin-type="OTHER" |
---|
455 | image="runplugin.png" |
---|
456 | title="Run plugin…" |
---|
457 | tooltip="Run a plugin" |
---|
458 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
459 | /> |
---|
460 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
461 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
462 | </tbl:toolbar> |
---|
463 | <tbl:panel> |
---|
464 | <tbl:presetselector /> |
---|
465 | <tbl:navigator |
---|
466 | page="<%=cc.getPage()%>" |
---|
467 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
468 | totalrows="<%=bioplates == null ? 0 : bioplates.getTotalCount()%>" |
---|
469 | visible="<%=mode.hasNavigator()%>" |
---|
470 | /> |
---|
471 | </tbl:panel> |
---|
472 | </div> |
---|
473 | <tbl:data> |
---|
474 | <tbl:headers> |
---|
475 | <tbl:headerrow> |
---|
476 | <tbl:header colspan="3" /> |
---|
477 | <tbl:columnheaders /> |
---|
478 | </tbl:headerrow> |
---|
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 | |
---|
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 | <tbl:propertyfilter /> |
---|
499 | </tbl:headerrow> |
---|
500 | </tbl:headers> |
---|
501 | <tbl:rows> |
---|
502 | <% |
---|
503 | if (cc.getMessage() != null) |
---|
504 | { |
---|
505 | %> |
---|
506 | <tbl:panel subclass="bg-filled-50"> |
---|
507 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
508 | </tbl:panel> |
---|
509 | <% |
---|
510 | cc.setMessage(null); |
---|
511 | } |
---|
512 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
513 | int selectedItemId = cc.getId(); |
---|
514 | if (bioplates != null) |
---|
515 | { |
---|
516 | PropertyPath<BioPlate, Integer> bmType = |
---|
517 | Metadata.getInstance(BioPlate.class).getPropertyPath("bioPlateType.bioMaterialType", false); |
---|
518 | while (bioplates.hasNext()) |
---|
519 | { |
---|
520 | BioPlate item = bioplates.next(); |
---|
521 | int itemId = item.getId(); |
---|
522 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
523 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
524 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
525 | String tooltip = mode.isSelectionMode() ? |
---|
526 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
527 | String name = HTML.encodeTags(item.getName()); |
---|
528 | index++; |
---|
529 | numListed++; |
---|
530 | %> |
---|
531 | <tbl:row> |
---|
532 | <tbl:header |
---|
533 | clazz="index" |
---|
534 | ><%=index%></tbl:header> |
---|
535 | <tbl:header |
---|
536 | clazz="check" |
---|
537 | visible="<%=mode.hasCheck()%>" |
---|
538 | ><input |
---|
539 | type="checkbox" |
---|
540 | name="<%=itemId%>" |
---|
541 | value="<%=itemId%>" |
---|
542 | title="<%=name%>" |
---|
543 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
544 | ></tbl:header> |
---|
545 | <tbl:header |
---|
546 | clazz="check" |
---|
547 | visible="<%=mode.hasRadio()%>" |
---|
548 | ><input |
---|
549 | type="radio" |
---|
550 | name="item_id" |
---|
551 | value="<%=itemId%>" |
---|
552 | title="<%=name%>" |
---|
553 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
554 | ></tbl:header> |
---|
555 | <tbl:header |
---|
556 | clazz="icons" |
---|
557 | visible="<%=mode.hasIcons()%>" |
---|
558 | ><base:icon |
---|
559 | image="deleted.png" |
---|
560 | id="<%="delete."+itemId %>" |
---|
561 | subclass="<%=deletePermission ? "table-delete-item" : null %>" |
---|
562 | data-item-id="<%=itemId%>" |
---|
563 | tooltip="This item has been scheduled for deletion" |
---|
564 | visible="<%=item.isRemoved()%>" |
---|
565 | /><base:icon |
---|
566 | image="shared.png" |
---|
567 | id="<%="share."+itemId %>" |
---|
568 | subclass="<%=sharePermission ? "table-share-item" : null %>" |
---|
569 | data-item-id="<%=itemId%>" |
---|
570 | tooltip="This item is shared to other users, groups and/or projects" |
---|
571 | visible="<%=item.isShared()%>" |
---|
572 | /> </tbl:header> |
---|
573 | <tbl:cell column="name"><div |
---|
574 | class="link table-item" |
---|
575 | data-item-id="<%=itemId%>" |
---|
576 | data-no-edit="<%=writePermission ? 0 : 1 %>" |
---|
577 | tabindex="0" |
---|
578 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
579 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
580 | <tbl:cell column="barcode"><%=HTML.encodeTags(item.getBarcode())%></tbl:cell> |
---|
581 | <tbl:cell column="destroyed"><%=item.isDestroyed()%></tbl:cell> |
---|
582 | <tbl:cell column="freeWells"><%=item.getFreeWells()%> (<%=item.getTotalWells()%>)</tbl:cell> |
---|
583 | <tbl:cell column="owner" |
---|
584 | ><base:propertyvalue |
---|
585 | item="<%=item%>" |
---|
586 | property="owner" |
---|
587 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
588 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
589 | /></tbl:cell> |
---|
590 | <tbl:cell column="plateGeometry" |
---|
591 | ><base:propertyvalue |
---|
592 | item="<%=item%>" |
---|
593 | property="plateGeometry" |
---|
594 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
595 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
596 | /></tbl:cell> |
---|
597 | <tbl:cell column="freezer"> |
---|
598 | <base:propertyvalue |
---|
599 | item="<%=item%>" |
---|
600 | property="freezer" |
---|
601 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
602 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
603 | /> |
---|
604 | </tbl:cell> |
---|
605 | <tbl:cell column="section"><%=HTML.encodeTags(item.getSection())%></tbl:cell> |
---|
606 | <tbl:cell column="tray"><%=HTML.encodeTags(item.getTray())%></tbl:cell> |
---|
607 | <tbl:cell column="position"><%=HTML.encodeTags(item.getPosition())%></tbl:cell> |
---|
608 | <tbl:cell column="bioPlateType"> |
---|
609 | <base:propertyvalue |
---|
610 | item="<%=item%>" |
---|
611 | property="bioPlateType" |
---|
612 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
613 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
614 | /> |
---|
615 | </tbl:cell> |
---|
616 | <tbl:cell column="bioMaterialType"><% |
---|
617 | Integer i = bmType.getValue(dc, item); |
---|
618 | %><%=i == null ? "<i>- any -</i>" : Item.fromValue(i).toString() %></tbl:cell> |
---|
619 | <tbl:cell column="bioMaterialSubtype"><base:propertyvalue |
---|
620 | item="<%=item%>" |
---|
621 | property="bioPlateType.itemSubtype" |
---|
622 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
623 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
624 | nulltext="<i>- any -</i>" |
---|
625 | /></tbl:cell> |
---|
626 | <tbl:cell column="eventDate" value="<%=item.getEventDate()%>" /> |
---|
627 | <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" /> |
---|
628 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
629 | <% |
---|
630 | if (item.isAnnotated()) |
---|
631 | { |
---|
632 | AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, item.getAnnotationSet().getId()); |
---|
633 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
634 | { |
---|
635 | if (loader.find(snapshot)) |
---|
636 | { |
---|
637 | %> |
---|
638 | <tbl:cell |
---|
639 | column="<%="at"+loader.getId()%>" |
---|
640 | ><tbl:cellvalue |
---|
641 | list="<%=loader.getValues()%>" |
---|
642 | suffix="<%=loader.getUnitSymbol()%>" |
---|
643 | /></tbl:cell> |
---|
644 | <% |
---|
645 | } |
---|
646 | } |
---|
647 | } |
---|
648 | %> |
---|
649 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
650 | <tbl:cell column="sharedTo"> |
---|
651 | <% |
---|
652 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
653 | while(sharees.hasNext()) |
---|
654 | { |
---|
655 | Nameable n = sharees.next(); |
---|
656 | if (mode.hasPropertyLink()) |
---|
657 | { |
---|
658 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
659 | } |
---|
660 | else |
---|
661 | { |
---|
662 | out.write(HTML.encodeTags(n.getName())); |
---|
663 | } |
---|
664 | out.write(sharees.hasNext() ? ", " : ""); |
---|
665 | } |
---|
666 | %> |
---|
667 | </tbl:cell> |
---|
668 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
669 | <tbl:cell column="xt-columns" /> |
---|
670 | </tbl:xt-cells> |
---|
671 | </tbl:row> |
---|
672 | <% |
---|
673 | } |
---|
674 | } |
---|
675 | if (numListed == 0) |
---|
676 | { |
---|
677 | %> |
---|
678 | <tbl:panel subclass="bg-filled-50"> |
---|
679 | <div class="messagecontainer note"> |
---|
680 | <%=bioplates == null || bioplates.getTotalCount() == 0 ? "No plates were found" : "No plates on this page. Please select another page!" %> |
---|
681 | </div> |
---|
682 | </tbl:panel> |
---|
683 | <% |
---|
684 | } |
---|
685 | %> |
---|
686 | </tbl:rows> |
---|
687 | </tbl:data> |
---|
688 | </tbl:table> |
---|
689 | </div> |
---|
690 | |
---|
691 | <base:buttongroup subclass="dialogbuttons"> |
---|
692 | <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
693 | <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
694 | <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
695 | </base:buttongroup> |
---|
696 | </base:body> |
---|
697 | </base:page> |
---|
698 | <% |
---|
699 | } |
---|
700 | finally |
---|
701 | { |
---|
702 | if (bioplates != null) bioplates.close(); |
---|
703 | if (dc != null) dc.close(); |
---|
704 | } |
---|
705 | %> |
---|