1 | <%-- $Id: view_details.jsp 5950 2012-02-09 10:30:23Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Nicklas Nordborg |
---|
4 | Copyright (C) 2007 Johan Enell |
---|
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.SystemItems" |
---|
30 | import="net.sf.basedb.core.BasicItem" |
---|
31 | import="net.sf.basedb.core.Item" |
---|
32 | import="net.sf.basedb.core.Location" |
---|
33 | import="net.sf.basedb.core.ItemContext" |
---|
34 | import="net.sf.basedb.core.Permission" |
---|
35 | import="net.sf.basedb.core.DiskUsage" |
---|
36 | import="net.sf.basedb.core.DiskUsageStatistics" |
---|
37 | import="net.sf.basedb.core.DiskConsumable" |
---|
38 | import="net.sf.basedb.core.Quota" |
---|
39 | import="net.sf.basedb.core.User" |
---|
40 | import="net.sf.basedb.core.Group" |
---|
41 | import="net.sf.basedb.core.Nameable" |
---|
42 | import="net.sf.basedb.core.Removable" |
---|
43 | import="net.sf.basedb.core.File" |
---|
44 | import="net.sf.basedb.core.QuotaType" |
---|
45 | import="net.sf.basedb.core.Metadata" |
---|
46 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
47 | import="net.sf.basedb.core.PluginDefinition" |
---|
48 | import="net.sf.basedb.core.ItemQuery" |
---|
49 | import="net.sf.basedb.core.ItemResultIterator" |
---|
50 | import="net.sf.basedb.core.Include" |
---|
51 | import="net.sf.basedb.core.Quantity" |
---|
52 | import="net.sf.basedb.core.Unit" |
---|
53 | import="net.sf.basedb.util.Enumeration" |
---|
54 | import="net.sf.basedb.core.query.Orders" |
---|
55 | import="net.sf.basedb.core.query.Hql" |
---|
56 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
57 | import="net.sf.basedb.core.plugin.Plugin" |
---|
58 | import="net.sf.basedb.util.units.UnitUtil" |
---|
59 | import="net.sf.basedb.clients.web.Base" |
---|
60 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
61 | import="net.sf.basedb.clients.web.util.HTML" |
---|
62 | import="net.sf.basedb.util.Values" |
---|
63 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
64 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
65 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
66 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
67 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
68 | import="java.util.Map" |
---|
69 | import="java.util.List" |
---|
70 | %> |
---|
71 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
72 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
73 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
74 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
75 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
76 | <%! |
---|
77 | private static final String subContext = "diskUsage"; |
---|
78 | private static final Enumeration<String, String> itemTypes = new Enumeration<String, String>(); |
---|
79 | static |
---|
80 | { |
---|
81 | for (Item item : Metadata.getDiskConsumableItems()) |
---|
82 | { |
---|
83 | itemTypes.add(String.valueOf(item.getValue()), item.toString()); |
---|
84 | } |
---|
85 | } |
---|
86 | private static final Enumeration<String, String> locations = new Enumeration<String, String>(); |
---|
87 | static |
---|
88 | { |
---|
89 | for (Location l : Location.values()) |
---|
90 | { |
---|
91 | locations.add(String.valueOf(l.getValue()), l.toString()); |
---|
92 | } |
---|
93 | } |
---|
94 | %> |
---|
95 | <% |
---|
96 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
97 | final String ID = sc.getId(); |
---|
98 | final Item itemType = Item.valueOf(request.getParameter("item_type")); |
---|
99 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, null, null); |
---|
100 | final int itemId = cc.getId(); |
---|
101 | final float scale = Base.getScale(sc); |
---|
102 | final DbControl dc = sc.newDbControl(); |
---|
103 | ItemResultIterator<DiskUsage> diskUsage = null; |
---|
104 | try |
---|
105 | { |
---|
106 | Unit bytes = UnitUtil.getUnit(dc, Quantity.STORAGE_SIZE, "B"); |
---|
107 | String title = null; |
---|
108 | User user = null; |
---|
109 | Group group = null; |
---|
110 | boolean writePermission = false; |
---|
111 | final boolean hasDiskUsagePermission = sc.hasPermission(Permission.READ, Item.DISKUSAGE); |
---|
112 | DiskUsageStatistics statistics = (DiskUsageStatistics)sc.getSessionSetting("diskUsageStatistics"); |
---|
113 | String returnCmd = null; |
---|
114 | if (statistics == null) |
---|
115 | { |
---|
116 | statistics = DiskUsage.getStatistics(dc); |
---|
117 | sc.setSessionSetting("diskUsageStatistics", statistics); |
---|
118 | } |
---|
119 | statistics.setDbControl(dc); |
---|
120 | List<QuotaType> quotaTypes = statistics.getQuotaTypes(); |
---|
121 | DiskUsageStatistics.Summary summary = null; |
---|
122 | if (itemType == Item.USER) |
---|
123 | { |
---|
124 | user = User.getById(dc, itemId); |
---|
125 | title = user.getName() + " (user)"; |
---|
126 | writePermission = user.hasPermission(Permission.WRITE); |
---|
127 | summary = statistics.getSummary(user); |
---|
128 | returnCmd = "ListUsers"; |
---|
129 | } |
---|
130 | else |
---|
131 | { |
---|
132 | group = Group.getById(dc, itemId); |
---|
133 | title = group.getName() + " (group)"; |
---|
134 | writePermission = group.hasPermission(Permission.WRITE); |
---|
135 | summary = statistics.getSummary(group); |
---|
136 | returnCmd = "ListGroups"; |
---|
137 | } |
---|
138 | long totalCount = 0; |
---|
139 | int numListed = 0; |
---|
140 | try |
---|
141 | { |
---|
142 | final ItemQuery<DiskUsage> query = Base.getConfiguredQuery(dc, cc, true, DiskUsage.getQuery(user, group), null); |
---|
143 | diskUsage = query.iterate(dc); |
---|
144 | totalCount = diskUsage.getTotalCount(); |
---|
145 | } |
---|
146 | catch (Throwable t) |
---|
147 | { |
---|
148 | cc.setMessage(t.getMessage()); |
---|
149 | } |
---|
150 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, |
---|
151 | GuiContext.list(Item.DISKUSAGE), user == null ? group : user); |
---|
152 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
153 | %> |
---|
154 | <base:page > |
---|
155 | <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> |
---|
156 | <ext:scripts context="<%=jspContext%>" /> |
---|
157 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
158 | <script language="JavaScript"> |
---|
159 | var formId = 'items'; |
---|
160 | var submitPage = 'index.jsp'; |
---|
161 | function editItem() |
---|
162 | { |
---|
163 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
164 | } |
---|
165 | function configureColumns() |
---|
166 | { |
---|
167 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>', '<%=subContext%>'); |
---|
168 | } |
---|
169 | function presetOnChange() |
---|
170 | { |
---|
171 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>', '<%=subContext%>'); |
---|
172 | } |
---|
173 | function deleteItems() |
---|
174 | { |
---|
175 | var frm = document.forms[formId]; |
---|
176 | if (Forms.numChecked(frm, /item:/) == 0) |
---|
177 | { |
---|
178 | alert('Please select at least one item in the list'); |
---|
179 | return; |
---|
180 | } |
---|
181 | frm.action = submitPage; |
---|
182 | frm.cmd.value = 'DeleteItems'; |
---|
183 | frm.submit(); |
---|
184 | } |
---|
185 | function restoreItems() |
---|
186 | { |
---|
187 | var frm = document.forms[formId]; |
---|
188 | if (Forms.numChecked(frm, /item:/) == 0) |
---|
189 | { |
---|
190 | alert('Please select at least one item in the list'); |
---|
191 | return; |
---|
192 | } |
---|
193 | frm.action = submitPage; |
---|
194 | frm.cmd.value = 'RestoreItems'; |
---|
195 | frm.submit(); |
---|
196 | } |
---|
197 | function shareItems() |
---|
198 | { |
---|
199 | Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems', /item:/); |
---|
200 | } |
---|
201 | </script> |
---|
202 | <style> |
---|
203 | table.special |
---|
204 | { |
---|
205 | border-collapse: collapse; |
---|
206 | width: auto; |
---|
207 | } |
---|
208 | table.special td, table.special tr:first-child th |
---|
209 | { |
---|
210 | text-align: right; |
---|
211 | border-right: 1px dotted #A0A0A0; |
---|
212 | } |
---|
213 | |
---|
214 | </style> |
---|
215 | </base:head> |
---|
216 | <base:body> |
---|
217 | <p:path><p:pathelement |
---|
218 | title="Disk usage" enabled="<%=hasDiskUsagePermission%>" |
---|
219 | href="<%="../index.jsp?ID="+ID+"&cmd="+returnCmd%>" |
---|
220 | /><p:pathelement title="<%=HTML.encodeTags(title)%>" |
---|
221 | /></p:path> |
---|
222 | |
---|
223 | <t:tabcontrol id="main" |
---|
224 | subclass="mastertabcontrol content"> |
---|
225 | <t:tab id="details" title="Details"> |
---|
226 | <div> |
---|
227 | <table class="fullform" style="height: auto;"> |
---|
228 | <tr> |
---|
229 | <th class="itemstatus"></th> |
---|
230 | <td style="padding: 0px;"> |
---|
231 | <tbl:toolbar subclass="bottomborder"> |
---|
232 | <tbl:button |
---|
233 | disabled="<%=!writePermission%>" |
---|
234 | image="edit.png" |
---|
235 | onclick="editItem()" |
---|
236 | title="Edit…" |
---|
237 | tooltip="<%=writePermission ? "Edit this item" : "You do not have permission to edit this item"%>" |
---|
238 | /> |
---|
239 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
240 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
241 | <tbl:button |
---|
242 | image="help.png" |
---|
243 | onclick="<%="Main.openHelp('" + ID +"', 'diskusage.details')"%>" |
---|
244 | title="Help…" |
---|
245 | tooltip="Get help about this page" |
---|
246 | /> |
---|
247 | </tbl:toolbar> |
---|
248 | </td> |
---|
249 | </tr> |
---|
250 | </table> |
---|
251 | <table style="width: 100%; height: 8em;" class="bottomborder"> |
---|
252 | <tr valign="top"> |
---|
253 | <td style="width: 50%; height: 100%;"> |
---|
254 | <% |
---|
255 | if (user != null) |
---|
256 | { |
---|
257 | %> |
---|
258 | <table class="fullform"> |
---|
259 | <tr> |
---|
260 | <th>Name</th> |
---|
261 | <td><%=Base.getLinkedName(ID, user, false, true)%></td> |
---|
262 | </tr> |
---|
263 | <tr> |
---|
264 | <th>Quota</th> |
---|
265 | <td><base:propertyvalue item="<%=user%>" property="quota" /></td> |
---|
266 | </tr> |
---|
267 | <tr> |
---|
268 | <th>Quota group</th> |
---|
269 | <td><base:propertyvalue item="<%=user%>" property="quotaGroup" /></td> |
---|
270 | </tr> |
---|
271 | <tr class="dynamic"> |
---|
272 | <th>Description</th> |
---|
273 | <td><%=HTML.niceFormat(user.getDescription())%></td> |
---|
274 | </tr> |
---|
275 | </table> |
---|
276 | <% |
---|
277 | } |
---|
278 | else if (group != null) |
---|
279 | { |
---|
280 | %> |
---|
281 | <table class="fullform"> |
---|
282 | <tr> |
---|
283 | <th>Name</th> |
---|
284 | <td><%=Base.getLinkedName(ID, group, false, true)%></td> |
---|
285 | </tr> |
---|
286 | <tr> |
---|
287 | <th>Quota</th> |
---|
288 | <td><base:propertyvalue item="<%=group%>" property="quota" /></td> |
---|
289 | </tr> |
---|
290 | <tr class="dynamic"> |
---|
291 | <th>Description</th> |
---|
292 | <td><%=HTML.niceFormat(group.getDescription())%></td> |
---|
293 | </tr> |
---|
294 | </table> |
---|
295 | <% |
---|
296 | } |
---|
297 | %> |
---|
298 | </td> |
---|
299 | <td style="width: 50%; height: 100%;" class="leftborder"> |
---|
300 | <table class="special fullform"> |
---|
301 | <tr> |
---|
302 | <th style="width: 10em;"></th> |
---|
303 | <th style="width: 12em;">Total</td> |
---|
304 | <th style="width: 12em;">Primary</td> |
---|
305 | <th style="width: 12em;">Secondary</td> |
---|
306 | <th style="width: 12em;">Offline</td> |
---|
307 | <th style="width: 12em;">External</td> |
---|
308 | </tr> |
---|
309 | <tr style="border-top: 1px solid #A0A0A0;" class="highlight"> |
---|
310 | <th>Total</th> |
---|
311 | <td><%=Values.formatBytes(summary.getTotal())%></td> |
---|
312 | <td><%=Values.formatBytes(summary.getTotal(Location.PRIMARY))%></td> |
---|
313 | <td><%=Values.formatBytes(summary.getTotal(Location.SECONDARY))%></td> |
---|
314 | <td><%=Values.formatBytes(summary.getTotal(Location.OFFLINE))%></td> |
---|
315 | <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td> |
---|
316 | </tr> |
---|
317 | <% |
---|
318 | for (QuotaType qt : quotaTypes) |
---|
319 | { |
---|
320 | %> |
---|
321 | <tr class="highlight"> |
---|
322 | <th><%=HTML.encodeTags(qt.getName())%></th> |
---|
323 | <td><%=Values.formatBytes(summary.getTotal(qt))%></td> |
---|
324 | <td><%=Values.formatBytes(summary.getTotal(qt, Location.PRIMARY))%></td> |
---|
325 | <td><%=qt.hasSecondaryLocation() ? Values.formatBytes(summary.getTotal(qt, Location.SECONDARY)) : "n/a"%></td> |
---|
326 | <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.OFFLINE)) : "n/a"%></td> |
---|
327 | <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td> |
---|
328 | </tr> |
---|
329 | <% |
---|
330 | } |
---|
331 | %> |
---|
332 | </table> |
---|
333 | </td> |
---|
334 | </tr> |
---|
335 | </table> |
---|
336 | </div> |
---|
337 | |
---|
338 | <base:section id="items" |
---|
339 | title="<%="Disk consuming items (" + totalCount + ")"%>" |
---|
340 | context="<%=cc%>"> |
---|
341 | <tbl:table |
---|
342 | id="items" |
---|
343 | columns="<%=cc.getSetting("columns")%>" |
---|
344 | sortby="<%=cc.getSortProperty()%>" |
---|
345 | direction="<%=cc.getSortDirection()%>" |
---|
346 | action="index.jsp" |
---|
347 | sc="<%=sc%>" |
---|
348 | item="<%=itemType%>" |
---|
349 | subcontext="<%=subContext%>" |
---|
350 | > |
---|
351 | <tbl:hidden |
---|
352 | name="item_type" |
---|
353 | value="<%=itemType.name()%>" |
---|
354 | /> |
---|
355 | <tbl:columndef |
---|
356 | id="type" |
---|
357 | property="itemType" |
---|
358 | datatype="int" |
---|
359 | title="Item type" |
---|
360 | enumeration="<%=itemTypes%>" |
---|
361 | filterable="true" |
---|
362 | sortable="true" |
---|
363 | show="always" |
---|
364 | /> |
---|
365 | <tbl:columndef |
---|
366 | id="name" |
---|
367 | title="Name" |
---|
368 | show="always" |
---|
369 | /> |
---|
370 | <tbl:columndef |
---|
371 | id="bytes" |
---|
372 | property="bytes" |
---|
373 | datatype="long" |
---|
374 | title="Bytes" |
---|
375 | sortable="true" |
---|
376 | filterable="true" |
---|
377 | exportable="true" |
---|
378 | unit="<%=bytes%>" |
---|
379 | /> |
---|
380 | <tbl:columndef |
---|
381 | id="location" |
---|
382 | property="location" |
---|
383 | datatype="int" |
---|
384 | title="Location" |
---|
385 | enumeration="<%=locations%>" |
---|
386 | filterable="true" |
---|
387 | sortable="true" |
---|
388 | /> |
---|
389 | <tbl:columndef |
---|
390 | id="owner" |
---|
391 | property="user.name" |
---|
392 | datatype="string" |
---|
393 | title="Owner" |
---|
394 | sortable="true" |
---|
395 | filterable="true" |
---|
396 | exportable="true" |
---|
397 | /> |
---|
398 | <tbl:columndef |
---|
399 | id="group" |
---|
400 | property="group.name" |
---|
401 | datatype="string" |
---|
402 | title="Group" |
---|
403 | sortable="true" |
---|
404 | filterable="true" |
---|
405 | exportable="true" |
---|
406 | /> |
---|
407 | <tbl:columndef |
---|
408 | id="description" |
---|
409 | title="Description" |
---|
410 | /> |
---|
411 | <div class="panelgroup topborder leftborder rightborder"> |
---|
412 | <tbl:toolbar subclass="bottomborder"> |
---|
413 | <tbl:button |
---|
414 | image="delete.png" |
---|
415 | onclick="deleteItems()" |
---|
416 | title="Delete" |
---|
417 | tooltip="Mark the selected items for deletion" |
---|
418 | disabled="<%=totalCount <= 0%>" |
---|
419 | /> |
---|
420 | <tbl:button |
---|
421 | image="restore.png" |
---|
422 | onclick="restoreItems()" |
---|
423 | title="Restore" |
---|
424 | tooltip="Restore the selected items" |
---|
425 | disabled="<%=totalCount <= 0%>" |
---|
426 | /> |
---|
427 | <tbl:button |
---|
428 | image="share.png" |
---|
429 | onclick="shareItems()" |
---|
430 | title="Share…" |
---|
431 | tooltip="Share the selected items" |
---|
432 | disabled="<%=totalCount <= 0%>" |
---|
433 | /> |
---|
434 | <tbl:button |
---|
435 | image="columns.png" |
---|
436 | onclick="configureColumns()" |
---|
437 | title="Columns…" |
---|
438 | tooltip="Show, hide and re-order columns" |
---|
439 | /> |
---|
440 | </tbl:toolbar> |
---|
441 | <tbl:panel> |
---|
442 | <tbl:presetselector |
---|
443 | onchange="presetOnChange()" |
---|
444 | disableremoved="true" |
---|
445 | /> |
---|
446 | <tbl:navigator |
---|
447 | page="<%=cc.getPage()%>" |
---|
448 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
449 | totalrows="<%=totalCount%>" |
---|
450 | /> |
---|
451 | </tbl:panel> |
---|
452 | </div> |
---|
453 | <tbl:data> |
---|
454 | <tbl:headers> |
---|
455 | <tbl:headerrow> |
---|
456 | <tbl:header colspan="3" /> |
---|
457 | <tbl:columnheaders /> |
---|
458 | </tbl:headerrow> |
---|
459 | <tbl:headerrow> |
---|
460 | <tbl:header subclass="index" /> |
---|
461 | <tbl:header |
---|
462 | subclass="check" |
---|
463 | ><base:icon |
---|
464 | image="check_uncheck.png" |
---|
465 | tooltip="Check/uncheck all" |
---|
466 | onclick="Forms.checkUncheck(document.forms[formId])" |
---|
467 | /></tbl:header> |
---|
468 | <tbl:header |
---|
469 | subclass="icons" |
---|
470 | /> |
---|
471 | <tbl:propertyfilter /> |
---|
472 | </tbl:headerrow> |
---|
473 | </tbl:headers> |
---|
474 | <tbl:rows> |
---|
475 | <% |
---|
476 | if (cc.getMessage() != null) |
---|
477 | { |
---|
478 | %> |
---|
479 | <tbl:panel clazz="messagepanel"> |
---|
480 | <div class="messagecontainer error"><%=HTML.encodeTags(cc.getMessage())%></div> |
---|
481 | </tbl:panel> |
---|
482 | <% |
---|
483 | cc.setMessage(null); |
---|
484 | } |
---|
485 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
486 | if (diskUsage != null) |
---|
487 | { |
---|
488 | while (diskUsage.hasNext()) |
---|
489 | { |
---|
490 | DiskUsage du = diskUsage.next(); |
---|
491 | DiskConsumable item = null; |
---|
492 | boolean hasReadPermission = true; |
---|
493 | boolean hasWritePermission = false; |
---|
494 | boolean isRemoved = false; |
---|
495 | int consumableId = 0; |
---|
496 | try |
---|
497 | { |
---|
498 | item = du.getItem(); |
---|
499 | consumableId = item.getId(); |
---|
500 | hasWritePermission = item.hasPermission(Permission.WRITE); |
---|
501 | } |
---|
502 | catch (PermissionDeniedException ex) |
---|
503 | { |
---|
504 | hasReadPermission = false; |
---|
505 | } |
---|
506 | String name = ""; |
---|
507 | String description = ""; |
---|
508 | if (item instanceof File) |
---|
509 | { |
---|
510 | File file = (File)item; |
---|
511 | name = file.getPath().toString(); |
---|
512 | description = file.getDescription(); |
---|
513 | } |
---|
514 | else if (item instanceof Nameable) |
---|
515 | { |
---|
516 | Nameable nameable = (Nameable)item; |
---|
517 | name = nameable.getName(); |
---|
518 | description = nameable.getDescription(); |
---|
519 | } |
---|
520 | else if (item != null) |
---|
521 | { |
---|
522 | name = item.toString(); |
---|
523 | } |
---|
524 | if (item instanceof Removable) |
---|
525 | { |
---|
526 | isRemoved = ((Removable)item).isRemoved(); |
---|
527 | } |
---|
528 | String link = hasReadPermission ? |
---|
529 | Base.getLink(ID, HTML.encodeTags(name), du.getItemType(), |
---|
530 | consumableId, hasWritePermission) : "<i>- denied -</i>"; |
---|
531 | index++; |
---|
532 | numListed++; |
---|
533 | %> |
---|
534 | <tbl:row> |
---|
535 | <tbl:header |
---|
536 | clazz="index" |
---|
537 | ><%=index%></tbl:header> |
---|
538 | <tbl:header |
---|
539 | clazz="check" |
---|
540 | ><input |
---|
541 | type="checkbox" |
---|
542 | name="item:<%=du.getItemType().name()%>" |
---|
543 | value="<%=consumableId%>" |
---|
544 | ></tbl:header> |
---|
545 | <tbl:header |
---|
546 | clazz="icons" |
---|
547 | ><base:icon |
---|
548 | image="deleted.png" |
---|
549 | tooltip="This item has been marked for deletion" |
---|
550 | visible="<%=isRemoved%>" |
---|
551 | /> </tbl:header> |
---|
552 | <tbl:cell column="type"><%=du.getItemType()%></tbl:cell> |
---|
553 | <tbl:cell column="name"><%=link%></tbl:cell> |
---|
554 | <tbl:cell column="bytes"><%=Values.formatBytes(du.getBytes())%></tbl:cell> |
---|
555 | <tbl:cell column="location"><%=du.getLocation()%></tbl:cell> |
---|
556 | <tbl:cell column="owner"><base:propertyvalue item="<%=du%>" property="user" /></tbl:cell> |
---|
557 | <tbl:cell column="group"><base:propertyvalue item="<%=du%>" property="group" /></tbl:cell> |
---|
558 | <tbl:cell column="description"><%=HTML.encodeTags(description)%></tbl:cell> |
---|
559 | </tbl:row> |
---|
560 | <% |
---|
561 | } |
---|
562 | } |
---|
563 | if (numListed == 0) |
---|
564 | { |
---|
565 | %> |
---|
566 | <tbl:panel clazz="messagepanel"> |
---|
567 | <div class="messagecontainer note"> |
---|
568 | <%=totalCount == 0 ? "No items were found" : "No items on this page. Please select another page!" %> |
---|
569 | </div> |
---|
570 | </tbl:panel> |
---|
571 | <% |
---|
572 | } |
---|
573 | %> |
---|
574 | </tbl:rows> |
---|
575 | </tbl:data> |
---|
576 | </tbl:table> |
---|
577 | </base:section> |
---|
578 | </t:tab> |
---|
579 | </t:tabcontrol> |
---|
580 | |
---|
581 | </base:body> |
---|
582 | </base:page> |
---|
583 | <% |
---|
584 | } |
---|
585 | finally |
---|
586 | { |
---|
587 | if (dc != null) dc.close(); |
---|
588 | } |
---|
589 | |
---|
590 | %> |
---|