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