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