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