1 | <%-- $Id: list_bioplates.jsp 5674 2011-06-27 12:29:52Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
---|
4 | Copyright (C) 2007 Johan Enell, Martin Svensson |
---|
5 | |
---|
6 | This file is part of BASE - BioArray Software Environment. |
---|
7 | Available at http://base.thep.lu.se/ |
---|
8 | |
---|
9 | BASE is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License |
---|
11 | as published by the Free Software Foundation; either version 3 |
---|
12 | of the License, or (at your option) any later version. |
---|
13 | |
---|
14 | BASE is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ------------------------------------------------------------------ |
---|
22 | |
---|
23 | @author Nicklas |
---|
24 | @version 2.0 |
---|
25 | --%> |
---|
26 | <%@ page pageEncoding="UTF-8" session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.Item" |
---|
30 | import="net.sf.basedb.core.AnnotationType" |
---|
31 | import="net.sf.basedb.core.AnnotationSet" |
---|
32 | import="net.sf.basedb.core.Annotation" |
---|
33 | import="net.sf.basedb.core.BioPlate" |
---|
34 | import="net.sf.basedb.core.PlateGeometry" |
---|
35 | import="net.sf.basedb.core.BioWell" |
---|
36 | import="net.sf.basedb.core.ItemQuery" |
---|
37 | import="net.sf.basedb.core.Include" |
---|
38 | import="net.sf.basedb.core.Type" |
---|
39 | import="net.sf.basedb.core.ItemResultIterator" |
---|
40 | import="net.sf.basedb.core.ItemResultList" |
---|
41 | import="net.sf.basedb.core.ItemContext" |
---|
42 | import="net.sf.basedb.core.Nameable" |
---|
43 | import="net.sf.basedb.core.Permission" |
---|
44 | import="net.sf.basedb.core.PluginDefinition" |
---|
45 | import="net.sf.basedb.core.Metadata" |
---|
46 | import="net.sf.basedb.core.Metadata.PropertyPath" |
---|
47 | import="net.sf.basedb.core.query.Hql" |
---|
48 | import="net.sf.basedb.core.query.Restrictions" |
---|
49 | import="net.sf.basedb.core.query.Expressions" |
---|
50 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
51 | import="net.sf.basedb.core.plugin.Plugin" |
---|
52 | import="net.sf.basedb.core.query.Orders" |
---|
53 | import="net.sf.basedb.core.query.Hql" |
---|
54 | import="net.sf.basedb.util.Enumeration" |
---|
55 | import="net.sf.basedb.util.ShareableUtil" |
---|
56 | import="net.sf.basedb.clients.web.Base" |
---|
57 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
58 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
59 | import="net.sf.basedb.clients.web.util.HTML" |
---|
60 | import="net.sf.basedb.util.formatter.Formatter" |
---|
61 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
62 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
63 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
64 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
65 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
66 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
67 | import="net.sf.basedb.util.Values" |
---|
68 | import="java.util.Iterator" |
---|
69 | import="java.util.List" |
---|
70 | import="java.util.Map" |
---|
71 | %> |
---|
72 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
73 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
74 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
75 | <%! |
---|
76 | private static final Item itemType = Item.BIOPLATE; |
---|
77 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
78 | |
---|
79 | private static Enumeration<String, String> bioMaterialTypes = new Enumeration<String, String>(); |
---|
80 | static |
---|
81 | { |
---|
82 | bioMaterialTypes.add("", "-any-"); |
---|
83 | bioMaterialTypes.add(Integer.toString(Item.SAMPLE.getValue()), Item.SAMPLE.toString()); |
---|
84 | bioMaterialTypes.add(Integer.toString(Item.EXTRACT.getValue()), Item.EXTRACT.toString()); |
---|
85 | } |
---|
86 | %> |
---|
87 | <% |
---|
88 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
89 | final String ID = sc.getId(); |
---|
90 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
91 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
92 | |
---|
93 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
94 | final String callback = request.getParameter("callback"); |
---|
95 | final String title = mode.generateTitle("bioplate", "bioplates"); |
---|
96 | final DbControl dc = sc.newDbControl(); |
---|
97 | ItemResultIterator<BioPlate> bioplates = null; |
---|
98 | ItemResultList<AnnotationType> annotationTypes = null; |
---|
99 | try |
---|
100 | { |
---|
101 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
102 | |
---|
103 | final ItemQuery<PlateGeometry> geometryQuery = PlateGeometry.getQuery(); |
---|
104 | geometryQuery.order(Orders.asc(Hql.property("name"))); |
---|
105 | geometryQuery.setCacheResult(true); |
---|
106 | |
---|
107 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
108 | annotationTypes = annotationTypeQuery.list(dc); |
---|
109 | try |
---|
110 | { |
---|
111 | final ItemQuery<BioPlate> query = Base.getConfiguredQuery(dc, cc, true, BioPlate.getQuery(), mode); |
---|
112 | bioplates = query.iterate(dc); |
---|
113 | } |
---|
114 | catch (Throwable t) |
---|
115 | { |
---|
116 | cc.setMessage(t.getMessage()); |
---|
117 | t.printStackTrace(); |
---|
118 | } |
---|
119 | int numListed = 0; |
---|
120 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
121 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
122 | %> |
---|
123 | <base:page title="<%=title==null ? "Bioplates" : title%>" type="<%=mode.getPageType()%>"> |
---|
124 | <base:head scripts="menu.js,table.js" styles="menu.css,table.css"> |
---|
125 | <ext:scripts context="<%=jspContext%>" /> |
---|
126 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
127 | <script language="JavaScript"> |
---|
128 | var submitPage = 'index.jsp'; |
---|
129 | var formId = 'bioplates'; |
---|
130 | function newItem() |
---|
131 | { |
---|
132 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true); |
---|
133 | } |
---|
134 | function editItem(itemId) |
---|
135 | { |
---|
136 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true); |
---|
137 | } |
---|
138 | function viewItem(itemId) |
---|
139 | { |
---|
140 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
141 | } |
---|
142 | function itemOnClick(evt, itemId) |
---|
143 | { |
---|
144 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected); |
---|
145 | } |
---|
146 | function deleteItems() |
---|
147 | { |
---|
148 | var frm = document.forms[formId]; |
---|
149 | if (Forms.numChecked(frm) == 0) |
---|
150 | { |
---|
151 | alert('Please select at least one item in the list'); |
---|
152 | return; |
---|
153 | } |
---|
154 | frm.action = submitPage; |
---|
155 | frm.cmd.value = 'DeleteItems'; |
---|
156 | frm.submit(); |
---|
157 | } |
---|
158 | function restoreItems() |
---|
159 | { |
---|
160 | var frm = document.forms[formId]; |
---|
161 | if (Forms.numChecked(frm) == 0) |
---|
162 | { |
---|
163 | alert('Please select at least one item in the list'); |
---|
164 | return; |
---|
165 | } |
---|
166 | frm.action = submitPage; |
---|
167 | frm.cmd.value = 'RestoreItems'; |
---|
168 | frm.submit(); |
---|
169 | } |
---|
170 | function deleteItemPermanently(itemId) |
---|
171 | { |
---|
172 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId); |
---|
173 | } |
---|
174 | function setOwner() |
---|
175 | { |
---|
176 | Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems'); |
---|
177 | } |
---|
178 | function shareItem(itemId) |
---|
179 | { |
---|
180 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareBioPlates', 600, 400); |
---|
181 | } |
---|
182 | function shareItems() |
---|
183 | { |
---|
184 | Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems'); |
---|
185 | } |
---|
186 | function configureColumns() |
---|
187 | { |
---|
188 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
189 | } |
---|
190 | function runPlugin(cmd) |
---|
191 | { |
---|
192 | Table.submitToPopup(formId, cmd, 740, 540); |
---|
193 | } |
---|
194 | function returnSelected() |
---|
195 | { |
---|
196 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
197 | window.close(); |
---|
198 | } |
---|
199 | function presetOnChange() |
---|
200 | { |
---|
201 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
202 | } |
---|
203 | </script> |
---|
204 | </base:head> |
---|
205 | <base:body> |
---|
206 | <% |
---|
207 | if (cc.getMessage() != null) |
---|
208 | { |
---|
209 | %> |
---|
210 | <div class="error"><%=cc.getMessage()%></div> |
---|
211 | <% |
---|
212 | cc.setMessage(null); |
---|
213 | } |
---|
214 | %> |
---|
215 | <tbl:table |
---|
216 | id="bioplates" |
---|
217 | clazz="itemlist" |
---|
218 | columns="<%=cc.getSetting("columns")%>" |
---|
219 | sortby="<%=cc.getSortProperty()%>" |
---|
220 | direction="<%=cc.getSortDirection()%>" |
---|
221 | title="<%=title%>" |
---|
222 | action="index.jsp" |
---|
223 | sc="<%=sc%>" |
---|
224 | item="<%=itemType%>" |
---|
225 | > |
---|
226 | <tbl:hidden |
---|
227 | name="mode" |
---|
228 | value="<%=mode.getName()%>" |
---|
229 | /> |
---|
230 | <tbl:hidden |
---|
231 | name="callback" |
---|
232 | value="<%=callback%>" |
---|
233 | skip="<%=callback == null%>" |
---|
234 | /> |
---|
235 | <tbl:columndef |
---|
236 | id="name" |
---|
237 | property="name" |
---|
238 | datatype="string" |
---|
239 | title="Name" |
---|
240 | sortable="true" |
---|
241 | filterable="true" |
---|
242 | exportable="true" |
---|
243 | show="always" |
---|
244 | /> |
---|
245 | <tbl:columndef |
---|
246 | id="id" |
---|
247 | clazz="uniquecol" |
---|
248 | property="id" |
---|
249 | datatype="int" |
---|
250 | title="ID" |
---|
251 | sortable="true" |
---|
252 | filterable="true" |
---|
253 | exportable="true" |
---|
254 | /> |
---|
255 | <tbl:columndef |
---|
256 | id="barcode" |
---|
257 | property="barcode" |
---|
258 | datatype="string" |
---|
259 | title="Barcode" |
---|
260 | sortable="true" |
---|
261 | filterable="true" |
---|
262 | exportable="true" |
---|
263 | /> |
---|
264 | <tbl:columndef |
---|
265 | id="destroyed" |
---|
266 | property="destroyed" |
---|
267 | datatype="boolean" |
---|
268 | title="Destroyed" |
---|
269 | sortable="true" |
---|
270 | filterable="true" |
---|
271 | exportable="true" |
---|
272 | /> |
---|
273 | <tbl:columndef |
---|
274 | id="freeWells" |
---|
275 | title="Free (total) wells" |
---|
276 | /> |
---|
277 | <% |
---|
278 | Enumeration<String, String> geometries = new Enumeration<String, String>(); |
---|
279 | ItemResultList<PlateGeometry> plateGeometries = geometryQuery.list(dc); |
---|
280 | for (PlateGeometry pg : plateGeometries) |
---|
281 | { |
---|
282 | geometries.add(Integer.toString(pg.getId()), HTML.encodeTags(pg.getName())); |
---|
283 | } |
---|
284 | %> |
---|
285 | <tbl:columndef |
---|
286 | id="plateGeometry" |
---|
287 | property="plateGeometry" |
---|
288 | sortproperty="plateGeometry.name" |
---|
289 | exportproperty="plateGeometry.name" |
---|
290 | datatype="int" |
---|
291 | enumeration="<%=geometries%>" |
---|
292 | title="Geometry" |
---|
293 | sortable="true" |
---|
294 | filterable="true" |
---|
295 | exportable="true" |
---|
296 | /> |
---|
297 | <tbl:columndef |
---|
298 | id="freezer" |
---|
299 | property="freezer.name" |
---|
300 | datatype="string" |
---|
301 | title="Freezer" |
---|
302 | sortable="true" |
---|
303 | filterable="true" |
---|
304 | exportable="true" |
---|
305 | /> |
---|
306 | <tbl:columndef |
---|
307 | id="bioPlateType" |
---|
308 | property="bioPlateType.name" |
---|
309 | datatype="string" |
---|
310 | title="Bio plate type" |
---|
311 | sortable="true" |
---|
312 | filterable="true" |
---|
313 | exportable="true" |
---|
314 | /> |
---|
315 | <tbl:columndef |
---|
316 | id="bioMaterialType" |
---|
317 | property="bioPlateType.bioMaterialType" |
---|
318 | title="Biomaterial type" |
---|
319 | datatype="int" |
---|
320 | sortable="true" |
---|
321 | filterable="true" |
---|
322 | exportable="true" |
---|
323 | enumeration="<%=bioMaterialTypes%>" |
---|
324 | /> |
---|
325 | <tbl:columndef |
---|
326 | id="owner" |
---|
327 | property="owner.name" |
---|
328 | datatype="string" |
---|
329 | title="Owner" |
---|
330 | sortable="true" |
---|
331 | filterable="true" |
---|
332 | exportable="true" |
---|
333 | /> |
---|
334 | <tbl:columndef |
---|
335 | id="description" |
---|
336 | property="description" |
---|
337 | datatype="string" |
---|
338 | title="Description" |
---|
339 | sortable="true" |
---|
340 | filterable="true" |
---|
341 | exportable="true" |
---|
342 | /> |
---|
343 | <% |
---|
344 | for (AnnotationType at : annotationTypes) |
---|
345 | { |
---|
346 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
347 | Enumeration<String, String> annotationEnum = null; |
---|
348 | if (at.isEnumeration()) |
---|
349 | { |
---|
350 | annotationEnum = new Enumeration<String, String>(); |
---|
351 | List<?> values = at.getValues(); |
---|
352 | for (Object value : values) |
---|
353 | { |
---|
354 | String encoded = formatter.format(value); |
---|
355 | annotationEnum.add(encoded, encoded); |
---|
356 | } |
---|
357 | } |
---|
358 | %> |
---|
359 | <tbl:columndef |
---|
360 | id="<%="at"+at.getId()%>" |
---|
361 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
362 | property="<%="#"+at.getId()%>" |
---|
363 | annotation="true" |
---|
364 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
365 | enumeration="<%=annotationEnum%>" |
---|
366 | smartenum="<%=at.getDisplayAsList() %>" |
---|
367 | sortable="false" |
---|
368 | filterable="true" |
---|
369 | exportable="true" |
---|
370 | formatter="<%=formatter%>" |
---|
371 | unit="<%=at.getDefaultUnit()%>" |
---|
372 | /> |
---|
373 | <% |
---|
374 | } |
---|
375 | %> |
---|
376 | <tbl:columndef |
---|
377 | id="permission" |
---|
378 | title="Permission" |
---|
379 | /> |
---|
380 | <tbl:columndef |
---|
381 | id="sharedTo" |
---|
382 | title="Shared to" |
---|
383 | filterable="true" |
---|
384 | filterproperty="!sharedTo.name" |
---|
385 | datatype="string" |
---|
386 | /> |
---|
387 | <tbl:toolbar |
---|
388 | visible="<%=mode.hasToolbar()%>" |
---|
389 | > |
---|
390 | <tbl:button |
---|
391 | disabled="<%=createPermission ? false : true%>" |
---|
392 | image="<%=createPermission ? "new.gif" : "new_disabled.gif"%>" |
---|
393 | onclick="newItem()" |
---|
394 | title="New…" |
---|
395 | tooltip="<%=createPermission ? "Create new bioplate" : "You do not have permission to create bioplate"%>" |
---|
396 | /> |
---|
397 | <tbl:button |
---|
398 | image="delete.gif" |
---|
399 | onclick="deleteItems()" |
---|
400 | title="Delete" |
---|
401 | tooltip="Delete the selected items" |
---|
402 | /> |
---|
403 | <tbl:button |
---|
404 | image="restore.gif" |
---|
405 | onclick="restoreItems()" |
---|
406 | title="Restore" |
---|
407 | tooltip="Restore the selected (deleted) items" |
---|
408 | /> |
---|
409 | <tbl:button |
---|
410 | image="share.gif" |
---|
411 | onclick="shareItems()" |
---|
412 | title="Share…" |
---|
413 | tooltip="Share the selected items" |
---|
414 | /> |
---|
415 | <tbl:button |
---|
416 | image="take_ownership.png" |
---|
417 | onclick="setOwner()" |
---|
418 | title="Set owner…" |
---|
419 | tooltip="Change owner of the selected items" |
---|
420 | /> |
---|
421 | <tbl:button |
---|
422 | image="columns.gif" |
---|
423 | onclick="configureColumns()" |
---|
424 | title="Columns…" |
---|
425 | tooltip="Show, hide and re-order columns" |
---|
426 | /> |
---|
427 | <tbl:button |
---|
428 | image="import.gif" |
---|
429 | onclick="runPlugin('ImportItems')" |
---|
430 | title="Import…" |
---|
431 | tooltip="Import data" |
---|
432 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
433 | /> |
---|
434 | <tbl:button |
---|
435 | image="export.gif" |
---|
436 | onclick="runPlugin('ExportItems')" |
---|
437 | title="Export…" |
---|
438 | tooltip="Export data" |
---|
439 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
440 | /> |
---|
441 | <tbl:button |
---|
442 | image="runplugin.gif" |
---|
443 | onclick="runPlugin('RunListPlugin')" |
---|
444 | title="Run plugin…" |
---|
445 | tooltip="Run a plugin" |
---|
446 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
447 | /> |
---|
448 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
449 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
450 | </tbl:toolbar> |
---|
451 | <tbl:navigator |
---|
452 | page="<%=cc.getPage()%>" |
---|
453 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
454 | totalrows="<%=bioplates == null ? 0 : bioplates.getTotalCount()%>" |
---|
455 | visible="<%=mode.hasNavigator()%>" |
---|
456 | /> |
---|
457 | <tbl:data> |
---|
458 | <tbl:columns> |
---|
459 | <tbl:presetselector |
---|
460 | clazz="columnheader" |
---|
461 | colspan="3" |
---|
462 | onchange="presetOnChange()" |
---|
463 | /> |
---|
464 | </tbl:columns> |
---|
465 | |
---|
466 | <tr> |
---|
467 | <tbl:header |
---|
468 | clazz="index" |
---|
469 | > </tbl:header> |
---|
470 | <tbl:header |
---|
471 | clazz="check" |
---|
472 | visible="<%=mode.hasCheck()%>" |
---|
473 | ><base:icon |
---|
474 | image="check_uncheck.gif" |
---|
475 | tooltip="Check/uncheck all" |
---|
476 | onclick="Forms.checkUncheck(document.forms[formId])" style="align: left;" |
---|
477 | /></tbl:header> |
---|
478 | <tbl:header |
---|
479 | clazz="check" |
---|
480 | visible="<%=mode.hasRadio()%>" |
---|
481 | > </tbl:header> |
---|
482 | <tbl:header |
---|
483 | clazz="icons" |
---|
484 | visible="<%=mode.hasIcons()%>" |
---|
485 | > </tbl:header> |
---|
486 | <tbl:propertyfilter /> |
---|
487 | </tr> |
---|
488 | |
---|
489 | <tbl:rows> |
---|
490 | <% |
---|
491 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
492 | int selectedItemId = cc.getId(); |
---|
493 | if (bioplates != null) |
---|
494 | { |
---|
495 | PropertyPath<BioPlate, Integer> bmType = |
---|
496 | Metadata.getInstance(BioPlate.class).getPropertyPath("bioPlateType.bioMaterialType", false); |
---|
497 | while (bioplates.hasNext()) |
---|
498 | { |
---|
499 | BioPlate item = bioplates.next(); |
---|
500 | int itemId = item.getId(); |
---|
501 | String openSharePopup = "shareItem("+itemId+")"; |
---|
502 | String deletePermanently = "deleteItemPermanently("+itemId+")"; |
---|
503 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
504 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
505 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
506 | String tooltip = mode.isSelectionMode() ? |
---|
507 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
508 | String name = HTML.encodeTags(item.getName()); |
---|
509 | index++; |
---|
510 | numListed++; |
---|
511 | %> |
---|
512 | <tbl:row> |
---|
513 | <tbl:header |
---|
514 | clazz="index" |
---|
515 | ><%=index%></tbl:header> |
---|
516 | <tbl:header |
---|
517 | clazz="check" |
---|
518 | visible="<%=mode.hasCheck()%>" |
---|
519 | ><input |
---|
520 | type="checkbox" |
---|
521 | name="<%=itemId%>" |
---|
522 | value="<%=itemId%>" |
---|
523 | title="<%=name%>" |
---|
524 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
525 | ></tbl:header> |
---|
526 | <tbl:header |
---|
527 | clazz="check" |
---|
528 | visible="<%=mode.hasRadio()%>" |
---|
529 | ><input |
---|
530 | type="radio" |
---|
531 | name="item_id" |
---|
532 | value="<%=itemId%>" |
---|
533 | title="<%=name%>" |
---|
534 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
535 | ></tbl:header> |
---|
536 | <tbl:header |
---|
537 | clazz="icons" |
---|
538 | visible="<%=mode.hasIcons()%>" |
---|
539 | ><base:icon |
---|
540 | image="<%=deletePermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
541 | onclick="<%=deletePermission ? deletePermanently : null%>" |
---|
542 | tooltip="This item has been scheduled for deletion" |
---|
543 | visible="<%=item.isRemoved()%>" |
---|
544 | /><base:icon |
---|
545 | image="<%=sharePermission ? "shared.gif" : "shared_disabled.gif"%>" |
---|
546 | onclick="<%=sharePermission ? openSharePopup : null%>" |
---|
547 | tooltip="This item is shared to other users, groups and/or projects" |
---|
548 | visible="<%=item.isShared()%>" |
---|
549 | /> </tbl:header> |
---|
550 | <tbl:cell column="name"><div class="link" |
---|
551 | onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" |
---|
552 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
553 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
554 | <tbl:cell column="barcode"><%=HTML.encodeTags(item.getBarcode())%></tbl:cell> |
---|
555 | <tbl:cell column="destroyed"><%=item.isDestroyed()%></tbl:cell> |
---|
556 | <tbl:cell column="freeWells"><%=item.getFreeWells()%> (<%=item.getTotalWells()%>)</tbl:cell> |
---|
557 | <tbl:cell column="owner" |
---|
558 | ><base:propertyvalue |
---|
559 | item="<%=item%>" |
---|
560 | property="owner" |
---|
561 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
562 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
563 | /></tbl:cell> |
---|
564 | <tbl:cell column="plateGeometry" |
---|
565 | ><base:propertyvalue |
---|
566 | item="<%=item%>" |
---|
567 | property="plateGeometry" |
---|
568 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
569 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
570 | /></tbl:cell> |
---|
571 | <tbl:cell column="freezer"> |
---|
572 | <base:propertyvalue |
---|
573 | item="<%=item%>" |
---|
574 | property="freezer" |
---|
575 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
576 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
577 | /> |
---|
578 | </tbl:cell> |
---|
579 | <tbl:cell column="bioPlateType"> |
---|
580 | <base:propertyvalue |
---|
581 | item="<%=item%>" |
---|
582 | property="bioPlateType" |
---|
583 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
584 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
585 | /> |
---|
586 | </tbl:cell> |
---|
587 | <tbl:cell column="bioMaterialType"><% |
---|
588 | Integer i = bmType.getValue(dc, item); |
---|
589 | %><%=i == null ? "<i>- any -</i>" : Item.fromValue(i).toString() %></tbl:cell> |
---|
590 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
591 | <% |
---|
592 | AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; |
---|
593 | if (as != null) |
---|
594 | { |
---|
595 | for (AnnotationType at : annotationTypes) |
---|
596 | { |
---|
597 | if (as.hasAnnotation(at)) |
---|
598 | { |
---|
599 | Annotation a = as.getAnnotation(at); |
---|
600 | String suffix = a.getUnitSymbol(null); |
---|
601 | if (suffix != null) suffix = " " + suffix; |
---|
602 | %> |
---|
603 | <tbl:cell |
---|
604 | column="<%="at"+at.getId()%>" |
---|
605 | ><tbl:cellvalue |
---|
606 | list="<%=a.getValues(null)%>" |
---|
607 | suffix="<%=suffix%>" |
---|
608 | /></tbl:cell> |
---|
609 | <% |
---|
610 | } |
---|
611 | } |
---|
612 | } |
---|
613 | %> |
---|
614 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
615 | <tbl:cell column="sharedTo"> |
---|
616 | <% |
---|
617 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
618 | while(sharees.hasNext()) |
---|
619 | { |
---|
620 | Nameable n = sharees.next(); |
---|
621 | if (mode.hasPropertyLink()) |
---|
622 | { |
---|
623 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
624 | } |
---|
625 | else |
---|
626 | { |
---|
627 | out.write(HTML.encodeTags(n.getName())); |
---|
628 | } |
---|
629 | out.write(sharees.hasNext() ? ", " : ""); |
---|
630 | } |
---|
631 | %> |
---|
632 | </tbl:cell> |
---|
633 | </tbl:row> |
---|
634 | <% |
---|
635 | } |
---|
636 | } |
---|
637 | %> |
---|
638 | </tbl:rows> |
---|
639 | </tbl:data> |
---|
640 | <% |
---|
641 | if (numListed == 0) |
---|
642 | { |
---|
643 | %> |
---|
644 | <tbl:panel><%=bioplates == null || bioplates.getTotalCount() == 0 ? "No plates were found" : "No plates on this page. Please select another page!" %></tbl:panel> |
---|
645 | <% |
---|
646 | } |
---|
647 | else |
---|
648 | { |
---|
649 | %> |
---|
650 | <tbl:navigator |
---|
651 | page="<%=cc.getPage()%>" |
---|
652 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
653 | totalrows="<%=bioplates == null ? 0 : bioplates.getTotalCount()%>" |
---|
654 | visible="<%=mode.hasNavigator()%>" |
---|
655 | locked="true" |
---|
656 | /> |
---|
657 | <% |
---|
658 | } |
---|
659 | %> |
---|
660 | </tbl:table> |
---|
661 | <base:buttongroup align="center" clazz="fixedatbottom"> |
---|
662 | <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
663 | <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
664 | <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
665 | </base:buttongroup> |
---|
666 | <br><br><br> |
---|
667 | </base:body> |
---|
668 | </base:page> |
---|
669 | <% |
---|
670 | } |
---|
671 | finally |
---|
672 | { |
---|
673 | if (bioplates != null) bioplates.close(); |
---|
674 | if (dc != null) dc.close(); |
---|
675 | } |
---|
676 | %> |
---|