1 | <%-- $Id: list_bioassays.jsp 5952 2012-02-10 12:27:27Z 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.PhysicalBioAssay" |
---|
31 | import="net.sf.basedb.core.Extract" |
---|
32 | import="net.sf.basedb.core.Tag" |
---|
33 | import="net.sf.basedb.core.DerivedBioAssay" |
---|
34 | import="net.sf.basedb.core.BioMaterialEvent" |
---|
35 | import="net.sf.basedb.core.BioMaterialEventSource" |
---|
36 | import="net.sf.basedb.core.AnnotationType" |
---|
37 | import="net.sf.basedb.core.AnnotationSet" |
---|
38 | import="net.sf.basedb.core.Annotation" |
---|
39 | import="net.sf.basedb.core.ItemSubtype" |
---|
40 | import="net.sf.basedb.core.ItemQuery" |
---|
41 | import="net.sf.basedb.core.Include" |
---|
42 | import="net.sf.basedb.core.Type" |
---|
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.PluginDefinition" |
---|
50 | import="net.sf.basedb.core.query.Hql" |
---|
51 | import="net.sf.basedb.core.query.Restrictions" |
---|
52 | import="net.sf.basedb.core.query.Expressions" |
---|
53 | import="net.sf.basedb.core.query.Orders" |
---|
54 | import="net.sf.basedb.core.query.Hql" |
---|
55 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
56 | import="net.sf.basedb.core.plugin.Plugin" |
---|
57 | import="net.sf.basedb.util.Enumeration" |
---|
58 | import="net.sf.basedb.util.ShareableUtil" |
---|
59 | import="net.sf.basedb.clients.web.Base" |
---|
60 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
61 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
62 | import="net.sf.basedb.clients.web.util.HTML" |
---|
63 | import="net.sf.basedb.util.formatter.Formatter" |
---|
64 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
65 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
66 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
67 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
68 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
69 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
70 | import="net.sf.basedb.util.Values" |
---|
71 | import="java.util.Iterator" |
---|
72 | import="java.util.List" |
---|
73 | import="java.util.Map" |
---|
74 | import="java.util.Date" |
---|
75 | %> |
---|
76 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
77 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
78 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
79 | <%! |
---|
80 | private static final Item itemType = Item.PHYSICALBIOASSAY; |
---|
81 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
82 | %> |
---|
83 | <% |
---|
84 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
85 | final String ID = sc.getId(); |
---|
86 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
87 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
88 | |
---|
89 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
90 | final String callback = request.getParameter("callback"); |
---|
91 | final String title = mode.generateTitle("physical bioassay", "physical bioassays"); |
---|
92 | final DbControl dc = sc.newDbControl(); |
---|
93 | ItemResultIterator<PhysicalBioAssay> bioAssays = null; |
---|
94 | ItemResultList<AnnotationType> annotationTypes = null; |
---|
95 | try |
---|
96 | { |
---|
97 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
98 | final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); |
---|
99 | |
---|
100 | // Query for extracts relatated to the current bioassay |
---|
101 | final ItemQuery<Extract> extractQuery = Extract.getQuery(); |
---|
102 | extractQuery.include(cc.getInclude()); |
---|
103 | extractQuery.join(Hql.innerJoin("childCreationEvents", "cce")); |
---|
104 | extractQuery.join(Hql.innerJoin("cce", "event", "evt")); |
---|
105 | extractQuery.restrict(Restrictions.eq(Hql.property("evt", "physicalBioAssay"), Expressions.parameter("bioAssay"))); |
---|
106 | extractQuery.order(Orders.asc(Hql.property("cce", "position"))); |
---|
107 | extractQuery.order(Orders.asc(Hql.property("name"))); |
---|
108 | |
---|
109 | // Query for derived bioassay sets from to the current bioassay |
---|
110 | final ItemQuery<DerivedBioAssay> dbasQuery = DerivedBioAssay.getQuery(); |
---|
111 | dbasQuery.include(cc.getInclude()); |
---|
112 | dbasQuery.restrict(Restrictions.eq(Hql.property("physicalBioAssay"), Expressions.parameter("bioAssay"))); |
---|
113 | dbasQuery.restrict(Restrictions.eq(Hql.property("parent"), null)); |
---|
114 | dbasQuery.order(Orders.asc(Hql.property("name"))); |
---|
115 | final boolean createDerivedBioAssayPermission = sc.hasPermission(Permission.CREATE, Item.DERIVEDBIOASSAY); |
---|
116 | |
---|
117 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
118 | annotationTypes = annotationTypeQuery.list(dc); |
---|
119 | try |
---|
120 | { |
---|
121 | final ItemQuery<PhysicalBioAssay> query = Base.getConfiguredQuery(dc, cc, true, PhysicalBioAssay.getQuery(), mode); |
---|
122 | bioAssays = query.iterate(dc); |
---|
123 | } |
---|
124 | catch (Throwable t) |
---|
125 | { |
---|
126 | cc.setMessage(t.getMessage()); |
---|
127 | t.printStackTrace(); |
---|
128 | } |
---|
129 | int numListed = 0; |
---|
130 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
131 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
132 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
133 | %> |
---|
134 | <base:page title="<%=title==null ? "Physical bioassays" : title%>" type="<%=mode.getPageType()%>"> |
---|
135 | <base:head scripts="menu.js,table.js" styles="menu.css,table.css,toolbar.css"> |
---|
136 | <ext:scripts context="<%=jspContext%>" /> |
---|
137 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
138 | <script language="JavaScript"> |
---|
139 | var submitPage = 'index.jsp'; |
---|
140 | var formId = 'bioassays'; |
---|
141 | function newItem() |
---|
142 | { |
---|
143 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true); |
---|
144 | } |
---|
145 | function editItem(itemId) |
---|
146 | { |
---|
147 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true); |
---|
148 | } |
---|
149 | function viewItem(itemId) |
---|
150 | { |
---|
151 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
152 | } |
---|
153 | function itemOnClick(evt, itemId) |
---|
154 | { |
---|
155 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected); |
---|
156 | } |
---|
157 | function deleteItems() |
---|
158 | { |
---|
159 | var frm = document.forms[formId]; |
---|
160 | if (Forms.numChecked(frm) == 0) |
---|
161 | { |
---|
162 | alert('Please select at least one item in the list'); |
---|
163 | return; |
---|
164 | } |
---|
165 | frm.action = submitPage; |
---|
166 | frm.cmd.value = 'DeleteItems'; |
---|
167 | frm.submit(); |
---|
168 | } |
---|
169 | function restoreItems() |
---|
170 | { |
---|
171 | var frm = document.forms[formId]; |
---|
172 | if (Forms.numChecked(frm) == 0) |
---|
173 | { |
---|
174 | alert('Please select at least one item in the list'); |
---|
175 | return; |
---|
176 | } |
---|
177 | frm.action = submitPage; |
---|
178 | frm.cmd.value = 'RestoreItems'; |
---|
179 | frm.submit(); |
---|
180 | } |
---|
181 | function deleteItemPermanently(itemId) |
---|
182 | { |
---|
183 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId); |
---|
184 | } |
---|
185 | function setOwner() |
---|
186 | { |
---|
187 | Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems'); |
---|
188 | } |
---|
189 | function shareItem(itemId) |
---|
190 | { |
---|
191 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareItem', 600, 400); |
---|
192 | } |
---|
193 | function shareItems() |
---|
194 | { |
---|
195 | Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems'); |
---|
196 | } |
---|
197 | function configureColumns() |
---|
198 | { |
---|
199 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
200 | } |
---|
201 | function runPlugin(cmd) |
---|
202 | { |
---|
203 | Table.submitToPopup(formId, cmd, 750, 500); |
---|
204 | } |
---|
205 | function returnSelected() |
---|
206 | { |
---|
207 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
208 | window.close(); |
---|
209 | } |
---|
210 | function presetOnChange() |
---|
211 | { |
---|
212 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
213 | } |
---|
214 | function newDerivedBioAssay(bioAssayId) |
---|
215 | { |
---|
216 | Main.viewOrEditItem('<%=ID%>', 'DERIVEDBIOASSAY', 0, true, '&physicalbioassay_id='+bioAssayId); |
---|
217 | } |
---|
218 | </script> |
---|
219 | </base:head> |
---|
220 | |
---|
221 | <base:body> |
---|
222 | <h1><%=title==null ? "Physical bioassays" : title%></h1> |
---|
223 | <div class="content"> |
---|
224 | <tbl:table |
---|
225 | id="bioassays" |
---|
226 | columns="<%=cc.getSetting("columns")%>" |
---|
227 | sortby="<%=cc.getSortProperty()%>" |
---|
228 | direction="<%=cc.getSortDirection()%>" |
---|
229 | action="index.jsp" |
---|
230 | sc="<%=sc%>" |
---|
231 | item="<%=itemType%>" |
---|
232 | subclass="fulltable" |
---|
233 | > |
---|
234 | <tbl:hidden |
---|
235 | name="mode" |
---|
236 | value="<%=mode.getName()%>" |
---|
237 | /> |
---|
238 | <tbl:hidden |
---|
239 | name="callback" |
---|
240 | value="<%=callback%>" |
---|
241 | skip="<%=callback == null%>" |
---|
242 | /> |
---|
243 | <tbl:columndef |
---|
244 | id="name" |
---|
245 | property="name" |
---|
246 | datatype="string" |
---|
247 | title="Name" |
---|
248 | sortable="true" |
---|
249 | filterable="true" |
---|
250 | exportable="true" |
---|
251 | show="always" |
---|
252 | /> |
---|
253 | <tbl:columndef |
---|
254 | id="itemSubtype" |
---|
255 | property="itemSubtype" |
---|
256 | sortproperty="itemSubtype.name" |
---|
257 | exportproperty="itemSubtype.name:string" |
---|
258 | datatype="int" |
---|
259 | enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>" |
---|
260 | title="Type" |
---|
261 | sortable="true" |
---|
262 | filterable="true" |
---|
263 | exportable="true" |
---|
264 | /> |
---|
265 | <tbl:columndef |
---|
266 | id="id" |
---|
267 | clazz="uniquecol" |
---|
268 | property="id" |
---|
269 | datatype="int" |
---|
270 | title="ID" |
---|
271 | sortable="true" |
---|
272 | filterable="true" |
---|
273 | exportable="true" |
---|
274 | /> |
---|
275 | <tbl:columndef |
---|
276 | id="size" |
---|
277 | property="size" |
---|
278 | datatype="int" |
---|
279 | title="Size" |
---|
280 | sortable="true" |
---|
281 | filterable="true" |
---|
282 | exportable="true" |
---|
283 | /> |
---|
284 | <tbl:columndef |
---|
285 | id="extracts" |
---|
286 | title="Extracts" |
---|
287 | property="&creationEvent.sources(bioMaterial.name)" |
---|
288 | datatype="string" |
---|
289 | filterable="true" |
---|
290 | exportable="true" |
---|
291 | /> |
---|
292 | <tbl:columndef |
---|
293 | id="arraySlide" |
---|
294 | property="arraySlide.name" |
---|
295 | datatype="string" |
---|
296 | title="Array slide" |
---|
297 | sortable="true" |
---|
298 | filterable="true" |
---|
299 | exportable="true" |
---|
300 | /> |
---|
301 | <tbl:columndef |
---|
302 | id="derivedBioAssays" |
---|
303 | title="Derived bioassays" |
---|
304 | property="&rootDerivedBioAssays(name)" |
---|
305 | datatype="string" |
---|
306 | filterable="true" |
---|
307 | exportable="true" |
---|
308 | /> |
---|
309 | <tbl:columndef |
---|
310 | id="protocol" |
---|
311 | property="creationEvent.protocol.name" |
---|
312 | datatype="string" |
---|
313 | title="Protocol" |
---|
314 | sortable="true" |
---|
315 | filterable="true" |
---|
316 | exportable="true" |
---|
317 | /> |
---|
318 | <tbl:columndef |
---|
319 | id="hardware" |
---|
320 | property="creationEvent.hardware.name" |
---|
321 | datatype="string" |
---|
322 | title="Hardware" |
---|
323 | sortable="true" |
---|
324 | filterable="true" |
---|
325 | exportable="true" |
---|
326 | /> |
---|
327 | <tbl:columndef |
---|
328 | id="eventDate" |
---|
329 | property="creationEvent.eventDate" |
---|
330 | datatype="date" |
---|
331 | title="Created" |
---|
332 | sortable="true" |
---|
333 | filterable="true" |
---|
334 | exportable="true" |
---|
335 | formatter="<%=dateFormatter%>" |
---|
336 | /> |
---|
337 | <tbl:columndef |
---|
338 | id="entryDate" |
---|
339 | property="creationEvent.entryDate" |
---|
340 | datatype="date" |
---|
341 | title="Registered" |
---|
342 | sortable="true" |
---|
343 | filterable="true" |
---|
344 | exportable="true" |
---|
345 | formatter="<%=dateFormatter%>" |
---|
346 | /> |
---|
347 | <tbl:columndef |
---|
348 | id="owner" |
---|
349 | property="owner.name" |
---|
350 | datatype="string" |
---|
351 | title="Owner" |
---|
352 | sortable="true" |
---|
353 | filterable="true" |
---|
354 | exportable="true" |
---|
355 | /> |
---|
356 | <tbl:columndef |
---|
357 | id="description" |
---|
358 | property="description" |
---|
359 | datatype="string" |
---|
360 | title="Description" |
---|
361 | sortable="true" |
---|
362 | filterable="true" |
---|
363 | exportable="true" |
---|
364 | /> |
---|
365 | <% |
---|
366 | for (AnnotationType at : annotationTypes) |
---|
367 | { |
---|
368 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
369 | Enumeration<String, String> annotationEnum = null; |
---|
370 | if (at.isEnumeration()) |
---|
371 | { |
---|
372 | annotationEnum = new Enumeration<String, String>(); |
---|
373 | List<?> values = at.getValues(); |
---|
374 | for (Object value : values) |
---|
375 | { |
---|
376 | String encoded = formatter.format(value); |
---|
377 | annotationEnum.add(encoded, encoded); |
---|
378 | } |
---|
379 | } |
---|
380 | %> |
---|
381 | <tbl:columndef |
---|
382 | id="<%="at"+at.getId()%>" |
---|
383 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
384 | property="<%="#"+at.getId()%>" |
---|
385 | annotation="true" |
---|
386 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
387 | enumeration="<%=annotationEnum%>" |
---|
388 | smartenum="<%=at.getDisplayAsList() %>" |
---|
389 | sortable="false" |
---|
390 | filterable="true" |
---|
391 | exportable="true" |
---|
392 | formatter="<%=formatter%>" |
---|
393 | unit="<%=at.getDefaultUnit()%>" |
---|
394 | /> |
---|
395 | <% |
---|
396 | } |
---|
397 | %> |
---|
398 | <tbl:columndef |
---|
399 | id="permission" |
---|
400 | title="Permission" |
---|
401 | /> |
---|
402 | <tbl:columndef |
---|
403 | id="sharedTo" |
---|
404 | title="Shared to" |
---|
405 | filterable="true" |
---|
406 | filterproperty="!sharedTo.name" |
---|
407 | datatype="string" |
---|
408 | /> |
---|
409 | <div class="panelgroup bottomborder"> |
---|
410 | <tbl:toolbar |
---|
411 | subclass="bottomborder" |
---|
412 | visible="<%=mode.hasToolbar()%>" |
---|
413 | > |
---|
414 | <tbl:button |
---|
415 | disabled="<%=!createPermission%>" |
---|
416 | image="new.png" |
---|
417 | onclick="newItem()" |
---|
418 | title="New…" |
---|
419 | tooltip="<%=createPermission ? "Create new physical bioassay" : "You do not have permission to create physical bioassays"%>" |
---|
420 | /> |
---|
421 | <tbl:button |
---|
422 | image="delete.png" |
---|
423 | onclick="deleteItems()" |
---|
424 | title="Delete" |
---|
425 | tooltip="Delete the selected items" |
---|
426 | /> |
---|
427 | <tbl:button |
---|
428 | image="restore.png" |
---|
429 | onclick="restoreItems()" |
---|
430 | title="Restore" |
---|
431 | tooltip="Restore the selected (deleted) items" |
---|
432 | /> |
---|
433 | <tbl:button |
---|
434 | image="share.png" |
---|
435 | onclick="shareItems()" |
---|
436 | title="Share…" |
---|
437 | tooltip="Share the selected items" |
---|
438 | /> |
---|
439 | <tbl:button |
---|
440 | image="take_ownership.png" |
---|
441 | onclick="setOwner()" |
---|
442 | title="Set owner…" |
---|
443 | tooltip="Change owner of the selected items" |
---|
444 | /> |
---|
445 | <tbl:button |
---|
446 | image="columns.png" |
---|
447 | onclick="configureColumns()" |
---|
448 | title="Columns…" |
---|
449 | tooltip="Show, hide and re-order columns" |
---|
450 | /> |
---|
451 | <tbl:button |
---|
452 | image="import.png" |
---|
453 | onclick="runPlugin('ImportItems')" |
---|
454 | title="Import…" |
---|
455 | tooltip="Import data" |
---|
456 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
457 | /> |
---|
458 | <tbl:button |
---|
459 | image="export.png" |
---|
460 | onclick="runPlugin('ExportItems')" |
---|
461 | title="Export…" |
---|
462 | tooltip="Export data" |
---|
463 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
464 | /> |
---|
465 | <tbl:button |
---|
466 | image="runplugin.png" |
---|
467 | onclick="runPlugin('RunListPlugin')" |
---|
468 | title="Run plugin…" |
---|
469 | tooltip="Run a plugin" |
---|
470 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
471 | /> |
---|
472 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
473 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
474 | </tbl:toolbar> |
---|
475 | <tbl:panel> |
---|
476 | <tbl:presetselector |
---|
477 | onchange="presetOnChange()" |
---|
478 | /> |
---|
479 | <tbl:navigator |
---|
480 | page="<%=cc.getPage()%>" |
---|
481 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
482 | totalrows="<%=bioAssays == null ? 0 : bioAssays.getTotalCount()%>" |
---|
483 | visible="<%=mode.hasNavigator()%>" |
---|
484 | /> |
---|
485 | </tbl:panel> |
---|
486 | </div> |
---|
487 | <tbl:data> |
---|
488 | <tbl:headers> |
---|
489 | <tbl:headerrow> |
---|
490 | <tbl:header colspan="3" /> |
---|
491 | <tbl:columnheaders /> |
---|
492 | </tbl:headerrow> |
---|
493 | <tbl:headerrow> |
---|
494 | <tbl:header subclass="index" /> |
---|
495 | <tbl:header |
---|
496 | subclass="check" |
---|
497 | visible="<%=mode.hasCheck()%>" |
---|
498 | ><base:icon |
---|
499 | image="check_uncheck.png" |
---|
500 | tooltip="Check/uncheck all" |
---|
501 | onclick="Forms.checkUncheck(document.forms[formId])" |
---|
502 | /></tbl:header> |
---|
503 | <tbl:header |
---|
504 | subclass="check" |
---|
505 | visible="<%=mode.hasRadio()%>" |
---|
506 | /> |
---|
507 | <tbl:header |
---|
508 | subclass="icons" |
---|
509 | visible="<%=mode.hasIcons()%>" |
---|
510 | /> |
---|
511 | <tbl:propertyfilter /> |
---|
512 | </tbl:headerrow> |
---|
513 | </tbl:headers> |
---|
514 | <tbl:rows> |
---|
515 | <% |
---|
516 | if (cc.getMessage() != null) |
---|
517 | { |
---|
518 | %> |
---|
519 | <tbl:panel clazz="messagepanel"> |
---|
520 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
521 | </tbl:panel> |
---|
522 | <% |
---|
523 | cc.setMessage(null); |
---|
524 | } |
---|
525 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
526 | int selectedItemId = cc.getId(); |
---|
527 | if (bioAssays != null) |
---|
528 | { |
---|
529 | while (bioAssays.hasNext()) |
---|
530 | { |
---|
531 | PhysicalBioAssay item = bioAssays.next(); |
---|
532 | BioMaterialEvent creationEvent = item.getCreationEvent(); |
---|
533 | int itemId = item.getId(); |
---|
534 | boolean usePermission = item.hasPermission(Permission.USE); |
---|
535 | String openSharePopup = "shareItem("+itemId+")"; |
---|
536 | String deletePermanently = "deleteItemPermanently("+itemId+")"; |
---|
537 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
538 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
539 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
540 | String tooltip = mode.isSelectionMode() ? |
---|
541 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
542 | String name = HTML.encodeTags(item.getName()); |
---|
543 | index++; |
---|
544 | numListed++; |
---|
545 | %> |
---|
546 | <tbl:row> |
---|
547 | <tbl:header |
---|
548 | clazz="index" |
---|
549 | ><%=index%></tbl:header> |
---|
550 | <tbl:header |
---|
551 | clazz="check" |
---|
552 | visible="<%=mode.hasCheck()%>" |
---|
553 | ><input |
---|
554 | type="checkbox" |
---|
555 | name="<%=itemId%>" |
---|
556 | value="<%=itemId%>" |
---|
557 | title="<%=name%>" |
---|
558 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
559 | ></tbl:header> |
---|
560 | <tbl:header |
---|
561 | clazz="check" |
---|
562 | visible="<%=mode.hasRadio()%>" |
---|
563 | ><input |
---|
564 | type="radio" |
---|
565 | name="item_id" |
---|
566 | value="<%=itemId%>" |
---|
567 | title="<%=name%>" |
---|
568 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
569 | ></tbl:header> |
---|
570 | <tbl:header |
---|
571 | clazz="icons" |
---|
572 | visible="<%=mode.hasIcons()%>" |
---|
573 | ><base:icon |
---|
574 | image="deleted.png" |
---|
575 | onclick="<%=deletePermission ? deletePermanently : null%>" |
---|
576 | tooltip="This item has been scheduled for deletion" |
---|
577 | visible="<%=item.isRemoved()%>" |
---|
578 | /><base:icon |
---|
579 | image="shared.png" |
---|
580 | onclick="<%=sharePermission ? openSharePopup : null%>" |
---|
581 | tooltip="This item is shared to other users, groups and/or projects" |
---|
582 | visible="<%=item.isShared()%>" |
---|
583 | /> </tbl:header> |
---|
584 | <tbl:cell column="name"><div class="link" |
---|
585 | onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" |
---|
586 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
587 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
588 | <tbl:cell column="itemSubtype"><base:propertyvalue |
---|
589 | item="<%=item%>" |
---|
590 | property="itemSubtype" |
---|
591 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
592 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
593 | /></tbl:cell> |
---|
594 | <tbl:cell column="size"><%=item.getSize()%></tbl:cell> |
---|
595 | <tbl:cell column="extracts"> |
---|
596 | <% |
---|
597 | extractQuery.setParameter("bioAssay", itemId, Type.INT); |
---|
598 | try |
---|
599 | { |
---|
600 | String separator = ""; |
---|
601 | boolean needIndex = item.getSize() > 1; |
---|
602 | for (Extract extract : extractQuery.list(dc)) |
---|
603 | { |
---|
604 | Tag tag = null; |
---|
605 | boolean readTag = true; |
---|
606 | try |
---|
607 | { |
---|
608 | tag = extract.getTag(); |
---|
609 | } |
---|
610 | catch (PermissionDeniedException ex) |
---|
611 | { |
---|
612 | readTag = false; |
---|
613 | } |
---|
614 | out.write(separator); |
---|
615 | if (needIndex) |
---|
616 | { |
---|
617 | out.write(creationEvent.getEventSource(extract).getPosition() + ": "); |
---|
618 | } |
---|
619 | if (mode.hasPropertyLink()) |
---|
620 | { |
---|
621 | out.write(Base.getLinkedName(ID, extract, false, mode.hasEditLink())); |
---|
622 | out.write(" (" + Base.getLinkedName(ID, tag, !readTag, mode.hasEditLink()) + ")"); |
---|
623 | } |
---|
624 | else |
---|
625 | { |
---|
626 | out.write(HTML.encodeTags(extract.getName())); |
---|
627 | out.write(" (" + Base.getEncodedName(tag, !readTag) + ")"); |
---|
628 | } |
---|
629 | separator = ", "; |
---|
630 | } |
---|
631 | } |
---|
632 | catch (Throwable t) |
---|
633 | { |
---|
634 | %> |
---|
635 | <div class="error"><%=t.getMessage()%></div> |
---|
636 | <% |
---|
637 | } |
---|
638 | %> |
---|
639 | </tbl:cell> |
---|
640 | <tbl:cell column="arraySlide" |
---|
641 | ><base:propertyvalue |
---|
642 | item="<%=item%>" |
---|
643 | property="arraySlide" |
---|
644 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
645 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
646 | /></tbl:cell> |
---|
647 | <tbl:cell column="derivedBioAssays"> |
---|
648 | <% |
---|
649 | dbasQuery.setParameter("bioAssay", itemId, Type.INT); |
---|
650 | try |
---|
651 | { |
---|
652 | String separator = ""; |
---|
653 | for (DerivedBioAssay dbas : dbasQuery.list(dc)) |
---|
654 | { |
---|
655 | out.write(separator); |
---|
656 | if (mode.hasPropertyLink()) |
---|
657 | { |
---|
658 | out.write(Base.getLinkedName(ID, dbas, false, mode.hasEditLink())); |
---|
659 | } |
---|
660 | else |
---|
661 | { |
---|
662 | out.write(HTML.encodeTags(dbas.getName())); |
---|
663 | } |
---|
664 | separator = ", "; |
---|
665 | } |
---|
666 | } |
---|
667 | catch (Throwable t) |
---|
668 | { |
---|
669 | %> |
---|
670 | <div class="error"><%=t.getMessage()%></div> |
---|
671 | <% |
---|
672 | } |
---|
673 | %> |
---|
674 | <base:icon |
---|
675 | image="add.png" |
---|
676 | onclick="<%="newDerivedBioAssay("+itemId+")"%>" |
---|
677 | tooltip="Create new derived bioassay" |
---|
678 | visible="<%=mode.hasEditLink() && createDerivedBioAssayPermission && usePermission %>" |
---|
679 | /> |
---|
680 | </tbl:cell> |
---|
681 | <tbl:cell column="protocol" |
---|
682 | ><base:propertyvalue |
---|
683 | item="<%=creationEvent%>" |
---|
684 | property="protocol" |
---|
685 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
686 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
687 | /></tbl:cell> |
---|
688 | <tbl:cell column="hardware" |
---|
689 | ><base:propertyvalue |
---|
690 | item="<%=creationEvent%>" |
---|
691 | property="hardware" |
---|
692 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
693 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
694 | /></tbl:cell> |
---|
695 | <tbl:cell column="eventDate" value="<%=creationEvent.getEventDate()%>" /> |
---|
696 | <tbl:cell column="entryDate" value="<%=creationEvent.getEntryDate()%>" /> |
---|
697 | <tbl:cell column="owner" |
---|
698 | ><base:propertyvalue |
---|
699 | item="<%=item%>" |
---|
700 | property="owner" |
---|
701 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
702 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
703 | /></tbl:cell> |
---|
704 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
705 | <% |
---|
706 | AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; |
---|
707 | if (as != null) |
---|
708 | { |
---|
709 | for (AnnotationType at : annotationTypes) |
---|
710 | { |
---|
711 | if (as.hasAnnotation(at)) |
---|
712 | { |
---|
713 | Annotation a = as.getAnnotation(at); |
---|
714 | String suffix = a.getUnitSymbol(null); |
---|
715 | if (suffix != null) suffix = " " + suffix; |
---|
716 | %> |
---|
717 | <tbl:cell |
---|
718 | column="<%="at"+at.getId()%>" |
---|
719 | ><tbl:cellvalue |
---|
720 | list="<%=a.getValues(null)%>" |
---|
721 | suffix="<%=suffix%>" |
---|
722 | /></tbl:cell> |
---|
723 | <% |
---|
724 | } |
---|
725 | } |
---|
726 | } |
---|
727 | %> |
---|
728 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
729 | <tbl:cell column="sharedTo"> |
---|
730 | <% |
---|
731 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
732 | while(sharees.hasNext()) |
---|
733 | { |
---|
734 | Nameable n = sharees.next(); |
---|
735 | if (mode.hasPropertyLink()) |
---|
736 | { |
---|
737 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
738 | } |
---|
739 | else |
---|
740 | { |
---|
741 | out.write(HTML.encodeTags(n.getName())); |
---|
742 | } |
---|
743 | out.write(sharees.hasNext() ? ", " : ""); |
---|
744 | } |
---|
745 | %> |
---|
746 | </tbl:cell> |
---|
747 | </tbl:row> |
---|
748 | <% |
---|
749 | } |
---|
750 | } |
---|
751 | if (numListed == 0) |
---|
752 | { |
---|
753 | %> |
---|
754 | <tbl:panel clazz="messagepanel"> |
---|
755 | <div class="messagecontainer note"> |
---|
756 | <%=bioAssays == null || bioAssays.getTotalCount() == 0 ? "No physical bioassays were found" : "No physical bioassays on this page. Please select another page!" %> |
---|
757 | </div> |
---|
758 | </tbl:panel> |
---|
759 | <% |
---|
760 | } |
---|
761 | %> |
---|
762 | </tbl:rows> |
---|
763 | </tbl:data> |
---|
764 | </tbl:table> |
---|
765 | </div> |
---|
766 | |
---|
767 | <base:buttongroup subclass="dialogbuttons"> |
---|
768 | <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
769 | <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
770 | <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
771 | </base:buttongroup> |
---|
772 | |
---|
773 | </base:body> |
---|
774 | </base:page> |
---|
775 | <% |
---|
776 | } |
---|
777 | finally |
---|
778 | { |
---|
779 | if (bioAssays != null) bioAssays.close(); |
---|
780 | if (dc != null) dc.close(); |
---|
781 | } |
---|
782 | %> |
---|