1 | <%-- $Id: view_experiment.jsp 2918 2006-11-15 11:21:13Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) Authors contributing to this file. |
---|
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 2 |
---|
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 this program; if not, write to the Free Software |
---|
20 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
21 | Boston, MA 02111-1307, USA. |
---|
22 | ------------------------------------------------------------------ |
---|
23 | |
---|
24 | @author Nicklas |
---|
25 | @version 2.0 |
---|
26 | --%> |
---|
27 | <%@ page |
---|
28 | import="net.sf.basedb.core.SessionControl" |
---|
29 | import="net.sf.basedb.core.DbControl" |
---|
30 | import="net.sf.basedb.core.Item" |
---|
31 | import="net.sf.basedb.core.ItemContext" |
---|
32 | import="net.sf.basedb.core.Permission" |
---|
33 | import="net.sf.basedb.core.Experiment" |
---|
34 | import="net.sf.basedb.core.RawBioAssay" |
---|
35 | import="net.sf.basedb.core.AnnotationType" |
---|
36 | import="net.sf.basedb.core.AnnotationSet" |
---|
37 | import="net.sf.basedb.core.Annotation" |
---|
38 | import="net.sf.basedb.core.User" |
---|
39 | import="net.sf.basedb.core.ItemQuery" |
---|
40 | import="net.sf.basedb.core.ItemResultList" |
---|
41 | import="net.sf.basedb.core.Include" |
---|
42 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
43 | import="net.sf.basedb.core.PluginDefinition" |
---|
44 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
45 | import="net.sf.basedb.core.plugin.Plugin" |
---|
46 | import="net.sf.basedb.core.query.Orders" |
---|
47 | import="net.sf.basedb.core.query.Hql" |
---|
48 | import="net.sf.basedb.clients.web.Base" |
---|
49 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
50 | import="net.sf.basedb.clients.web.util.HTML" |
---|
51 | import="net.sf.basedb.util.Values" |
---|
52 | import="java.util.Date" |
---|
53 | import="java.util.Map" |
---|
54 | import="java.util.Set" |
---|
55 | %> |
---|
56 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
57 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
58 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
59 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
60 | <%! |
---|
61 | private static final Item itemType = Item.EXPERIMENT; |
---|
62 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
63 | %> |
---|
64 | <% |
---|
65 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
66 | final String ID = sc.getId(); |
---|
67 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
68 | final int itemId = cc.getId(); |
---|
69 | final float scale = Base.getScale(sc); |
---|
70 | final String root = request.getContextPath(); |
---|
71 | final DbControl dc = sc.newDbControl(); |
---|
72 | try |
---|
73 | { |
---|
74 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
75 | |
---|
76 | String title = null; |
---|
77 | Experiment experiment = Experiment.getById(dc, itemId); |
---|
78 | |
---|
79 | final boolean writePermission = experiment.hasPermission(Permission.WRITE); |
---|
80 | final boolean deletePermission = experiment.hasPermission(Permission.DELETE); |
---|
81 | final boolean sharePermission = experiment.hasPermission(Permission.SET_PERMISSION); |
---|
82 | final boolean setOwnerPermission = experiment.hasPermission(Permission.SET_OWNER); |
---|
83 | final boolean isOwner = experiment.isOwner(); |
---|
84 | %> |
---|
85 | |
---|
86 | <base:page title="<%=title%>"> |
---|
87 | <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
88 | <script language="JavaScript"> |
---|
89 | function editItem() |
---|
90 | { |
---|
91 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
92 | } |
---|
93 | function shareItem() |
---|
94 | { |
---|
95 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareRawBioAssay', 500, 400); |
---|
96 | } |
---|
97 | function deleteItem() |
---|
98 | { |
---|
99 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
100 | } |
---|
101 | function restoreItem() |
---|
102 | { |
---|
103 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
104 | } |
---|
105 | function takeOwnership() |
---|
106 | { |
---|
107 | if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) |
---|
108 | { |
---|
109 | location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); |
---|
110 | } |
---|
111 | } |
---|
112 | function runPlugin(cmd) |
---|
113 | { |
---|
114 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540); |
---|
115 | } |
---|
116 | function analyzeItem() |
---|
117 | { |
---|
118 | location.href = '<%=root%>/analyze/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; |
---|
119 | } |
---|
120 | function viewBioAssaySets() |
---|
121 | { |
---|
122 | location.href = 'bioassaysets/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; |
---|
123 | } |
---|
124 | function switchTab(tabControlId, tabId) |
---|
125 | { |
---|
126 | if (tabId == 'bioassaysets') |
---|
127 | { |
---|
128 | viewBioAssaySets(); |
---|
129 | } |
---|
130 | else |
---|
131 | { |
---|
132 | TabControl.setActiveTab(tabControlId, tabId); |
---|
133 | } |
---|
134 | } |
---|
135 | </script> |
---|
136 | </base:head> |
---|
137 | <base:body> |
---|
138 | <p> |
---|
139 | <p:path> |
---|
140 | <p:pathelement title="Experiments" href="<%="index.jsp?ID="+ID%>" /> |
---|
141 | <p:pathelement title="<%=HTML.encodeTags(experiment.getName())%>" /> |
---|
142 | </p:path> |
---|
143 | |
---|
144 | <t:tabcontrol id="main" active="properties" switch="switchTab"> |
---|
145 | <t:tab id="properties" title="Properties"> |
---|
146 | |
---|
147 | <tbl:toolbar |
---|
148 | > |
---|
149 | <tbl:button |
---|
150 | disabled="<%=writePermission ? false : true%>" |
---|
151 | image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" |
---|
152 | onclick="editItem()" |
---|
153 | title="Edit…" |
---|
154 | tooltip="<%=writePermission ? "Edit this experiment" : "You do not have permission to edit this experiment"%>" |
---|
155 | /> |
---|
156 | <tbl:button |
---|
157 | disabled="<%=deletePermission ? false : true%>" |
---|
158 | image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" |
---|
159 | onclick="deleteItem()" |
---|
160 | title="Delete" |
---|
161 | visible="<%=!experiment.isRemoved()%>" |
---|
162 | tooltip="<%=deletePermission ? "Delete this experiment" : "You do not have permission to delete this experiment"%>" |
---|
163 | /> |
---|
164 | <tbl:button |
---|
165 | disabled="<%=writePermission ? false : true%>" |
---|
166 | image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" |
---|
167 | onclick="restoreItem()" |
---|
168 | title="Restore" |
---|
169 | visible="<%=experiment.isRemoved()%>" |
---|
170 | tooltip="<%=writePermission ? "Restore this experiment" : "You do not have permission to restore this experiment"%>" |
---|
171 | /> |
---|
172 | <tbl:button |
---|
173 | disabled="<%=sharePermission ? false : true%>" |
---|
174 | image="<%=sharePermission ? "share.gif" : "share_disabled.gif"%>" |
---|
175 | onclick="shareItem()" |
---|
176 | title="Share…" |
---|
177 | tooltip="<%=sharePermission ? "Share this experiment to other user, groups and projects" : "You do not have permission to share this experiment"%>" |
---|
178 | /> |
---|
179 | <tbl:button |
---|
180 | disabled="<%=setOwnerPermission ? false : true%>" |
---|
181 | image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" |
---|
182 | onclick="takeOwnership()" |
---|
183 | title="Take ownership…" |
---|
184 | visible="<%=!isOwner%>" |
---|
185 | tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" |
---|
186 | /> |
---|
187 | <tbl:button |
---|
188 | image="import.gif" |
---|
189 | onclick="runPlugin('ImportItem')" |
---|
190 | title="Import…" |
---|
191 | tooltip="Import data" |
---|
192 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
193 | /> |
---|
194 | <tbl:button |
---|
195 | image="export.gif" |
---|
196 | onclick="runPlugin('ExportItem')" |
---|
197 | title="Export…" |
---|
198 | tooltip="Export data" |
---|
199 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
200 | /> |
---|
201 | <tbl:button |
---|
202 | image="runplugin.gif" |
---|
203 | onclick="runPlugin('RunPlugin')" |
---|
204 | title="Run plugin…" |
---|
205 | tooltip="Run a plugin" |
---|
206 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
207 | /> |
---|
208 | <tbl:button |
---|
209 | image="help.gif" |
---|
210 | onclick="<%="Main.openHelp('" + ID +"', 'experiment.view.properties')"%>" |
---|
211 | title="Help…" |
---|
212 | tooltip="Get help about this page" |
---|
213 | /> |
---|
214 | </tbl:toolbar> |
---|
215 | <div class="boxedbottom"> |
---|
216 | <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(experiment)%></i></div> |
---|
217 | <% |
---|
218 | if (experiment.isRemoved() || experiment.isShared()) |
---|
219 | { |
---|
220 | %> |
---|
221 | <div class="itemstatus"> |
---|
222 | <base:icon image="deleted.gif" |
---|
223 | visible="<%=experiment.isRemoved()%>"> This item has been flagged for deletion<br></base:icon> |
---|
224 | <base:icon image="shared.gif" |
---|
225 | visible="<%=experiment.isShared()%>"> This item is shared to other user, groups and/or projects</base:icon> |
---|
226 | </div> |
---|
227 | <% |
---|
228 | } |
---|
229 | %> |
---|
230 | <table class="form" cellspacing=0> |
---|
231 | <tr> |
---|
232 | <td class="prompt">Name</td> |
---|
233 | <td><%=HTML.encodeTags(experiment.getName())%></td> |
---|
234 | </tr> |
---|
235 | <tr> |
---|
236 | <td class="prompt">Raw data type</td> |
---|
237 | <td><%=HTML.encodeTags(experiment.getRawDataType().getName())%></td> |
---|
238 | </tr> |
---|
239 | <tr> |
---|
240 | <td class="prompt">Directory</td> |
---|
241 | <td><base:propertyvalue item="<%=experiment%>" property="directory" /></td> |
---|
242 | </tr> |
---|
243 | <tr> |
---|
244 | <td class="prompt">Bytes</td> |
---|
245 | <td><%=Values.formatBytes(experiment.getBytes())%></td> |
---|
246 | </tr> |
---|
247 | <tr> |
---|
248 | <td class="prompt">Owner</td> |
---|
249 | <td><base:propertyvalue item="<%=experiment%>" property="owner" /></td> |
---|
250 | </tr> |
---|
251 | <tr> |
---|
252 | <td class="prompt">Description</td> |
---|
253 | <td><%=HTML.niceFormat(experiment.getDescription())%></td> |
---|
254 | </tr> |
---|
255 | </table> |
---|
256 | |
---|
257 | <h4>Publication</h4> |
---|
258 | <table class="form" cellspacing=0> |
---|
259 | <tr> |
---|
260 | <td class="prompt">PubMed ID</td> |
---|
261 | <td> |
---|
262 | <%=HTML.encodeTags(experiment.getPubMedId())%> |
---|
263 | <% |
---|
264 | int pubMedId = Values.getInt(experiment.getPubMedId(), -1); |
---|
265 | if (pubMedId != -1) |
---|
266 | { |
---|
267 | %> |
---|
268 | <b>Link to:</b> |
---|
269 | <a href="http://www.ebi.ac.uk/citexplore/citationDetails.do?externalId=<%=pubMedId%>&dataSource=MED" |
---|
270 | target="_new" title="External link to EBI Citation database" |
---|
271 | >EBI Citation database</a>, |
---|
272 | <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=PureSearch&db=pubmed&details_term=<%=pubMedId%>" |
---|
273 | target="_new" title="External link to NCBI Entrez PubMed">NCBI Entrez PubMed</a> |
---|
274 | <% |
---|
275 | } |
---|
276 | %> |
---|
277 | </td> |
---|
278 | </tr> |
---|
279 | <tr> |
---|
280 | <td class="prompt">Title</td> |
---|
281 | <td><%=HTML.niceFormat(experiment.getTitle())%></td> |
---|
282 | </tr> |
---|
283 | <tr> |
---|
284 | <td class="prompt">Publication date</td> |
---|
285 | <td><%=Values.formatDate(experiment.getPublicationDate())%></td> |
---|
286 | </tr> |
---|
287 | <tr> |
---|
288 | <td class="prompt">Abstract</td> |
---|
289 | <td><%=HTML.niceFormat(experiment.getAbstract())%></td> |
---|
290 | </tr> |
---|
291 | <tr> |
---|
292 | <td class="prompt">Experiment design</td> |
---|
293 | <td><%=HTML.niceFormat(experiment.getExperimentDesign())%></td> |
---|
294 | </tr> |
---|
295 | <tr> |
---|
296 | <td class="prompt">Experiment type</td> |
---|
297 | <td><%=HTML.niceFormat(experiment.getExperimentType())%></td> |
---|
298 | </tr> |
---|
299 | <tr> |
---|
300 | <td class="prompt">Affiliations</td> |
---|
301 | <td><%=HTML.niceFormat(experiment.getAffiliations())%></td> |
---|
302 | </tr> |
---|
303 | <tr> |
---|
304 | <td class="prompt">Authors</td> |
---|
305 | <td><%=HTML.niceFormat(experiment.getAuthors())%></td> |
---|
306 | </tr> |
---|
307 | <tr> |
---|
308 | <td class="prompt">Publication</td> |
---|
309 | <td><%=HTML.niceFormat(experiment.getPublication())%></td> |
---|
310 | </tr> |
---|
311 | </table> |
---|
312 | |
---|
313 | <% |
---|
314 | ItemQuery<AnnotationType> efQuery = experiment.getExperimentalFactors(); |
---|
315 | efQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT); |
---|
316 | efQuery.order(Orders.asc(Hql.property("name"))); |
---|
317 | ItemResultList<AnnotationType> experimentalFactors = efQuery.list(dc); |
---|
318 | if (experimentalFactors.size() == 0) |
---|
319 | { |
---|
320 | %> |
---|
321 | <h4>Experimental factors</h4> |
---|
322 | No experimental factors has been added to this experiment |
---|
323 | (or, you don't have permission to view them). |
---|
324 | <% |
---|
325 | } |
---|
326 | else |
---|
327 | { |
---|
328 | %> |
---|
329 | <h4 class="docked">Experimental factors</h4> |
---|
330 | <tbl:table |
---|
331 | id="experimentalFactors" |
---|
332 | clazz="itemlist" |
---|
333 | columns="all" |
---|
334 | > |
---|
335 | <tbl:columndef |
---|
336 | id="name" |
---|
337 | title="Name" |
---|
338 | /> |
---|
339 | <tbl:columndef |
---|
340 | id="values" |
---|
341 | title="Values" |
---|
342 | /> |
---|
343 | <tbl:columndef |
---|
344 | id="description" |
---|
345 | title="Description" |
---|
346 | /> |
---|
347 | <tbl:data> |
---|
348 | <tbl:columns> |
---|
349 | </tbl:columns> |
---|
350 | <tbl:rows> |
---|
351 | <% |
---|
352 | for (AnnotationType item : experimentalFactors) |
---|
353 | { |
---|
354 | %> |
---|
355 | <tbl:row> |
---|
356 | <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
357 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
358 | <tbl:cell column="values"> |
---|
359 | <%=item.isEnumeration() ? |
---|
360 | "Enumeration: " + HTML.encodeTags(Values.getString(item.getValues(), ", ", true)) : |
---|
361 | item.getValueType()%> |
---|
362 | </tbl:cell> |
---|
363 | </tbl:row> |
---|
364 | <% |
---|
365 | } |
---|
366 | %> |
---|
367 | </tbl:rows> |
---|
368 | </tbl:data> |
---|
369 | </tbl:table> |
---|
370 | <% |
---|
371 | } |
---|
372 | %> |
---|
373 | |
---|
374 | <% |
---|
375 | ItemQuery<RawBioAssay> rbaQuery = experiment.getRawBioAssays(); |
---|
376 | rbaQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT); |
---|
377 | rbaQuery.order(Orders.asc(Hql.property("name"))); |
---|
378 | ItemResultList<RawBioAssay> rawBioAssays = rbaQuery.list(dc); |
---|
379 | if (rawBioAssays.size() == 0) |
---|
380 | { |
---|
381 | %> |
---|
382 | <h4>Raw bioassays</h4> |
---|
383 | No raw bioassays has been added to this experiment |
---|
384 | (or, you don't have permission to view them). |
---|
385 | <% |
---|
386 | } |
---|
387 | else |
---|
388 | { |
---|
389 | %> |
---|
390 | <h4 class="docked">Raw bioassays</h4> |
---|
391 | <tbl:table |
---|
392 | id="rawbioassays" |
---|
393 | clazz="itemlist" |
---|
394 | columns="all" |
---|
395 | > |
---|
396 | <tbl:columndef |
---|
397 | id="name" |
---|
398 | title="Name" |
---|
399 | /> |
---|
400 | <tbl:columndef |
---|
401 | id="description" |
---|
402 | title="Description" |
---|
403 | /> |
---|
404 | <% |
---|
405 | for (AnnotationType at : experimentalFactors) |
---|
406 | { |
---|
407 | %> |
---|
408 | <tbl:columndef |
---|
409 | id="<%="at"+at.getId()%>" |
---|
410 | title="<%=HTML.encodeTags(at.getName())+" [EF]"%>" |
---|
411 | /> |
---|
412 | <% |
---|
413 | } |
---|
414 | %> |
---|
415 | |
---|
416 | <tbl:data> |
---|
417 | <tbl:columns> |
---|
418 | </tbl:columns> |
---|
419 | <tbl:rows> |
---|
420 | <% |
---|
421 | for (RawBioAssay item : rawBioAssays) |
---|
422 | { |
---|
423 | AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; |
---|
424 | %> |
---|
425 | <tbl:row> |
---|
426 | <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
427 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
428 | <% |
---|
429 | for (AnnotationType at : experimentalFactors) |
---|
430 | { |
---|
431 | |
---|
432 | String value = "<i>- none -</i>"; |
---|
433 | if (as != null) |
---|
434 | { |
---|
435 | Annotation a = as.findAnnotation(at); |
---|
436 | if (a != null) |
---|
437 | { |
---|
438 | value = HTML.encodeTags(Values.getString(a.getValues(), ", ", true)); |
---|
439 | } |
---|
440 | } |
---|
441 | %> |
---|
442 | <tbl:cell column="<%="at"+at.getId()%>"><%=value%></tbl:cell> |
---|
443 | <% |
---|
444 | } |
---|
445 | %> |
---|
446 | </tbl:row> |
---|
447 | <% |
---|
448 | } |
---|
449 | %> |
---|
450 | </tbl:rows> |
---|
451 | </tbl:data> |
---|
452 | </tbl:table> |
---|
453 | <% |
---|
454 | } |
---|
455 | %> |
---|
456 | </div> |
---|
457 | </t:tab> |
---|
458 | |
---|
459 | <t:tab id="bioassaysets" title="Bioassay sets" /> |
---|
460 | |
---|
461 | </t:tabcontrol> |
---|
462 | |
---|
463 | |
---|
464 | </base:body> |
---|
465 | </base:page> |
---|
466 | <% |
---|
467 | } |
---|
468 | finally |
---|
469 | { |
---|
470 | if (dc != null) dc.close(); |
---|
471 | } |
---|
472 | |
---|
473 | %> |
---|