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