1 | <%-- $Id: view_bioplate.jsp 6255 2013-03-22 09:50:51Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, 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 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.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.Permission" |
---|
34 | import="net.sf.basedb.core.AnnotationType" |
---|
35 | import="net.sf.basedb.core.AnnotationSet" |
---|
36 | import="net.sf.basedb.core.BioPlate" |
---|
37 | import="net.sf.basedb.core.BioWell" |
---|
38 | import="net.sf.basedb.core.MeasuredBioMaterial" |
---|
39 | import="net.sf.basedb.core.PlateGeometry" |
---|
40 | import="net.sf.basedb.core.User" |
---|
41 | import="net.sf.basedb.core.ItemQuery" |
---|
42 | import="net.sf.basedb.core.Include" |
---|
43 | import="net.sf.basedb.core.ItemResultList" |
---|
44 | import="net.sf.basedb.core.MultiPermissions" |
---|
45 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
46 | import="net.sf.basedb.core.PluginDefinition" |
---|
47 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
48 | import="net.sf.basedb.core.plugin.Plugin" |
---|
49 | import="net.sf.basedb.core.Project" |
---|
50 | import="net.sf.basedb.core.query.Orders" |
---|
51 | import="net.sf.basedb.core.query.Hql" |
---|
52 | import="net.sf.basedb.clients.web.Base" |
---|
53 | import="net.sf.basedb.clients.web.ChangeHistoryUtil" |
---|
54 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
55 | import="net.sf.basedb.clients.web.util.HTML" |
---|
56 | import="net.sf.basedb.util.Values" |
---|
57 | import="net.sf.basedb.util.formatter.Formatter" |
---|
58 | import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
---|
59 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
60 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
61 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
62 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
63 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
64 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
65 | import="java.util.Collections" |
---|
66 | import="java.util.Date" |
---|
67 | import="java.util.Map" |
---|
68 | import="java.util.Set" |
---|
69 | import="java.util.List" |
---|
70 | %> |
---|
71 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
72 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
73 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
74 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
75 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
76 | <%! |
---|
77 | private static final Item itemType = Item.BIOPLATE; |
---|
78 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
79 | %> |
---|
80 | <% |
---|
81 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
82 | final String ID = sc.getId(); |
---|
83 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
84 | final int itemId = cc.getId(); |
---|
85 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
86 | final float scale = Base.getScale(sc); |
---|
87 | final DbControl dc = sc.newDbControl(); |
---|
88 | try |
---|
89 | { |
---|
90 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
91 | |
---|
92 | String title = null; |
---|
93 | BioPlate bioplate = BioPlate.getById(dc, itemId); |
---|
94 | Item bioMaterialType = bioplate.getBioPlateType().getBioMaterialType(); |
---|
95 | PlateGeometry geometry = bioplate.getPlateGeometry(); |
---|
96 | |
---|
97 | final boolean writePermission = bioplate.hasPermission(Permission.WRITE); |
---|
98 | final boolean deletePermission = bioplate.hasPermission(Permission.DELETE); |
---|
99 | final boolean sharePermission = bioplate.hasPermission(Permission.SET_PERMISSION); |
---|
100 | final boolean setOwnerPermission = bioplate.hasPermission(Permission.SET_OWNER); |
---|
101 | final boolean isRemoved = bioplate.isRemoved(); |
---|
102 | final boolean isUsed = isRemoved && bioplate.isUsed(); |
---|
103 | final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
---|
104 | final boolean isOwner = bioplate.isOwner(); |
---|
105 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, bioplate); |
---|
106 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
107 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
108 | %> |
---|
109 | <base:page title="<%=title%>"> |
---|
110 | <base:head scripts="tabcontrol.js,table.js" |
---|
111 | styles="toolbar.css,table.css,headertabcontrol.css,path.css,plate.css"> |
---|
112 | <ext:scripts context="<%=jspContext%>" /> |
---|
113 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
114 | <script> |
---|
115 | function editItem() |
---|
116 | { |
---|
117 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
118 | } |
---|
119 | function shareItem() |
---|
120 | { |
---|
121 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'SharePlate', 600, 400); |
---|
122 | } |
---|
123 | function deleteItem() |
---|
124 | { |
---|
125 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
126 | } |
---|
127 | function restoreItem() |
---|
128 | { |
---|
129 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
130 | } |
---|
131 | function deleteItemPermanently() |
---|
132 | { |
---|
133 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted'); |
---|
134 | } |
---|
135 | function itemDeleted() |
---|
136 | { |
---|
137 | Main.listItems('<%=ID%>', '<%=itemType.name()%>'); |
---|
138 | } |
---|
139 | function showUsingItems() |
---|
140 | { |
---|
141 | Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>); |
---|
142 | } |
---|
143 | function setOwner() |
---|
144 | { |
---|
145 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300); |
---|
146 | } |
---|
147 | function runPlugin(cmd) |
---|
148 | { |
---|
149 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500); |
---|
150 | } |
---|
151 | function viewWells() |
---|
152 | { |
---|
153 | location.href = 'wells/index.jsp?ID=<%=ID%>&bioplate_id=<%=itemId%>'; |
---|
154 | } |
---|
155 | function viewEvents() |
---|
156 | { |
---|
157 | location.href = 'events/index.jsp?ID=<%=ID%>&bioplate_id=<%=itemId%>'; |
---|
158 | } |
---|
159 | function switchTab(tabControlId, tabId) |
---|
160 | { |
---|
161 | if (tabId == 'wells') |
---|
162 | { |
---|
163 | viewWells(); |
---|
164 | } |
---|
165 | else if (tabId == 'events') |
---|
166 | { |
---|
167 | viewEvents(); |
---|
168 | } |
---|
169 | else |
---|
170 | { |
---|
171 | TabControl.setActiveTab(tabControlId, tabId); |
---|
172 | } |
---|
173 | } |
---|
174 | function editWell(wellId) |
---|
175 | { |
---|
176 | Main.viewOrEditItem('<%=ID%>', 'BIOWELL', wellId, true); |
---|
177 | } |
---|
178 | function showWellInfo(evt, coordinate, wellId) |
---|
179 | { |
---|
180 | // Display the 'wellInfo' postit note |
---|
181 | var wellInfo = document.getElementById('wellInfo'); |
---|
182 | var wellTd = document.getElementById('well.' + wellId); |
---|
183 | var pos = Main.getElementPosition(wellTd); |
---|
184 | wellInfo.style.left = (pos.left + pos.width - 5) + 'px'; |
---|
185 | wellInfo.style.top = (pos.top + 10) + 'px'; |
---|
186 | Main.show('wellInfo'); |
---|
187 | |
---|
188 | // Get the well information |
---|
189 | var info = wellInfoCache['well.'+wellId]; |
---|
190 | if (!info) |
---|
191 | { |
---|
192 | // Use Ajax to load the information |
---|
193 | wellInfo.innerHTML = '[' + coordinate + '] loading, please wait...'; |
---|
194 | info = loadWellInfo(wellId); |
---|
195 | } |
---|
196 | var html; |
---|
197 | var bioMaterial = info.bioMaterial; |
---|
198 | if (bioMaterial) |
---|
199 | { |
---|
200 | if (bioMaterial.denied) |
---|
201 | { |
---|
202 | html = 'Denied'; |
---|
203 | } |
---|
204 | else |
---|
205 | { |
---|
206 | var id = bioMaterial.id; |
---|
207 | var type = bioMaterial.type; |
---|
208 | var subtype = bioMaterial.subtype; |
---|
209 | html = Main.linkItem('<%=ID%>', type, id, bioMaterial.editable, bioMaterial.name); |
---|
210 | html += ': <b>' + type + '</b>'; |
---|
211 | if (subtype) html += ' <span class="itemsubtype">[' + subtype.name + ']</span>'; |
---|
212 | html += '<br>'+bioMaterial.description; |
---|
213 | } |
---|
214 | } |
---|
215 | else |
---|
216 | { |
---|
217 | html = 'Empty'; |
---|
218 | } |
---|
219 | wellInfo.innerHTML = html; |
---|
220 | } |
---|
221 | function hideWellInfo() |
---|
222 | { |
---|
223 | Main.hide('wellInfo'); |
---|
224 | } |
---|
225 | var wellInfoCache = new Array(); |
---|
226 | function loadWellInfo(wellId) |
---|
227 | { |
---|
228 | var request = Ajax.getXmlHttpRequest(); |
---|
229 | var url = 'wells/ajax.jsp?ID=<%=ID%>&cmd=WellInfo&encodeStrings=1&item_id=' + wellId; |
---|
230 | request.open("GET", url, false); |
---|
231 | // NOTE! 'false' causes code to wait for the response. aka. 'Synchronous AJAX' or SJAX. |
---|
232 | request.send(null); |
---|
233 | var response = JSON.parse(request.responseText); |
---|
234 | if (response.status != 'ok') |
---|
235 | { |
---|
236 | alert(response.message); |
---|
237 | return false; |
---|
238 | } |
---|
239 | |
---|
240 | wellInfoCache['well.'+wellId] = response; |
---|
241 | return response; |
---|
242 | } |
---|
243 | function viewOrEditWellItem(event, itemType, itemId, editable) |
---|
244 | { |
---|
245 | //Main.viewOrEditItem('<%=ID%>', itemType, itemId, editable); |
---|
246 | Main.itemOnClick(event, '<%=ID%>', itemType, itemId, editable); |
---|
247 | } |
---|
248 | function moveBioMaterial() |
---|
249 | { |
---|
250 | Main.openPopup('index.jsp?ID=<%=ID%>&item_id=<%=itemId%>&cmd=MoveBioMaterial', 'MoveBioMaterial', 900, 600); |
---|
251 | } |
---|
252 | function createChildBioPlate() |
---|
253 | { |
---|
254 | Main.openPopup('index.jsp?ID=<%=ID%>&item_id=<%=itemId%>&cmd=CreateChildBioPlate', 'CreateChildBioPlate', 900, 600); |
---|
255 | } |
---|
256 | </script> |
---|
257 | </base:head> |
---|
258 | <base:body> |
---|
259 | <p:path><p:pathelement |
---|
260 | title="Bioplates" href="<%="index.jsp?ID="+ID%>" /><p:pathelement |
---|
261 | title="<%=HTML.encodeTags(bioplate.getName())%>" /></p:path> |
---|
262 | |
---|
263 | <t:tabcontrol id="main" |
---|
264 | subclass="content mastertabcontrol" |
---|
265 | active="<%=tab%>" switch="switchTab" remember="false"> |
---|
266 | <t:tab id="properties" title="Properties"> |
---|
267 | <div> |
---|
268 | <table class="fullform"> |
---|
269 | <tr> |
---|
270 | <th class="itemstatus"> |
---|
271 | <base:icon |
---|
272 | image="shared.png" |
---|
273 | visible="<%=bioplate.isShared()%>" |
---|
274 | tooltip="This item is shared to other users, groups and/or projects" |
---|
275 | /> |
---|
276 | <base:icon |
---|
277 | image="deleted.png" |
---|
278 | onclick="deleteItemPermanently()" |
---|
279 | tooltip="This item has been flagged for deletion. Click to delete it now." |
---|
280 | enabled="<%=deletePermanentlyPermission %>" |
---|
281 | visible="<%=isRemoved%>" |
---|
282 | /> |
---|
283 | <base:icon image="used.png" |
---|
284 | onclick="showUsingItems()" |
---|
285 | tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" |
---|
286 | visible="<%=isRemoved && isUsed%>" /> |
---|
287 | </th> |
---|
288 | <td style="padding: 0px;"> |
---|
289 | <tbl:toolbar subclass="bottomborder"> |
---|
290 | <tbl:button |
---|
291 | disabled="<%=!writePermission%>" |
---|
292 | image="edit.png" |
---|
293 | onclick="editItem()" |
---|
294 | title="Edit…" |
---|
295 | tooltip="<%=writePermission ? "Edit this bioplate" : "You do not have permission to edit this bioplate"%>" |
---|
296 | /> |
---|
297 | <tbl:button |
---|
298 | disabled="<%=!deletePermission%>" |
---|
299 | image="delete.png" |
---|
300 | onclick="deleteItem()" |
---|
301 | title="Delete" |
---|
302 | visible="<%=!bioplate.isRemoved()%>" |
---|
303 | tooltip="<%=deletePermission ? "Delete this bioplate" : "You do not have permission to delete this bioplate"%>" |
---|
304 | /> |
---|
305 | <tbl:button |
---|
306 | disabled="<%=!writePermission%>" |
---|
307 | image="restore.png" |
---|
308 | onclick="restoreItem()" |
---|
309 | title="Restore" |
---|
310 | visible="<%=bioplate.isRemoved()%>" |
---|
311 | tooltip="<%=writePermission ? "Restore this bioplate" : "You do not have permission to restore this bioplate"%>" |
---|
312 | /> |
---|
313 | <tbl:button |
---|
314 | disabled="<%=!sharePermission%>" |
---|
315 | image="share.png" |
---|
316 | onclick="shareItem()" |
---|
317 | title="Share…" |
---|
318 | tooltip="<%=sharePermission ? "Share this bioplate to other user, groups and projects" : "You do not have permission to share this bioplate"%>" |
---|
319 | /> |
---|
320 | <tbl:button |
---|
321 | disabled="<%=!setOwnerPermission%>" |
---|
322 | image="take_ownership.png" |
---|
323 | onclick="setOwner()" |
---|
324 | title="Set owner…" |
---|
325 | tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" |
---|
326 | /> |
---|
327 | <tbl:button |
---|
328 | image="move_to_plate.png" |
---|
329 | onclick="moveBioMaterial()" |
---|
330 | title="Move biomaterial…" |
---|
331 | tooltip="Move biomaterial on this plate to another plate" |
---|
332 | /> |
---|
333 | <tbl:button |
---|
334 | image="add.png" |
---|
335 | onclick="createChildBioPlate()" |
---|
336 | title="<%="Create child bioplate" + (bioMaterialType == Item.EXTRACT ? "/bioassay" : "") +"…"%>" |
---|
337 | tooltip="Create one or more child biomaterial plates" |
---|
338 | visible="<%=bioMaterialType != null%>" |
---|
339 | /> |
---|
340 | <tbl:button |
---|
341 | image="import.png" |
---|
342 | onclick="runPlugin('ImportItem')" |
---|
343 | title="Import…" |
---|
344 | tooltip="Import data" |
---|
345 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
346 | /> |
---|
347 | <tbl:button |
---|
348 | image="export.png" |
---|
349 | onclick="runPlugin('ExportItem')" |
---|
350 | title="Export…" |
---|
351 | tooltip="Export data" |
---|
352 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
353 | /> |
---|
354 | <tbl:button |
---|
355 | image="runplugin.png" |
---|
356 | onclick="runPlugin('RunPlugin')" |
---|
357 | title="Run plugin…" |
---|
358 | tooltip="Run a plugin" |
---|
359 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
360 | /> |
---|
361 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
362 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
363 | <tbl:button |
---|
364 | image="help.png" |
---|
365 | onclick="<%="Main.openHelp('" + ID +"', 'plate.view.properties')"%>" |
---|
366 | title="Help…" |
---|
367 | tooltip="Get help about this page" |
---|
368 | /> |
---|
369 | </tbl:toolbar> |
---|
370 | </td> |
---|
371 | </tr> |
---|
372 | </table> |
---|
373 | <table style="width: 100%; height: <%=geometry.getRows()*35+20 %>px;" class="bottomborder"> |
---|
374 | <tr style="vertical-align: top;"> |
---|
375 | <td style="width: 50%; height: 100%;"> |
---|
376 | <table class="fullform" > |
---|
377 | <tr> |
---|
378 | <th>Name</th> |
---|
379 | <td><%=HTML.encodeTags(bioplate.getName())%></td> |
---|
380 | </tr> |
---|
381 | <tr> |
---|
382 | <th>Barcode</th> |
---|
383 | <td><%=HTML.encodeTags(bioplate.getBarcode())%></td> |
---|
384 | </tr> |
---|
385 | <tr> |
---|
386 | <th>Created</th> |
---|
387 | <td><%=dateFormatter.format(bioplate.getEventDate())%></td> |
---|
388 | </tr> |
---|
389 | <tr> |
---|
390 | <th>Registered</th> |
---|
391 | <td><%=dateFormatter.format(bioplate.getEntryDate())%></td> |
---|
392 | </tr> |
---|
393 | <tr> |
---|
394 | <th>Destroyed</th> |
---|
395 | <td><%=bioplate.isDestroyed() ? "yes" : "no"%></td> |
---|
396 | </tr> |
---|
397 | <tr> |
---|
398 | <th>Bioplate type</th> |
---|
399 | <td><base:propertyvalue item="<%=bioplate%>" property="bioPlateType" /></td> |
---|
400 | </tr> |
---|
401 | <tr> |
---|
402 | <th>Geometry</th> |
---|
403 | <td><base:propertyvalue item="<%=bioplate%>" property="plateGeometry" /></td> |
---|
404 | </tr> |
---|
405 | <tr> |
---|
406 | <th>Free (total) wells</th> |
---|
407 | <td><%=bioplate.getFreeWells()%> (<%=bioplate.getTotalWells()%>)</td> |
---|
408 | </tr> |
---|
409 | <tr> |
---|
410 | <th>Storage location</th> |
---|
411 | <td><base:propertyvalue item="<%=bioplate%>" property="freezer" /></td> |
---|
412 | </tr> |
---|
413 | <tr> |
---|
414 | <th class="subprompt"></th> |
---|
415 | <td> |
---|
416 | <b>Section</b>: <%=HTML.encodeTags(Values.getString(bioplate.getSection(), "-")) %>; |
---|
417 | <b>Tray</b>: <%=HTML.encodeTags(Values.getString(bioplate.getTray(), "-")) %>; |
---|
418 | <b>Position</b>: <%=HTML.encodeTags(Values.getString(bioplate.getPosition(), "-")) %> |
---|
419 | </td> |
---|
420 | </tr> |
---|
421 | <tr> |
---|
422 | <th>Owner</th> |
---|
423 | <td><base:propertyvalue item="<%=bioplate%>" property="owner" /></td> |
---|
424 | </tr> |
---|
425 | <tr> |
---|
426 | <th>Permissions</th> |
---|
427 | <td><%=PermissionUtil.getFullPermissionNames(bioplate)%></td> |
---|
428 | </tr> |
---|
429 | <tr class="dynamic"> |
---|
430 | <th>Description</th> |
---|
431 | <td><%=HTML.niceFormat(bioplate.getDescription())%></td> |
---|
432 | </tr> |
---|
433 | </table> |
---|
434 | </td> |
---|
435 | <td style="width: 50%; padding: 1em;" onmouseout="hideWellInfo();"> |
---|
436 | <table class="plate" onmouseout="event.cancelBubble=true"> |
---|
437 | <% |
---|
438 | int columns = geometry.getColumns(); |
---|
439 | int rows = geometry.getRows(); |
---|
440 | WellCoordinateFormatter rowF = new WellCoordinateFormatter(true); |
---|
441 | WellCoordinateFormatter colF = new WellCoordinateFormatter(false); |
---|
442 | %> |
---|
443 | <tr><td></td> |
---|
444 | <% |
---|
445 | for (int c = 0; c < columns; ++c) |
---|
446 | { |
---|
447 | %> |
---|
448 | <td class="columnheader"><%=colF.format(c)%></td> |
---|
449 | <% |
---|
450 | } |
---|
451 | %> |
---|
452 | </tr> |
---|
453 | <% |
---|
454 | for (int r = 0; r < rows; ++r) |
---|
455 | { |
---|
456 | String row = rowF.format(r); |
---|
457 | %> |
---|
458 | <tr><td class="rowheader"><%=row%></td> |
---|
459 | <% |
---|
460 | for (int c = 0; c < columns; ++c) |
---|
461 | { |
---|
462 | BioWell well = bioplate.getBioWell(r, c); |
---|
463 | if (well == null) continue; |
---|
464 | boolean isEmpty = well.isEmpty(); |
---|
465 | boolean hasBeenUsed = well.hasBeenUsed(); |
---|
466 | boolean canAddBioMaterial = well.canAddBioMaterial(); |
---|
467 | boolean canClearBioMaterial = well.canClearBioMaterial(); |
---|
468 | boolean usePermission = well.hasPermission(Permission.USE); |
---|
469 | |
---|
470 | boolean deniedBioMaterial = false; |
---|
471 | |
---|
472 | String cls = "well"; |
---|
473 | String tooltip = ""; |
---|
474 | String onClick = null; |
---|
475 | String onMouseOver = "hideWellInfo()"; |
---|
476 | |
---|
477 | if (isEmpty) |
---|
478 | { |
---|
479 | cls += " empty"; |
---|
480 | if (usePermission && canAddBioMaterial) |
---|
481 | { |
---|
482 | // The used is allowed to add biomaterial to the empty well |
---|
483 | cls += " editable"; |
---|
484 | onClick = "editWell(" + well.getId() + ")"; |
---|
485 | tooltip = "Add biomaterial to this well"; |
---|
486 | } |
---|
487 | else if (hasBeenUsed) |
---|
488 | { |
---|
489 | // The well has been used and it is not allowed to add biomaterial |
---|
490 | cls += " wasused"; |
---|
491 | onMouseOver = "showWellInfo(event, '" + row + (c+1) + "', " + well.getId() + ")"; |
---|
492 | tooltip = "This well has already been used"; |
---|
493 | } |
---|
494 | else |
---|
495 | { |
---|
496 | // The user doesn't have permission to add biomaterial |
---|
497 | cls += " locked"; |
---|
498 | tooltip = "You are not allowed to add biomaterial to this well"; |
---|
499 | } |
---|
500 | } |
---|
501 | else |
---|
502 | { |
---|
503 | cls += " used"; |
---|
504 | try |
---|
505 | { |
---|
506 | MeasuredBioMaterial bioMaterial = well.getBioMaterial(); |
---|
507 | onMouseOver = "showWellInfo(event, '" + row + (c+1) + "', " + well.getId() + ")"; |
---|
508 | if (usePermission && canClearBioMaterial && bioMaterial.hasPermission(Permission.WRITE)) |
---|
509 | { |
---|
510 | // The user is allowed to replace/remove the biomaterial in the well |
---|
511 | cls += " editable"; |
---|
512 | onClick = "editWell(" + well.getId() + ")"; |
---|
513 | if (canAddBioMaterial) |
---|
514 | { |
---|
515 | // Replace and/or remove |
---|
516 | tooltip = "Change biomaterial in this well"; |
---|
517 | } |
---|
518 | else |
---|
519 | { |
---|
520 | // Remove only |
---|
521 | tooltip = "Remove the biomaterial from this well"; |
---|
522 | } |
---|
523 | } |
---|
524 | else |
---|
525 | { |
---|
526 | cls += " locked"; |
---|
527 | tooltip = "This well is locked for modifications"; |
---|
528 | } |
---|
529 | } |
---|
530 | catch (PermissionDeniedException ex) |
---|
531 | { |
---|
532 | cls += " denied"; |
---|
533 | tooltip = "Access denied"; |
---|
534 | } |
---|
535 | } |
---|
536 | %> |
---|
537 | <td class="<%=cls%>" id="well.<%=well.getId()%>" |
---|
538 | <%=onClick != null ? "onclick=\"" + onClick + "\"" : ""%> |
---|
539 | <%=onMouseOver != null ? "onmouseover=\"" + onMouseOver + "\"" : ""%> |
---|
540 | title="<%=tooltip%>"></td> |
---|
541 | <% |
---|
542 | } |
---|
543 | %> |
---|
544 | </tr> |
---|
545 | <% |
---|
546 | } |
---|
547 | %> |
---|
548 | </table> |
---|
549 | </td> |
---|
550 | </tr> |
---|
551 | </table> |
---|
552 | </div> |
---|
553 | |
---|
554 | <jsp:include page="../../common/anytoany/list_anytoany.jsp"> |
---|
555 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
556 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
557 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
558 | <jsp:param name="title" value="Other items related to this bioplate" /> |
---|
559 | </jsp:include> |
---|
560 | <jsp:include page="../../common/share/list_share.jsp"> |
---|
561 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
562 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
563 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
564 | <jsp:param name="title" value="Shared to" /> |
---|
565 | </jsp:include> |
---|
566 | </t:tab> |
---|
567 | |
---|
568 | <t:tab id="annotations" title="Annotations" |
---|
569 | tooltip="View annotation values" clazz="white" |
---|
570 | activate="AnnotationsList.loadOnce()"> |
---|
571 | <jsp:include page="../../common/annotations/list_frameset.jsp"> |
---|
572 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
573 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
574 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
575 | </jsp:include> |
---|
576 | </t:tab> |
---|
577 | |
---|
578 | <t:tab id="wells" title="Wells" /> |
---|
579 | <t:tab id="events" title="Plate events" /> |
---|
580 | <t:tab id="overview" title="Overview" |
---|
581 | tooltip="Display a tree overview of related items" |
---|
582 | activate="Overview.loadOnce()"> |
---|
583 | <jsp:include page="../../common/overview/overview.jsp"> |
---|
584 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
585 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
586 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
587 | </jsp:include> |
---|
588 | </t:tab> |
---|
589 | <t:tab id="history" title="Change history" |
---|
590 | tooltip="Displays a log of all modifications made to this item" |
---|
591 | visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>" |
---|
592 | activate="History.loadOnce()"> |
---|
593 | <jsp:include page="../../common/history/frameset.jsp"> |
---|
594 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
595 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
596 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
597 | </jsp:include> |
---|
598 | </t:tab> |
---|
599 | </t:tabcontrol> |
---|
600 | |
---|
601 | <div class="postit" id="wellInfo" style="display:none; width: 20em; min-height: 3em;" onmouseout="event.cancelBubble=true"></div> |
---|
602 | </base:body> |
---|
603 | </base:page> |
---|
604 | <% |
---|
605 | } |
---|
606 | finally |
---|
607 | { |
---|
608 | if (dc != null) dc.close(); |
---|
609 | } |
---|
610 | %> |
---|