1 | <%-- $Id: view_sample.jsp 4882 2009-04-03 10:53:42Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Johan Enell, Jari Hakkinen, Nicklas Nordborg, Martin Svensson |
---|
4 | Copyright (C) 2007 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 session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.SystemItems" |
---|
30 | import="net.sf.basedb.core.Extract" |
---|
31 | import="net.sf.basedb.core.Item" |
---|
32 | import="net.sf.basedb.core.ItemContext" |
---|
33 | import="net.sf.basedb.core.Permission" |
---|
34 | import="net.sf.basedb.core.Sample" |
---|
35 | import="net.sf.basedb.core.BioSource" |
---|
36 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
37 | import="net.sf.basedb.core.BioWell" |
---|
38 | import="net.sf.basedb.core.Protocol" |
---|
39 | import="net.sf.basedb.core.User" |
---|
40 | import="net.sf.basedb.core.Group" |
---|
41 | import="net.sf.basedb.core.ItemProxy" |
---|
42 | import="net.sf.basedb.core.ItemQuery" |
---|
43 | import="net.sf.basedb.core.ItemResultIterator" |
---|
44 | import="net.sf.basedb.core.ItemResultList" |
---|
45 | import="net.sf.basedb.core.Include" |
---|
46 | import="net.sf.basedb.core.MultiPermissions" |
---|
47 | import="net.sf.basedb.core.query.Orders" |
---|
48 | import="net.sf.basedb.core.query.Hql" |
---|
49 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
50 | import="net.sf.basedb.core.PluginDefinition" |
---|
51 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
52 | import="net.sf.basedb.core.plugin.Plugin" |
---|
53 | import="net.sf.basedb.core.Project" |
---|
54 | import="net.sf.basedb.clients.web.Base" |
---|
55 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
56 | import="net.sf.basedb.clients.web.util.HTML" |
---|
57 | import="net.sf.basedb.util.Values" |
---|
58 | import="net.sf.basedb.util.formatter.Formatter" |
---|
59 | import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
---|
60 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
61 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
62 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
63 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
64 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
65 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
66 | import="java.util.ArrayList" |
---|
67 | import="java.util.Collections" |
---|
68 | import="java.util.Date" |
---|
69 | import="java.util.Map" |
---|
70 | import="java.util.Set" |
---|
71 | import="java.util.List" |
---|
72 | %> |
---|
73 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
74 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
75 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
76 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
77 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
78 | <%! |
---|
79 | private static final Item itemType = Item.SAMPLE; |
---|
80 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
81 | %> |
---|
82 | <% |
---|
83 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
84 | final String ID = sc.getId(); |
---|
85 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
86 | final int itemId = cc.getId(); |
---|
87 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
88 | final float scale = Base.getScale(sc); |
---|
89 | final DbControl dc = sc.newDbControl(); |
---|
90 | try |
---|
91 | { |
---|
92 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
93 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
94 | |
---|
95 | WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true); |
---|
96 | WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false); |
---|
97 | |
---|
98 | String title = null; |
---|
99 | Sample sample = Sample.getById(dc, itemId); |
---|
100 | BioMaterialEvent creationEvent = sample.getCreationEvent(); |
---|
101 | |
---|
102 | final boolean usePermission = sample.hasPermission(Permission.USE); |
---|
103 | final boolean writePermission = sample.hasPermission(Permission.WRITE); |
---|
104 | final boolean deletePermission = sample.hasPermission(Permission.DELETE); |
---|
105 | final boolean sharePermission = sample.hasPermission(Permission.SET_PERMISSION); |
---|
106 | final boolean setOwnerPermission = sample.hasPermission(Permission.SET_OWNER); |
---|
107 | final boolean isRemoved = sample.isRemoved(); |
---|
108 | final boolean isUsed = isRemoved && sample.isUsed(); |
---|
109 | final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
---|
110 | final boolean isOwner = sample.isOwner(); |
---|
111 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, sample); |
---|
112 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
113 | %> |
---|
114 | <base:page title="<%=title%>"> |
---|
115 | <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
116 | <ext:scripts context="<%=jspContext%>" /> |
---|
117 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
118 | <script language="JavaScript"> |
---|
119 | function editItem() |
---|
120 | { |
---|
121 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
122 | } |
---|
123 | function shareItem() |
---|
124 | { |
---|
125 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareSample', 600, 400); |
---|
126 | } |
---|
127 | function newExtract() |
---|
128 | { |
---|
129 | Main.viewOrEditItem('<%=ID%>', 'EXTRACT', 0, true, '&sample_id=<%=itemId%>'); |
---|
130 | } |
---|
131 | function deleteItem() |
---|
132 | { |
---|
133 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
134 | } |
---|
135 | function restoreItem() |
---|
136 | { |
---|
137 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
138 | } |
---|
139 | function deleteItemPermanently() |
---|
140 | { |
---|
141 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted'); |
---|
142 | } |
---|
143 | function itemDeleted() |
---|
144 | { |
---|
145 | Main.listItems('<%=ID%>', '<%=itemType.name()%>'); |
---|
146 | } |
---|
147 | function showUsingItems() |
---|
148 | { |
---|
149 | Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>); |
---|
150 | } |
---|
151 | function setOwner() |
---|
152 | { |
---|
153 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150); |
---|
154 | } |
---|
155 | function runPlugin(cmd) |
---|
156 | { |
---|
157 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540); |
---|
158 | } |
---|
159 | function viewEvents() |
---|
160 | { |
---|
161 | location.href = '../events/index.jsp?ID=<%=ID%>&cmd=List&biomaterial_id=<%=itemId%>&biomaterial_type=<%=itemType.name()%>'; |
---|
162 | } |
---|
163 | function switchTab(tabControlId, tabId) |
---|
164 | { |
---|
165 | if (TabControl.isActive(tabControlId, tabId)) return; |
---|
166 | if (tabId == 'overview' && tabId != '<%=tab%>') |
---|
167 | { |
---|
168 | location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId; |
---|
169 | } |
---|
170 | else if (tabId == 'events') |
---|
171 | { |
---|
172 | viewEvents(); |
---|
173 | } |
---|
174 | else |
---|
175 | { |
---|
176 | TabControl.setActiveTab(tabControlId, tabId); |
---|
177 | } |
---|
178 | } |
---|
179 | </script> |
---|
180 | </base:head> |
---|
181 | <base:body> |
---|
182 | <p> |
---|
183 | <p:path> |
---|
184 | <p:pathelement title="Samples" href="<%="index.jsp?ID="+ID%>" /> |
---|
185 | <p:pathelement title="<%=HTML.encodeTags(sample.getName())%>" /> |
---|
186 | </p:path> |
---|
187 | |
---|
188 | <t:tabcontrol id="main" active="<%=tab%>" switch="switchTab" remember="false"> |
---|
189 | <t:tab id="properties" title="Properties"> |
---|
190 | |
---|
191 | <tbl:toolbar |
---|
192 | > |
---|
193 | <tbl:button |
---|
194 | disabled="<%=writePermission ? false : true%>" |
---|
195 | image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" |
---|
196 | onclick="editItem()" |
---|
197 | title="Edit…" |
---|
198 | tooltip="<%=writePermission ? "Edit this sample" : "You do not have permission to edit this sample"%>" |
---|
199 | /> |
---|
200 | <tbl:button |
---|
201 | disabled="<%=deletePermission ? false : true%>" |
---|
202 | image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" |
---|
203 | onclick="deleteItem()" |
---|
204 | title="Delete" |
---|
205 | visible="<%=!sample.isRemoved()%>" |
---|
206 | tooltip="<%=deletePermission ? "Delete this sample" : "You do not have permission to delete this sample"%>" |
---|
207 | /> |
---|
208 | <tbl:button |
---|
209 | disabled="<%=writePermission ? false : true%>" |
---|
210 | image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" |
---|
211 | onclick="restoreItem()" |
---|
212 | title="Restore" |
---|
213 | visible="<%=sample.isRemoved()%>" |
---|
214 | tooltip="<%=writePermission ? "Restore this sample" : "You do not have permission to restore this sample"%>" |
---|
215 | /> |
---|
216 | <tbl:button |
---|
217 | disabled="<%=sharePermission ? false : true%>" |
---|
218 | image="<%=sharePermission ? "share.gif" : "share_disabled.gif"%>" |
---|
219 | onclick="shareItem()" |
---|
220 | title="Share…" |
---|
221 | tooltip="<%=sharePermission ? "Share this sample to other user, groups and projects" : "You do not have permission to share this sample"%>" |
---|
222 | /> |
---|
223 | <tbl:button |
---|
224 | disabled="<%=setOwnerPermission ? false : true%>" |
---|
225 | image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" |
---|
226 | onclick="setOwner()" |
---|
227 | title="Set owner…" |
---|
228 | tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" |
---|
229 | /> |
---|
230 | <tbl:button |
---|
231 | image="add.png" |
---|
232 | onclick="newExtract()" |
---|
233 | title="New extract…" |
---|
234 | tooltip="Create a new extract from this sample" |
---|
235 | visible="<%=sc.hasPermission(Permission.CREATE, Item.EXTRACT) && usePermission%>" |
---|
236 | /> |
---|
237 | <tbl:button |
---|
238 | image="import.gif" |
---|
239 | onclick="runPlugin('ImportItem')" |
---|
240 | title="Import…" |
---|
241 | tooltip="Import data" |
---|
242 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
243 | /> |
---|
244 | <tbl:button |
---|
245 | image="export.gif" |
---|
246 | onclick="runPlugin('ExportItem')" |
---|
247 | title="Export…" |
---|
248 | tooltip="Export data" |
---|
249 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
250 | /> |
---|
251 | <tbl:button |
---|
252 | image="runplugin.gif" |
---|
253 | onclick="runPlugin('RunPlugin')" |
---|
254 | title="Run plugin…" |
---|
255 | tooltip="Run a plugin" |
---|
256 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
257 | /> |
---|
258 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
259 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
260 | <tbl:button |
---|
261 | image="help.gif" |
---|
262 | onclick="<%="Main.openHelp('" + ID +"', 'sample.view.properties')"%>" |
---|
263 | title="Help…" |
---|
264 | tooltip="Get help about this page" |
---|
265 | /> |
---|
266 | </tbl:toolbar> |
---|
267 | <div class="boxedbottom"> |
---|
268 | <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(sample)%></i></div> |
---|
269 | <% |
---|
270 | if (sample.isRemoved() || sample.isShared()) |
---|
271 | { |
---|
272 | %> |
---|
273 | <div class="itemstatus"> |
---|
274 | <base:icon |
---|
275 | image="<%=deletePermanentlyPermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
276 | onclick="<%=deletePermanentlyPermission ? "deleteItemPermanently()" : null%>" |
---|
277 | tooltip="<%=deletePermanentlyPermission ? "Permanently delete this item" : null%>" |
---|
278 | visible="<%=isRemoved%>"> This item has been flagged for deletion<br></base:icon> |
---|
279 | <base:icon image="used.gif" |
---|
280 | onclick="showUsingItems()" |
---|
281 | tooltip="Show the items that are using this one" |
---|
282 | visible="<%=isUsed%>"> This item is used by other items and can't be permanently deleted<br></base:icon> |
---|
283 | <base:icon image="shared.gif" |
---|
284 | visible="<%=sample.isShared()%>"> This item is shared to other users, groups and/or projects</base:icon> |
---|
285 | </div> |
---|
286 | <% |
---|
287 | } |
---|
288 | %> |
---|
289 | <table class="form" cellspacing="0"> |
---|
290 | <tr> |
---|
291 | <td class="prompt">Name</td> |
---|
292 | <td><%=HTML.encodeTags(sample.getName())%></td> |
---|
293 | </tr> |
---|
294 | <tr> |
---|
295 | <td class="prompt">External ID</td> |
---|
296 | <td><%=HTML.encodeTags(sample.getExternalId())%></td> |
---|
297 | </tr> |
---|
298 | <tr> |
---|
299 | <td class="prompt">Created</td> |
---|
300 | <td><%=dateFormatter.format(creationEvent.getEventDate())%></td> |
---|
301 | </tr> |
---|
302 | <tr> |
---|
303 | <td class="prompt">Registered</td> |
---|
304 | <td><%=dateFormatter.format(creationEvent.getEntryDate())%></td> |
---|
305 | </tr> |
---|
306 | <% |
---|
307 | if (!sample.isPooled()) |
---|
308 | { |
---|
309 | %> |
---|
310 | <tr> |
---|
311 | <td class="prompt">Biosource</td> |
---|
312 | <td><base:propertyvalue item="<%=sample%>" property="parent" /></td> |
---|
313 | </tr> |
---|
314 | <% |
---|
315 | } |
---|
316 | %> |
---|
317 | <tr> |
---|
318 | <td class="prompt">Protocol</td> |
---|
319 | <td><base:propertyvalue item="<%=creationEvent%>" property="protocol" /></td> |
---|
320 | </tr> |
---|
321 | <tr> |
---|
322 | <td class="prompt">Original quantity</td> |
---|
323 | <td><%=Values.formatNumber(sample.getOriginalQuantity(), 2, " µg")%></td> |
---|
324 | </tr> |
---|
325 | <tr> |
---|
326 | <td class="prompt">Remaining quantity</td> |
---|
327 | <td><%=Values.formatNumber(sample.getRemainingQuantity(), 2, " µg")%></td> |
---|
328 | </tr> |
---|
329 | <tr> |
---|
330 | <td class="prompt">Bioplate</td> |
---|
331 | <td> |
---|
332 | <base:propertyvalue item="<%=sample%>" property="bioWell.bioPlate" /> |
---|
333 | <% |
---|
334 | try |
---|
335 | { |
---|
336 | if (sample.getBioWell() != null) |
---|
337 | { |
---|
338 | BioWell bw = sample.getBioWell(); |
---|
339 | %> |
---|
340 | [<%=rowFormatter.format(bw.getRow())%>,<%=columnFormatter.format(bw.getColumn())%>] |
---|
341 | <% |
---|
342 | } |
---|
343 | } |
---|
344 | catch (PermissionDeniedException ex) |
---|
345 | {} |
---|
346 | %> |
---|
347 | </td> |
---|
348 | </tr> |
---|
349 | <tr> |
---|
350 | <td class="prompt">Owner</td> |
---|
351 | <td><base:propertyvalue item="<%=sample%>" property="owner" /></td> |
---|
352 | </tr> |
---|
353 | <tr valign="baseline"> |
---|
354 | <td class="prompt">Description</td> |
---|
355 | <td><%=HTML.niceFormat(sample.getDescription())%></td> |
---|
356 | </tr> |
---|
357 | </table> |
---|
358 | |
---|
359 | <% |
---|
360 | if (sample.isPooled()) |
---|
361 | { |
---|
362 | ItemQuery<Sample> samplesQuery = (ItemQuery<Sample>)creationEvent.getSources(); |
---|
363 | samplesQuery.include(Include.ALL); |
---|
364 | samplesQuery.order(Orders.asc(Hql.property("name"))); |
---|
365 | ItemResultList<Sample> samples = samplesQuery.list(dc); |
---|
366 | %> |
---|
367 | <h4 class="docked">Pooled from samples</h4> |
---|
368 | <tbl:table |
---|
369 | id="pooled" |
---|
370 | clazz="itemlist" |
---|
371 | columns="all" |
---|
372 | > |
---|
373 | <tbl:columndef |
---|
374 | id="name" |
---|
375 | title="Name" |
---|
376 | /> |
---|
377 | <tbl:columndef |
---|
378 | id="quantity" |
---|
379 | title="Used quantity (µg)" |
---|
380 | /> |
---|
381 | <tbl:columndef |
---|
382 | id="description" |
---|
383 | title="Description" |
---|
384 | /> |
---|
385 | <tbl:data> |
---|
386 | <tbl:columns> |
---|
387 | </tbl:columns> |
---|
388 | <tbl:rows> |
---|
389 | <% |
---|
390 | for (Sample item : samples) |
---|
391 | { |
---|
392 | %> |
---|
393 | <tbl:row> |
---|
394 | <tbl:cell column="name"><base:icon |
---|
395 | image="deleted.gif" |
---|
396 | tooltip="This item has been scheduled for deletion" |
---|
397 | visible="<%=item.isRemoved()%>" |
---|
398 | /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
399 | <tbl:cell column="quantity"><%=Values.formatNumber(creationEvent.getUsedQuantity(item), 2)%></tbl:cell> |
---|
400 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
401 | </tbl:row> |
---|
402 | <% |
---|
403 | } |
---|
404 | %> |
---|
405 | </tbl:rows> |
---|
406 | </tbl:data> |
---|
407 | </tbl:table> |
---|
408 | <% |
---|
409 | } |
---|
410 | |
---|
411 | // Samples this item is pooled in. |
---|
412 | ItemQuery<BioMaterialEvent> poolingQuery = sample.getPoolingEvents(); |
---|
413 | ItemResultList<BioMaterialEvent> poolingEvents = poolingQuery.list(dc); |
---|
414 | if (poolingEvents.size() == 0) |
---|
415 | { |
---|
416 | %> |
---|
417 | <h4>Pooled in samples</h4> |
---|
418 | No samples have been pooled from this sample |
---|
419 | (or, you don't have permission to view them). |
---|
420 | <% |
---|
421 | } |
---|
422 | else |
---|
423 | { |
---|
424 | %> |
---|
425 | <h4 class="docked">Pooled in samples</h4> |
---|
426 | <tbl:table |
---|
427 | id="poolChilds" |
---|
428 | clazz="itemlist" |
---|
429 | columns="all" |
---|
430 | > |
---|
431 | <tbl:columndef |
---|
432 | id="name" |
---|
433 | title="Name" |
---|
434 | /> |
---|
435 | <tbl:columndef |
---|
436 | id="quantity" |
---|
437 | title="Original quantity (µg)" |
---|
438 | /> |
---|
439 | <tbl:columndef |
---|
440 | id="parents" |
---|
441 | title="Used samples[quantity]" |
---|
442 | /> |
---|
443 | <tbl:columndef |
---|
444 | id="description" |
---|
445 | title="Description" |
---|
446 | /> |
---|
447 | <tbl:data> |
---|
448 | <tbl:columns></tbl:columns> |
---|
449 | <tbl:rows> |
---|
450 | <% |
---|
451 | for (BioMaterialEvent poolingEvt : poolingEvents) |
---|
452 | { |
---|
453 | Sample child = (Sample)poolingEvt.getBioMaterial(); |
---|
454 | ItemQuery<Sample> samplesQuery = (ItemQuery<Sample>)poolingEvt.getSources(); |
---|
455 | samplesQuery.include(Include.ALL); |
---|
456 | samplesQuery.order(Orders.asc(Hql.property("name"))); |
---|
457 | ItemResultList<Sample> parentSamples = samplesQuery.list(dc); |
---|
458 | %> |
---|
459 | <tbl:row> |
---|
460 | <tbl:cell column="name"> |
---|
461 | <base:icon |
---|
462 | image="deleted.gif" |
---|
463 | tooltip="This item has been scheduled for deletion" |
---|
464 | visible="<%=child.isRemoved()%>" |
---|
465 | /> |
---|
466 | <%=Base.getLinkedName(ID, child, false, true)%> |
---|
467 | </tbl:cell> |
---|
468 | <tbl:cell column="quantity"><%=Values.formatNumber(child.getOriginalQuantity(), 2)%></tbl:cell> |
---|
469 | <tbl:cell column="parents"> |
---|
470 | <% |
---|
471 | String separator = ""; |
---|
472 | for (Sample parent : parentSamples) |
---|
473 | { |
---|
474 | out.write(separator); |
---|
475 | if (parent.equals(sample)) |
---|
476 | out.write(HTML.encodeTags(parent.getName())); |
---|
477 | else |
---|
478 | out.write(Base.getLinkedName(ID, parent, false, true)); |
---|
479 | out.write("[" + Values.formatNumber(poolingEvt.getUsedQuantity(parent), 2) + "µg]"); |
---|
480 | separator = ", "; |
---|
481 | } |
---|
482 | %> |
---|
483 | </tbl:cell> |
---|
484 | <tbl:cell column="description"><%=HTML.encodeTags(child.getDescription())%></tbl:cell> |
---|
485 | </tbl:row> |
---|
486 | <% |
---|
487 | } |
---|
488 | %> |
---|
489 | </tbl:rows> |
---|
490 | </tbl:data> |
---|
491 | </tbl:table> |
---|
492 | <% |
---|
493 | } |
---|
494 | |
---|
495 | // Extracts created from this sample |
---|
496 | ItemQuery<Extract> extractQuery = sample.getExtracts(); |
---|
497 | extractQuery.include(Include.ALL); |
---|
498 | extractQuery.order(Orders.asc(Hql.property("name"))); |
---|
499 | ItemResultList<Extract> extracts = extractQuery.list(dc); |
---|
500 | if (extracts.size() == 0) |
---|
501 | { |
---|
502 | %> |
---|
503 | <h4>Extracts</h4> |
---|
504 | No extracts have been created from this sample |
---|
505 | (or, you don't have permission to view them). |
---|
506 | <% |
---|
507 | } |
---|
508 | else |
---|
509 | { |
---|
510 | %> |
---|
511 | <h4 class="docked">Extracts</h4> |
---|
512 | <tbl:table |
---|
513 | id="extracts" |
---|
514 | clazz="itemlist" |
---|
515 | columns="all" |
---|
516 | > |
---|
517 | <tbl:columndef |
---|
518 | id="name" |
---|
519 | title="Name" |
---|
520 | /> |
---|
521 | <tbl:columndef |
---|
522 | id="quantity" |
---|
523 | title="Used quantity (µg)" |
---|
524 | /> |
---|
525 | <tbl:columndef |
---|
526 | id="description" |
---|
527 | title="Description" |
---|
528 | /> |
---|
529 | <tbl:data> |
---|
530 | <tbl:columns></tbl:columns> |
---|
531 | <tbl:rows> |
---|
532 | <% |
---|
533 | for (Extract e : extracts) |
---|
534 | { |
---|
535 | %> |
---|
536 | <tbl:row> |
---|
537 | <tbl:cell column="name"><base:icon |
---|
538 | image="deleted.gif" |
---|
539 | tooltip="This item has been scheduled for deletion" |
---|
540 | visible="<%=e.isRemoved()%>" |
---|
541 | /><%=Base.getLinkedName(ID, e, false, true)%></tbl:cell> |
---|
542 | <tbl:cell column="quantity"><%=Values.formatNumber(e.getCreationEvent().getUsedQuantity(sample), 2)%></tbl:cell> |
---|
543 | <tbl:cell column="description"><%=HTML.encodeTags(e.getDescription())%></tbl:cell> |
---|
544 | </tbl:row> |
---|
545 | <% |
---|
546 | } |
---|
547 | %> |
---|
548 | </tbl:rows> |
---|
549 | </tbl:data> |
---|
550 | </tbl:table> |
---|
551 | <% |
---|
552 | } |
---|
553 | |
---|
554 | // Tables with users/groups/projects that this item is shared to |
---|
555 | MultiPermissions mp = new MultiPermissions(Collections.singleton(sample)); |
---|
556 | ItemResultIterator<User> users = mp.getUsers().iterate(dc); |
---|
557 | ItemResultIterator<Group> groups = mp.getGroups().iterate(dc); |
---|
558 | ItemResultIterator<Project> projects = mp.getProjects().iterate(dc); |
---|
559 | |
---|
560 | if (users.hasNext() || groups.hasNext() || projects.hasNext()) |
---|
561 | { |
---|
562 | %> |
---|
563 | <h4 class="docked">Shared to</h4> |
---|
564 | <tbl:table |
---|
565 | id="itemsSharedTo" |
---|
566 | clazz="itemlist" |
---|
567 | columns="all" |
---|
568 | > |
---|
569 | <tbl:columndef |
---|
570 | id="itemType" |
---|
571 | title="Item type" |
---|
572 | /> |
---|
573 | <tbl:columndef |
---|
574 | id="name" |
---|
575 | title="Name" |
---|
576 | /> |
---|
577 | <tbl:columndef |
---|
578 | id="permissions" |
---|
579 | title="Permissions" |
---|
580 | /> |
---|
581 | <tbl:data> |
---|
582 | <tbl:columns> |
---|
583 | </tbl:columns> |
---|
584 | <tbl:rows> |
---|
585 | <% |
---|
586 | while(projects.hasNext()) |
---|
587 | { |
---|
588 | Project project = projects.next(); |
---|
589 | Set<Permission> permissions = mp.getPermissions(project).values().iterator().next(); |
---|
590 | %> |
---|
591 | <tbl:row> |
---|
592 | <tbl:cell column="itemType"><%=project.getType()%></tbl:cell> |
---|
593 | <tbl:cell column="name"><base:icon |
---|
594 | image="deleted.gif" |
---|
595 | tooltip="This item has been scheduled for deletion" |
---|
596 | visible="<%=project.isRemoved()%>" |
---|
597 | /><%=Base.getLinkedName(ID, project, false, true)%></tbl:cell> |
---|
598 | <tbl:cell column="permissions"> |
---|
599 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
600 | </tbl:cell> |
---|
601 | </tbl:row> |
---|
602 | <% |
---|
603 | } |
---|
604 | while(groups.hasNext()) |
---|
605 | { |
---|
606 | Group group = groups.next(); |
---|
607 | Set<Permission> permissions = mp.getPermissions(group).values().iterator().next(); |
---|
608 | %> |
---|
609 | <tbl:row> |
---|
610 | <tbl:cell column="itemType"><%=group.getType()%></tbl:cell> |
---|
611 | <tbl:cell column="name"><base:icon |
---|
612 | image="deleted.gif" |
---|
613 | tooltip="This item has been scheduled for deletion" |
---|
614 | visible="<%=group.isRemoved()%>" |
---|
615 | /><%=Base.getLinkedName(ID, group, false, true)%></tbl:cell> |
---|
616 | <tbl:cell column="permissions"> |
---|
617 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
618 | </tbl:cell> |
---|
619 | </tbl:row> |
---|
620 | <% |
---|
621 | } |
---|
622 | while (users.hasNext()) |
---|
623 | { |
---|
624 | User user = users.next(); |
---|
625 | Set<Permission> permissions = mp.getPermissions(user).values().iterator().next(); |
---|
626 | %> |
---|
627 | <tbl:row> |
---|
628 | <tbl:cell column="itemType"><%=user.getType()%></tbl:cell> |
---|
629 | <tbl:cell column="name"><base:icon |
---|
630 | image="deleted.gif" |
---|
631 | tooltip="This item has been scheduled for deletion" |
---|
632 | visible="<%=user.isRemoved()%>" |
---|
633 | /><%=Base.getLinkedName(ID, user, false, true)%></tbl:cell> |
---|
634 | <tbl:cell column="permissions"> |
---|
635 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
636 | </tbl:cell> |
---|
637 | </tbl:row> |
---|
638 | <% |
---|
639 | } |
---|
640 | %> |
---|
641 | </tbl:rows> |
---|
642 | </tbl:data> |
---|
643 | </tbl:table> |
---|
644 | <% |
---|
645 | } |
---|
646 | else |
---|
647 | { |
---|
648 | %> |
---|
649 | <h4>Shared to</h4> |
---|
650 | This sample is not shared |
---|
651 | (or, you don't have permission to view the ones it is shared to). |
---|
652 | <% |
---|
653 | } |
---|
654 | %> |
---|
655 | </div> |
---|
656 | </t:tab> |
---|
657 | |
---|
658 | <t:tab id="annotations" title="Annotations & parameters" |
---|
659 | tooltip="View annotation values and protocol parameters"> |
---|
660 | <div class="boxed"> |
---|
661 | <jsp:include page="../../common/annotations/list_annotations.jsp"> |
---|
662 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
663 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
664 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
665 | </jsp:include> |
---|
666 | </div> |
---|
667 | </t:tab> |
---|
668 | <t:tab id="events" title="Events" /> |
---|
669 | <t:tab id="overview" title="Overview" |
---|
670 | tooltip="Display a tree overview of related items"> |
---|
671 | <% |
---|
672 | if ("overview".equals(tab)) |
---|
673 | { |
---|
674 | %> |
---|
675 | <jsp:include page="../../common/overview/overview.jsp"> |
---|
676 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
677 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
678 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
679 | </jsp:include> |
---|
680 | <% |
---|
681 | } |
---|
682 | %> |
---|
683 | </t:tab> |
---|
684 | </t:tabcontrol> |
---|
685 | |
---|
686 | </base:body> |
---|
687 | </base:page> |
---|
688 | <% |
---|
689 | } |
---|
690 | finally |
---|
691 | { |
---|
692 | if (dc != null) dc.close(); |
---|
693 | } |
---|
694 | |
---|
695 | %> |
---|