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