1997 |
16 Feb 06 |
nicklas |
1 |
<%-- $Id$ |
1997 |
16 Feb 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
1997 |
16 Feb 06 |
nicklas |
4 |
|
2304 |
22 May 06 |
jari |
5 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
6 |
Available at http://base.thep.lu.se/ |
1997 |
16 Feb 06 |
nicklas |
7 |
|
1997 |
16 Feb 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1997 |
16 Feb 06 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
10 |
as published by the Free Software Foundation; either version 3 |
1997 |
16 Feb 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1997 |
16 Feb 06 |
nicklas |
12 |
|
1997 |
16 Feb 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1997 |
16 Feb 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1997 |
16 Feb 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1997 |
16 Feb 06 |
nicklas |
16 |
GNU General Public License for more details. |
1997 |
16 Feb 06 |
nicklas |
17 |
|
1997 |
16 Feb 06 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1997 |
16 Feb 06 |
nicklas |
20 |
------------------------------------------------------------------ |
1997 |
16 Feb 06 |
nicklas |
21 |
|
1997 |
16 Feb 06 |
nicklas |
22 |
@author Nicklas |
1997 |
16 Feb 06 |
nicklas |
23 |
@version 2.0 |
1997 |
16 Feb 06 |
nicklas |
24 |
--%> |
5426 |
24 Sep 10 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
1997 |
16 Feb 06 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
1997 |
16 Feb 06 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
1997 |
16 Feb 06 |
nicklas |
28 |
import="net.sf.basedb.core.SystemItems" |
1997 |
16 Feb 06 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
1997 |
16 Feb 06 |
nicklas |
30 |
import="net.sf.basedb.core.ItemContext" |
1997 |
16 Feb 06 |
nicklas |
31 |
import="net.sf.basedb.core.Permission" |
1997 |
16 Feb 06 |
nicklas |
32 |
import="net.sf.basedb.core.News" |
1997 |
16 Feb 06 |
nicklas |
33 |
import="net.sf.basedb.core.PermissionDeniedException" |
1997 |
16 Feb 06 |
nicklas |
34 |
import="net.sf.basedb.core.PluginDefinition" |
1997 |
16 Feb 06 |
nicklas |
35 |
import="net.sf.basedb.core.plugin.GuiContext" |
1997 |
16 Feb 06 |
nicklas |
36 |
import="net.sf.basedb.core.plugin.Plugin" |
1997 |
16 Feb 06 |
nicklas |
37 |
import="net.sf.basedb.clients.web.Base" |
2386 |
15 Jun 06 |
martin |
38 |
import="net.sf.basedb.clients.web.PermissionUtil" |
1997 |
16 Feb 06 |
nicklas |
39 |
import="net.sf.basedb.clients.web.util.HTML" |
2942 |
22 Nov 06 |
nicklas |
40 |
import="net.sf.basedb.util.formatter.Formatter" |
2942 |
22 Nov 06 |
nicklas |
41 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
4886 |
03 Apr 09 |
nicklas |
42 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
4886 |
03 Apr 09 |
nicklas |
43 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
4886 |
03 Apr 09 |
nicklas |
44 |
import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
7604 |
25 Feb 19 |
nicklas |
45 |
import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" |
4886 |
03 Apr 09 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
4886 |
03 Apr 09 |
nicklas |
47 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
2753 |
20 Oct 06 |
nicklas |
48 |
import="net.sf.basedb.util.Values" |
1997 |
16 Feb 06 |
nicklas |
49 |
import="java.util.Map" |
2942 |
22 Nov 06 |
nicklas |
50 |
import="java.util.Date" |
1997 |
16 Feb 06 |
nicklas |
51 |
%> |
1997 |
16 Feb 06 |
nicklas |
52 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1997 |
16 Feb 06 |
nicklas |
53 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
1997 |
16 Feb 06 |
nicklas |
54 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
1997 |
16 Feb 06 |
nicklas |
55 |
<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
4886 |
03 Apr 09 |
nicklas |
56 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
1997 |
16 Feb 06 |
nicklas |
57 |
<%! |
1997 |
16 Feb 06 |
nicklas |
58 |
private static final Item itemType = Item.NEWS; |
1997 |
16 Feb 06 |
nicklas |
59 |
private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
1997 |
16 Feb 06 |
nicklas |
60 |
%> |
1997 |
16 Feb 06 |
nicklas |
61 |
<% |
1997 |
16 Feb 06 |
nicklas |
62 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1997 |
16 Feb 06 |
nicklas |
63 |
final String ID = sc.getId(); |
1997 |
16 Feb 06 |
nicklas |
64 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1997 |
16 Feb 06 |
nicklas |
65 |
final int itemId = cc.getId(); |
6262 |
27 Mar 13 |
nicklas |
66 |
final String tab = Values.getStringOrNull(request.getParameter("tab")); |
1997 |
16 Feb 06 |
nicklas |
67 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
68 |
final DbControl dc = sc.newDbControl(":View "+itemType); |
1997 |
16 Feb 06 |
nicklas |
69 |
try |
1997 |
16 Feb 06 |
nicklas |
70 |
{ |
1997 |
16 Feb 06 |
nicklas |
71 |
Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
1997 |
16 Feb 06 |
nicklas |
72 |
|
1997 |
16 Feb 06 |
nicklas |
73 |
String title = null; |
1997 |
16 Feb 06 |
nicklas |
74 |
News news = News.getById(dc, itemId); |
1997 |
16 Feb 06 |
nicklas |
75 |
|
1997 |
16 Feb 06 |
nicklas |
76 |
final boolean writePermission = news.hasPermission(Permission.WRITE); |
1997 |
16 Feb 06 |
nicklas |
77 |
final boolean deletePermission = news.hasPermission(Permission.DELETE); |
4003 |
26 Nov 07 |
nicklas |
78 |
final boolean isRemoved = news.isRemoved(); |
4003 |
26 Nov 07 |
nicklas |
79 |
final boolean isUsed = isRemoved && news.isUsed(); |
4003 |
26 Nov 07 |
nicklas |
80 |
final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
2942 |
22 Nov 06 |
nicklas |
81 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
4886 |
03 Apr 09 |
nicklas |
82 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, news); |
7604 |
25 Feb 19 |
nicklas |
83 |
ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext); |
1997 |
16 Feb 06 |
nicklas |
84 |
%> |
6218 |
19 Dec 12 |
nicklas |
85 |
<base:page title="<%=title%>" id="view-page"> |
6218 |
19 Dec 12 |
nicklas |
86 |
<base:head scripts="tabcontrol-2.js,table.js,~news.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css"> |
4886 |
03 Apr 09 |
nicklas |
87 |
<ext:scripts context="<%=jspContext%>" /> |
4886 |
03 Apr 09 |
nicklas |
88 |
<ext:stylesheets context="<%=jspContext%>" /> |
1997 |
16 Feb 06 |
nicklas |
89 |
</base:head> |
1997 |
16 Feb 06 |
nicklas |
90 |
<base:body> |
5941 |
01 Feb 12 |
nicklas |
91 |
<p:path><p:pathelement |
5941 |
01 Feb 12 |
nicklas |
92 |
title="News" href="<%="index.jsp?ID="+ID%>" |
5941 |
01 Feb 12 |
nicklas |
93 |
/><p:pathelement title="<%=HTML.encodeTags(news.getName())%>" |
5941 |
01 Feb 12 |
nicklas |
94 |
/></p:path> |
6218 |
19 Dec 12 |
nicklas |
95 |
|
6218 |
19 Dec 12 |
nicklas |
96 |
<div id="page-data" data-item-id="<%=itemId%>"></div> |
1997 |
16 Feb 06 |
nicklas |
97 |
|
5941 |
01 Feb 12 |
nicklas |
98 |
<t:tabcontrol |
5941 |
01 Feb 12 |
nicklas |
99 |
id="main" |
5941 |
01 Feb 12 |
nicklas |
100 |
subclass="content mastertabcontrol" |
6262 |
27 Mar 13 |
nicklas |
101 |
active="<%=tab%>"> |
1997 |
16 Feb 06 |
nicklas |
102 |
<t:tab id="properties" title="Properties"> |
5941 |
01 Feb 12 |
nicklas |
103 |
<div> |
5941 |
01 Feb 12 |
nicklas |
104 |
<table class="fullform bottomborder"> |
5941 |
01 Feb 12 |
nicklas |
105 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
106 |
<th class="itemstatus"> |
4003 |
26 Nov 07 |
nicklas |
107 |
<base:icon |
6218 |
19 Dec 12 |
nicklas |
108 |
id="btnDeletePermanently" |
5946 |
03 Feb 12 |
nicklas |
109 |
image="deleted.png" |
5941 |
01 Feb 12 |
nicklas |
110 |
tooltip="This item has been flagged for deletion. Click to delete it now." |
5941 |
01 Feb 12 |
nicklas |
111 |
enabled="<%=deletePermanentlyPermission %>" |
5941 |
01 Feb 12 |
nicklas |
112 |
visible="<%=isRemoved%>" |
5941 |
01 Feb 12 |
nicklas |
113 |
/> |
6218 |
19 Dec 12 |
nicklas |
114 |
<base:icon |
6218 |
19 Dec 12 |
nicklas |
115 |
id="btnUsingItems" |
6218 |
19 Dec 12 |
nicklas |
116 |
image="used.png" |
5941 |
01 Feb 12 |
nicklas |
117 |
tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" |
5941 |
01 Feb 12 |
nicklas |
118 |
visible="<%=isRemoved && isUsed%>" /> |
5941 |
01 Feb 12 |
nicklas |
119 |
</th> |
5941 |
01 Feb 12 |
nicklas |
120 |
<td style="padding: 0px;"> |
6605 |
18 Nov 14 |
nicklas |
121 |
<tbl:toolbar subclass="bottomborder bg-filled-50"> |
5941 |
01 Feb 12 |
nicklas |
122 |
<tbl:button |
6218 |
19 Dec 12 |
nicklas |
123 |
id="btnEdit" |
5942 |
01 Feb 12 |
nicklas |
124 |
disabled="<%=!writePermission%>" |
5945 |
02 Feb 12 |
nicklas |
125 |
image="edit.png" |
5941 |
01 Feb 12 |
nicklas |
126 |
title="Edit…" |
5941 |
01 Feb 12 |
nicklas |
127 |
tooltip="<%=writePermission ? "Edit this news" : "You do not have permission to edit news"%>" |
5941 |
01 Feb 12 |
nicklas |
128 |
/> |
5941 |
01 Feb 12 |
nicklas |
129 |
<tbl:button |
6218 |
19 Dec 12 |
nicklas |
130 |
id="btnDelete" |
5942 |
01 Feb 12 |
nicklas |
131 |
disabled="<%=!deletePermission%>" |
5946 |
03 Feb 12 |
nicklas |
132 |
image="delete.png" |
5941 |
01 Feb 12 |
nicklas |
133 |
title="Delete" |
5941 |
01 Feb 12 |
nicklas |
134 |
visible="<%=!news.isRemoved()%>" |
5941 |
01 Feb 12 |
nicklas |
135 |
tooltip="<%=deletePermission ? "Delete this news" : "You do not have permission to delete this news"%>" |
5941 |
01 Feb 12 |
nicklas |
136 |
/> |
5941 |
01 Feb 12 |
nicklas |
137 |
<tbl:button |
6218 |
19 Dec 12 |
nicklas |
138 |
id="btnRestore" |
5942 |
01 Feb 12 |
nicklas |
139 |
disabled="<%=!writePermission%>" |
6218 |
19 Dec 12 |
nicklas |
140 |
image="restore.png" |
5941 |
01 Feb 12 |
nicklas |
141 |
title="Restore" |
5941 |
01 Feb 12 |
nicklas |
142 |
visible="<%=news.isRemoved()%>" |
5941 |
01 Feb 12 |
nicklas |
143 |
tooltip="<%=writePermission ? "Restore this news" : "You do not have permission to restore this news"%>" |
5941 |
01 Feb 12 |
nicklas |
144 |
/> |
5941 |
01 Feb 12 |
nicklas |
145 |
<tbl:button |
6220 |
10 Jan 13 |
nicklas |
146 |
id="btnImport" |
5946 |
03 Feb 12 |
nicklas |
147 |
image="import.png" |
6220 |
10 Jan 13 |
nicklas |
148 |
data-plugin-type="IMPORT" |
5941 |
01 Feb 12 |
nicklas |
149 |
title="Import…" |
5941 |
01 Feb 12 |
nicklas |
150 |
tooltip="Import data" |
6222 |
14 Jan 13 |
nicklas |
151 |
visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
5941 |
01 Feb 12 |
nicklas |
152 |
/> |
5941 |
01 Feb 12 |
nicklas |
153 |
<tbl:button |
6220 |
10 Jan 13 |
nicklas |
154 |
id="btnExport" |
6220 |
10 Jan 13 |
nicklas |
155 |
image="export.png" |
6220 |
10 Jan 13 |
nicklas |
156 |
data-plugin-type="EXPORT" |
5941 |
01 Feb 12 |
nicklas |
157 |
title="Export…" |
5941 |
01 Feb 12 |
nicklas |
158 |
tooltip="Export data" |
6222 |
14 Jan 13 |
nicklas |
159 |
visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
5941 |
01 Feb 12 |
nicklas |
160 |
/> |
5941 |
01 Feb 12 |
nicklas |
161 |
<tbl:button |
6220 |
10 Jan 13 |
nicklas |
162 |
id="btnRunPlugin" |
6220 |
10 Jan 13 |
nicklas |
163 |
image="runplugin.png" |
6220 |
10 Jan 13 |
nicklas |
164 |
data-plugin-type="OTHER" |
5941 |
01 Feb 12 |
nicklas |
165 |
title="Run plugin…" |
5941 |
01 Feb 12 |
nicklas |
166 |
tooltip="Run a plugin" |
6222 |
14 Jan 13 |
nicklas |
167 |
visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
5941 |
01 Feb 12 |
nicklas |
168 |
/> |
5941 |
01 Feb 12 |
nicklas |
169 |
<ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
7604 |
25 Feb 19 |
nicklas |
170 |
wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/> |
5941 |
01 Feb 12 |
nicklas |
171 |
<tbl:button |
5941 |
01 Feb 12 |
nicklas |
172 |
image="help.png" |
6219 |
08 Jan 13 |
nicklas |
173 |
subclass="auto-init" |
6219 |
08 Jan 13 |
nicklas |
174 |
data-auto-init="help" |
6219 |
08 Jan 13 |
nicklas |
175 |
data-help-id="news.view.properties" |
5941 |
01 Feb 12 |
nicklas |
176 |
title="Help…" |
5941 |
01 Feb 12 |
nicklas |
177 |
tooltip="Get help about this page" |
5941 |
01 Feb 12 |
nicklas |
178 |
/> |
5941 |
01 Feb 12 |
nicklas |
179 |
</tbl:toolbar> |
5941 |
01 Feb 12 |
nicklas |
180 |
</td> |
5941 |
01 Feb 12 |
nicklas |
181 |
</tr> |
1997 |
16 Feb 06 |
nicklas |
182 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
183 |
<th>Name</th> |
1997 |
16 Feb 06 |
nicklas |
184 |
<td><%=HTML.encodeTags(news.getName())%></td> |
1997 |
16 Feb 06 |
nicklas |
185 |
</tr> |
1997 |
16 Feb 06 |
nicklas |
186 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
187 |
<th>Registered</th> |
4698 |
10 Dec 08 |
nicklas |
188 |
<td><%=dateFormatter.format(news.getEntryDate())%></td> |
4698 |
10 Dec 08 |
nicklas |
189 |
</tr> |
4698 |
10 Dec 08 |
nicklas |
190 |
<tr> |
7393 |
09 Jun 17 |
nicklas |
191 |
<th>Sticky</th> |
7393 |
09 Jun 17 |
nicklas |
192 |
<td><%=news.isSticky()%></td> |
7393 |
09 Jun 17 |
nicklas |
193 |
</tr> |
7393 |
09 Jun 17 |
nicklas |
194 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
195 |
<th>Start date</th> |
2942 |
22 Nov 06 |
nicklas |
196 |
<td><%=dateFormatter.format(news.getStartDate())%></td> |
1997 |
16 Feb 06 |
nicklas |
197 |
</tr> |
1997 |
16 Feb 06 |
nicklas |
198 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
199 |
<th>News date</th> |
2942 |
22 Nov 06 |
nicklas |
200 |
<td><%=dateFormatter.format(news.getNewsDate())%></td> |
1997 |
16 Feb 06 |
nicklas |
201 |
</tr> |
1997 |
16 Feb 06 |
nicklas |
202 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
203 |
<th>End date</th> |
2942 |
22 Nov 06 |
nicklas |
204 |
<td><%=dateFormatter.format(news.getEndDate())%></td> |
1997 |
16 Feb 06 |
nicklas |
205 |
</tr> |
5941 |
01 Feb 12 |
nicklas |
206 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
207 |
<th>Permissions</th> |
5941 |
01 Feb 12 |
nicklas |
208 |
<td><%=PermissionUtil.getFullPermissionNames(news)%></td> |
5941 |
01 Feb 12 |
nicklas |
209 |
</tr> |
5941 |
01 Feb 12 |
nicklas |
210 |
<tr class="big"> |
5941 |
01 Feb 12 |
nicklas |
211 |
<th>Description</th> |
1997 |
16 Feb 06 |
nicklas |
212 |
<td><%=HTML.niceFormat(news.getDescription())%></td> |
1997 |
16 Feb 06 |
nicklas |
213 |
</tr> |
1997 |
16 Feb 06 |
nicklas |
214 |
</table> |
5941 |
01 Feb 12 |
nicklas |
215 |
</div> |
5507 |
19 Nov 10 |
nicklas |
216 |
<jsp:include page="../../common/anytoany/list_anytoany.jsp"> |
5507 |
19 Nov 10 |
nicklas |
217 |
<jsp:param name="ID" value="<%=ID%>" /> |
5507 |
19 Nov 10 |
nicklas |
218 |
<jsp:param name="item_type" value="<%=itemType.name()%>" /> |
5507 |
19 Nov 10 |
nicklas |
219 |
<jsp:param name="item_id" value="<%=itemId%>" /> |
5507 |
19 Nov 10 |
nicklas |
220 |
<jsp:param name="title" value="Other items related to this news" /> |
5507 |
19 Nov 10 |
nicklas |
221 |
</jsp:include> |
5941 |
01 Feb 12 |
nicklas |
222 |
</t:tab> |
5941 |
01 Feb 12 |
nicklas |
223 |
</t:tabcontrol> |
1997 |
16 Feb 06 |
nicklas |
224 |
</base:body> |
1997 |
16 Feb 06 |
nicklas |
225 |
</base:page> |
1997 |
16 Feb 06 |
nicklas |
226 |
<% |
1997 |
16 Feb 06 |
nicklas |
227 |
} |
1997 |
16 Feb 06 |
nicklas |
228 |
finally |
1997 |
16 Feb 06 |
nicklas |
229 |
{ |
1997 |
16 Feb 06 |
nicklas |
230 |
if (dc != null) dc.close(); |
1997 |
16 Feb 06 |
nicklas |
231 |
} |
1997 |
16 Feb 06 |
nicklas |
232 |
|
1997 |
16 Feb 06 |
nicklas |
233 |
%> |