1 | <%-- $Id: view_design.jsp 4889 2009-04-06 12:52:39Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
---|
4 | Copyright (C) 2007 Nicklas Nordborg, 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 session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.SystemItems" |
---|
30 | import="net.sf.basedb.core.Group" |
---|
31 | import="net.sf.basedb.core.Item" |
---|
32 | import="net.sf.basedb.core.ItemContext" |
---|
33 | import="net.sf.basedb.core.ItemResultIterator" |
---|
34 | import="net.sf.basedb.core.Permission" |
---|
35 | import="net.sf.basedb.core.AnnotationType" |
---|
36 | import="net.sf.basedb.core.FileSet" |
---|
37 | import="net.sf.basedb.core.FileSetMember" |
---|
38 | import="net.sf.basedb.core.DataFileType" |
---|
39 | import="net.sf.basedb.core.AnnotationSet" |
---|
40 | import="net.sf.basedb.core.ArrayDesign" |
---|
41 | import="net.sf.basedb.core.ArrayBatch" |
---|
42 | import="net.sf.basedb.core.Affymetrix" |
---|
43 | import="net.sf.basedb.core.File" |
---|
44 | import="net.sf.basedb.core.ArrayDesignPlate" |
---|
45 | import="net.sf.basedb.core.Plate" |
---|
46 | import="net.sf.basedb.core.User" |
---|
47 | import="net.sf.basedb.core.Job" |
---|
48 | import="net.sf.basedb.core.ItemQuery" |
---|
49 | import="net.sf.basedb.core.Include" |
---|
50 | import="net.sf.basedb.core.ItemResultList" |
---|
51 | import="net.sf.basedb.core.MultiPermissions" |
---|
52 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
53 | import="net.sf.basedb.core.PluginDefinition" |
---|
54 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
55 | import="net.sf.basedb.core.plugin.Plugin" |
---|
56 | import="net.sf.basedb.core.Project" |
---|
57 | import="net.sf.basedb.core.query.Orders" |
---|
58 | import="net.sf.basedb.core.query.Hql" |
---|
59 | import="net.sf.basedb.util.formatter.Formatter" |
---|
60 | import="net.sf.basedb.clients.web.Base" |
---|
61 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
62 | import="net.sf.basedb.clients.web.util.HTML" |
---|
63 | import="net.sf.basedb.util.Values" |
---|
64 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
65 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
66 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
67 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
68 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
69 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
70 | import="java.util.Collections" |
---|
71 | import="java.util.Date" |
---|
72 | import="java.util.Map" |
---|
73 | import="java.util.Set" |
---|
74 | import="java.util.List" |
---|
75 | import="java.util.Date" |
---|
76 | %> |
---|
77 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
78 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
79 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
80 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
81 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
82 | <%! |
---|
83 | private static final Item itemType = Item.ARRAYDESIGN; |
---|
84 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
85 | %> |
---|
86 | <% |
---|
87 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
88 | final String ID = sc.getId(); |
---|
89 | final String root = request.getContextPath()+"/"; |
---|
90 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
91 | final int itemId = cc.getId(); |
---|
92 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
93 | final float scale = Base.getScale(sc); |
---|
94 | final DbControl dc = sc.newDbControl(); |
---|
95 | try |
---|
96 | { |
---|
97 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
98 | |
---|
99 | String title = null; |
---|
100 | ArrayDesign design = ArrayDesign.getById(dc, itemId); |
---|
101 | Job job = null; |
---|
102 | boolean readJob = true; |
---|
103 | try |
---|
104 | { |
---|
105 | job = design.getJob(); |
---|
106 | } |
---|
107 | catch (PermissionDeniedException ex) |
---|
108 | { |
---|
109 | readJob = false; |
---|
110 | } |
---|
111 | final Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
112 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
113 | |
---|
114 | final boolean usePermission = design.hasPermission(Permission.USE); |
---|
115 | final boolean writePermission = design.hasPermission(Permission.WRITE); |
---|
116 | final boolean deletePermission = design.hasPermission(Permission.DELETE); |
---|
117 | final boolean sharePermission = design.hasPermission(Permission.SET_PERMISSION); |
---|
118 | final boolean setOwnerPermission = design.hasPermission(Permission.SET_OWNER); |
---|
119 | final boolean isRemoved = design.isRemoved(); |
---|
120 | final boolean isUsed = isRemoved && design.isUsed(); |
---|
121 | final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
---|
122 | final boolean isOwner = design.isOwner(); |
---|
123 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, design); |
---|
124 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
125 | %> |
---|
126 | <base:page title="<%=title%>"> |
---|
127 | <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
128 | <ext:scripts context="<%=jspContext%>" /> |
---|
129 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
130 | <script language="JavaScript"> |
---|
131 | function editItem() |
---|
132 | { |
---|
133 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
134 | } |
---|
135 | function shareItem() |
---|
136 | { |
---|
137 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareArrayDesign', 600, 400); |
---|
138 | } |
---|
139 | function deleteItem() |
---|
140 | { |
---|
141 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
142 | } |
---|
143 | function restoreItem() |
---|
144 | { |
---|
145 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
146 | } |
---|
147 | function deleteItemPermanently() |
---|
148 | { |
---|
149 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted'); |
---|
150 | } |
---|
151 | function itemDeleted() |
---|
152 | { |
---|
153 | Main.listItems('<%=ID%>', '<%=itemType.name()%>'); |
---|
154 | } |
---|
155 | function showUsingItems() |
---|
156 | { |
---|
157 | Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>); |
---|
158 | } |
---|
159 | function setOwner() |
---|
160 | { |
---|
161 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150); |
---|
162 | } |
---|
163 | function runPlugin(cmd) |
---|
164 | { |
---|
165 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540); |
---|
166 | } |
---|
167 | function viewFeatures() |
---|
168 | { |
---|
169 | location.href = 'features/index.jsp?ID=<%=ID%>&arraydesign_id=<%=itemId%>'; |
---|
170 | } |
---|
171 | function managePlates() |
---|
172 | { |
---|
173 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ManagePlates&item_id=<%=itemId%>', 'ManagePlates', 600, 400); |
---|
174 | } |
---|
175 | function switchTab(tabControlId, tabId) |
---|
176 | { |
---|
177 | if (TabControl.isActive(tabControlId, tabId)) return; |
---|
178 | if (tabId == 'overview' && tabId != '<%=tab%>') |
---|
179 | { |
---|
180 | location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId; |
---|
181 | } |
---|
182 | else if (tabId == 'features') |
---|
183 | { |
---|
184 | viewFeatures(); |
---|
185 | } |
---|
186 | else |
---|
187 | { |
---|
188 | TabControl.setActiveTab(tabControlId, tabId); |
---|
189 | } |
---|
190 | } |
---|
191 | function newBatch() |
---|
192 | { |
---|
193 | Main.viewOrEditItem('<%=ID%>', 'ARRAYBATCH', 0, true, '&arraydesign_id=<%=itemId%>'); |
---|
194 | } |
---|
195 | function verifyReporters() |
---|
196 | { |
---|
197 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=VerifyReporters&item_id=<%=itemId%>', 'VerifyReporters', 740, 540); |
---|
198 | } |
---|
199 | </script> |
---|
200 | </base:head> |
---|
201 | <base:body> |
---|
202 | <p> |
---|
203 | <p:path> |
---|
204 | <p:pathelement title="Array designs" href="<%="index.jsp?ID="+ID%>" /> |
---|
205 | <p:pathelement title="<%=HTML.encodeTags(design.getName())%>" /> |
---|
206 | </p:path> |
---|
207 | |
---|
208 | <t:tabcontrol id="main" active="<%=tab%>" switch="switchTab" remember="false"> |
---|
209 | <t:tab id="properties" title="Properties"> |
---|
210 | <tbl:toolbar |
---|
211 | > |
---|
212 | <tbl:button |
---|
213 | disabled="<%=writePermission ? false : true%>" |
---|
214 | image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" |
---|
215 | onclick="editItem()" |
---|
216 | title="Edit…" |
---|
217 | tooltip="<%=writePermission ? "Edit this array design" : "You do not have permission to edit this array design"%>" |
---|
218 | /> |
---|
219 | <tbl:button |
---|
220 | disabled="<%=deletePermission ? false : true%>" |
---|
221 | image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" |
---|
222 | onclick="deleteItem()" |
---|
223 | title="Delete" |
---|
224 | visible="<%=!design.isRemoved()%>" |
---|
225 | tooltip="<%=deletePermission ? "Delete this array design" : "You do not have permission to delete this array design"%>" |
---|
226 | /> |
---|
227 | <tbl:button |
---|
228 | disabled="<%=writePermission ? false : true%>" |
---|
229 | image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" |
---|
230 | onclick="restoreItem()" |
---|
231 | title="Restore" |
---|
232 | visible="<%=design.isRemoved()%>" |
---|
233 | tooltip="<%=writePermission ? "Restore this array design" : "You do not have permission to restore this array design"%>" |
---|
234 | /> |
---|
235 | <tbl:button |
---|
236 | disabled="<%=sharePermission ? false : true%>" |
---|
237 | image="<%=sharePermission ? "share.gif" : "share_disabled.gif"%>" |
---|
238 | onclick="shareItem()" |
---|
239 | title="Share…" |
---|
240 | tooltip="<%=sharePermission ? "Share this array design to other user, groups and projects" : "You do not have permission to share this array design"%>" |
---|
241 | /> |
---|
242 | <tbl:button |
---|
243 | disabled="<%=setOwnerPermission ? false : true%>" |
---|
244 | image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" |
---|
245 | onclick="setOwner()" |
---|
246 | title="Set owner…" |
---|
247 | tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" |
---|
248 | /> |
---|
249 | <tbl:button |
---|
250 | image="add.png" |
---|
251 | onclick="newBatch()" |
---|
252 | title="New batch…" |
---|
253 | tooltip="Create a new array batch with this design" |
---|
254 | visible="<%=sc.hasPermission(Permission.CREATE, Item.ARRAYBATCH) && usePermission%>" |
---|
255 | /> |
---|
256 | <tbl:button |
---|
257 | image="import.gif" |
---|
258 | onclick="runPlugin('ImportItem')" |
---|
259 | title="Import…" |
---|
260 | tooltip="Import data" |
---|
261 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
262 | /> |
---|
263 | <tbl:button |
---|
264 | image="export.gif" |
---|
265 | onclick="runPlugin('ExportItem')" |
---|
266 | title="Export…" |
---|
267 | tooltip="Export data" |
---|
268 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
269 | /> |
---|
270 | <tbl:button |
---|
271 | image="runplugin.gif" |
---|
272 | onclick="runPlugin('RunPlugin')" |
---|
273 | title="Run plugin…" |
---|
274 | tooltip="Run a plugin" |
---|
275 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
276 | /> |
---|
277 | <tbl:button |
---|
278 | onclick="managePlates()" |
---|
279 | title="Manage plates…" |
---|
280 | tooltip="Attach / detach plates to this array design" |
---|
281 | visible="<%=writePermission && !design.hasFeatures() && !design.isAffyChip()%>" |
---|
282 | /> |
---|
283 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
284 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
285 | <tbl:button |
---|
286 | image="help.gif" |
---|
287 | onclick="<%="Main.openHelp('" + ID +"', 'arraydesign.view.properties')"%>" |
---|
288 | title="Help…" |
---|
289 | tooltip="Get help about this page" |
---|
290 | /> |
---|
291 | </tbl:toolbar> |
---|
292 | |
---|
293 | <div class="boxedbottom"> |
---|
294 | <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(design)%></i></div> |
---|
295 | <% |
---|
296 | if (design.isRemoved() || design.isShared()) |
---|
297 | { |
---|
298 | %> |
---|
299 | <div class="itemstatus"> |
---|
300 | <base:icon |
---|
301 | image="<%=deletePermanentlyPermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
302 | onclick="<%=deletePermanentlyPermission ? "deleteItemPermanently()" : null%>" |
---|
303 | tooltip="<%=deletePermanentlyPermission ? "Permanently delete this item" : null%>" |
---|
304 | visible="<%=isRemoved%>"> This item has been flagged for deletion<br></base:icon> |
---|
305 | <base:icon image="used.gif" |
---|
306 | onclick="showUsingItems()" |
---|
307 | tooltip="Show the items that are using this one" |
---|
308 | visible="<%=isUsed%>"> This item is used by other items and can't be permanently deleted<br></base:icon> |
---|
309 | <base:icon image="shared.gif" |
---|
310 | visible="<%=design.isShared()%>"> This item is shared to other users, groups and/or projects</base:icon> |
---|
311 | </div> |
---|
312 | <% |
---|
313 | } |
---|
314 | %> |
---|
315 | |
---|
316 | <table width="100%"> |
---|
317 | <tr valign="top"> |
---|
318 | <td> |
---|
319 | |
---|
320 | <table class="form" cellspacing="0"> |
---|
321 | <tr> |
---|
322 | <td class="prompt">Name</td> |
---|
323 | <td><%=HTML.encodeTags(design.getName())%></td> |
---|
324 | </tr> |
---|
325 | <tr> |
---|
326 | <td class="prompt">Registered</td> |
---|
327 | <td><%=dateFormatter.format(design.getEntryDate())%></td> |
---|
328 | </tr> |
---|
329 | <tr> |
---|
330 | <td class="prompt">Platform</td> |
---|
331 | <td><base:propertyvalue item="<%=design%>" property="platform" /></td> |
---|
332 | </tr> |
---|
333 | <tr> |
---|
334 | <td class="prompt">Variant</td> |
---|
335 | <td><base:propertyvalue item="<%=design%>" property="variant" /></td> |
---|
336 | </tr> |
---|
337 | <tr> |
---|
338 | <td class="prompt">Arrays per slide</td> |
---|
339 | <td><%=design.getNumArrays()%></td> |
---|
340 | </tr> |
---|
341 | <tr> |
---|
342 | <td class="prompt">Features</td> |
---|
343 | <td><%=design.hasFeatures() ? "yes (db: " + design.getNumDbFeatures() + "; file: " + design.getNumFileFeatures() + ")" : "no"%></td> |
---|
344 | </tr> |
---|
345 | <tr> |
---|
346 | <td class="prompt">Feature identification method</td> |
---|
347 | <td><%=design.getFeatureIdentificationMethod()%></td> |
---|
348 | </tr> |
---|
349 | <tr> |
---|
350 | <td class="prompt">Owner</td> |
---|
351 | <td><base:propertyvalue item="<%=design%>" property="owner" /></td> |
---|
352 | </tr> |
---|
353 | <tr> |
---|
354 | <td class="prompt">Description</td> |
---|
355 | <td><%=HTML.niceFormat(design.getDescription())%></td> |
---|
356 | </tr> |
---|
357 | </table> |
---|
358 | |
---|
359 | </td> |
---|
360 | <td> |
---|
361 | <% |
---|
362 | if (design.getNumDbFeatures() > 0) |
---|
363 | { |
---|
364 | %> |
---|
365 | <h4 style="margin-top: 0px;">Feature import</h4> |
---|
366 | <table class="form" cellspacing="0"> |
---|
367 | <tr> |
---|
368 | <td class="prompt">Job</td> |
---|
369 | <td><%=Base.getLinkedName(ID, job, !readJob, true)%></td> |
---|
370 | </tr> |
---|
371 | <tr> |
---|
372 | <td class="prompt">Date / time</td> |
---|
373 | <td><%=job == null ? "" : dateTimeFormatter.format(job.getEnded())%></td> |
---|
374 | </tr> |
---|
375 | <tr> |
---|
376 | <td class="prompt">Plugin</td> |
---|
377 | <td><base:propertyvalue item="<%=design%>" property="job.pluginDefinition" /></td> |
---|
378 | </tr> |
---|
379 | <tr> |
---|
380 | <td class="prompt">Configuration / file format</td> |
---|
381 | <td><base:propertyvalue item="<%=design%>" property="job.pluginConfiguration" /></td> |
---|
382 | </tr> |
---|
383 | </table> |
---|
384 | <% |
---|
385 | } |
---|
386 | %> |
---|
387 | |
---|
388 | </td> |
---|
389 | </tr> |
---|
390 | </table> |
---|
391 | |
---|
392 | <jsp:include page="../../common/datafiles/list_files.jsp"> |
---|
393 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
394 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
395 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
396 | </jsp:include> |
---|
397 | |
---|
398 | <% |
---|
399 | ItemQuery<ArrayBatch> batchQuery = design.getArrayBatches(); |
---|
400 | batchQuery.include(Include.ALL); |
---|
401 | batchQuery.order(Orders.asc(Hql.property("name"))); |
---|
402 | ItemResultList<ArrayBatch> batches = batchQuery.list(dc); |
---|
403 | if (batches.size() == 0) |
---|
404 | { |
---|
405 | %> |
---|
406 | <h4>Array batches</h4> |
---|
407 | No batches exists for this design |
---|
408 | (or, you don't have permission to view them). |
---|
409 | <% |
---|
410 | } |
---|
411 | else |
---|
412 | { |
---|
413 | %> |
---|
414 | <base:section |
---|
415 | id="batches" |
---|
416 | title="<%="Array batches (" + batches.size() +")"%>" |
---|
417 | context="<%=cc%>"> |
---|
418 | <tbl:table |
---|
419 | id="batches" |
---|
420 | clazz="itemlist" |
---|
421 | columns="all" |
---|
422 | > |
---|
423 | <tbl:columndef |
---|
424 | id="name" |
---|
425 | title="Name" |
---|
426 | /> |
---|
427 | <tbl:columndef |
---|
428 | id="description" |
---|
429 | title="Description" |
---|
430 | /> |
---|
431 | <tbl:data> |
---|
432 | <tbl:columns> |
---|
433 | </tbl:columns> |
---|
434 | <tbl:rows> |
---|
435 | <% |
---|
436 | for (ArrayBatch item : batches) |
---|
437 | { |
---|
438 | %> |
---|
439 | <tbl:row> |
---|
440 | <tbl:cell column="name"><base:icon |
---|
441 | image="deleted.gif" |
---|
442 | tooltip="This item has been scheduled for deletion" |
---|
443 | visible="<%=item.isRemoved()%>" |
---|
444 | /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
445 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
446 | </tbl:row> |
---|
447 | <% |
---|
448 | } |
---|
449 | %> |
---|
450 | </tbl:rows> |
---|
451 | </tbl:data> |
---|
452 | </tbl:table> |
---|
453 | </base:section> |
---|
454 | <% |
---|
455 | } |
---|
456 | %> |
---|
457 | |
---|
458 | <% |
---|
459 | ItemQuery<ArrayDesignPlate> platesQuery = design.getArrayDesignPlates(); |
---|
460 | platesQuery.include(Include.ALL); |
---|
461 | platesQuery.order(Orders.asc(Hql.property("position"))); |
---|
462 | ItemResultList<ArrayDesignPlate> plates = platesQuery.list(dc); |
---|
463 | if (plates.size() == 0) |
---|
464 | { |
---|
465 | %> |
---|
466 | <h4>Plates</h4> |
---|
467 | This array design isn't connected to any plates (or, you don't have permission to view them). |
---|
468 | <% |
---|
469 | } |
---|
470 | else |
---|
471 | { |
---|
472 | %> |
---|
473 | <base:section |
---|
474 | id="plates" |
---|
475 | title="<%="Plates (" + plates.size() +")"%>" |
---|
476 | context="<%=cc%>"> |
---|
477 | <tbl:table |
---|
478 | id="plates" |
---|
479 | clazz="itemlist" |
---|
480 | columns="all" |
---|
481 | > |
---|
482 | <tbl:columndef |
---|
483 | id="name" |
---|
484 | title="Name" |
---|
485 | /> |
---|
486 | <tbl:columndef |
---|
487 | id="position" |
---|
488 | title="Position" |
---|
489 | /> |
---|
490 | <tbl:columndef |
---|
491 | id="description" |
---|
492 | title="Description" |
---|
493 | /> |
---|
494 | <tbl:data> |
---|
495 | <tbl:columns> |
---|
496 | </tbl:columns> |
---|
497 | <tbl:rows> |
---|
498 | <% |
---|
499 | for (ArrayDesignPlate item : plates) |
---|
500 | { |
---|
501 | Plate plate = null; |
---|
502 | boolean readPlate = true; |
---|
503 | try |
---|
504 | { |
---|
505 | plate = item.getPlate(); |
---|
506 | } |
---|
507 | catch (PermissionDeniedException ex) |
---|
508 | { |
---|
509 | readPlate = false; |
---|
510 | } |
---|
511 | %> |
---|
512 | <tbl:row> |
---|
513 | <tbl:cell column="name"><base:icon |
---|
514 | image="deleted.gif" |
---|
515 | tooltip="This item has been scheduled for deletion" |
---|
516 | visible="<%=plate != null && plate.isRemoved()%>" |
---|
517 | /><%=Base.getLinkedName(ID, plate, !readPlate, true)%></tbl:cell> |
---|
518 | <tbl:cell column="position"><%=item.getPosition()+1%></tbl:cell> |
---|
519 | <tbl:cell column="description"><%=HTML.encodeTags(plate == null ? "" : plate.getDescription())%></tbl:cell> |
---|
520 | </tbl:row> |
---|
521 | <% |
---|
522 | } |
---|
523 | %> |
---|
524 | </tbl:rows> |
---|
525 | </tbl:data> |
---|
526 | </tbl:table> |
---|
527 | </base:section> |
---|
528 | <% |
---|
529 | } |
---|
530 | %> |
---|
531 | |
---|
532 | |
---|
533 | <% |
---|
534 | // Tables with users/groups/projects that this item is shared to |
---|
535 | MultiPermissions mp = new MultiPermissions(Collections.singleton(design)); |
---|
536 | ItemResultIterator<User> users = mp.getUsers().iterate(dc); |
---|
537 | ItemResultIterator<Group> groups = mp.getGroups().iterate(dc); |
---|
538 | ItemResultIterator<Project> projects = mp.getProjects().iterate(dc); |
---|
539 | |
---|
540 | if (users.hasNext() || groups.hasNext() || projects.hasNext()) |
---|
541 | { |
---|
542 | %> |
---|
543 | <base:section |
---|
544 | id="sharedTo" |
---|
545 | title="Shared to" |
---|
546 | context="<%=cc%>"> |
---|
547 | <tbl:table |
---|
548 | id="itemsSharedTo" |
---|
549 | clazz="itemlist" |
---|
550 | columns="all" |
---|
551 | > |
---|
552 | <tbl:columndef |
---|
553 | id="itemType" |
---|
554 | title="Item type" |
---|
555 | /> |
---|
556 | <tbl:columndef |
---|
557 | id="name" |
---|
558 | title="Name" |
---|
559 | /> |
---|
560 | <tbl:columndef |
---|
561 | id="permissions" |
---|
562 | title="Permissions" |
---|
563 | /> |
---|
564 | <tbl:data> |
---|
565 | <tbl:columns> |
---|
566 | </tbl:columns> |
---|
567 | <tbl:rows> |
---|
568 | <% |
---|
569 | while(projects.hasNext()) |
---|
570 | { |
---|
571 | Project project = projects.next(); |
---|
572 | Set<Permission> permissions = mp.getPermissions(project).values().iterator().next(); |
---|
573 | %> |
---|
574 | <tbl:row> |
---|
575 | <tbl:cell column="itemType"><%=project.getType()%></tbl:cell> |
---|
576 | <tbl:cell column="name"><base:icon |
---|
577 | image="deleted.gif" |
---|
578 | tooltip="This item has been scheduled for deletion" |
---|
579 | visible="<%=project.isRemoved()%>" |
---|
580 | /><%=Base.getLinkedName(ID, project, false, true)%></tbl:cell> |
---|
581 | <tbl:cell column="permissions"> |
---|
582 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
583 | </tbl:cell> |
---|
584 | </tbl:row> |
---|
585 | <% |
---|
586 | } |
---|
587 | while(groups.hasNext()) |
---|
588 | { |
---|
589 | Group group = groups.next(); |
---|
590 | Set<Permission> permissions = mp.getPermissions(group).values().iterator().next(); |
---|
591 | %> |
---|
592 | <tbl:row> |
---|
593 | <tbl:cell column="itemType"><%=group.getType()%></tbl:cell> |
---|
594 | <tbl:cell column="name"><base:icon |
---|
595 | image="deleted.gif" |
---|
596 | tooltip="This item has been scheduled for deletion" |
---|
597 | visible="<%=group.isRemoved()%>" |
---|
598 | /><%=Base.getLinkedName(ID, group, false, true)%></tbl:cell> |
---|
599 | <tbl:cell column="permissions"> |
---|
600 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
601 | </tbl:cell> |
---|
602 | </tbl:row> |
---|
603 | <% |
---|
604 | } |
---|
605 | while (users.hasNext()) |
---|
606 | { |
---|
607 | User user = users.next(); |
---|
608 | Set<Permission> permissions = mp.getPermissions(user).values().iterator().next(); |
---|
609 | %> |
---|
610 | <tbl:row> |
---|
611 | <tbl:cell column="itemType"><%=user.getType()%></tbl:cell> |
---|
612 | <tbl:cell column="name"><base:icon |
---|
613 | image="deleted.gif" |
---|
614 | tooltip="This item has been scheduled for deletion" |
---|
615 | visible="<%=user.isRemoved()%>" |
---|
616 | /><%=Base.getLinkedName(ID, user, false, true)%></tbl:cell> |
---|
617 | <tbl:cell column="permissions"> |
---|
618 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
619 | </tbl:cell> |
---|
620 | </tbl:row> |
---|
621 | <% |
---|
622 | } |
---|
623 | %> |
---|
624 | </tbl:rows> |
---|
625 | </tbl:data> |
---|
626 | </tbl:table> |
---|
627 | </base:section> |
---|
628 | <% |
---|
629 | } |
---|
630 | else |
---|
631 | { |
---|
632 | %> |
---|
633 | <h4>Shared to</h4> |
---|
634 | This array design is not shared |
---|
635 | (or, you don't have permission to view the ones it is shared to). |
---|
636 | <% |
---|
637 | } |
---|
638 | %> |
---|
639 | |
---|
640 | </div> |
---|
641 | </t:tab> |
---|
642 | |
---|
643 | <t:tab id="annotations" title="Annotations" > |
---|
644 | <div class="boxed"> |
---|
645 | <jsp:include page="../../common/annotations/list_annotations.jsp"> |
---|
646 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
647 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
648 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
649 | </jsp:include> |
---|
650 | </div> |
---|
651 | </t:tab> |
---|
652 | |
---|
653 | <t:tab id="features" title="Features" visible="<%=design.getNumDbFeatures() > 0%>"/> |
---|
654 | |
---|
655 | <t:tab id="overview" title="Overview" |
---|
656 | tooltip="Display a tree overview of related items"> |
---|
657 | <% |
---|
658 | if ("overview".equals(tab)) |
---|
659 | { |
---|
660 | %> |
---|
661 | <jsp:include page="../../common/overview/overview.jsp"> |
---|
662 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
663 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
664 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
665 | </jsp:include> |
---|
666 | <% |
---|
667 | } |
---|
668 | %> |
---|
669 | </t:tab> |
---|
670 | </t:tabcontrol> |
---|
671 | |
---|
672 | </base:body> |
---|
673 | </base:page> |
---|
674 | <% |
---|
675 | } |
---|
676 | finally |
---|
677 | { |
---|
678 | if (dc != null) dc.close(); |
---|
679 | } |
---|
680 | |
---|
681 | %> |
---|