1 | <%-- $Id: list_labeledextracts.jsp 4882 2009-04-03 10:53:42Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Hakkinen, 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 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.LabeledExtract" |
---|
31 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
32 | import="net.sf.basedb.core.BioPlate" |
---|
33 | import="net.sf.basedb.core.BioWell" |
---|
34 | import="net.sf.basedb.core.Extract" |
---|
35 | import="net.sf.basedb.core.AnnotationType" |
---|
36 | import="net.sf.basedb.core.AnnotationSet" |
---|
37 | import="net.sf.basedb.core.Annotation" |
---|
38 | import="net.sf.basedb.core.Quantity" |
---|
39 | import="net.sf.basedb.core.Unit" |
---|
40 | import="net.sf.basedb.core.Hybridization" |
---|
41 | import="net.sf.basedb.core.ItemQuery" |
---|
42 | import="net.sf.basedb.core.Include" |
---|
43 | import="net.sf.basedb.core.ItemResultIterator" |
---|
44 | import="net.sf.basedb.core.ItemResultList" |
---|
45 | import="net.sf.basedb.core.ItemContext" |
---|
46 | import="net.sf.basedb.core.Nameable" |
---|
47 | import="net.sf.basedb.core.Permission" |
---|
48 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
49 | import="net.sf.basedb.core.PlateGeometry" |
---|
50 | import="net.sf.basedb.core.PluginDefinition" |
---|
51 | import="net.sf.basedb.core.query.Hql" |
---|
52 | import="net.sf.basedb.core.query.Orders" |
---|
53 | import="net.sf.basedb.core.query.Restrictions" |
---|
54 | import="net.sf.basedb.core.query.Expressions" |
---|
55 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
56 | import="net.sf.basedb.core.plugin.Plugin" |
---|
57 | import="net.sf.basedb.core.Type" |
---|
58 | import="net.sf.basedb.util.Enumeration" |
---|
59 | import="net.sf.basedb.util.ShareableUtil" |
---|
60 | import="net.sf.basedb.util.units.UnitUtil" |
---|
61 | import="net.sf.basedb.clients.web.Base" |
---|
62 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
63 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
64 | import="net.sf.basedb.clients.web.util.HTML" |
---|
65 | import="net.sf.basedb.util.formatter.Formatter" |
---|
66 | import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
---|
67 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
68 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
69 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
70 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
71 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
72 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
73 | import="net.sf.basedb.util.Values" |
---|
74 | import="java.util.Iterator" |
---|
75 | import="java.util.List" |
---|
76 | import="java.util.Map" |
---|
77 | import="java.util.Date" |
---|
78 | %> |
---|
79 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
80 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
81 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
82 | <%! |
---|
83 | private static final Item itemType = Item.LABELEDEXTRACT; |
---|
84 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
85 | %> |
---|
86 | <% |
---|
87 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
88 | final String ID = sc.getId(); |
---|
89 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
90 | final boolean createHybridizationPermission = sc.hasPermission(Permission.CREATE, Item.HYBRIDIZATION); |
---|
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("labeled extract", "labeled extracts"); |
---|
96 | final DbControl dc = sc.newDbControl(); |
---|
97 | ItemResultIterator<LabeledExtract> labeledExtracts = null; |
---|
98 | ItemResultList<AnnotationType> annotationTypes = null; |
---|
99 | try |
---|
100 | { |
---|
101 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
102 | |
---|
103 | Unit microGram = UnitUtil.getUnit(dc, Quantity.MASS, "µg"); |
---|
104 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
105 | annotationTypes = annotationTypeQuery.list(dc); |
---|
106 | try |
---|
107 | { |
---|
108 | final ItemQuery<LabeledExtract> query = Base.getConfiguredQuery(dc, cc, true, LabeledExtract.getQuery(), mode); |
---|
109 | labeledExtracts = query.iterate(dc); |
---|
110 | } |
---|
111 | catch (Throwable t) |
---|
112 | { |
---|
113 | cc.setMessage(t.getMessage()); |
---|
114 | t.printStackTrace(); |
---|
115 | } |
---|
116 | int numListed = 0; |
---|
117 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
118 | WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true); |
---|
119 | WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false); |
---|
120 | |
---|
121 | Enumeration<String, String> wellRows = new Enumeration<String, String>(); |
---|
122 | ItemQuery<PlateGeometry> geometryQuery = PlateGeometry.getQuery(); |
---|
123 | geometryQuery.order(Orders.desc(Hql.property("rows"))); |
---|
124 | ItemResultIterator<PlateGeometry> result = geometryQuery.iterate(dc); |
---|
125 | int maxRows = result.next().getRows(); |
---|
126 | for (int r = 0; r < maxRows; r++) |
---|
127 | { |
---|
128 | wellRows.add(Integer.toString(r), rowFormatter.format(r)); |
---|
129 | } |
---|
130 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
131 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
132 | %> |
---|
133 | <base:page title="<%=title==null ? "Labeled extract" : title%>" type="<%=mode.getPageType()%>"> |
---|
134 | <base:head scripts="menu.js,table.js" styles="menu.css,table.css"> |
---|
135 | <ext:scripts context="<%=jspContext%>" /> |
---|
136 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
137 | <script language="JavaScript"> |
---|
138 | var submitPage = 'index.jsp'; |
---|
139 | var formId = 'labeledextracts'; |
---|
140 | function newItem() |
---|
141 | { |
---|
142 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true); |
---|
143 | } |
---|
144 | function newPooledItem() |
---|
145 | { |
---|
146 | Table.poolItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'NewPooledItem'); |
---|
147 | } |
---|
148 | function newHybridization() |
---|
149 | { |
---|
150 | Table.poolItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'NewHybridization'); |
---|
151 | } |
---|
152 | function editItem(itemId) |
---|
153 | { |
---|
154 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true); |
---|
155 | } |
---|
156 | function viewItem(itemId) |
---|
157 | { |
---|
158 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
159 | } |
---|
160 | function itemOnClick(evt, itemId) |
---|
161 | { |
---|
162 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected); |
---|
163 | } |
---|
164 | function deleteItems() |
---|
165 | { |
---|
166 | var frm = document.forms[formId]; |
---|
167 | if (Forms.numChecked(frm) == 0) |
---|
168 | { |
---|
169 | alert('Please select at least one item in the list'); |
---|
170 | return; |
---|
171 | } |
---|
172 | frm.action = submitPage; |
---|
173 | frm.cmd.value = 'DeleteItems'; |
---|
174 | frm.submit(); |
---|
175 | } |
---|
176 | function restoreItems() |
---|
177 | { |
---|
178 | var frm = document.forms[formId]; |
---|
179 | if (Forms.numChecked(frm) == 0) |
---|
180 | { |
---|
181 | alert('Please select at least one item in the list'); |
---|
182 | return; |
---|
183 | } |
---|
184 | frm.action = submitPage; |
---|
185 | frm.cmd.value = 'RestoreItems'; |
---|
186 | frm.submit(); |
---|
187 | } |
---|
188 | function deleteItemPermanently(itemId) |
---|
189 | { |
---|
190 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId); |
---|
191 | } |
---|
192 | function setOwner() |
---|
193 | { |
---|
194 | Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems'); |
---|
195 | } |
---|
196 | function shareItem(itemId) |
---|
197 | { |
---|
198 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareLabeledExtracts', 600, 400); |
---|
199 | } |
---|
200 | function shareItems() |
---|
201 | { |
---|
202 | Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems'); |
---|
203 | } |
---|
204 | function configureColumns() |
---|
205 | { |
---|
206 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
207 | } |
---|
208 | function runPlugin(cmd) |
---|
209 | { |
---|
210 | Table.submitToPopup(formId, cmd, 740, 540); |
---|
211 | } |
---|
212 | function returnSelected() |
---|
213 | { |
---|
214 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
215 | window.close(); |
---|
216 | } |
---|
217 | function presetOnChange() |
---|
218 | { |
---|
219 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
220 | } |
---|
221 | function newBioMaterialList() |
---|
222 | { |
---|
223 | var controller = Main.getController('BIOMATERIALLIST'); |
---|
224 | Table.submitToPopup(formId, 'CreateBioMaterialList', controller.width, controller.height); |
---|
225 | } |
---|
226 | </script> |
---|
227 | </base:head> |
---|
228 | |
---|
229 | <base:body> |
---|
230 | <% |
---|
231 | if (cc.getMessage() != null) |
---|
232 | { |
---|
233 | %> |
---|
234 | <div class="error"><%=cc.getMessage()%></div> |
---|
235 | <% |
---|
236 | cc.setMessage(null); |
---|
237 | } |
---|
238 | %> |
---|
239 | <tbl:table |
---|
240 | id="labeledextracts" |
---|
241 | clazz="itemlist" |
---|
242 | columns="<%=cc.getSetting("columns")%>" |
---|
243 | sortby="<%=cc.getSortProperty()%>" |
---|
244 | direction="<%=cc.getSortDirection()%>" |
---|
245 | title="<%=title%>" |
---|
246 | action="index.jsp" |
---|
247 | sc="<%=sc%>" |
---|
248 | item="<%=itemType%>" |
---|
249 | > |
---|
250 | <tbl:hidden |
---|
251 | name="mode" |
---|
252 | value="<%=mode.getName()%>" |
---|
253 | /> |
---|
254 | <tbl:hidden |
---|
255 | name="callback" |
---|
256 | value="<%=callback%>" |
---|
257 | skip="<%=callback == null%>" |
---|
258 | /> |
---|
259 | <tbl:columndef |
---|
260 | id="name" |
---|
261 | property="name" |
---|
262 | datatype="string" |
---|
263 | title="Name" |
---|
264 | sortable="true" |
---|
265 | filterable="true" |
---|
266 | exportable="true" |
---|
267 | show="always" |
---|
268 | /> |
---|
269 | <tbl:columndef |
---|
270 | id="id" |
---|
271 | clazz="uniquecol" |
---|
272 | property="id" |
---|
273 | datatype="int" |
---|
274 | title="ID" |
---|
275 | sortable="true" |
---|
276 | filterable="true" |
---|
277 | exportable="true" |
---|
278 | /> |
---|
279 | <tbl:columndef |
---|
280 | id="label" |
---|
281 | property="label" |
---|
282 | sortproperty="label.name" |
---|
283 | filterproperty="label.name" |
---|
284 | exportproperty="label.name" |
---|
285 | datatype="string" |
---|
286 | title="Label" |
---|
287 | sortable="true" |
---|
288 | filterable="true" |
---|
289 | exportable="true" |
---|
290 | /> |
---|
291 | <tbl:columndef |
---|
292 | id="externalId" |
---|
293 | property="externalId" |
---|
294 | datatype="string" |
---|
295 | title="External id" |
---|
296 | sortable="true" |
---|
297 | filterable="true" |
---|
298 | exportable="true" |
---|
299 | /> |
---|
300 | <tbl:columndef |
---|
301 | id="originalQuantity" |
---|
302 | property="originalQuantity" |
---|
303 | datatype="float" |
---|
304 | title="Original quantity (µg)" |
---|
305 | sortable="true" |
---|
306 | filterable="true" |
---|
307 | exportable="true" |
---|
308 | unit="<%=microGram%>" |
---|
309 | /> |
---|
310 | <tbl:columndef |
---|
311 | id="remainingQuantity" |
---|
312 | property="remainingQuantity" |
---|
313 | datatype="float" |
---|
314 | title="Remaining quantity (µg)" |
---|
315 | sortable="true" |
---|
316 | filterable="true" |
---|
317 | exportable="true" |
---|
318 | unit="<%=microGram%>" |
---|
319 | /> |
---|
320 | <tbl:columndef |
---|
321 | id="protocol" |
---|
322 | property="creationEvent.protocol" |
---|
323 | sortproperty="creationEvent.protocol.name" |
---|
324 | filterproperty="creationEvent.protocol.name" |
---|
325 | exportproperty="creationEvent.protocol.name" |
---|
326 | datatype="string" |
---|
327 | title="Protocol" |
---|
328 | sortable="true" |
---|
329 | filterable="true" |
---|
330 | exportable="true" |
---|
331 | /> |
---|
332 | <tbl:columndef |
---|
333 | id="eventDate" |
---|
334 | property="creationEvent.eventDate" |
---|
335 | datatype="date" |
---|
336 | title="Created" |
---|
337 | sortable="true" |
---|
338 | filterable="true" |
---|
339 | exportable="true" |
---|
340 | formatter="<%=dateFormatter%>" |
---|
341 | /> |
---|
342 | <tbl:columndef |
---|
343 | id="entryDate" |
---|
344 | property="creationEvent.entryDate" |
---|
345 | datatype="date" |
---|
346 | title="Registered" |
---|
347 | sortable="true" |
---|
348 | filterable="true" |
---|
349 | exportable="true" |
---|
350 | formatter="<%=dateFormatter%>" |
---|
351 | /> |
---|
352 | <tbl:columndef |
---|
353 | id="pooled" |
---|
354 | property="pooled" |
---|
355 | datatype="boolean" |
---|
356 | title="Pooled" |
---|
357 | sortable="true" |
---|
358 | filterable="true" |
---|
359 | exportable="true" |
---|
360 | /> |
---|
361 | <tbl:columndef |
---|
362 | id="parents" |
---|
363 | title="Parents" |
---|
364 | property="&creationEvent.sourceBioMaterials(name)" |
---|
365 | datatype="string" |
---|
366 | filterable="true" |
---|
367 | /> |
---|
368 | <tbl:columndef |
---|
369 | id="hybridizations" |
---|
370 | title="Hybridizations" |
---|
371 | property="&sourceEvents(event.hybridization.name)" |
---|
372 | datatype="string" |
---|
373 | filterable="true" |
---|
374 | /> |
---|
375 | <tbl:columndef |
---|
376 | id="bioPlate" |
---|
377 | property="bioWell.bioPlate.name" |
---|
378 | sortproperty="bioWell.bioPlate.name" |
---|
379 | filterproperty="bioWell.bioPlate.name" |
---|
380 | exportproperty="bioWell.bioPlate.name" |
---|
381 | datatype="string" |
---|
382 | title="Bioplate" |
---|
383 | sortable="true" |
---|
384 | filterable="true" |
---|
385 | exportable="true" |
---|
386 | /> |
---|
387 | <tbl:columndef |
---|
388 | id="bioWellRow" |
---|
389 | property="bioWell.row" |
---|
390 | sortproperty="bioWell.row" |
---|
391 | datatype="int" |
---|
392 | title="Biowell row" |
---|
393 | filterable="true" |
---|
394 | enumeration="<%=wellRows%>" |
---|
395 | exportable="true" |
---|
396 | sortable="true" |
---|
397 | formatter="<%=rowFormatter%>" |
---|
398 | /> |
---|
399 | <tbl:columndef |
---|
400 | id="bioWellColumn" |
---|
401 | property="bioWell.column" |
---|
402 | sortproperty="bioWell.column" |
---|
403 | datatype="int" |
---|
404 | title="Biowell column" |
---|
405 | filterable="true" |
---|
406 | exportable="true" |
---|
407 | sortable="true" |
---|
408 | formatter="<%=columnFormatter%>" |
---|
409 | /> |
---|
410 | <tbl:columndef |
---|
411 | id="owner" |
---|
412 | property="owner.name" |
---|
413 | datatype="string" |
---|
414 | title="Owner" |
---|
415 | sortable="true" |
---|
416 | filterable="true" |
---|
417 | exportable="true" |
---|
418 | /> |
---|
419 | <tbl:columndef |
---|
420 | id="description" |
---|
421 | property="description" |
---|
422 | datatype="string" |
---|
423 | title="Description" |
---|
424 | sortable="true" |
---|
425 | filterable="true" |
---|
426 | exportable="true" |
---|
427 | /> |
---|
428 | <tbl:columndef |
---|
429 | id="bioMaterialList" |
---|
430 | property="@bioMaterialLists" |
---|
431 | datatype="int" |
---|
432 | title="Biomaterial list" |
---|
433 | filterable="true" |
---|
434 | enumeration="<%=Base.getBioMaterialListsEnum(dc, itemType, cc.getInclude())%>" |
---|
435 | multiple="false" |
---|
436 | /> |
---|
437 | <% |
---|
438 | for (AnnotationType at : annotationTypes) |
---|
439 | { |
---|
440 | Enumeration<String, String> annotationEnum = null; |
---|
441 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
442 | if (at.isEnumeration()) |
---|
443 | { |
---|
444 | annotationEnum = new Enumeration<String, String>(); |
---|
445 | List<?> values = at.getValues(); |
---|
446 | for (Object value : values) |
---|
447 | { |
---|
448 | String encoded = formatter.format(value); |
---|
449 | annotationEnum.add(encoded, encoded); |
---|
450 | } |
---|
451 | } |
---|
452 | %> |
---|
453 | <tbl:columndef |
---|
454 | id="<%="at"+at.getId()%>" |
---|
455 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
456 | property="<%="#"+at.getId()%>" |
---|
457 | annotation="true" |
---|
458 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
459 | enumeration="<%=annotationEnum%>" |
---|
460 | sortable="false" |
---|
461 | filterable="true" |
---|
462 | exportable="true" |
---|
463 | formatter="<%=formatter%>" |
---|
464 | unit="<%=at.getDefaultUnit()%>" |
---|
465 | /> |
---|
466 | <% |
---|
467 | } |
---|
468 | %> |
---|
469 | <tbl:columndef |
---|
470 | id="permission" |
---|
471 | title="Permission" |
---|
472 | /> |
---|
473 | <tbl:columndef |
---|
474 | id="sharedTo" |
---|
475 | title="Shared to" |
---|
476 | /> |
---|
477 | <tbl:toolbar |
---|
478 | visible="<%=mode.hasToolbar()%>" |
---|
479 | > |
---|
480 | <tbl:button |
---|
481 | disabled="<%=createPermission ? false : true%>" |
---|
482 | image="<%=createPermission ? "new.gif" : "new_disabled.gif"%>" |
---|
483 | onclick="newItem()" |
---|
484 | title="New…" |
---|
485 | tooltip="<%=createPermission ? "Create new labeled extract" : "You do not have permission to create labeled extracts"%>" |
---|
486 | /> |
---|
487 | <tbl:button |
---|
488 | disabled="<%=createPermission ? false : true%>" |
---|
489 | image="<%=createPermission ? "new_pooled.gif" : "new_pooled_disabled.gif"%>" |
---|
490 | onclick="newPooledItem()" |
---|
491 | title="Pool…" |
---|
492 | tooltip="<%=createPermission ? "Create new pooled labeled extract" : "You do not have permission to create labeled extracts"%>" |
---|
493 | /> |
---|
494 | <tbl:button |
---|
495 | disabled="<%=createHybridizationPermission ? false : true%>" |
---|
496 | image="<%=createHybridizationPermission ? "add.png" : "add_disabled.png"%>" |
---|
497 | onclick="newHybridization()" |
---|
498 | title="New hybridzation…" |
---|
499 | tooltip="<%=createHybridizationPermission ? "Create new hybridization with the selected labeled extract" : "You do not have permission to create hybridizations"%>" |
---|
500 | /> |
---|
501 | <tbl:button |
---|
502 | image="delete.gif" |
---|
503 | onclick="deleteItems()" |
---|
504 | title="Delete" |
---|
505 | tooltip="Delete the selected items" |
---|
506 | /> |
---|
507 | <tbl:button |
---|
508 | image="restore.gif" |
---|
509 | onclick="restoreItems()" |
---|
510 | title="Restore" |
---|
511 | tooltip="Restore the selected (deleted) items" |
---|
512 | /> |
---|
513 | <tbl:button |
---|
514 | image="share.gif" |
---|
515 | onclick="shareItems()" |
---|
516 | title="Share…" |
---|
517 | tooltip="Share the selected items" |
---|
518 | /> |
---|
519 | <tbl:button |
---|
520 | image="take_ownership.png" |
---|
521 | onclick="setOwner()" |
---|
522 | title="Set owner…" |
---|
523 | tooltip="Change owner of the selected items" |
---|
524 | /> |
---|
525 | <tbl:button |
---|
526 | image="columns.gif" |
---|
527 | onclick="configureColumns()" |
---|
528 | title="Columns…" |
---|
529 | tooltip="Show, hide and re-order columns" |
---|
530 | /> |
---|
531 | <tbl:button |
---|
532 | image="add.png" |
---|
533 | onclick="newBioMaterialList()" |
---|
534 | title="New biomaterial list…" |
---|
535 | tooltip="Create a new biomaterial list from matching labeled extracts" |
---|
536 | visible="<%=sc.hasPermission(Permission.CREATE, Item.BIOMATERIALLIST)%>" |
---|
537 | /> |
---|
538 | <tbl:button |
---|
539 | image="import.gif" |
---|
540 | onclick="runPlugin('ImportItems')" |
---|
541 | title="Import…" |
---|
542 | tooltip="Import data" |
---|
543 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
544 | /> |
---|
545 | <tbl:button |
---|
546 | image="export.gif" |
---|
547 | onclick="runPlugin('ExportItems')" |
---|
548 | title="Export…" |
---|
549 | tooltip="Export data" |
---|
550 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
551 | /> |
---|
552 | <tbl:button |
---|
553 | image="runplugin.gif" |
---|
554 | onclick="runPlugin('RunListPlugin')" |
---|
555 | title="Run plugin…" |
---|
556 | tooltip="Run a plugin" |
---|
557 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
558 | /> |
---|
559 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
560 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
561 | </tbl:toolbar> |
---|
562 | <tbl:navigator |
---|
563 | page="<%=cc.getPage()%>" |
---|
564 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
565 | totalrows="<%=labeledExtracts == null ? 0 : labeledExtracts.getTotalCount()%>" |
---|
566 | visible="<%=mode.hasNavigator()%>" |
---|
567 | /> |
---|
568 | <tbl:data> |
---|
569 | <tbl:columns> |
---|
570 | <tbl:presetselector |
---|
571 | clazz="columnheader" |
---|
572 | colspan="3" |
---|
573 | onchange="presetOnChange()" |
---|
574 | /> |
---|
575 | </tbl:columns> |
---|
576 | |
---|
577 | <tr> |
---|
578 | <tbl:header |
---|
579 | clazz="index" |
---|
580 | > </tbl:header> |
---|
581 | <tbl:header |
---|
582 | clazz="check" |
---|
583 | visible="<%=mode.hasCheck()%>" |
---|
584 | ><base:icon |
---|
585 | image="check_uncheck.gif" |
---|
586 | tooltip="Check/uncheck all" |
---|
587 | onclick="Forms.checkUncheck(document.forms[formId])" style="align: left;" |
---|
588 | /></tbl:header> |
---|
589 | <tbl:header |
---|
590 | clazz="check" |
---|
591 | visible="<%=mode.hasRadio()%>" |
---|
592 | > </tbl:header> |
---|
593 | <tbl:header |
---|
594 | clazz="icons" |
---|
595 | visible="<%=mode.hasIcons()%>" |
---|
596 | > </tbl:header> |
---|
597 | <tbl:propertyfilter /> |
---|
598 | </tr> |
---|
599 | |
---|
600 | <tbl:rows> |
---|
601 | <% |
---|
602 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
603 | int selectedItemId = cc.getId(); |
---|
604 | if (labeledExtracts != null) |
---|
605 | { |
---|
606 | while (labeledExtracts.hasNext()) |
---|
607 | { |
---|
608 | LabeledExtract item = labeledExtracts.next(); |
---|
609 | BioMaterialEvent creationEvent = item.getCreationEvent(); |
---|
610 | int itemId = item.getId(); |
---|
611 | String openSharePopup = "shareItem("+itemId+")"; |
---|
612 | String deletePermanently = "deleteItemPermanently("+itemId+")"; |
---|
613 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
614 | boolean usePermission = item.hasPermission(Permission.USE); |
---|
615 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
616 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
617 | String tooltip = mode.isSelectionMode() ? |
---|
618 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
619 | String name = HTML.encodeTags(item.getName()); |
---|
620 | index++; |
---|
621 | numListed++; |
---|
622 | %> |
---|
623 | <tbl:row> |
---|
624 | <tbl:header |
---|
625 | clazz="index" |
---|
626 | ><%=index%></tbl:header> |
---|
627 | <tbl:header |
---|
628 | clazz="check" |
---|
629 | visible="<%=mode.hasCheck()%>" |
---|
630 | ><input |
---|
631 | type="checkbox" |
---|
632 | name="<%=itemId%>" |
---|
633 | value="<%=itemId%>" |
---|
634 | title="<%=name%>" |
---|
635 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
636 | ></tbl:header> |
---|
637 | <tbl:header |
---|
638 | clazz="check" |
---|
639 | visible="<%=mode.hasRadio()%>" |
---|
640 | ><input |
---|
641 | type="radio" |
---|
642 | name="item_id" |
---|
643 | value="<%=itemId%>" |
---|
644 | title="<%=name%>" |
---|
645 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
646 | ></tbl:header> |
---|
647 | <tbl:header |
---|
648 | clazz="icons" |
---|
649 | visible="<%=mode.hasIcons()%>" |
---|
650 | ><base:icon |
---|
651 | image="<%=deletePermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
652 | onclick="<%=deletePermission ? deletePermanently : null%>" |
---|
653 | tooltip="This item has been scheduled for deletion" |
---|
654 | visible="<%=item.isRemoved()%>" |
---|
655 | /><base:icon |
---|
656 | image="<%=sharePermission ? "shared.gif" : "shared_disabled.gif"%>" |
---|
657 | onclick="<%=sharePermission ? openSharePopup : null%>" |
---|
658 | tooltip="This item is shared to other users, groups and/or projects" |
---|
659 | visible="<%=item.isShared()%>" |
---|
660 | /> </tbl:header> |
---|
661 | <tbl:cell column="name"><div class="link" |
---|
662 | onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" |
---|
663 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
664 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
665 | <tbl:cell column="label" |
---|
666 | ><base:propertyvalue |
---|
667 | item="<%=item%>" |
---|
668 | property="label" |
---|
669 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
670 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
671 | /></tbl:cell> |
---|
672 | <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell> |
---|
673 | <tbl:cell column="originalQuantity"><%=Values.formatNumber(item.getOriginalQuantity(), 2)%></tbl:cell> |
---|
674 | <tbl:cell column="remainingQuantity"><%=Values.formatNumber(item.getRemainingQuantity(), 2)%></tbl:cell> |
---|
675 | <tbl:cell column="pooled"><%=item.isPooled()%></tbl:cell> |
---|
676 | <tbl:cell column="protocol" |
---|
677 | ><base:propertyvalue |
---|
678 | item="<%=creationEvent%>" |
---|
679 | property="protocol" |
---|
680 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
681 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
682 | /></tbl:cell> |
---|
683 | <tbl:cell column="eventDate" value="<%=creationEvent.getEventDate()%>" /> |
---|
684 | <tbl:cell column="entryDate" value="<%=creationEvent.getEntryDate()%>" /> |
---|
685 | <tbl:cell column="parents"> |
---|
686 | <% |
---|
687 | if (!item.isPooled()) |
---|
688 | { |
---|
689 | %> |
---|
690 | <base:propertyvalue item="<%=item%>" property="parent"/> |
---|
691 | <% |
---|
692 | } |
---|
693 | else |
---|
694 | { |
---|
695 | String separator = ""; |
---|
696 | ItemQuery<LabeledExtract> parentQuery = (ItemQuery<LabeledExtract>)item.getCreationEvent().getSources(); |
---|
697 | parentQuery.include(Include.MINE, Include.OTHERS, Include.IN_PROJECT, Include.SHARED); |
---|
698 | parentQuery.order(Orders.asc(Hql.property("name"))); |
---|
699 | |
---|
700 | for (LabeledExtract e : parentQuery.list(dc)) |
---|
701 | { |
---|
702 | out.write(separator); |
---|
703 | if (mode.hasPropertyLink()) |
---|
704 | { |
---|
705 | out.write(Base.getLinkedName(ID, e, false, mode.hasEditLink())); |
---|
706 | } |
---|
707 | else |
---|
708 | { |
---|
709 | out.write(HTML.encodeTags(e.getName())); |
---|
710 | } |
---|
711 | separator = ", "; |
---|
712 | } |
---|
713 | } |
---|
714 | %></tbl:cell> |
---|
715 | <tbl:cell column="hybridizations"> |
---|
716 | <% |
---|
717 | try |
---|
718 | { |
---|
719 | ItemQuery<Hybridization> hybridizationQuery = item.getHybridizations(); |
---|
720 | hybridizationQuery.include(cc.getInclude()); |
---|
721 | hybridizationQuery.order(Orders.asc(Hql.property("name"))); |
---|
722 | String separator = ""; |
---|
723 | for (Hybridization h : hybridizationQuery.list(dc)) |
---|
724 | { |
---|
725 | out.write(separator); |
---|
726 | if (mode.hasPropertyLink()) |
---|
727 | { |
---|
728 | out.write(Base.getLinkedName(ID, h, false, mode.hasEditLink())); |
---|
729 | } |
---|
730 | else |
---|
731 | { |
---|
732 | out.write(HTML.encodeTags(h.getName())); |
---|
733 | } |
---|
734 | separator = ", "; |
---|
735 | } |
---|
736 | } |
---|
737 | catch (Throwable t) |
---|
738 | { |
---|
739 | %> |
---|
740 | <div class="error"><%=t.getMessage()%></div> |
---|
741 | <% |
---|
742 | } |
---|
743 | %> |
---|
744 | </tbl:cell> |
---|
745 | <% |
---|
746 | BioWell well = null; |
---|
747 | boolean readBioWell = true; |
---|
748 | try |
---|
749 | { |
---|
750 | well = item.getBioWell(); |
---|
751 | } |
---|
752 | catch(PermissionDeniedException e) |
---|
753 | { |
---|
754 | readBioWell = false; |
---|
755 | } |
---|
756 | if (!readBioWell) |
---|
757 | { |
---|
758 | %> |
---|
759 | <tbl:cell column="bioWellRow"><i>- denied -</i> </tbl:cell> |
---|
760 | <tbl:cell column="bioWellColumn"><i>- denied -</i> </tbl:cell> |
---|
761 | <tbl:cell column="bioPlate"><i>- denied -</i> </tbl:cell> |
---|
762 | <% |
---|
763 | } |
---|
764 | else if (well == null) |
---|
765 | { |
---|
766 | %> |
---|
767 | <tbl:cell column="bioWellRow"><i>- none -</i> </tbl:cell> |
---|
768 | <tbl:cell column="bioWellColumn"><i>- none -</i> </tbl:cell> |
---|
769 | <tbl:cell column="bioPlate"><i>- none -</i> </tbl:cell> |
---|
770 | <% |
---|
771 | |
---|
772 | } |
---|
773 | else |
---|
774 | { |
---|
775 | %> |
---|
776 | <tbl:cell column="bioWellRow"> |
---|
777 | <tbl:cellvalue value="<%=well.getRow()%>"/> |
---|
778 | </tbl:cell> |
---|
779 | <tbl:cell column="bioWellColumn"> |
---|
780 | <tbl:cellvalue value="<%=well.getColumn()%>"/> |
---|
781 | </tbl:cell> |
---|
782 | <tbl:cell column="bioPlate"><%=Base.getLinkedName(ID, well.getPlate(), false, true)%></tbl:cell> |
---|
783 | <% |
---|
784 | } |
---|
785 | %> |
---|
786 | <tbl:cell column="owner" |
---|
787 | ><base:propertyvalue |
---|
788 | item="<%=item%>" |
---|
789 | property="owner" |
---|
790 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
791 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
792 | /></tbl:cell> |
---|
793 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
794 | <% |
---|
795 | AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; |
---|
796 | if (as != null) |
---|
797 | { |
---|
798 | for (AnnotationType at : annotationTypes) |
---|
799 | { |
---|
800 | if (as.hasAnnotation(at)) |
---|
801 | { |
---|
802 | Annotation a = as.getAnnotation(at); |
---|
803 | String suffix = a.getUnitSymbol(null); |
---|
804 | if (suffix != null) suffix = " " + suffix; |
---|
805 | %> |
---|
806 | <tbl:cell |
---|
807 | column="<%="at"+at.getId()%>" |
---|
808 | ><tbl:cellvalue |
---|
809 | list="<%=a.getValues(null)%>" |
---|
810 | suffix="<%=suffix%>" |
---|
811 | /></tbl:cell> |
---|
812 | <% |
---|
813 | } |
---|
814 | } |
---|
815 | } |
---|
816 | %> |
---|
817 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
818 | <tbl:cell column="sharedTo"> |
---|
819 | <% |
---|
820 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
821 | while(sharees.hasNext()) |
---|
822 | { |
---|
823 | Nameable n = sharees.next(); |
---|
824 | if (mode.hasPropertyLink()) |
---|
825 | { |
---|
826 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
827 | } |
---|
828 | else |
---|
829 | { |
---|
830 | out.write(HTML.encodeTags(n.getName())); |
---|
831 | } |
---|
832 | out.write(sharees.hasNext() ? ", " : ""); |
---|
833 | } |
---|
834 | %> |
---|
835 | </tbl:cell> |
---|
836 | </tbl:row> |
---|
837 | <% |
---|
838 | } |
---|
839 | } |
---|
840 | %> |
---|
841 | </tbl:rows> |
---|
842 | </tbl:data> |
---|
843 | <% |
---|
844 | if (numListed == 0) |
---|
845 | { |
---|
846 | %> |
---|
847 | <tbl:panel><%=labeledExtracts == null || labeledExtracts.getTotalCount() == 0 ? "No labeled extracts were found" : "No labeled extracts on this page. Please select another page!" %></tbl:panel> |
---|
848 | <% |
---|
849 | } |
---|
850 | else |
---|
851 | { |
---|
852 | %> |
---|
853 | <tbl:navigator |
---|
854 | page="<%=cc.getPage()%>" |
---|
855 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
856 | totalrows="<%=labeledExtracts == null ? 0 : labeledExtracts.getTotalCount()%>" |
---|
857 | visible="<%=mode.hasNavigator()%>" |
---|
858 | locked="true" |
---|
859 | /> |
---|
860 | <% |
---|
861 | } |
---|
862 | %> |
---|
863 | </tbl:table> |
---|
864 | <base:buttongroup align="center" clazz="fixedatbottom"> |
---|
865 | <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
866 | <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
867 | <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
868 | </base:buttongroup> |
---|
869 | <br><br><br> |
---|
870 | </base:body> |
---|
871 | </base:page> |
---|
872 | <% |
---|
873 | } |
---|
874 | finally |
---|
875 | { |
---|
876 | if (labeledExtracts != null) labeledExtracts.close(); |
---|
877 | if (dc != null) dc.close(); |
---|
878 | } |
---|
879 | %> |
---|