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