1391 |
15 Sep 11 |
nicklas |
1 |
<%-- |
1391 |
15 Sep 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
1391 |
15 Sep 11 |
nicklas |
3 |
|
1391 |
15 Sep 11 |
nicklas |
4 |
This file is part of the Example Code Package for BASE. |
1391 |
15 Sep 11 |
nicklas |
5 |
Available at http://baseplugins.thep.lu.se/ |
1391 |
15 Sep 11 |
nicklas |
6 |
BASE main site: http://base.thep.lu.se/ |
1391 |
15 Sep 11 |
nicklas |
7 |
|
1391 |
15 Sep 11 |
nicklas |
8 |
This is free software; you can redistribute it and/or |
1391 |
15 Sep 11 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
1391 |
15 Sep 11 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
1391 |
15 Sep 11 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1391 |
15 Sep 11 |
nicklas |
12 |
|
1391 |
15 Sep 11 |
nicklas |
13 |
The software is distributed in the hope that it will be useful, |
1391 |
15 Sep 11 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1391 |
15 Sep 11 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1391 |
15 Sep 11 |
nicklas |
16 |
GNU General Public License for more details. |
1391 |
15 Sep 11 |
nicklas |
17 |
|
1391 |
15 Sep 11 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
1391 |
15 Sep 11 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1391 |
15 Sep 11 |
nicklas |
20 |
--%> |
1027 |
07 Apr 09 |
nicklas |
21 |
<%@ page |
1027 |
07 Apr 09 |
nicklas |
22 |
pageEncoding="UTF-8" |
1027 |
07 Apr 09 |
nicklas |
23 |
session="false" |
1019 |
03 Apr 09 |
nicklas |
24 |
import="net.sf.basedb.core.SessionControl" |
1019 |
03 Apr 09 |
nicklas |
25 |
import="net.sf.basedb.core.DbControl" |
1019 |
03 Apr 09 |
nicklas |
26 |
import="net.sf.basedb.core.Item" |
1019 |
03 Apr 09 |
nicklas |
27 |
import="net.sf.basedb.core.BasicItem" |
1019 |
03 Apr 09 |
nicklas |
28 |
import="net.sf.basedb.core.Nameable" |
1019 |
03 Apr 09 |
nicklas |
29 |
import="net.sf.basedb.core.Registered" |
1019 |
03 Apr 09 |
nicklas |
30 |
import="net.sf.basedb.core.Shareable" |
1019 |
03 Apr 09 |
nicklas |
31 |
import="net.sf.basedb.core.Removable" |
1019 |
03 Apr 09 |
nicklas |
32 |
import="net.sf.basedb.core.Ownable" |
1021 |
06 Apr 09 |
nicklas |
33 |
import="net.sf.basedb.core.Reporter" |
1021 |
06 Apr 09 |
nicklas |
34 |
import="net.sf.basedb.core.data.ReporterData" |
1019 |
03 Apr 09 |
nicklas |
35 |
import="net.sf.basedb.util.Values" |
1019 |
03 Apr 09 |
nicklas |
36 |
import="net.sf.basedb.util.formatter.Formatter" |
1019 |
03 Apr 09 |
nicklas |
37 |
import="net.sf.basedb.clients.web.Base" |
1019 |
03 Apr 09 |
nicklas |
38 |
import="net.sf.basedb.clients.web.util.HTML" |
1019 |
03 Apr 09 |
nicklas |
39 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
1019 |
03 Apr 09 |
nicklas |
40 |
import="java.util.Date" |
1019 |
03 Apr 09 |
nicklas |
41 |
%> |
1019 |
03 Apr 09 |
nicklas |
42 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1019 |
03 Apr 09 |
nicklas |
43 |
<% |
1019 |
03 Apr 09 |
nicklas |
44 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1019 |
03 Apr 09 |
nicklas |
45 |
final String ID = sc.getId(); |
1019 |
03 Apr 09 |
nicklas |
46 |
final DbControl dc = sc.newDbControl(); |
1019 |
03 Apr 09 |
nicklas |
47 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
1019 |
03 Apr 09 |
nicklas |
48 |
final int itemId = Values.getInt(request.getParameter("item_id")); |
1019 |
03 Apr 09 |
nicklas |
49 |
try |
1019 |
03 Apr 09 |
nicklas |
50 |
{ |
1021 |
06 Apr 09 |
nicklas |
51 |
String name = null; |
1021 |
06 Apr 09 |
nicklas |
52 |
Date registered = null; |
1021 |
06 Apr 09 |
nicklas |
53 |
boolean isShared = false; |
1021 |
06 Apr 09 |
nicklas |
54 |
boolean isRemoved = false; |
1021 |
06 Apr 09 |
nicklas |
55 |
boolean isOwnedByYou = false; |
1021 |
06 Apr 09 |
nicklas |
56 |
if (itemType.getItemClass() != null) |
1021 |
06 Apr 09 |
nicklas |
57 |
{ |
1021 |
06 Apr 09 |
nicklas |
58 |
BasicItem item = itemType.getById(dc, itemId); |
1021 |
06 Apr 09 |
nicklas |
59 |
name = item instanceof Nameable ? ((Nameable)item).getName() : item.toString(); |
1021 |
06 Apr 09 |
nicklas |
60 |
if (item instanceof Registered) registered = ((Registered)item).getEntryDate(); |
1021 |
06 Apr 09 |
nicklas |
61 |
if (item instanceof Shareable) isShared = ((Shareable)item).isShared(); |
1021 |
06 Apr 09 |
nicklas |
62 |
if (item instanceof Removable) isRemoved = ((Removable)item).isRemoved(); |
1021 |
06 Apr 09 |
nicklas |
63 |
if (item instanceof Ownable) isOwnedByYou = ((Ownable)item).isOwner(); |
1021 |
06 Apr 09 |
nicklas |
64 |
} |
1021 |
06 Apr 09 |
nicklas |
65 |
else if (itemType == Item.REPORTER) |
1021 |
06 Apr 09 |
nicklas |
66 |
{ |
1021 |
06 Apr 09 |
nicklas |
67 |
ReporterData reporter = Reporter.getById(dc, itemId); |
1021 |
06 Apr 09 |
nicklas |
68 |
name = reporter.getName(); |
1021 |
06 Apr 09 |
nicklas |
69 |
registered = reporter.getEntryDate(); |
1021 |
06 Apr 09 |
nicklas |
70 |
} |
1019 |
03 Apr 09 |
nicklas |
71 |
|
1019 |
03 Apr 09 |
nicklas |
72 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
1019 |
03 Apr 09 |
nicklas |
73 |
%> |
2205 |
29 Jan 14 |
nicklas |
74 |
<base:page type="popup" title="Item information" id="item-info"> |
2205 |
29 Jan 14 |
nicklas |
75 |
<base:head scripts="~scripts/common.js" /> |
1019 |
03 Apr 09 |
nicklas |
76 |
<base:body> |
1537 |
16 Feb 12 |
nicklas |
77 |
<h1>Item information</h1> |
1537 |
16 Feb 12 |
nicklas |
78 |
<div class="content bottomborder"> |
1019 |
03 Apr 09 |
nicklas |
79 |
|
1537 |
16 Feb 12 |
nicklas |
80 |
<table class="fullform larger"> |
1019 |
03 Apr 09 |
nicklas |
81 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
82 |
<th>Type</th> |
1019 |
03 Apr 09 |
nicklas |
83 |
<td><%=itemType.name()%></td> |
1019 |
03 Apr 09 |
nicklas |
84 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
85 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
86 |
<th>ID</th> |
1019 |
03 Apr 09 |
nicklas |
87 |
<td><%=itemId%></td> |
1019 |
03 Apr 09 |
nicklas |
88 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
89 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
90 |
<th>Name</th> |
1021 |
06 Apr 09 |
nicklas |
91 |
<td><%=name == null ? "<i>unknown</i>" : HTML.niceFormat(name)%></td> |
1019 |
03 Apr 09 |
nicklas |
92 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
93 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
94 |
<th>Registration date</th> |
1019 |
03 Apr 09 |
nicklas |
95 |
<td><%=registered == null ? "<i>unknown</i>" : dateFormatter.format(registered)%></td> |
1019 |
03 Apr 09 |
nicklas |
96 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
97 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
98 |
<th>Owned by you?</th> |
1019 |
03 Apr 09 |
nicklas |
99 |
<td><%=isOwnedByYou ? "yes" : "no"%></td> |
1019 |
03 Apr 09 |
nicklas |
100 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
101 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
102 |
<th>Shared to other users?</th> |
1019 |
03 Apr 09 |
nicklas |
103 |
<td><%=isShared ? "yes" : "no"%></td> |
1019 |
03 Apr 09 |
nicklas |
104 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
105 |
<tr> |
1537 |
16 Feb 12 |
nicklas |
106 |
<th>Marked for removal?</th> |
1019 |
03 Apr 09 |
nicklas |
107 |
<td><%=isRemoved ? "yes" : "no"%></td> |
1019 |
03 Apr 09 |
nicklas |
108 |
</tr> |
1537 |
16 Feb 12 |
nicklas |
109 |
<tr class="dynamic"> |
1537 |
16 Feb 12 |
nicklas |
110 |
<th></th> |
1537 |
16 Feb 12 |
nicklas |
111 |
<td></td> |
1537 |
16 Feb 12 |
nicklas |
112 |
</tr> |
1019 |
03 Apr 09 |
nicklas |
113 |
</table> |
1019 |
03 Apr 09 |
nicklas |
114 |
</div> |
1537 |
16 Feb 12 |
nicklas |
115 |
|
1537 |
16 Feb 12 |
nicklas |
116 |
<base:buttongroup subclass="dialogbuttons"> |
2205 |
29 Jan 14 |
nicklas |
117 |
<base:button id="close" title="Close" /> |
1537 |
16 Feb 12 |
nicklas |
118 |
</base:buttongroup> |
1019 |
03 Apr 09 |
nicklas |
119 |
</base:body> |
1019 |
03 Apr 09 |
nicklas |
120 |
</base:page> |
1019 |
03 Apr 09 |
nicklas |
121 |
<% |
1019 |
03 Apr 09 |
nicklas |
122 |
} |
1019 |
03 Apr 09 |
nicklas |
123 |
finally |
1019 |
03 Apr 09 |
nicklas |
124 |
{ |
1019 |
03 Apr 09 |
nicklas |
125 |
if (dc != null) dc.close(); |
1019 |
03 Apr 09 |
nicklas |
126 |
} |
1019 |
03 Apr 09 |
nicklas |
127 |
%> |