1 | <%-- $Id: list_biowells.jsp 6604 2014-11-18 10:39:22Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2005 Nicklas Nordborg |
---|
4 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, 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 Martin |
---|
24 | @version 2.10 |
---|
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.Include" |
---|
31 | import="net.sf.basedb.core.ItemContext" |
---|
32 | import="net.sf.basedb.core.AnnotationType" |
---|
33 | import="net.sf.basedb.core.BioPlate" |
---|
34 | import="net.sf.basedb.core.BioPlateType" |
---|
35 | import="net.sf.basedb.core.BioWell" |
---|
36 | import="net.sf.basedb.core.MeasuredBioMaterial" |
---|
37 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
38 | import="net.sf.basedb.core.ItemQuery" |
---|
39 | import="net.sf.basedb.core.ItemResultIterator" |
---|
40 | import="net.sf.basedb.core.ItemResultList" |
---|
41 | import="net.sf.basedb.core.Permission" |
---|
42 | import="net.sf.basedb.core.PluginDefinition" |
---|
43 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
44 | import="net.sf.basedb.core.Unit" |
---|
45 | import="net.sf.basedb.core.Quantity" |
---|
46 | import="net.sf.basedb.core.query.Restrictions" |
---|
47 | import="net.sf.basedb.core.query.Expressions" |
---|
48 | import="net.sf.basedb.core.query.Orders" |
---|
49 | import="net.sf.basedb.core.query.Hql" |
---|
50 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
51 | import="net.sf.basedb.core.plugin.Plugin" |
---|
52 | import="net.sf.basedb.core.snapshot.AnnotationLoaderUtil" |
---|
53 | import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
---|
54 | import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
---|
55 | import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
---|
56 | import="net.sf.basedb.core.snapshot.SnapshotManager" |
---|
57 | import="net.sf.basedb.util.Enumeration" |
---|
58 | import="net.sf.basedb.util.units.UnitUtil" |
---|
59 | import="net.sf.basedb.clients.web.Base" |
---|
60 | import="net.sf.basedb.clients.web.ChangeHistoryUtil" |
---|
61 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
62 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
63 | import="net.sf.basedb.clients.web.util.HTML" |
---|
64 | import="net.sf.basedb.util.Values" |
---|
65 | import="net.sf.basedb.util.formatter.Formatter" |
---|
66 | import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
---|
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="java.util.ArrayList" |
---|
75 | import="java.util.List" |
---|
76 | import="java.util.Map" |
---|
77 | import="java.util.Date" |
---|
78 | %> |
---|
79 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
80 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
81 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
82 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
83 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
84 | <%! |
---|
85 | private static final Item itemType = Item.BIOWELL; |
---|
86 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
87 | %> |
---|
88 | <% |
---|
89 | final int bioPlateId = Values.getInt(request.getParameter("bioplate_id")); |
---|
90 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
91 | final String ID = sc.getId(); |
---|
92 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
93 | |
---|
94 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
95 | final String callback = request.getParameter("callback"); |
---|
96 | final String title = mode.generateTitle("biowell", "biowells"); |
---|
97 | final DbControl dc = sc.newDbControl(); |
---|
98 | ItemResultIterator<BioWell> biowells = null; |
---|
99 | List<AnnotationLoaderUtil> annotationLoaders = new ArrayList<AnnotationLoaderUtil>(); |
---|
100 | |
---|
101 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
102 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
103 | |
---|
104 | WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true); |
---|
105 | WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false); |
---|
106 | |
---|
107 | try |
---|
108 | { |
---|
109 | final BioPlate bioplate = BioPlate.getById(dc, bioPlateId); |
---|
110 | final BioPlateType bioPlateType = bioplate.getBioPlateType(); |
---|
111 | final boolean createPermission = bioplate.hasPermission(Permission.WRITE); |
---|
112 | final boolean deletePermission = createPermission; |
---|
113 | final BioWell.LockMode lockMode = bioPlateType.getLockMode(); |
---|
114 | final Item bioMaterialType = bioPlateType.getBioMaterialType(); |
---|
115 | |
---|
116 | Enumeration<String, String> rows = new Enumeration<String,String>(); |
---|
117 | for (int r = 0; r < bioplate.getPlateGeometry().getRows() && r < 256; r++) |
---|
118 | { |
---|
119 | rows.add(Integer.toString(r), rowFormatter.format(r)); |
---|
120 | } |
---|
121 | |
---|
122 | Enumeration<String, String> columns = new Enumeration<String,String>(); |
---|
123 | for (int c = 0; c < bioplate.getPlateGeometry().getColumns() && c < 256; c++) |
---|
124 | { |
---|
125 | columns.add(Integer.toString(c), columnFormatter.format(c)); |
---|
126 | } |
---|
127 | |
---|
128 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
129 | Formatter<Number> numericFormatter = FormatterFactory.getNumberFormatter(sc); |
---|
130 | Unit microGram = UnitUtil.getUnit(dc, Quantity.MASS, "µg"); |
---|
131 | |
---|
132 | SnapshotManager manager = new SnapshotManager(); |
---|
133 | if (bioMaterialType != null) |
---|
134 | { |
---|
135 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(bioMaterialType); |
---|
136 | for (AnnotationType at : annotationTypeQuery.list(dc)) |
---|
137 | { |
---|
138 | annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at)); |
---|
139 | } |
---|
140 | } |
---|
141 | |
---|
142 | try |
---|
143 | { |
---|
144 | final ItemQuery<BioWell> query = Base.getConfiguredQuery(dc, cc, true, bioplate.getBioWells(), mode); |
---|
145 | query.join(Hql.leftJoin(null, "bioMaterial", "mbm", null, true)); |
---|
146 | query.join(Hql.leftJoin("mbm", "creationEvent", "evt", null, true)); |
---|
147 | query.join(Hql.leftJoin("mbm", "owner", "usr", null, false)); |
---|
148 | query.join(Hql.leftJoin("evt", "protocol", "pcl", null, false)); |
---|
149 | if (!"row".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("row"))); |
---|
150 | if (!"column".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("column"))); |
---|
151 | biowells = query.iterate(dc); |
---|
152 | } |
---|
153 | catch (Throwable t) |
---|
154 | { |
---|
155 | cc.setMessage(t.getMessage()); |
---|
156 | t.printStackTrace(); |
---|
157 | } |
---|
158 | int numListed = 0; |
---|
159 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, bioplate); |
---|
160 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
161 | ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
---|
162 | %> |
---|
163 | <base:page title="<%=title%>" type="<%=mode.getPageType()%>" id="list-page"> |
---|
164 | <base:head scripts="table.js,tabcontrol-2.js,~biowells.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
165 | <ext:scripts context="<%=jspContext%>" /> |
---|
166 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
167 | </base:head> |
---|
168 | <base:body> |
---|
169 | <% |
---|
170 | if (!mode.isSelectionMode()) |
---|
171 | { |
---|
172 | %> |
---|
173 | <p:path><p:pathelement |
---|
174 | title="Bioplates" href="<%="../index.jsp?ID="+ID%>" |
---|
175 | /><p:pathelement title="<%=HTML.encodeTags(bioplate.getName())%>" |
---|
176 | /></p:path> |
---|
177 | <% |
---|
178 | } |
---|
179 | else |
---|
180 | { |
---|
181 | %> |
---|
182 | <h1><%=title%></h1> |
---|
183 | <% |
---|
184 | } |
---|
185 | %> |
---|
186 | <t:tabcontrol |
---|
187 | id="main" |
---|
188 | subclass="content mastertabcontrol" |
---|
189 | active="biowells" |
---|
190 | notabs="<%=mode.isSelectionMode()%>" |
---|
191 | > |
---|
192 | <t:tab id="properties" title="Properties" /> |
---|
193 | <t:tab id="annotations" title="Annotations" /> |
---|
194 | <t:tab id="biowells" title="Wells"> |
---|
195 | <tbl:table |
---|
196 | id="biowells" |
---|
197 | columns="<%=cc.getSetting("columns")%>" |
---|
198 | sortby="<%=cc.getSortProperty()%>" |
---|
199 | direction="<%=cc.getSortDirection()%>" |
---|
200 | action="index.jsp" |
---|
201 | sc="<%=sc%>" |
---|
202 | item="<%=itemType%>" |
---|
203 | subclass="fulltable" |
---|
204 | > |
---|
205 | <tbl:hidden |
---|
206 | name="mode" |
---|
207 | value="<%=mode.getName()%>" |
---|
208 | /> |
---|
209 | <tbl:hidden |
---|
210 | name="bioplate_id" |
---|
211 | value="<%=String.valueOf(bioPlateId)%>" |
---|
212 | /> |
---|
213 | <tbl:hidden |
---|
214 | name="callback" |
---|
215 | value="<%=callback%>" |
---|
216 | skip="<%=callback == null%>" |
---|
217 | /> |
---|
218 | <tbl:columndef |
---|
219 | id="row" |
---|
220 | property="row" |
---|
221 | datatype="int" |
---|
222 | title="Row" |
---|
223 | sortable="true" |
---|
224 | filterable="true" |
---|
225 | enumeration="<%=rows%>" |
---|
226 | exportable="true" |
---|
227 | show="always" |
---|
228 | formatter="<%=rowFormatter%>" |
---|
229 | /> |
---|
230 | <tbl:columndef |
---|
231 | id="column" |
---|
232 | property="column" |
---|
233 | datatype="int" |
---|
234 | title="Column" |
---|
235 | sortable="true" |
---|
236 | filterable="true" |
---|
237 | enumeration="<%=columns%>" |
---|
238 | exportable="true" |
---|
239 | show="always" |
---|
240 | formatter="<%=columnFormatter%>" |
---|
241 | /> |
---|
242 | <tbl:columndef |
---|
243 | id="id" |
---|
244 | clazz="uniquecol" |
---|
245 | property="id" |
---|
246 | datatype="int" |
---|
247 | title="ID" |
---|
248 | sortable="true" |
---|
249 | filterable="true" |
---|
250 | exportable="true" |
---|
251 | /> |
---|
252 | <tbl:columndef |
---|
253 | id="bioMaterial.name" |
---|
254 | property="$mbm.name" |
---|
255 | exportproperty="bioMaterial.name" |
---|
256 | datatype="string" |
---|
257 | title="Name" |
---|
258 | sortable="true" |
---|
259 | filterable="true" |
---|
260 | exportable="true" |
---|
261 | /> |
---|
262 | <tbl:columndef |
---|
263 | id="bioMaterial.externalId" |
---|
264 | property="$mbm.externalId" |
---|
265 | exportproperty="bioMaterial.externalId" |
---|
266 | datatype="string" |
---|
267 | title="External id" |
---|
268 | sortable="true" |
---|
269 | filterable="true" |
---|
270 | exportable="true" |
---|
271 | /> |
---|
272 | <tbl:columndef |
---|
273 | id="bioMaterial.originalQuantity" |
---|
274 | property="$mbm.originalQuantity" |
---|
275 | exportproperty="bioMaterial.originalQuantity" |
---|
276 | datatype="float" |
---|
277 | title="Original quantity (µg)" |
---|
278 | sortable="true" |
---|
279 | filterable="true" |
---|
280 | exportable="true" |
---|
281 | unit="<%=microGram%>" |
---|
282 | formatter="<%=numericFormatter%>" |
---|
283 | /> |
---|
284 | <tbl:columndef |
---|
285 | id="bioMaterial.remainingQuantity" |
---|
286 | property="$mbm.remainingQuantity" |
---|
287 | exportproperty="bioMaterial.remainingQuantity" |
---|
288 | datatype="float" |
---|
289 | title="Remaining quantity (µg)" |
---|
290 | sortable="true" |
---|
291 | filterable="true" |
---|
292 | exportable="true" |
---|
293 | unit="<%=microGram%>" |
---|
294 | formatter="<%=numericFormatter%>" |
---|
295 | /> |
---|
296 | <tbl:columndef |
---|
297 | id="bioMaterial.protocol" |
---|
298 | property="$evt.protocol" |
---|
299 | sortproperty="$pcl.name" |
---|
300 | filterproperty="$pcl.name" |
---|
301 | exportproperty="bioMaterial.creationEvent.protocol.name" |
---|
302 | datatype="string" |
---|
303 | title="Protocol" |
---|
304 | sortable="true" |
---|
305 | filterable="true" |
---|
306 | exportable="true" |
---|
307 | /> |
---|
308 | <tbl:columndef |
---|
309 | id="bioMaterial.entryDate" |
---|
310 | property="$evt.entryDate" |
---|
311 | exportproperty="bioMaterial.creationEvent.entryDate" |
---|
312 | datatype="date" |
---|
313 | title="Registered" |
---|
314 | sortable="true" |
---|
315 | filterable="true" |
---|
316 | exportable="true" |
---|
317 | formatter="<%=dateFormatter%>" |
---|
318 | /> |
---|
319 | <tbl:columndef |
---|
320 | id="bioMaterial.eventDate" |
---|
321 | property="$evt.eventDate" |
---|
322 | exportproperty="bioMaterial.creationEvent.eventDate" |
---|
323 | datatype="date" |
---|
324 | title="Created" |
---|
325 | sortable="true" |
---|
326 | filterable="true" |
---|
327 | exportable="true" |
---|
328 | formatter="<%=dateFormatter%>" |
---|
329 | /> |
---|
330 | <tbl:columndef |
---|
331 | id="bioMaterial.owner" |
---|
332 | property="$usr.name" |
---|
333 | exportproperty="bioMaterial.owner.name" |
---|
334 | datatype="string" |
---|
335 | title="Owner" |
---|
336 | sortable="true" |
---|
337 | filterable="true" |
---|
338 | exportable="true" |
---|
339 | /> |
---|
340 | <tbl:columndef |
---|
341 | id="bioMaterial.description" |
---|
342 | property="$mbm.description" |
---|
343 | exportproperty="bioMaterial.description" |
---|
344 | datatype="string" |
---|
345 | title="Description" |
---|
346 | sortable="true" |
---|
347 | filterable="true" |
---|
348 | exportable="true" |
---|
349 | /> |
---|
350 | <tbl:columndef |
---|
351 | id="bioMaterialList" |
---|
352 | property="@bioMaterial.bioMaterialLists" |
---|
353 | datatype="int" |
---|
354 | title="Biomaterial list" |
---|
355 | filterable="true" |
---|
356 | enumeration="<%=Base.getBioMaterialListsEnum(dc, bioMaterialType, Include.ALL)%>" |
---|
357 | multiple="false" |
---|
358 | /> |
---|
359 | <tbl:columndef |
---|
360 | id="originalBioMaterial.name" |
---|
361 | property="originalBioMaterial.name" |
---|
362 | datatype="string" |
---|
363 | title="Original biomaterial" |
---|
364 | sortable="true" |
---|
365 | filterable="true" |
---|
366 | exportable="true" |
---|
367 | /> |
---|
368 | <% |
---|
369 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
370 | { |
---|
371 | AnnotationType at = loader.getAnnotationType(); |
---|
372 | Enumeration<String, String> annotationEnum = null; |
---|
373 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
374 | if (at.isEnumeration()) |
---|
375 | { |
---|
376 | annotationEnum = new Enumeration<String, String>(); |
---|
377 | List<?> values = at.getValues(); |
---|
378 | for (Object value : values) |
---|
379 | { |
---|
380 | String encoded = formatter.format(value); |
---|
381 | annotationEnum.add(encoded, encoded); |
---|
382 | } |
---|
383 | } |
---|
384 | %> |
---|
385 | <tbl:columndef |
---|
386 | id="<%="at"+at.getId()%>" |
---|
387 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
388 | property="<%="$mbm.#"+at.getId()%>" |
---|
389 | annotation="true" |
---|
390 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
391 | enumeration="<%=annotationEnum%>" |
---|
392 | smartenum="<%=at.getDisplayAsList() %>" |
---|
393 | sortable="<%=at.getMultiplicity() == 1%>" |
---|
394 | filterable="true" |
---|
395 | exportable="false" |
---|
396 | formatter="<%=formatter%>" |
---|
397 | unit="<%=at.getDefaultUnit()%>" |
---|
398 | /> |
---|
399 | <% |
---|
400 | } |
---|
401 | %> |
---|
402 | <tbl:columndef |
---|
403 | id="permission" |
---|
404 | title="Permission" |
---|
405 | /> |
---|
406 | <tbl:columndef |
---|
407 | id="xt-columns" |
---|
408 | extensions="<%=columnsInvoker%>" |
---|
409 | jspcontext="<%=jspContext%>" |
---|
410 | /> |
---|
411 | <div class="panelgroup bg-filled-50 bottomborder"> |
---|
412 | <tbl:toolbar |
---|
413 | visible="<%=mode.hasToolbar()%>" |
---|
414 | subclass="bottomborder" |
---|
415 | > |
---|
416 | <tbl:button |
---|
417 | id="btnColumns" |
---|
418 | image="columns.png" |
---|
419 | title="Columns…" |
---|
420 | tooltip="Show, hide and re-order columns" |
---|
421 | /> |
---|
422 | <tbl:button |
---|
423 | id="btnImport" |
---|
424 | data-plugin-type="IMPORT" |
---|
425 | image="import.png" |
---|
426 | title="Import…" |
---|
427 | tooltip="Import data" |
---|
428 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
429 | /> |
---|
430 | <tbl:button |
---|
431 | id="btnExport" |
---|
432 | data-plugin-type="EXPORT" |
---|
433 | image="export.png" |
---|
434 | title="Export…" |
---|
435 | tooltip="Export data" |
---|
436 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
437 | /> |
---|
438 | <tbl:button |
---|
439 | id="btnRunPlugin" |
---|
440 | data-plugin-type="OTHER" |
---|
441 | image="runplugin.png" |
---|
442 | title="Run plugin…" |
---|
443 | tooltip="Run a plugin" |
---|
444 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
445 | /> |
---|
446 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
447 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
448 | </tbl:toolbar> |
---|
449 | <tbl:panel> |
---|
450 | <tbl:presetselector /> |
---|
451 | <tbl:navigator |
---|
452 | page="<%=cc.getPage()%>" |
---|
453 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
454 | totalrows="<%=biowells == null ? 0 : biowells.getTotalCount()%>" |
---|
455 | visible="<%=mode.hasNavigator()%>" |
---|
456 | /> |
---|
457 | </tbl:panel> |
---|
458 | </div> |
---|
459 | <tbl:data> |
---|
460 | <tbl:headers> |
---|
461 | <tbl:headerrow> |
---|
462 | <tbl:header colspan="3" /> |
---|
463 | <tbl:columnheaders /> |
---|
464 | </tbl:headerrow> |
---|
465 | <tbl:headerrow> |
---|
466 | <tbl:header subclass="index" /> |
---|
467 | <tbl:header |
---|
468 | subclass="check" |
---|
469 | visible="<%=mode.hasCheck()%>" |
---|
470 | ><base:icon |
---|
471 | id="check.uncheck" |
---|
472 | image="check_uncheck.png" |
---|
473 | tooltip="Check/uncheck all" |
---|
474 | |
---|
475 | /></tbl:header> |
---|
476 | <tbl:header |
---|
477 | subclass="check" |
---|
478 | visible="<%=mode.hasRadio()%>" |
---|
479 | /> |
---|
480 | <tbl:header |
---|
481 | subclass="icons" |
---|
482 | visible="<%=mode.hasIcons()%>" |
---|
483 | /> |
---|
484 | <tbl:propertyfilter /> |
---|
485 | </tbl:headerrow> |
---|
486 | </tbl:headers> |
---|
487 | <tbl:rows> |
---|
488 | <% |
---|
489 | if (cc.getMessage() != null) |
---|
490 | { |
---|
491 | %> |
---|
492 | <tbl:panel subclass="bg-filled-50"> |
---|
493 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
494 | </tbl:panel> |
---|
495 | <% |
---|
496 | cc.setMessage(null); |
---|
497 | } |
---|
498 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
499 | int selectedItemId = cc.getId(); |
---|
500 | if (biowells != null) |
---|
501 | { |
---|
502 | while (biowells.hasNext()) |
---|
503 | { |
---|
504 | BioWell item = biowells.next(); |
---|
505 | int itemId = item.getId(); |
---|
506 | String coordinate = rowFormatter.format(item.getRow()) + columnFormatter.format(item.getColumn()); |
---|
507 | index++; |
---|
508 | numListed++; |
---|
509 | MeasuredBioMaterial bioMaterial = null; |
---|
510 | BioMaterialEvent creationEvent = null; |
---|
511 | boolean editWellPermission = item.hasPermission(Permission.USE); |
---|
512 | try |
---|
513 | { |
---|
514 | bioMaterial = item.getBioMaterial(); |
---|
515 | if (bioMaterial != null) |
---|
516 | { |
---|
517 | creationEvent = bioMaterial.getCreationEvent(); |
---|
518 | editWellPermission &= bioMaterial.hasPermission(Permission.WRITE) && !bioMaterial.isLockedInWell(); |
---|
519 | } |
---|
520 | else |
---|
521 | { |
---|
522 | editWellPermission &= item.canAddBioMaterial(); |
---|
523 | } |
---|
524 | } |
---|
525 | catch (PermissionDeniedException ex) |
---|
526 | { |
---|
527 | editWellPermission = false; |
---|
528 | } |
---|
529 | %> |
---|
530 | <tbl:row> |
---|
531 | <tbl:header |
---|
532 | clazz="index" |
---|
533 | ><%=index%></tbl:header> |
---|
534 | <tbl:header |
---|
535 | clazz="check" |
---|
536 | visible="<%=mode.hasCheck()%>" |
---|
537 | ><input |
---|
538 | type="checkbox" |
---|
539 | name="<%=itemId%>" |
---|
540 | value="<%=itemId%>" |
---|
541 | title="<%=coordinate%>" |
---|
542 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
543 | ></tbl:header> |
---|
544 | <tbl:header |
---|
545 | clazz="check" |
---|
546 | visible="<%=mode.hasRadio()%>" |
---|
547 | ><input |
---|
548 | type="radio" |
---|
549 | name="item_id" |
---|
550 | value="<%=itemId%>" |
---|
551 | title="<%=coordinate%>" |
---|
552 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
553 | ></tbl:header> |
---|
554 | <tbl:header |
---|
555 | clazz="icons" |
---|
556 | visible="<%=mode.hasIcons()%>" |
---|
557 | > </tbl:header> |
---|
558 | |
---|
559 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
560 | <tbl:cell column="row"> |
---|
561 | <% |
---|
562 | if (mode.isSelectionMode()) |
---|
563 | { |
---|
564 | %> |
---|
565 | <div |
---|
566 | class="link table-item" |
---|
567 | data-item-id="<%=itemId%>" |
---|
568 | tabindex="0" |
---|
569 | title="Select this item"> |
---|
570 | <tbl:cellvalue value="<%=item.getRow()%>" /> |
---|
571 | </div> |
---|
572 | <% |
---|
573 | } |
---|
574 | else |
---|
575 | { |
---|
576 | %><tbl:cellvalue value="<%=item.getRow()%>" /><% |
---|
577 | } |
---|
578 | %> |
---|
579 | </tbl:cell> |
---|
580 | <tbl:cell column="column" value="<%=item.getColumn()%>" /> |
---|
581 | <tbl:cell column="bioMaterial.name"> |
---|
582 | <base:propertyvalue |
---|
583 | item="<%=item%>" |
---|
584 | property="bioMaterial" |
---|
585 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
586 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
587 | /> |
---|
588 | <base:icon |
---|
589 | visible="<%=editWellPermission%>" |
---|
590 | subclass="link auto-init" |
---|
591 | data-auto-init="item-link" |
---|
592 | data-item-type="BIOWELL" |
---|
593 | data-item-id="<%=itemId %>" |
---|
594 | image="edit.png" |
---|
595 | tooltip="<%=bioMaterial == null ? "Add biomaterial to this well" : "Change the biomaterial in this well"%>" |
---|
596 | /> |
---|
597 | <base:icon |
---|
598 | visible="<%=!editWellPermission%>" |
---|
599 | image="locked.png" |
---|
600 | tooltip="<%=item.hasBeenUsed() ? "This well has already been used" : "This well is locked for modification"%>" |
---|
601 | /> |
---|
602 | </tbl:cell> |
---|
603 | <tbl:cell column="bioMaterial.owner" |
---|
604 | ><base:propertyvalue |
---|
605 | item="<%=bioMaterial%>" |
---|
606 | property="owner" |
---|
607 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
608 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
609 | /></tbl:cell> |
---|
610 | <tbl:cell column="bioMaterial.description"><base:propertyvalue item="<%=bioMaterial%>" property="description"/></tbl:cell> |
---|
611 | <tbl:cell column="bioMaterial.protocol"><base:propertyvalue item="<%=creationEvent%>" property="protocol"/></tbl:cell> |
---|
612 | <tbl:cell column="bioMaterial.entryDate" value="<%=creationEvent == null ? null : creationEvent.getEntryDate() %>" /> |
---|
613 | <tbl:cell column="bioMaterial.eventDate" value="<%=creationEvent == null ? null : creationEvent.getEntryDate() %>" /> |
---|
614 | <tbl:cell column="bioMaterial.externalId"><%=HTML.encodeTags(bioMaterial == null ? null : bioMaterial.getExternalId())%></tbl:cell> |
---|
615 | <tbl:cell column="bioMaterial.originalQuantity" value="<%=bioMaterial == null ? null : bioMaterial.getOriginalQuantity()%>" /> |
---|
616 | <tbl:cell column="bioMaterial.remainingQuantity" value="<%=bioMaterial == null ? null : bioMaterial.getRemainingQuantity()%>" /> |
---|
617 | <tbl:cell column="originalBioMaterial.name"><base:propertyvalue item="<%=item%>" property="originalBioMaterial" /></tbl:cell> |
---|
618 | <% |
---|
619 | if (bioMaterial != null && bioMaterial.isAnnotated()) |
---|
620 | { |
---|
621 | AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, bioMaterial.getAnnotationSet().getId()); |
---|
622 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
623 | { |
---|
624 | if (loader.find(snapshot)) |
---|
625 | { |
---|
626 | %> |
---|
627 | <tbl:cell |
---|
628 | column="<%="at"+loader.getId()%>" |
---|
629 | ><tbl:cellvalue |
---|
630 | list="<%=loader.getValues()%>" |
---|
631 | suffix="<%=loader.getUnitSymbol()%>" |
---|
632 | /></tbl:cell> |
---|
633 | <% |
---|
634 | } |
---|
635 | } |
---|
636 | } |
---|
637 | %> |
---|
638 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
639 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
640 | <tbl:cell column="xt-columns" /> |
---|
641 | </tbl:xt-cells> |
---|
642 | </tbl:row> |
---|
643 | <% |
---|
644 | } |
---|
645 | } |
---|
646 | if (numListed == 0) |
---|
647 | { |
---|
648 | %> |
---|
649 | <tbl:panel subclass="bg-filled-50"> |
---|
650 | <div class="messagecontainer note"> |
---|
651 | <%=biowells == null || biowells.getTotalCount() == 0 ? "No biowells were found" : "No biowells on this page. Please select another page!" %> |
---|
652 | </div> |
---|
653 | </tbl:panel> |
---|
654 | <% |
---|
655 | } |
---|
656 | %> |
---|
657 | </tbl:rows> |
---|
658 | </tbl:data> |
---|
659 | </tbl:table> |
---|
660 | </t:tab> |
---|
661 | |
---|
662 | <t:tab id="events" title="Plate events" /> |
---|
663 | <t:tab id="overview" title="Overview" |
---|
664 | tooltip="Display a tree overview of related items" /> |
---|
665 | <t:tab id="history" title="Change history" |
---|
666 | tooltip="Displays a log of all modifications made to this item" |
---|
667 | visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>" /> |
---|
668 | </t:tabcontrol> |
---|
669 | |
---|
670 | <base:buttongroup subclass="dialogbuttons"> |
---|
671 | <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
672 | <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
673 | <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
674 | </base:buttongroup> |
---|
675 | |
---|
676 | </base:body> |
---|
677 | </base:page> |
---|
678 | <% |
---|
679 | } |
---|
680 | finally |
---|
681 | { |
---|
682 | if (biowells != null) biowells.close(); |
---|
683 | if (dc != null) dc.close(); |
---|
684 | } |
---|
685 | %> |
---|