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