2213 |
04 May 06 |
nicklas |
1 |
<%-- $Id$ |
2213 |
04 May 06 |
nicklas |
2 |
------------------------------------------------------------------ |
2213 |
04 May 06 |
nicklas |
Copyright (C) 2006 Nicklas Nordborg |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg, Martin Svensson |
2213 |
04 May 06 |
nicklas |
5 |
|
2213 |
04 May 06 |
nicklas |
6 |
This file is part of BASE - BioArray Software Environment. |
2213 |
04 May 06 |
nicklas |
7 |
Available at http://base.thep.lu.se/ |
2213 |
04 May 06 |
nicklas |
8 |
|
2213 |
04 May 06 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or modify it |
2213 |
04 May 06 |
nicklas |
10 |
under the terms of the GNU General Public License as published by |
4476 |
05 Sep 08 |
jari |
11 |
the Free Software Foundation; either version 3 of the License, or |
2213 |
04 May 06 |
nicklas |
12 |
(at your option) any later version. |
2213 |
04 May 06 |
nicklas |
13 |
|
2213 |
04 May 06 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, but |
2213 |
04 May 06 |
nicklas |
15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
2213 |
04 May 06 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2213 |
04 May 06 |
nicklas |
17 |
General Public License for more details. |
2213 |
04 May 06 |
nicklas |
18 |
|
2213 |
04 May 06 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2213 |
04 May 06 |
nicklas |
21 |
------------------------------------------------------------------ |
2213 |
04 May 06 |
nicklas |
22 |
|
2213 |
04 May 06 |
nicklas |
23 |
@author Nicklas |
2213 |
04 May 06 |
nicklas |
24 |
@version 2.0 |
2213 |
04 May 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
2213 |
04 May 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
2213 |
04 May 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
2213 |
04 May 06 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
2213 |
04 May 06 |
nicklas |
30 |
import="net.sf.basedb.core.ItemContext" |
2213 |
04 May 06 |
nicklas |
31 |
import="net.sf.basedb.core.BasicItem" |
2213 |
04 May 06 |
nicklas |
32 |
import="net.sf.basedb.core.Removable" |
2213 |
04 May 06 |
nicklas |
33 |
import="net.sf.basedb.core.Permission" |
2510 |
10 Aug 06 |
nicklas |
34 |
import="net.sf.basedb.core.Trashcan" |
2213 |
04 May 06 |
nicklas |
35 |
import="net.sf.basedb.core.ItemInUseException" |
2901 |
14 Nov 06 |
nicklas |
36 |
import="net.sf.basedb.core.PermissionDeniedException" |
3655 |
10 Aug 07 |
nicklas |
37 |
import="net.sf.basedb.core.SimpleProgressReporter" |
2213 |
04 May 06 |
nicklas |
38 |
import="net.sf.basedb.clients.web.Base" |
2213 |
04 May 06 |
nicklas |
39 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
40 |
import="net.sf.basedb.util.Values" |
2213 |
04 May 06 |
nicklas |
41 |
import="net.sf.basedb.clients.web.util.HTML" |
2213 |
04 May 06 |
nicklas |
42 |
import="java.util.Enumeration" |
2223 |
09 May 06 |
nicklas |
43 |
import="java.util.Set" |
2223 |
09 May 06 |
nicklas |
44 |
import="java.util.HashSet" |
2510 |
10 Aug 06 |
nicklas |
45 |
import="java.util.List" |
3526 |
21 Jun 07 |
nicklas |
46 |
import="java.util.LinkedList" |
2223 |
09 May 06 |
nicklas |
47 |
import="java.util.Iterator" |
2213 |
04 May 06 |
nicklas |
48 |
%> |
2213 |
04 May 06 |
nicklas |
49 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2213 |
04 May 06 |
nicklas |
50 |
<%! |
2218 |
05 May 06 |
nicklas |
51 |
private static final ItemContext defaultContext = Base.createDefaultContext("", "type,name"); |
2213 |
04 May 06 |
nicklas |
52 |
private static final Item itemType = Item.SYSTEM; |
2213 |
04 May 06 |
nicklas |
53 |
private static final String subContext = "trashcan"; |
2213 |
04 May 06 |
nicklas |
54 |
%> |
2213 |
04 May 06 |
nicklas |
55 |
<% |
2213 |
04 May 06 |
nicklas |
56 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2213 |
04 May 06 |
nicklas |
57 |
final String ID = sc.getId(); |
2213 |
04 May 06 |
nicklas |
58 |
final String cmd = request.getParameter("cmd"); |
2213 |
04 May 06 |
nicklas |
59 |
final String root = request.getContextPath()+"/"; |
2213 |
04 May 06 |
nicklas |
60 |
|
2213 |
04 May 06 |
nicklas |
61 |
final String listPage = "list_trash.jsp?ID="+ID; |
2894 |
10 Nov 06 |
nicklas |
62 |
final String viewPage = "view_item.jsp?ID="+ID; |
2213 |
04 May 06 |
nicklas |
63 |
|
2213 |
04 May 06 |
nicklas |
64 |
String forward = null; |
2213 |
04 May 06 |
nicklas |
65 |
String redirect = null; |
2213 |
04 May 06 |
nicklas |
66 |
String message = null; |
6218 |
19 Dec 12 |
nicklas |
67 |
String notify = request.getParameter("notify"); |
2213 |
04 May 06 |
nicklas |
68 |
DbControl dc = null; |
2213 |
04 May 06 |
nicklas |
69 |
|
2213 |
04 May 06 |
nicklas |
70 |
try |
2213 |
04 May 06 |
nicklas |
71 |
{ |
2213 |
04 May 06 |
nicklas |
72 |
if (cmd == null || "List".equals(cmd)) |
2213 |
04 May 06 |
nicklas |
73 |
{ |
2213 |
04 May 06 |
nicklas |
74 |
// Display the list page without updatinging the current context |
2213 |
04 May 06 |
nicklas |
75 |
Base.getAndSetCurrentContext(sc, itemType, subContext, null, defaultContext); |
2213 |
04 May 06 |
nicklas |
76 |
redirect = listPage; |
2213 |
04 May 06 |
nicklas |
77 |
} |
2213 |
04 May 06 |
nicklas |
78 |
else if ("UpdateContext".equals(cmd)) |
2213 |
04 May 06 |
nicklas |
79 |
{ |
2213 |
04 May 06 |
nicklas |
80 |
// Display the list page after updating the current context from the request parameters |
2213 |
04 May 06 |
nicklas |
81 |
Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
2213 |
04 May 06 |
nicklas |
82 |
redirect = listPage; |
2213 |
04 May 06 |
nicklas |
83 |
} |
2213 |
04 May 06 |
nicklas |
84 |
else if ("LoadContext".equals(cmd)) |
2213 |
04 May 06 |
nicklas |
85 |
{ |
2213 |
04 May 06 |
nicklas |
86 |
// Display the list page after loading a saved context |
2213 |
04 May 06 |
nicklas |
87 |
int contextId = Values.getInt(request.getParameter("context")); |
2213 |
04 May 06 |
nicklas |
88 |
Base.loadContext(sc, contextId, defaultContext); |
2213 |
04 May 06 |
nicklas |
89 |
redirect = listPage; |
2213 |
04 May 06 |
nicklas |
90 |
} |
2898 |
13 Nov 06 |
nicklas |
91 |
else if ("DeleteItemsPermanently".equals(cmd)) |
2213 |
04 May 06 |
nicklas |
92 |
{ |
2213 |
04 May 06 |
nicklas |
93 |
// Delete all selected items on the list page |
7601 |
22 Feb 19 |
nicklas |
94 |
Enumeration<String> names = request.getParameterNames(); |
3526 |
21 Jun 07 |
nicklas |
95 |
List<Removable> items = new LinkedList<Removable>(); |
7954 |
12 May 21 |
nicklas |
96 |
dc = sc.newDbControl(":Delete items permanently (trashcan)"); |
2213 |
04 May 06 |
nicklas |
97 |
while (names.hasMoreElements()) |
2213 |
04 May 06 |
nicklas |
98 |
{ |
2213 |
04 May 06 |
nicklas |
99 |
String name = names.nextElement(); |
2213 |
04 May 06 |
nicklas |
100 |
if (name.startsWith("item:")) |
2213 |
04 May 06 |
nicklas |
101 |
{ |
2213 |
04 May 06 |
nicklas |
102 |
Item itemType = Item.valueOf(name.substring(5)); |
2213 |
04 May 06 |
nicklas |
103 |
Integer[] ids = Values.getInt(request.getParameterValues(name)); |
2213 |
04 May 06 |
nicklas |
104 |
for (int itemId : ids) |
2213 |
04 May 06 |
nicklas |
105 |
{ |
3526 |
21 Jun 07 |
nicklas |
106 |
try |
3526 |
21 Jun 07 |
nicklas |
107 |
{ |
3526 |
21 Jun 07 |
nicklas |
108 |
items.add((Removable)itemType.getById(dc, itemId)); |
3526 |
21 Jun 07 |
nicklas |
109 |
} |
3526 |
21 Jun 07 |
nicklas |
110 |
catch (Throwable t) |
3526 |
21 Jun 07 |
nicklas |
111 |
{} |
2213 |
04 May 06 |
nicklas |
112 |
} |
2213 |
04 May 06 |
nicklas |
113 |
} |
2213 |
04 May 06 |
nicklas |
114 |
} |
3526 |
21 Jun 07 |
nicklas |
115 |
dc.close(); |
2223 |
09 May 06 |
nicklas |
116 |
|
2223 |
09 May 06 |
nicklas |
117 |
int numTotal = items.size(); |
3655 |
10 Aug 07 |
nicklas |
118 |
SimpleProgressReporter progress = new SimpleProgressReporter(null); |
3655 |
10 Aug 07 |
nicklas |
119 |
sc.setSessionSetting("progress.trashcan", progress); |
3655 |
10 Aug 07 |
nicklas |
120 |
int numRemoved = Trashcan.delete(sc, items, false, progress); |
6311 |
23 Aug 13 |
nicklas |
121 |
|
2213 |
04 May 06 |
nicklas |
122 |
if (numTotal != numRemoved) |
2213 |
04 May 06 |
nicklas |
123 |
{ |
2213 |
04 May 06 |
nicklas |
124 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission, or the item is used by other items"; |
2213 |
04 May 06 |
nicklas |
125 |
} |
6192 |
31 Oct 12 |
nicklas |
126 |
redirect = listPage; |
2213 |
04 May 06 |
nicklas |
127 |
} |
2898 |
13 Nov 06 |
nicklas |
128 |
else if ("DeleteItems".equals(cmd)) |
2898 |
13 Nov 06 |
nicklas |
129 |
{ |
2898 |
13 Nov 06 |
nicklas |
130 |
// Mark selected items as removed |
7954 |
12 May 21 |
nicklas |
131 |
dc = sc.newDbControl(":Delete items (trashcan)"); |
2898 |
13 Nov 06 |
nicklas |
132 |
int numTotal = 0; |
2901 |
14 Nov 06 |
nicklas |
133 |
int numDeleted = 0; |
2898 |
13 Nov 06 |
nicklas |
134 |
|
7601 |
22 Feb 19 |
nicklas |
135 |
Enumeration<String> names = request.getParameterNames(); |
2898 |
13 Nov 06 |
nicklas |
136 |
while (names.hasMoreElements()) |
2898 |
13 Nov 06 |
nicklas |
137 |
{ |
2898 |
13 Nov 06 |
nicklas |
138 |
String name = names.nextElement(); |
2898 |
13 Nov 06 |
nicklas |
139 |
if (name.startsWith("item:")) |
2898 |
13 Nov 06 |
nicklas |
140 |
{ |
2898 |
13 Nov 06 |
nicklas |
141 |
Item itemType = Item.valueOf(name.substring(5)); |
2898 |
13 Nov 06 |
nicklas |
142 |
Integer[] ids = Values.getInt(request.getParameterValues(name)); |
2898 |
13 Nov 06 |
nicklas |
143 |
for (int itemId : ids) |
2898 |
13 Nov 06 |
nicklas |
144 |
{ |
2898 |
13 Nov 06 |
nicklas |
145 |
numTotal++; |
2901 |
14 Nov 06 |
nicklas |
146 |
try |
2901 |
14 Nov 06 |
nicklas |
147 |
{ |
2901 |
14 Nov 06 |
nicklas |
148 |
BasicItem item = itemType.getById(dc, itemId); |
2901 |
14 Nov 06 |
nicklas |
149 |
Removable r = (Removable)item; |
2901 |
14 Nov 06 |
nicklas |
150 |
r.setRemoved(true); |
2901 |
14 Nov 06 |
nicklas |
151 |
numDeleted++; |
2901 |
14 Nov 06 |
nicklas |
152 |
} |
2901 |
14 Nov 06 |
nicklas |
153 |
catch (PermissionDeniedException ex) |
2901 |
14 Nov 06 |
nicklas |
154 |
{} |
2898 |
13 Nov 06 |
nicklas |
155 |
} |
2898 |
13 Nov 06 |
nicklas |
156 |
} |
2898 |
13 Nov 06 |
nicklas |
157 |
} |
2898 |
13 Nov 06 |
nicklas |
158 |
dc.commit(); |
2901 |
14 Nov 06 |
nicklas |
159 |
if (numTotal != numDeleted) |
2898 |
13 Nov 06 |
nicklas |
160 |
{ |
2901 |
14 Nov 06 |
nicklas |
161 |
message = (numDeleted == 0 ? "No" : "Only "+numDeleted+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
2898 |
13 Nov 06 |
nicklas |
162 |
} |
2898 |
13 Nov 06 |
nicklas |
163 |
Item itemType = Item.valueOf(request.getParameter("item_type")); |
2898 |
13 Nov 06 |
nicklas |
164 |
int itemId = Values.getInt(request.getParameter("item_id")); |
2898 |
13 Nov 06 |
nicklas |
165 |
|
6192 |
31 Oct 12 |
nicklas |
166 |
redirect = viewPage+"&item_type=" + itemType.name() + "&item_id="+itemId; |
2898 |
13 Nov 06 |
nicklas |
167 |
} |
2213 |
04 May 06 |
nicklas |
168 |
else if ("RestoreItems".equals(cmd)) |
2213 |
04 May 06 |
nicklas |
169 |
{ |
2898 |
13 Nov 06 |
nicklas |
170 |
// Restore all selected items on the list or view page |
7954 |
12 May 21 |
nicklas |
171 |
dc = sc.newDbControl(":Restore items (trashcan)"); |
2213 |
04 May 06 |
nicklas |
172 |
int numTotal = 0; |
2213 |
04 May 06 |
nicklas |
173 |
int numRestored = 0; |
2213 |
04 May 06 |
nicklas |
174 |
|
7601 |
22 Feb 19 |
nicklas |
175 |
Enumeration<String> names = request.getParameterNames(); |
2213 |
04 May 06 |
nicklas |
176 |
while (names.hasMoreElements()) |
2213 |
04 May 06 |
nicklas |
177 |
{ |
2213 |
04 May 06 |
nicklas |
178 |
String name = names.nextElement(); |
2213 |
04 May 06 |
nicklas |
179 |
if (name.startsWith("item:")) |
2213 |
04 May 06 |
nicklas |
180 |
{ |
2213 |
04 May 06 |
nicklas |
181 |
Item itemType = Item.valueOf(name.substring(5)); |
2213 |
04 May 06 |
nicklas |
182 |
Integer[] ids = Values.getInt(request.getParameterValues(name)); |
2213 |
04 May 06 |
nicklas |
183 |
for (int itemId : ids) |
2213 |
04 May 06 |
nicklas |
184 |
{ |
2213 |
04 May 06 |
nicklas |
185 |
numTotal++; |
2901 |
14 Nov 06 |
nicklas |
186 |
try |
2901 |
14 Nov 06 |
nicklas |
187 |
{ |
2901 |
14 Nov 06 |
nicklas |
188 |
BasicItem item = itemType.getById(dc, itemId); |
2901 |
14 Nov 06 |
nicklas |
189 |
Removable r = (Removable)item; |
2901 |
14 Nov 06 |
nicklas |
190 |
r.setRemoved(false); |
2901 |
14 Nov 06 |
nicklas |
191 |
numRestored++; |
2901 |
14 Nov 06 |
nicklas |
192 |
} |
2901 |
14 Nov 06 |
nicklas |
193 |
catch (PermissionDeniedException ex) |
2901 |
14 Nov 06 |
nicklas |
194 |
{} |
2213 |
04 May 06 |
nicklas |
195 |
} |
2213 |
04 May 06 |
nicklas |
196 |
} |
2213 |
04 May 06 |
nicklas |
197 |
} |
2213 |
04 May 06 |
nicklas |
198 |
dc.commit(); |
2213 |
04 May 06 |
nicklas |
199 |
|
2213 |
04 May 06 |
nicklas |
200 |
if (numTotal != numRestored) |
2213 |
04 May 06 |
nicklas |
201 |
{ |
2213 |
04 May 06 |
nicklas |
202 |
message = (numRestored == 0 ? "No" : "Only "+numRestored+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
2213 |
04 May 06 |
nicklas |
203 |
} |
2898 |
13 Nov 06 |
nicklas |
204 |
|
2898 |
13 Nov 06 |
nicklas |
205 |
if (request.getParameter("item_type") != null) |
2898 |
13 Nov 06 |
nicklas |
206 |
{ |
2898 |
13 Nov 06 |
nicklas |
207 |
Item itemType = Item.valueOf(request.getParameter("item_type")); |
2898 |
13 Nov 06 |
nicklas |
208 |
int itemId = Values.getInt(request.getParameter("item_id")); |
2898 |
13 Nov 06 |
nicklas |
209 |
redirect = viewPage + "&item_type=" + itemType.name() + "&item_id="+itemId; |
2898 |
13 Nov 06 |
nicklas |
210 |
} |
2898 |
13 Nov 06 |
nicklas |
211 |
else |
2898 |
13 Nov 06 |
nicklas |
212 |
{ |
2898 |
13 Nov 06 |
nicklas |
213 |
redirect = listPage; |
2898 |
13 Nov 06 |
nicklas |
214 |
} |
2213 |
04 May 06 |
nicklas |
215 |
} |
2894 |
10 Nov 06 |
nicklas |
216 |
else if ("RestoreItem".equals(cmd)) |
2894 |
10 Nov 06 |
nicklas |
217 |
{ |
2898 |
13 Nov 06 |
nicklas |
218 |
// Restore the currently viewed item |
7954 |
12 May 21 |
nicklas |
219 |
dc = sc.newDbControl(":Restore item (trashcan)"); |
2894 |
10 Nov 06 |
nicklas |
220 |
Item itemType = Item.valueOf(request.getParameter("item_type")); |
2894 |
10 Nov 06 |
nicklas |
221 |
int itemId = Values.getInt(request.getParameter("item_id")); |
3550 |
05 Jul 07 |
martin |
222 |
String itemsIndexPage = request.getParameter("itemsIndexPage"); |
2894 |
10 Nov 06 |
nicklas |
223 |
BasicItem item = itemType.getById(dc, itemId); |
2894 |
10 Nov 06 |
nicklas |
224 |
Removable r = (Removable)item; |
2894 |
10 Nov 06 |
nicklas |
225 |
r.setRemoved(false); |
2894 |
10 Nov 06 |
nicklas |
226 |
dc.commit(); |
3550 |
05 Jul 07 |
martin |
227 |
redirect = itemsIndexPage + "?ID=" + ID + "&cmd=ViewItem&item_id=" + itemId; |
2894 |
10 Nov 06 |
nicklas |
228 |
} |
2898 |
13 Nov 06 |
nicklas |
229 |
else if ("DeleteItem".equals(cmd)) |
2894 |
10 Nov 06 |
nicklas |
230 |
{ |
2898 |
13 Nov 06 |
nicklas |
231 |
// Delete the currently view item |
7954 |
12 May 21 |
nicklas |
232 |
dc = sc.newDbControl(":Delete item (trashcan)"); |
2894 |
10 Nov 06 |
nicklas |
233 |
Item itemType = Item.valueOf(request.getParameter("item_type")); |
2894 |
10 Nov 06 |
nicklas |
234 |
int itemId = Values.getInt(request.getParameter("item_id")); |
2894 |
10 Nov 06 |
nicklas |
235 |
BasicItem item = itemType.getById(dc, itemId); |
2894 |
10 Nov 06 |
nicklas |
236 |
dc.deleteItem(item); |
2894 |
10 Nov 06 |
nicklas |
237 |
dc.commit(); |
4003 |
26 Nov 07 |
nicklas |
238 |
if (request.getParameter("popup") != null) |
4003 |
26 Nov 07 |
nicklas |
239 |
{ |
4003 |
26 Nov 07 |
nicklas |
240 |
message = itemType.toString() + " deleted"; |
4003 |
26 Nov 07 |
nicklas |
241 |
} |
4003 |
26 Nov 07 |
nicklas |
242 |
else |
4003 |
26 Nov 07 |
nicklas |
243 |
{ |
4003 |
26 Nov 07 |
nicklas |
244 |
redirect = listPage; |
4003 |
26 Nov 07 |
nicklas |
245 |
} |
2894 |
10 Nov 06 |
nicklas |
246 |
} |
2898 |
13 Nov 06 |
nicklas |
247 |
else if ("DeleteAllPermanently".equals(cmd)) |
2510 |
10 Aug 06 |
nicklas |
248 |
{ |
7954 |
12 May 21 |
nicklas |
249 |
dc = sc.newDbControl(":Delete all permanently (trashcan)"); |
4347 |
18 Jun 08 |
nicklas |
250 |
List<Removable> items = Trashcan.getItems(dc, (Set<Item>)null, 0, 0); |
2510 |
10 Aug 06 |
nicklas |
251 |
dc.close(); |
2510 |
10 Aug 06 |
nicklas |
252 |
int numTotal = items.size(); |
3655 |
10 Aug 07 |
nicklas |
253 |
SimpleProgressReporter progress = new SimpleProgressReporter(null); |
3655 |
10 Aug 07 |
nicklas |
254 |
sc.setSessionSetting("progress.trashcan", progress); |
3655 |
10 Aug 07 |
nicklas |
255 |
int numRemoved = Trashcan.delete(sc, items, false, progress); |
2510 |
10 Aug 06 |
nicklas |
256 |
|
2510 |
10 Aug 06 |
nicklas |
257 |
if (numTotal != numRemoved) |
2510 |
10 Aug 06 |
nicklas |
258 |
{ |
2510 |
10 Aug 06 |
nicklas |
259 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission, or the item is used by other items"; |
2510 |
10 Aug 06 |
nicklas |
260 |
} |
6192 |
31 Oct 12 |
nicklas |
261 |
redirect = listPage; |
2510 |
10 Aug 06 |
nicklas |
262 |
} |
2894 |
10 Nov 06 |
nicklas |
263 |
else if ("ViewUsingItems".equals(cmd)) |
2894 |
10 Nov 06 |
nicklas |
264 |
{ |
2894 |
10 Nov 06 |
nicklas |
265 |
redirect = viewPage + "&item_type=" + request.getParameter("item_type") + "&item_id="+request.getParameter("item_id"); |
2894 |
10 Nov 06 |
nicklas |
266 |
} |
2213 |
04 May 06 |
nicklas |
267 |
else |
2213 |
04 May 06 |
nicklas |
268 |
{ |
2213 |
04 May 06 |
nicklas |
269 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
2213 |
04 May 06 |
nicklas |
270 |
} |
2213 |
04 May 06 |
nicklas |
271 |
} |
2213 |
04 May 06 |
nicklas |
272 |
finally |
2213 |
04 May 06 |
nicklas |
273 |
{ |
2213 |
04 May 06 |
nicklas |
274 |
if (dc != null) dc.close(); |
2213 |
04 May 06 |
nicklas |
275 |
} |
2213 |
04 May 06 |
nicklas |
276 |
|
2213 |
04 May 06 |
nicklas |
277 |
if (forward != null) |
2213 |
04 May 06 |
nicklas |
278 |
{ |
6192 |
31 Oct 12 |
nicklas |
279 |
sc.setSessionSetting("alert-message", message); |
2213 |
04 May 06 |
nicklas |
280 |
pageContext.forward(forward); |
2213 |
04 May 06 |
nicklas |
281 |
} |
2213 |
04 May 06 |
nicklas |
282 |
else if (redirect != null) |
2213 |
04 May 06 |
nicklas |
283 |
{ |
6192 |
31 Oct 12 |
nicklas |
284 |
sc.setSessionSetting("alert-message", message); |
2213 |
04 May 06 |
nicklas |
285 |
response.sendRedirect(redirect); |
2213 |
04 May 06 |
nicklas |
286 |
} |
2213 |
04 May 06 |
nicklas |
287 |
else if (message == null) |
2213 |
04 May 06 |
nicklas |
288 |
{ |
4003 |
26 Nov 07 |
nicklas |
289 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0" + |
6218 |
19 Dec 12 |
nicklas |
290 |
(notify != null ? "¬ify_opener=" + HTML.urlEncode(notify) : "")); |
2213 |
04 May 06 |
nicklas |
291 |
} |
2213 |
04 May 06 |
nicklas |
292 |
else |
2213 |
04 May 06 |
nicklas |
293 |
{ |
4003 |
26 Nov 07 |
nicklas |
294 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+ |
6218 |
19 Dec 12 |
nicklas |
295 |
HTML.urlEncode(message) + (notify != null ? "¬ify_opener=" + HTML.urlEncode(notify) : "")); |
2213 |
04 May 06 |
nicklas |
296 |
} |
2213 |
04 May 06 |
nicklas |
297 |
%> |
2213 |
04 May 06 |
nicklas |
298 |
|