1 | <%-- $Id: view_scan.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.SystemItems" |
---|
31 | import="net.sf.basedb.core.Item" |
---|
32 | import="net.sf.basedb.core.ItemContext" |
---|
33 | import="net.sf.basedb.core.Permission" |
---|
34 | import="net.sf.basedb.core.AnnotationType" |
---|
35 | import="net.sf.basedb.core.AnnotationSet" |
---|
36 | import="net.sf.basedb.core.Scan" |
---|
37 | import="net.sf.basedb.core.RawBioAssay" |
---|
38 | import="net.sf.basedb.core.Protocol" |
---|
39 | import="net.sf.basedb.core.Hardware" |
---|
40 | import="net.sf.basedb.core.Hybridization" |
---|
41 | import="net.sf.basedb.core.User" |
---|
42 | import="net.sf.basedb.core.ItemQuery" |
---|
43 | import="net.sf.basedb.core.ItemResultList" |
---|
44 | import="net.sf.basedb.core.Include" |
---|
45 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
46 | import="net.sf.basedb.core.PluginDefinition" |
---|
47 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
48 | import="net.sf.basedb.core.plugin.Plugin" |
---|
49 | import="net.sf.basedb.core.query.Orders" |
---|
50 | import="net.sf.basedb.core.query.Hql" |
---|
51 | import="net.sf.basedb.clients.web.Base" |
---|
52 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
53 | import="net.sf.basedb.clients.web.util.HTML" |
---|
54 | import="net.sf.basedb.util.Values" |
---|
55 | import="java.util.Date" |
---|
56 | import="java.util.Map" |
---|
57 | import="java.util.Set" |
---|
58 | import="java.util.List" |
---|
59 | %> |
---|
60 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
61 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
62 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
63 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
64 | <%! |
---|
65 | private static final Item itemType = Item.SCAN; |
---|
66 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
67 | %> |
---|
68 | <% |
---|
69 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
70 | final String ID = sc.getId(); |
---|
71 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
72 | final int itemId = cc.getId(); |
---|
73 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
74 | final float scale = Base.getScale(sc); |
---|
75 | final DbControl dc = sc.newDbControl(); |
---|
76 | try |
---|
77 | { |
---|
78 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
79 | |
---|
80 | String title = null; |
---|
81 | Scan scan = Scan.getById(dc, itemId); |
---|
82 | |
---|
83 | final boolean usePermission = scan.hasPermission(Permission.USE); |
---|
84 | final boolean writePermission = scan.hasPermission(Permission.WRITE); |
---|
85 | final boolean deletePermission = scan.hasPermission(Permission.DELETE); |
---|
86 | final boolean sharePermission = scan.hasPermission(Permission.SET_PERMISSION); |
---|
87 | final boolean setOwnerPermission = scan.hasPermission(Permission.SET_OWNER); |
---|
88 | final boolean isOwner = scan.isOwner(); |
---|
89 | %> |
---|
90 | |
---|
91 | <base:page title="<%=title%>"> |
---|
92 | <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
93 | <script language="JavaScript"> |
---|
94 | function editItem() |
---|
95 | { |
---|
96 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
97 | } |
---|
98 | function shareItem() |
---|
99 | { |
---|
100 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareScan', 500, 400); |
---|
101 | } |
---|
102 | function deleteItem() |
---|
103 | { |
---|
104 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
105 | } |
---|
106 | function restoreItem() |
---|
107 | { |
---|
108 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
109 | } |
---|
110 | function takeOwnership() |
---|
111 | { |
---|
112 | if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) |
---|
113 | { |
---|
114 | location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); |
---|
115 | } |
---|
116 | } |
---|
117 | function runPlugin(cmd) |
---|
118 | { |
---|
119 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540); |
---|
120 | } |
---|
121 | function viewImages() |
---|
122 | { |
---|
123 | location.href = 'images/index.jsp?ID=<%=ID%>&cmd=List&scan_id=<%=itemId%>'; |
---|
124 | } |
---|
125 | function switchTab(tabControlId, tabId) |
---|
126 | { |
---|
127 | if (tabId == 'images') |
---|
128 | { |
---|
129 | viewImages(); |
---|
130 | } |
---|
131 | else |
---|
132 | { |
---|
133 | TabControl.setActiveTab(tabControlId, tabId); |
---|
134 | } |
---|
135 | } |
---|
136 | function newRawBioAssay() |
---|
137 | { |
---|
138 | Main.viewOrEditItem('<%=ID%>', 'RAWBIOASSAY', 0, true, '&scan_id=<%=itemId%>'); |
---|
139 | } |
---|
140 | </script> |
---|
141 | </base:head> |
---|
142 | <base:body> |
---|
143 | <p> |
---|
144 | <p:path> |
---|
145 | <p:pathelement title="Scans" href="<%="index.jsp?ID="+ID%>" /> |
---|
146 | <p:pathelement title="<%=HTML.encodeTags(scan.getName())%>" /> |
---|
147 | </p:path> |
---|
148 | |
---|
149 | <t:tabcontrol id="main" active="<%=tab%>" switch="switchTab"> |
---|
150 | <t:tab id="properties" title="Properties"> |
---|
151 | |
---|
152 | <tbl:toolbar |
---|
153 | > |
---|
154 | <tbl:button |
---|
155 | disabled="<%=writePermission ? false : true%>" |
---|
156 | image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" |
---|
157 | onclick="editItem()" |
---|
158 | title="Edit…" |
---|
159 | tooltip="<%=writePermission ? "Edit this scan" : "You do not have permission to edit this scan"%>" |
---|
160 | /> |
---|
161 | <tbl:button |
---|
162 | disabled="<%=deletePermission ? false : true%>" |
---|
163 | image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" |
---|
164 | onclick="deleteItem()" |
---|
165 | title="Delete" |
---|
166 | visible="<%=!scan.isRemoved()%>" |
---|
167 | tooltip="<%=deletePermission ? "Delete this scan" : "You do not have permission to delete this scan"%>" |
---|
168 | /> |
---|
169 | <tbl:button |
---|
170 | disabled="<%=writePermission ? false : true%>" |
---|
171 | image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" |
---|
172 | onclick="restoreItem()" |
---|
173 | title="Restore" |
---|
174 | visible="<%=scan.isRemoved()%>" |
---|
175 | tooltip="<%=writePermission ? "Restore this scan" : "You do not have permission to restore this scan"%>" |
---|
176 | /> |
---|
177 | <tbl:button |
---|
178 | disabled="<%=sharePermission ? false : true%>" |
---|
179 | image="<%=sharePermission ? "share.gif" : "share_disabled.gif"%>" |
---|
180 | onclick="shareItem()" |
---|
181 | title="Share…" |
---|
182 | tooltip="<%=sharePermission ? "Share this scan to other user, groups and projects" : "You do not have permission to share this scan"%>" |
---|
183 | /> |
---|
184 | <tbl:button |
---|
185 | disabled="<%=setOwnerPermission ? false : true%>" |
---|
186 | image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" |
---|
187 | onclick="takeOwnership()" |
---|
188 | title="Take ownership…" |
---|
189 | visible="<%=!isOwner%>" |
---|
190 | tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" |
---|
191 | /> |
---|
192 | <tbl:button |
---|
193 | image="add.png" |
---|
194 | onclick="newRawBioAssay()" |
---|
195 | title="New raw bioassay…" |
---|
196 | tooltip="Create a new raw bioassay from this scan" |
---|
197 | visible="<%=sc.hasPermission(Permission.CREATE, Item.RAWBIOASSAY) && usePermission%>" |
---|
198 | /> |
---|
199 | <tbl:button |
---|
200 | image="import.gif" |
---|
201 | onclick="runPlugin('ImportItem')" |
---|
202 | title="Import…" |
---|
203 | tooltip="Import data" |
---|
204 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
205 | /> |
---|
206 | <tbl:button |
---|
207 | image="export.gif" |
---|
208 | onclick="runPlugin('ExportItem')" |
---|
209 | title="Export…" |
---|
210 | tooltip="Export data" |
---|
211 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
212 | /> |
---|
213 | <tbl:button |
---|
214 | image="runplugin.gif" |
---|
215 | onclick="runPlugin('RunPlugin')" |
---|
216 | title="Run plugin…" |
---|
217 | tooltip="Run a plugin" |
---|
218 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
219 | /> |
---|
220 | <tbl:button |
---|
221 | image="help.gif" |
---|
222 | onclick="<%="Main.openHelp('" + ID +"', 'scan.view.properties')"%>" |
---|
223 | title="Help…" |
---|
224 | tooltip="Get help about this page" |
---|
225 | /> |
---|
226 | </tbl:toolbar> |
---|
227 | <div class="boxedbottom"> |
---|
228 | <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(scan)%></i></div> |
---|
229 | <% |
---|
230 | if (scan.isRemoved() || scan.isShared()) |
---|
231 | { |
---|
232 | %> |
---|
233 | <div class="itemstatus"> |
---|
234 | <base:icon image="deleted.gif" |
---|
235 | visible="<%=scan.isRemoved()%>"> This item has been flagged for deletion<br></base:icon> |
---|
236 | <base:icon image="shared.gif" |
---|
237 | visible="<%=scan.isShared()%>"> This item is shared to other user, groups and/or projects</base:icon> |
---|
238 | </div> |
---|
239 | <% |
---|
240 | } |
---|
241 | %> |
---|
242 | <table class="form" cellspacing=0> |
---|
243 | <tr> |
---|
244 | <td class="prompt">Name</td> |
---|
245 | <td><%=HTML.encodeTags(scan.getName())%></td> |
---|
246 | </tr> |
---|
247 | <tr> |
---|
248 | <td class="prompt">Hybridization</td> |
---|
249 | <td><base:propertyvalue item="<%=scan%>" property="hybridization" /></td> |
---|
250 | </tr> |
---|
251 | <tr> |
---|
252 | <td class="prompt">Scanner</td> |
---|
253 | <td><base:propertyvalue item="<%=scan%>" property="scanner" /></td> |
---|
254 | </tr> |
---|
255 | <tr> |
---|
256 | <td class="prompt">Protocol</td> |
---|
257 | <td><base:propertyvalue item="<%=scan%>" property="protocol" /></td> |
---|
258 | </tr> |
---|
259 | <tr> |
---|
260 | <td class="prompt">Owner</td> |
---|
261 | <td><base:propertyvalue item="<%=scan%>" property="owner" /></td> |
---|
262 | </tr> |
---|
263 | <tr> |
---|
264 | <td class="prompt">Description</td> |
---|
265 | <td><%=HTML.niceFormat(scan.getDescription())%></td> |
---|
266 | </tr> |
---|
267 | </table> |
---|
268 | |
---|
269 | <% |
---|
270 | ItemQuery<RawBioAssay> rawQuery = scan.getRawBioAssays(); |
---|
271 | rawQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT); |
---|
272 | rawQuery.order(Orders.asc(Hql.property("name"))); |
---|
273 | ItemResultList<RawBioAssay> raw = rawQuery.list(dc); |
---|
274 | if (raw.size() == 0) |
---|
275 | { |
---|
276 | %> |
---|
277 | <h4>Raw bioassays</h4> |
---|
278 | No raw bioassays has been created from this scan |
---|
279 | (or, you don't have permission to view them). |
---|
280 | <% |
---|
281 | } |
---|
282 | else |
---|
283 | { |
---|
284 | %> |
---|
285 | <h4 class="docked">Raw bioassays</h4> |
---|
286 | <tbl:table |
---|
287 | id="rawBioAssays" |
---|
288 | clazz="itemlist" |
---|
289 | columns="all" |
---|
290 | > |
---|
291 | <tbl:columndef |
---|
292 | id="name" |
---|
293 | title="Name" |
---|
294 | /> |
---|
295 | <tbl:columndef |
---|
296 | id="type" |
---|
297 | title="Type" |
---|
298 | /> |
---|
299 | <tbl:columndef |
---|
300 | id="software" |
---|
301 | title="Software" |
---|
302 | /> |
---|
303 | <tbl:columndef |
---|
304 | id="data" |
---|
305 | title="Data" |
---|
306 | /> |
---|
307 | <tbl:columndef |
---|
308 | id="arrayDesign" |
---|
309 | title="Array design" |
---|
310 | /> |
---|
311 | <tbl:columndef |
---|
312 | id="description" |
---|
313 | title="Description" |
---|
314 | /> |
---|
315 | <tbl:data> |
---|
316 | <tbl:columns> |
---|
317 | </tbl:columns> |
---|
318 | <tbl:rows> |
---|
319 | <% |
---|
320 | for (RawBioAssay item : raw) |
---|
321 | { |
---|
322 | %> |
---|
323 | <tbl:row> |
---|
324 | <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
325 | <tbl:cell column="type"><%=HTML.encodeTags(item.getRawDataType().getName())%></tbl:cell> |
---|
326 | <tbl:cell column="software"><base:propertyvalue item="<%=item%>" property="software" /></tbl:cell> |
---|
327 | <tbl:cell column="data"><%=item.hasData() ? "yes (" + item.getSpots() + " spots)" : "no"%></tbl:cell> |
---|
328 | <tbl:cell column="arrayDesign"><base:propertyvalue item="<%=item%>" property="arrayDesign" /></tbl:cell> |
---|
329 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
330 | </tbl:row> |
---|
331 | <% |
---|
332 | } |
---|
333 | %> |
---|
334 | </tbl:rows> |
---|
335 | </tbl:data> |
---|
336 | </tbl:table> |
---|
337 | <% |
---|
338 | } |
---|
339 | %> |
---|
340 | |
---|
341 | </div> |
---|
342 | </t:tab> |
---|
343 | |
---|
344 | <t:tab id="annotations" title="Annotations & parameters" |
---|
345 | tooltip="View annotation values and protocol parameters"> |
---|
346 | <div class="boxed"> |
---|
347 | <jsp:include page="../../common/annotations/list_annotations.jsp"> |
---|
348 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
349 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
350 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
351 | </jsp:include> |
---|
352 | </div> |
---|
353 | </t:tab> |
---|
354 | |
---|
355 | <t:tab id="images" title="Images" /> |
---|
356 | </t:tabcontrol> |
---|
357 | |
---|
358 | |
---|
359 | </base:body> |
---|
360 | </base:page> |
---|
361 | <% |
---|
362 | } |
---|
363 | finally |
---|
364 | { |
---|
365 | if (dc != null) dc.close(); |
---|
366 | } |
---|
367 | |
---|
368 | %> |
---|