1611 |
23 Apr 12 |
nicklas |
1 |
<%-- |
1611 |
23 Apr 12 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
1611 |
23 Apr 12 |
nicklas |
3 |
|
1611 |
23 Apr 12 |
nicklas |
4 |
This file is part of the Example Code Package for BASE. |
1611 |
23 Apr 12 |
nicklas |
5 |
Available at http://baseplugins.thep.lu.se/ |
1611 |
23 Apr 12 |
nicklas |
6 |
BASE main site: http://base.thep.lu.se/ |
1611 |
23 Apr 12 |
nicklas |
7 |
|
1611 |
23 Apr 12 |
nicklas |
8 |
This is free software; you can redistribute it and/or |
1611 |
23 Apr 12 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
1611 |
23 Apr 12 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
1611 |
23 Apr 12 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1611 |
23 Apr 12 |
nicklas |
12 |
|
1611 |
23 Apr 12 |
nicklas |
13 |
The software is distributed in the hope that it will be useful, |
1611 |
23 Apr 12 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1611 |
23 Apr 12 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1611 |
23 Apr 12 |
nicklas |
16 |
GNU General Public License for more details. |
1611 |
23 Apr 12 |
nicklas |
17 |
|
1611 |
23 Apr 12 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
1611 |
23 Apr 12 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1611 |
23 Apr 12 |
nicklas |
20 |
--%> |
1611 |
23 Apr 12 |
nicklas |
21 |
<%@ page |
1611 |
23 Apr 12 |
nicklas |
22 |
pageEncoding="UTF-8" |
1611 |
23 Apr 12 |
nicklas |
23 |
session="false" |
1611 |
23 Apr 12 |
nicklas |
24 |
import="net.sf.basedb.core.SessionControl" |
1611 |
23 Apr 12 |
nicklas |
25 |
import="net.sf.basedb.core.DbControl" |
1611 |
23 Apr 12 |
nicklas |
26 |
import="net.sf.basedb.core.Item" |
1611 |
23 Apr 12 |
nicklas |
27 |
import="net.sf.basedb.core.BasicItem" |
1611 |
23 Apr 12 |
nicklas |
28 |
import="net.sf.basedb.core.Nameable" |
1611 |
23 Apr 12 |
nicklas |
29 |
import="net.sf.basedb.core.Registered" |
1611 |
23 Apr 12 |
nicklas |
30 |
import="net.sf.basedb.core.Shareable" |
1611 |
23 Apr 12 |
nicklas |
31 |
import="net.sf.basedb.core.Removable" |
1611 |
23 Apr 12 |
nicklas |
32 |
import="net.sf.basedb.core.Ownable" |
1611 |
23 Apr 12 |
nicklas |
33 |
import="net.sf.basedb.core.Reporter" |
1611 |
23 Apr 12 |
nicklas |
34 |
import="net.sf.basedb.core.data.ReporterData" |
1611 |
23 Apr 12 |
nicklas |
35 |
import="net.sf.basedb.util.Values" |
1611 |
23 Apr 12 |
nicklas |
36 |
import="net.sf.basedb.util.formatter.Formatter" |
1611 |
23 Apr 12 |
nicklas |
37 |
import="net.sf.basedb.util.overview.Node" |
1611 |
23 Apr 12 |
nicklas |
38 |
import="net.sf.basedb.clients.web.Base" |
1611 |
23 Apr 12 |
nicklas |
39 |
import="net.sf.basedb.clients.web.util.HTML" |
1611 |
23 Apr 12 |
nicklas |
40 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
1611 |
23 Apr 12 |
nicklas |
41 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
1611 |
23 Apr 12 |
nicklas |
42 |
import="java.util.Date" |
1611 |
23 Apr 12 |
nicklas |
43 |
%> |
1611 |
23 Apr 12 |
nicklas |
44 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1611 |
23 Apr 12 |
nicklas |
45 |
<% |
1611 |
23 Apr 12 |
nicklas |
46 |
//Get the JspContext that was created on the main edit page |
1611 |
23 Apr 12 |
nicklas |
47 |
final JspContext jspContext = (JspContext)request.getAttribute(JspContext.ATTRIBUTE_KEY); |
1611 |
23 Apr 12 |
nicklas |
48 |
|
1611 |
23 Apr 12 |
nicklas |
49 |
//The current node is found in the context. |
1611 |
23 Apr 12 |
nicklas |
50 |
final Node node = (Node)jspContext.getCurrentItem(); |
1611 |
23 Apr 12 |
nicklas |
51 |
|
1611 |
23 Apr 12 |
nicklas |
52 |
// The current item should be a BasicItem |
1611 |
23 Apr 12 |
nicklas |
53 |
final BasicItem item = (BasicItem)node.getItem(); |
1611 |
23 Apr 12 |
nicklas |
54 |
|
1611 |
23 Apr 12 |
nicklas |
55 |
//Get the DbControl and SessionControl used to handle the request (do not close!) |
1611 |
23 Apr 12 |
nicklas |
56 |
final DbControl dc = jspContext.getDbControl(); |
1611 |
23 Apr 12 |
nicklas |
57 |
final SessionControl sc = dc.getSessionControl(); |
1611 |
23 Apr 12 |
nicklas |
58 |
final String ID = sc.getId(); |
1611 |
23 Apr 12 |
nicklas |
59 |
|
1611 |
23 Apr 12 |
nicklas |
60 |
try |
1611 |
23 Apr 12 |
nicklas |
61 |
{ |
1611 |
23 Apr 12 |
nicklas |
62 |
String name = null; |
1611 |
23 Apr 12 |
nicklas |
63 |
Date registered = null; |
1611 |
23 Apr 12 |
nicklas |
64 |
boolean isShared = false; |
1611 |
23 Apr 12 |
nicklas |
65 |
boolean isRemoved = false; |
1611 |
23 Apr 12 |
nicklas |
66 |
boolean isOwnedByYou = false; |
1611 |
23 Apr 12 |
nicklas |
67 |
|
1611 |
23 Apr 12 |
nicklas |
68 |
name = item instanceof Nameable ? ((Nameable)item).getName() : item.toString(); |
1611 |
23 Apr 12 |
nicklas |
69 |
if (item instanceof Registered) registered = ((Registered)item).getEntryDate(); |
1611 |
23 Apr 12 |
nicklas |
70 |
if (item instanceof Shareable) isShared = ((Shareable)item).isShared(); |
1611 |
23 Apr 12 |
nicklas |
71 |
if (item instanceof Removable) isRemoved = ((Removable)item).isRemoved(); |
1611 |
23 Apr 12 |
nicklas |
72 |
if (item instanceof Ownable) isOwnedByYou = ((Ownable)item).isOwner(); |
1611 |
23 Apr 12 |
nicklas |
73 |
|
1611 |
23 Apr 12 |
nicklas |
74 |
|
1611 |
23 Apr 12 |
nicklas |
75 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
1611 |
23 Apr 12 |
nicklas |
76 |
%> |
1611 |
23 Apr 12 |
nicklas |
77 |
<base:page type="include" title="Item information"> |
1611 |
23 Apr 12 |
nicklas |
78 |
<base:body> |
1611 |
23 Apr 12 |
nicklas |
79 |
<table class="fullform larger fullborder"> |
1611 |
23 Apr 12 |
nicklas |
80 |
<tr> |
1611 |
23 Apr 12 |
nicklas |
81 |
<th>Type</th> |
1611 |
23 Apr 12 |
nicklas |
82 |
<td><%=item.getType().name()%></td> |
1611 |
23 Apr 12 |
nicklas |
83 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
84 |
<tr> |
1611 |
23 Apr 12 |
nicklas |
85 |
<th>ID</th> |
1611 |
23 Apr 12 |
nicklas |
86 |
<td><%=item.getId()%></td> |
1611 |
23 Apr 12 |
nicklas |
87 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
88 |
<tr> |
1611 |
23 Apr 12 |
nicklas |
89 |
<th>Name</th> |
1611 |
23 Apr 12 |
nicklas |
90 |
<td><%=name == null ? "<i>unknown</i>" : HTML.niceFormat(name)%></td> |
1611 |
23 Apr 12 |
nicklas |
91 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
92 |
<tr> |
1611 |
23 Apr 12 |
nicklas |
93 |
<th>Registration date</th> |
1611 |
23 Apr 12 |
nicklas |
94 |
<td><%=registered == null ? "<i>unknown</i>" : dateFormatter.format(registered)%></td> |
1611 |
23 Apr 12 |
nicklas |
95 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
96 |
<tr> |
1611 |
23 Apr 12 |
nicklas |
97 |
<th>Owned by you?</th> |
1611 |
23 Apr 12 |
nicklas |
98 |
<td><%=isOwnedByYou ? "yes" : "no"%></td> |
1611 |
23 Apr 12 |
nicklas |
99 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
100 |
<tr> |
1611 |
23 Apr 12 |
nicklas |
101 |
<th>Shared to other users?</th> |
1611 |
23 Apr 12 |
nicklas |
102 |
<td><%=isShared ? "yes" : "no"%></td> |
1611 |
23 Apr 12 |
nicklas |
103 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
104 |
<tr class="dynamic"> |
1611 |
23 Apr 12 |
nicklas |
105 |
<th>Marked for removal?</th> |
1611 |
23 Apr 12 |
nicklas |
106 |
<td><%=isRemoved ? "yes" : "no"%></td> |
1611 |
23 Apr 12 |
nicklas |
107 |
</tr> |
1611 |
23 Apr 12 |
nicklas |
108 |
</table> |
1611 |
23 Apr 12 |
nicklas |
109 |
|
1611 |
23 Apr 12 |
nicklas |
110 |
</base:body> |
1611 |
23 Apr 12 |
nicklas |
111 |
</base:page> |
1611 |
23 Apr 12 |
nicklas |
112 |
<% |
1611 |
23 Apr 12 |
nicklas |
113 |
} |
1611 |
23 Apr 12 |
nicklas |
114 |
finally |
1611 |
23 Apr 12 |
nicklas |
115 |
{ |
1611 |
23 Apr 12 |
nicklas |
116 |
if (dc != null) dc.close(); |
1611 |
23 Apr 12 |
nicklas |
117 |
} |
1611 |
23 Apr 12 |
nicklas |
118 |
%> |