1342 |
15 Sep 05 |
nicklas |
1 |
<%-- $Id$ |
1342 |
15 Sep 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
1342 |
15 Sep 05 |
nicklas |
6 |
|
2304 |
22 May 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
1342 |
15 Sep 05 |
nicklas |
9 |
|
1342 |
15 Sep 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
1342 |
15 Sep 05 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
1342 |
15 Sep 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
1342 |
15 Sep 05 |
nicklas |
14 |
|
1342 |
15 Sep 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
1342 |
15 Sep 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1342 |
15 Sep 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1342 |
15 Sep 05 |
nicklas |
18 |
GNU General Public License for more details. |
1342 |
15 Sep 05 |
nicklas |
19 |
|
1342 |
15 Sep 05 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1342 |
15 Sep 05 |
nicklas |
22 |
------------------------------------------------------------------ |
1342 |
15 Sep 05 |
nicklas |
23 |
|
1342 |
15 Sep 05 |
nicklas |
24 |
@author Nicklas |
1342 |
15 Sep 05 |
nicklas |
25 |
@version 2.0 |
1342 |
15 Sep 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
3708 |
05 Sep 07 |
martin |
28 |
import="net.sf.basedb.core.Application" |
1342 |
15 Sep 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
1342 |
15 Sep 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
1342 |
15 Sep 05 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
1993 |
15 Feb 06 |
nicklas |
32 |
import="net.sf.basedb.core.Include" |
1342 |
15 Sep 05 |
nicklas |
33 |
import="net.sf.basedb.core.PluginDefinition" |
2631 |
08 Sep 06 |
nicklas |
34 |
import="net.sf.basedb.core.JobAgent" |
2631 |
08 Sep 06 |
nicklas |
35 |
import="net.sf.basedb.core.JobAgentSettings" |
1418 |
07 Oct 05 |
nicklas |
36 |
import="net.sf.basedb.core.ItemQuery" |
2671 |
27 Sep 06 |
martin |
37 |
import="net.sf.basedb.core.ItemResultList" |
1342 |
15 Sep 05 |
nicklas |
38 |
import="net.sf.basedb.core.Permission" |
1993 |
15 Feb 06 |
nicklas |
39 |
import="net.sf.basedb.core.ItemContext" |
1993 |
15 Feb 06 |
nicklas |
40 |
import="net.sf.basedb.core.MultiPermissions" |
4587 |
15 Oct 08 |
martin |
41 |
import="net.sf.basedb.core.OwnedItem" |
3712 |
06 Sep 07 |
martin |
42 |
import="net.sf.basedb.core.BaseException" |
1993 |
15 Feb 06 |
nicklas |
43 |
import="net.sf.basedb.core.PermissionDeniedException" |
4906 |
24 Apr 09 |
martin |
44 |
import="net.sf.basedb.core.PluginConfiguration" |
1993 |
15 Feb 06 |
nicklas |
45 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
2671 |
27 Sep 06 |
martin |
46 |
import="net.sf.basedb.core.RoleKey" |
2854 |
02 Nov 06 |
nicklas |
47 |
import="net.sf.basedb.core.plugin.Plugin" |
4906 |
24 Apr 09 |
martin |
48 |
import="net.sf.basedb.core.query.Expressions" |
3452 |
05 Jun 07 |
nicklas |
49 |
import="net.sf.basedb.core.query.Hql" |
4906 |
24 Apr 09 |
martin |
50 |
import="net.sf.basedb.core.query.Orders" |
4906 |
24 Apr 09 |
martin |
51 |
import="net.sf.basedb.core.query.Restrictions" |
3712 |
06 Sep 07 |
martin |
52 |
import="net.sf.basedb.util.FileUtil" |
1993 |
15 Feb 06 |
nicklas |
53 |
import="net.sf.basedb.util.RemovableUtil" |
1993 |
15 Feb 06 |
nicklas |
54 |
import="net.sf.basedb.util.ShareableUtil" |
2921 |
15 Nov 06 |
nicklas |
55 |
import="net.sf.basedb.util.OwnableUtil" |
1993 |
15 Feb 06 |
nicklas |
56 |
import="net.sf.basedb.util.JarClassLoader" |
3832 |
15 Oct 07 |
nicklas |
57 |
import="net.sf.basedb.util.RegexpFileFilter" |
4906 |
24 Apr 09 |
martin |
58 |
import="net.sf.basedb.util.Values" |
4906 |
24 Apr 09 |
martin |
59 |
import="net.sf.basedb.util.formatter.NameableFormatter" |
1342 |
15 Sep 05 |
nicklas |
60 |
import="net.sf.basedb.clients.web.Base" |
2671 |
27 Sep 06 |
martin |
61 |
import="net.sf.basedb.clients.web.PermissionUtil" |
4906 |
24 Apr 09 |
martin |
62 |
import="net.sf.basedb.clients.web.WebException" |
4906 |
24 Apr 09 |
martin |
63 |
import="net.sf.basedb.clients.web.plugins.ItemQueryLoader" |
1342 |
15 Sep 05 |
nicklas |
64 |
import="net.sf.basedb.clients.web.util.HTML" |
4859 |
27 Mar 09 |
nicklas |
65 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
3733 |
14 Sep 07 |
martin |
66 |
import="net.sf.basedb.plugins.PluginConfigurationImporter" |
5508 |
19 Nov 10 |
nicklas |
67 |
import="net.sf.basedb.core.plugin.GuiContext" |
5508 |
19 Nov 10 |
nicklas |
68 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5615 |
19 Apr 11 |
nicklas |
69 |
import="net.sf.basedb.util.extensions.manager.PluginInfoKey" |
5615 |
19 Apr 11 |
nicklas |
70 |
import="net.sf.basedb.util.extensions.xml.PluginInfo" |
5508 |
19 Nov 10 |
nicklas |
71 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5508 |
19 Nov 10 |
nicklas |
72 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5508 |
19 Nov 10 |
nicklas |
73 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
74 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveAction" |
5508 |
19 Nov 10 |
nicklas |
75 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveRenderer" |
6045 |
03 Apr 12 |
nicklas |
76 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
77 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6045 |
03 Apr 12 |
nicklas |
78 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
1993 |
15 Feb 06 |
nicklas |
79 |
import="java.util.Enumeration" |
1342 |
15 Sep 05 |
nicklas |
80 |
import="java.util.Set" |
4711 |
18 Dec 08 |
nicklas |
81 |
import="java.util.Map" |
4711 |
18 Dec 08 |
nicklas |
82 |
import="java.util.LinkedHashMap" |
3733 |
14 Sep 07 |
martin |
83 |
import="java.util.HashMap" |
1993 |
15 Feb 06 |
nicklas |
84 |
import="java.util.HashSet" |
1993 |
15 Feb 06 |
nicklas |
85 |
import="java.util.List" |
3832 |
15 Oct 07 |
nicklas |
86 |
import="java.util.LinkedList" |
1993 |
15 Feb 06 |
nicklas |
87 |
import="java.util.Collections" |
3832 |
15 Oct 07 |
nicklas |
88 |
import="java.io.FileFilter" |
1342 |
15 Sep 05 |
nicklas |
89 |
%> |
1342 |
15 Sep 05 |
nicklas |
90 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1342 |
15 Sep 05 |
nicklas |
91 |
<%! |
1993 |
15 Feb 06 |
nicklas |
92 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,pluginType,className,description"); |
1993 |
15 Feb 06 |
nicklas |
93 |
private static final Item itemType = Item.PLUGINDEFINITION; |
4906 |
24 Apr 09 |
martin |
94 |
|
4906 |
24 Apr 09 |
martin |
95 |
private static void registerExportUtils(ItemContext cc) |
4906 |
24 Apr 09 |
martin |
96 |
{ |
4906 |
24 Apr 09 |
martin |
97 |
// Register formatters |
4906 |
24 Apr 09 |
martin |
98 |
cc.setObject("export.formatter.&configurations(name)", new NameableFormatter()); |
4906 |
24 Apr 09 |
martin |
99 |
|
4906 |
24 Apr 09 |
martin |
100 |
// Register dataloaders |
4906 |
24 Apr 09 |
martin |
101 |
String pluginParameter = "plugin"; |
4906 |
24 Apr 09 |
martin |
102 |
ItemQuery<PluginConfiguration> configQuery = PluginConfiguration.getQuery(); |
4906 |
24 Apr 09 |
martin |
103 |
configQuery.include(cc.getInclude()); |
4906 |
24 Apr 09 |
martin |
104 |
configQuery.restrict(Restrictions.eq(Hql.property("pluginDefinition"), Expressions.parameter("plugin"))); |
4906 |
24 Apr 09 |
martin |
105 |
configQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
106 |
cc.setObject("export.dataloader.&configurations(name)", new ItemQueryLoader<PluginDefinition>(configQuery, pluginParameter)); |
4906 |
24 Apr 09 |
martin |
107 |
} |
1342 |
15 Sep 05 |
nicklas |
108 |
%> |
1342 |
15 Sep 05 |
nicklas |
109 |
<% |
1993 |
15 Feb 06 |
nicklas |
110 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1342 |
15 Sep 05 |
nicklas |
111 |
final String ID = sc.getId(); |
1993 |
15 Feb 06 |
nicklas |
112 |
final String cmd = request.getParameter("cmd"); |
1993 |
15 Feb 06 |
nicklas |
113 |
final String root = request.getContextPath()+"/"; |
1993 |
15 Feb 06 |
nicklas |
114 |
final String mode = request.getParameter("mode"); |
1993 |
15 Feb 06 |
nicklas |
115 |
final String callback = request.getParameter("callback"); |
1993 |
15 Feb 06 |
nicklas |
116 |
final String itemId = request.getParameter("item_id"); |
1993 |
15 Feb 06 |
nicklas |
117 |
final String listPage = "list_plugins.jsp?ID="+ID |
1993 |
15 Feb 06 |
nicklas |
118 |
+(mode == null ? "" : "&mode="+mode) |
1993 |
15 Feb 06 |
nicklas |
119 |
+(callback == null ? "" : "&callback="+callback) |
1993 |
15 Feb 06 |
nicklas |
120 |
+(itemId == null ? "" : "&item_id="+itemId); |
5615 |
19 Apr 11 |
nicklas |
121 |
final String viewPage = "view_plugin.jsp?ID="+ID+"&iframe=" + Values.getBoolean(request.getParameter("iframe")); |
1993 |
15 Feb 06 |
nicklas |
122 |
final String editPage = "edit_plugin.jsp?ID="+ID; |
1342 |
15 Sep 05 |
nicklas |
123 |
|
1993 |
15 Feb 06 |
nicklas |
124 |
String forward = null; |
1993 |
15 Feb 06 |
nicklas |
125 |
String redirect = null; |
1993 |
15 Feb 06 |
nicklas |
126 |
String message = null; |
1993 |
15 Feb 06 |
nicklas |
127 |
DbControl dc = null; |
1993 |
15 Feb 06 |
nicklas |
128 |
|
1342 |
15 Sep 05 |
nicklas |
129 |
try |
1342 |
15 Sep 05 |
nicklas |
130 |
{ |
1993 |
15 Feb 06 |
nicklas |
131 |
if (cmd == null || "List".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
132 |
{ |
1993 |
15 Feb 06 |
nicklas |
133 |
// Display the list page without updatinging the current context |
2811 |
26 Oct 06 |
nicklas |
134 |
Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
1993 |
15 Feb 06 |
nicklas |
135 |
redirect = listPage; |
1993 |
15 Feb 06 |
nicklas |
136 |
} |
1993 |
15 Feb 06 |
nicklas |
137 |
else if ("UpdateContext".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
138 |
{ |
1993 |
15 Feb 06 |
nicklas |
139 |
// Display the list page after updating the current context from the request parameters |
1993 |
15 Feb 06 |
nicklas |
140 |
Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
141 |
redirect = listPage; |
1993 |
15 Feb 06 |
nicklas |
142 |
} |
1993 |
15 Feb 06 |
nicklas |
143 |
else if ("LoadContext".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
144 |
{ |
1993 |
15 Feb 06 |
nicklas |
145 |
// Display the list page after loading a saved context |
1993 |
15 Feb 06 |
nicklas |
146 |
int contextId = Values.getInt(request.getParameter("context")); |
1993 |
15 Feb 06 |
nicklas |
147 |
Base.loadContext(sc, contextId, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
148 |
redirect = listPage; |
1993 |
15 Feb 06 |
nicklas |
149 |
} |
1993 |
15 Feb 06 |
nicklas |
150 |
|
1993 |
15 Feb 06 |
nicklas |
151 |
else if ("ViewItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
152 |
{ |
1993 |
15 Feb 06 |
nicklas |
153 |
// Display the view page for a single item |
1993 |
15 Feb 06 |
nicklas |
154 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
155 |
forward = viewPage; |
1993 |
15 Feb 06 |
nicklas |
156 |
} |
5615 |
19 Apr 11 |
nicklas |
157 |
else if ("ViewItemByClass".equals(cmd)) |
5615 |
19 Apr 11 |
nicklas |
158 |
{ |
7954 |
12 May 21 |
nicklas |
159 |
dc = sc.newDbControl(":View "+itemType); |
5615 |
19 Apr 11 |
nicklas |
160 |
PluginDefinition plugin = PluginDefinition.getByClassName(dc, request.getParameter("className")); |
5615 |
19 Apr 11 |
nicklas |
161 |
// Display the view page for a single item |
5615 |
19 Apr 11 |
nicklas |
162 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5615 |
19 Apr 11 |
nicklas |
163 |
cc.setId(plugin.getId()); |
5615 |
19 Apr 11 |
nicklas |
164 |
forward = viewPage; |
5615 |
19 Apr 11 |
nicklas |
165 |
} |
1993 |
15 Feb 06 |
nicklas |
166 |
else if ("EditItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
167 |
{ |
1993 |
15 Feb 06 |
nicklas |
168 |
// Display the edit page for a single item (should be opened in a popup) |
1993 |
15 Feb 06 |
nicklas |
169 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2631 |
08 Sep 06 |
nicklas |
170 |
forward = editPage; |
1993 |
15 Feb 06 |
nicklas |
171 |
} |
1993 |
15 Feb 06 |
nicklas |
172 |
else if ("NewItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
173 |
{ |
1993 |
15 Feb 06 |
nicklas |
174 |
// Display the edit page for a new item (should be opened in a popup) |
1993 |
15 Feb 06 |
nicklas |
175 |
if (!sc.hasPermission(Permission.CREATE, itemType)) |
1342 |
15 Sep 05 |
nicklas |
176 |
{ |
1993 |
15 Feb 06 |
nicklas |
177 |
throw new PermissionDeniedException(Permission.CREATE, itemType.toString()); |
1342 |
15 Sep 05 |
nicklas |
178 |
} |
1993 |
15 Feb 06 |
nicklas |
179 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
180 |
cc.setId(0); |
3733 |
14 Sep 07 |
martin |
181 |
|
5616 |
27 Apr 11 |
nicklas |
182 |
redirect = editPage; |
1993 |
15 Feb 06 |
nicklas |
183 |
} |
1993 |
15 Feb 06 |
nicklas |
184 |
else if ("UpdateItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
185 |
{ |
1993 |
15 Feb 06 |
nicklas |
186 |
// Update the properties on an item (will close the popup) |
1993 |
15 Feb 06 |
nicklas |
187 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
7954 |
12 May 21 |
nicklas |
188 |
dc = sc.newDbControl(":Edit "+itemType); |
7605 |
26 Feb 19 |
nicklas |
189 |
PluginDefinition plugin = cc.getObject("item"); |
1993 |
15 Feb 06 |
nicklas |
190 |
String className = Values.getStringOrNull(request.getParameter("className")); |
5595 |
17 Mar 11 |
nicklas |
191 |
String jarFile = Values.getStringOrNull(request.getParameter("jarFile")); |
2802 |
25 Oct 06 |
nicklas |
192 |
int usePermissions = Values.getInt(request.getParameter("use_permissions")); |
1993 |
15 Feb 06 |
nicklas |
193 |
if (plugin == null) |
1342 |
15 Sep 05 |
nicklas |
194 |
{ |
5595 |
17 Mar 11 |
nicklas |
195 |
plugin = PluginDefinition.getNew(dc, className, jarFile, usePermissions == 2); |
1993 |
15 Feb 06 |
nicklas |
196 |
message = "Plugin created"; |
1993 |
15 Feb 06 |
nicklas |
197 |
dc.saveItem(plugin); |
1342 |
15 Sep 05 |
nicklas |
198 |
} |
1993 |
15 Feb 06 |
nicklas |
199 |
else |
1342 |
15 Sep 05 |
nicklas |
200 |
{ |
5060 |
19 Aug 09 |
nicklas |
201 |
dc.reattachItem(plugin, false); |
5595 |
17 Mar 11 |
nicklas |
202 |
plugin.loadPluginInformation(jarFile, className, usePermissions == 2); |
1993 |
15 Feb 06 |
nicklas |
203 |
message = "Plugin updated"; |
1342 |
15 Sep 05 |
nicklas |
204 |
} |
5508 |
19 Nov 10 |
nicklas |
205 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(Item.PLUGINDEFINITION), plugin); |
7604 |
25 Feb 19 |
nicklas |
206 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5508 |
19 Nov 10 |
nicklas |
207 |
try |
2671 |
27 Sep 06 |
martin |
208 |
{ |
5508 |
19 Nov 10 |
nicklas |
209 |
plugin.setMaxMemory(Values.parseBytes(request.getParameter("maxMemory"), null)); |
5508 |
19 Nov 10 |
nicklas |
210 |
plugin.setTrusted(Values.getBoolean(request.getParameter("trusted"))); |
5508 |
19 Nov 10 |
nicklas |
211 |
plugin.setUseInternalJobQueue(Values.getBoolean(request.getParameter("use_internal_jobqueue"))); |
5508 |
19 Nov 10 |
nicklas |
212 |
String aie = Values.getStringOrNull(request.getParameter("allow_immediate_execution")); |
5508 |
19 Nov 10 |
nicklas |
213 |
plugin.setAllowImmediateExecution(aie == null ? |
5508 |
19 Nov 10 |
nicklas |
214 |
plugin.getMainType() == Plugin.MainType.EXPORT : Values.getBoolean(aie)); |
5508 |
19 Nov 10 |
nicklas |
215 |
|
5508 |
19 Nov 10 |
nicklas |
216 |
//Update permissions |
5508 |
19 Nov 10 |
nicklas |
217 |
ItemQuery<RoleKey> q = RoleKey.getQuery(); |
5508 |
19 Nov 10 |
nicklas |
218 |
q.setCacheResult(true); |
5508 |
19 Nov 10 |
nicklas |
219 |
ItemResultList<RoleKey> roleKeys = q.list(dc); |
5508 |
19 Nov 10 |
nicklas |
220 |
for (RoleKey key : roleKeys) |
2631 |
08 Sep 06 |
nicklas |
221 |
{ |
5508 |
19 Nov 10 |
nicklas |
222 |
String name = key.getItemType().name(); |
5508 |
19 Nov 10 |
nicklas |
223 |
int granted = Values.getInt(request.getParameter(name+"_granted")); |
5508 |
19 Nov 10 |
nicklas |
224 |
int denied = Values.getInt(request.getParameter(name+"_denied")); |
5508 |
19 Nov 10 |
nicklas |
225 |
plugin.setPermissions(key, PermissionUtil.getPermissions(granted), PermissionUtil.getPermissions(denied)); |
2631 |
08 Sep 06 |
nicklas |
226 |
} |
5508 |
19 Nov 10 |
nicklas |
227 |
plugin.setUsePermissions(usePermissions != 0); |
5508 |
19 Nov 10 |
nicklas |
228 |
|
5508 |
19 Nov 10 |
nicklas |
229 |
// Installed on job agents |
6305 |
09 Aug 13 |
nicklas |
230 |
String[] removeAgents = Values.getString(request.getParameter("-JOBAGENT")).split(","); |
5508 |
19 Nov 10 |
nicklas |
231 |
for (int i = 0; i < removeAgents.length; ++i) |
2631 |
08 Sep 06 |
nicklas |
232 |
{ |
5508 |
19 Nov 10 |
nicklas |
233 |
int agentId = Values.getInt(removeAgents[i], -1); |
5508 |
19 Nov 10 |
nicklas |
234 |
if (agentId != -1) |
2631 |
08 Sep 06 |
nicklas |
235 |
{ |
5508 |
19 Nov 10 |
nicklas |
236 |
JobAgent agent = JobAgent.getById(dc, agentId); |
5508 |
19 Nov 10 |
nicklas |
237 |
JobAgentSettings settings = agent.getSettings(plugin, false); |
5508 |
19 Nov 10 |
nicklas |
238 |
if (settings != null && settings.isInDatabase()) dc.deleteItem(settings); |
2631 |
08 Sep 06 |
nicklas |
239 |
} |
5508 |
19 Nov 10 |
nicklas |
240 |
} |
5508 |
19 Nov 10 |
nicklas |
241 |
|
5508 |
19 Nov 10 |
nicklas |
242 |
String[] allAgents = Values.getString(request.getParameter("allAgents")).split(","); |
5508 |
19 Nov 10 |
nicklas |
243 |
for (int i = 0; i < allAgents.length; ++i) |
5508 |
19 Nov 10 |
nicklas |
244 |
{ |
5508 |
19 Nov 10 |
nicklas |
245 |
int agentId = Values.getInt(allAgents[i], -1); |
5508 |
19 Nov 10 |
nicklas |
246 |
if (agentId != -1) |
2631 |
08 Sep 06 |
nicklas |
247 |
{ |
5508 |
19 Nov 10 |
nicklas |
248 |
JobAgent agent = JobAgent.getById(dc, agentId); |
5508 |
19 Nov 10 |
nicklas |
249 |
JobAgentSettings settings = agent.getSettings(plugin, true); |
5508 |
19 Nov 10 |
nicklas |
250 |
if (!settings.isInDatabase()) |
5508 |
19 Nov 10 |
nicklas |
251 |
{ |
5508 |
19 Nov 10 |
nicklas |
252 |
dc.saveItem(settings); |
5508 |
19 Nov 10 |
nicklas |
253 |
} |
5508 |
19 Nov 10 |
nicklas |
254 |
else |
5508 |
19 Nov 10 |
nicklas |
255 |
{ |
5508 |
19 Nov 10 |
nicklas |
256 |
dc.reattachItem(settings, false); |
5508 |
19 Nov 10 |
nicklas |
257 |
} |
5508 |
19 Nov 10 |
nicklas |
258 |
settings.setMaxMemory(Values.parseBytes(request.getParameter("maxMemory."+agentId), null)); |
5508 |
19 Nov 10 |
nicklas |
259 |
settings.setPriorityBoost(Values.getInt(request.getParameter("priorityBoost."+agentId))); |
6305 |
09 Aug 13 |
nicklas |
260 |
String trusted = Values.getStringOrNull(request.getParameter("trusted."+agentId)); |
5508 |
19 Nov 10 |
nicklas |
261 |
settings.setTrusted(trusted == null ? null : Values.getBoolean(trusted)); |
2631 |
08 Sep 06 |
nicklas |
262 |
} |
2631 |
08 Sep 06 |
nicklas |
263 |
} |
5508 |
19 Nov 10 |
nicklas |
264 |
|
5508 |
19 Nov 10 |
nicklas |
265 |
//Annotations |
5508 |
19 Nov 10 |
nicklas |
266 |
Base.updateAnnotations(dc, plugin, plugin, request); |
5508 |
19 Nov 10 |
nicklas |
267 |
|
5508 |
19 Nov 10 |
nicklas |
268 |
// OnSave extensions |
5508 |
19 Nov 10 |
nicklas |
269 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5508 |
19 Nov 10 |
nicklas |
270 |
dc.commit(); |
5508 |
19 Nov 10 |
nicklas |
271 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
2631 |
08 Sep 06 |
nicklas |
272 |
} |
5508 |
19 Nov 10 |
nicklas |
273 |
catch (Exception ex) |
5508 |
19 Nov 10 |
nicklas |
274 |
{ |
5508 |
19 Nov 10 |
nicklas |
275 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5508 |
19 Nov 10 |
nicklas |
276 |
throw ex; |
5508 |
19 Nov 10 |
nicklas |
277 |
} |
5508 |
19 Nov 10 |
nicklas |
278 |
finally |
5508 |
19 Nov 10 |
nicklas |
279 |
{ |
5508 |
19 Nov 10 |
nicklas |
280 |
cc.removeObject("item"); |
5508 |
19 Nov 10 |
nicklas |
281 |
} |
1993 |
15 Feb 06 |
nicklas |
282 |
} |
5615 |
19 Apr 11 |
nicklas |
283 |
else if ("DisableItem".equals(cmd)) |
5615 |
19 Apr 11 |
nicklas |
284 |
{ |
5615 |
19 Apr 11 |
nicklas |
285 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
286 |
dc = sc.newDbControl(":Disable "+itemType); |
5615 |
19 Apr 11 |
nicklas |
287 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5615 |
19 Apr 11 |
nicklas |
288 |
PluginDefinition plugin = PluginDefinition.getById(dc, cc.getId()); |
5615 |
19 Apr 11 |
nicklas |
289 |
plugin.setDisabled(true); |
5615 |
19 Apr 11 |
nicklas |
290 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
5615 |
19 Apr 11 |
nicklas |
291 |
PluginInfo info = ec.getObjectForKey(new PluginInfoKey(plugin.getClassName())); |
5615 |
19 Apr 11 |
nicklas |
292 |
if (info != null) info.setDisabled(true); |
5615 |
19 Apr 11 |
nicklas |
293 |
dc.commit(); |
5615 |
19 Apr 11 |
nicklas |
294 |
redirect = viewPage; |
5615 |
19 Apr 11 |
nicklas |
295 |
} |
5615 |
19 Apr 11 |
nicklas |
296 |
else if ("EnableItem".equals(cmd)) |
5615 |
19 Apr 11 |
nicklas |
297 |
{ |
5615 |
19 Apr 11 |
nicklas |
298 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
299 |
dc = sc.newDbControl(":Enable "+itemType); |
5615 |
19 Apr 11 |
nicklas |
300 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5615 |
19 Apr 11 |
nicklas |
301 |
PluginDefinition plugin = PluginDefinition.getById(dc, cc.getId()); |
5615 |
19 Apr 11 |
nicklas |
302 |
plugin.setDisabled(false); |
5615 |
19 Apr 11 |
nicklas |
303 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
5615 |
19 Apr 11 |
nicklas |
304 |
PluginInfo info = ec.getObjectForKey(new PluginInfoKey(plugin.getClassName())); |
5615 |
19 Apr 11 |
nicklas |
305 |
if (info != null) info.setDisabled(false); |
5615 |
19 Apr 11 |
nicklas |
306 |
dc.commit(); |
5615 |
19 Apr 11 |
nicklas |
307 |
redirect = viewPage; |
5615 |
19 Apr 11 |
nicklas |
308 |
} |
1993 |
15 Feb 06 |
nicklas |
309 |
else if ("DeleteItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
310 |
{ |
1993 |
15 Feb 06 |
nicklas |
311 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
312 |
dc = sc.newDbControl(":Delete "+itemType); |
1993 |
15 Feb 06 |
nicklas |
313 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
314 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), true); |
1993 |
15 Feb 06 |
nicklas |
315 |
dc.commit(); |
1993 |
15 Feb 06 |
nicklas |
316 |
redirect = viewPage; |
1993 |
15 Feb 06 |
nicklas |
317 |
} |
1993 |
15 Feb 06 |
nicklas |
318 |
else if ("DeleteItems".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
319 |
{ |
1993 |
15 Feb 06 |
nicklas |
320 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
321 |
dc = sc.newDbControl(":Delete "+itemType); |
1993 |
15 Feb 06 |
nicklas |
322 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
323 |
int numTotal = cc.getSelected().size(); |
1993 |
15 Feb 06 |
nicklas |
324 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true); |
1993 |
15 Feb 06 |
nicklas |
325 |
dc.commit(); |
1993 |
15 Feb 06 |
nicklas |
326 |
if (numTotal != numRemoved) |
1342 |
15 Sep 05 |
nicklas |
327 |
{ |
1993 |
15 Feb 06 |
nicklas |
328 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
1342 |
15 Sep 05 |
nicklas |
329 |
} |
6192 |
31 Oct 12 |
nicklas |
330 |
redirect = listPage; |
1993 |
15 Feb 06 |
nicklas |
331 |
} |
1993 |
15 Feb 06 |
nicklas |
332 |
else if ("RestoreItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
333 |
{ |
1993 |
15 Feb 06 |
nicklas |
334 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
335 |
dc = sc.newDbControl(":Restore "+itemType); |
1993 |
15 Feb 06 |
nicklas |
336 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
337 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), false); |
1993 |
15 Feb 06 |
nicklas |
338 |
dc.commit(); |
1993 |
15 Feb 06 |
nicklas |
339 |
redirect = viewPage; |
1993 |
15 Feb 06 |
nicklas |
340 |
} |
1993 |
15 Feb 06 |
nicklas |
341 |
else if ("RestoreItems".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
342 |
{ |
1993 |
15 Feb 06 |
nicklas |
343 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
344 |
dc = sc.newDbControl(":Restore "+itemType); |
1993 |
15 Feb 06 |
nicklas |
345 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
346 |
int numTotal = cc.getSelected().size(); |
1993 |
15 Feb 06 |
nicklas |
347 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false); |
1993 |
15 Feb 06 |
nicklas |
348 |
dc.commit(); |
1993 |
15 Feb 06 |
nicklas |
349 |
if (numTotal != numRemoved) |
1353 |
20 Sep 05 |
nicklas |
350 |
{ |
2528 |
15 Aug 06 |
martin |
351 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
1993 |
15 Feb 06 |
nicklas |
352 |
} |
6192 |
31 Oct 12 |
nicklas |
353 |
redirect = listPage; |
1993 |
15 Feb 06 |
nicklas |
354 |
} |
1993 |
15 Feb 06 |
nicklas |
355 |
else if ("ShareItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
356 |
{ |
1993 |
15 Feb 06 |
nicklas |
357 |
// Display a popup window for sharing a single item |
7954 |
12 May 21 |
nicklas |
358 |
dc = sc.newDbControl(":Share "+itemType); |
1993 |
15 Feb 06 |
nicklas |
359 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
360 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId())); |
1993 |
15 Feb 06 |
nicklas |
361 |
dc.close(); |
1993 |
15 Feb 06 |
nicklas |
362 |
cc.setObject("MultiPermissions", permissions); |
1993 |
15 Feb 06 |
nicklas |
363 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1993 |
15 Feb 06 |
nicklas |
364 |
} |
1993 |
15 Feb 06 |
nicklas |
365 |
else if ("ShareItems".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
366 |
{ |
1993 |
15 Feb 06 |
nicklas |
367 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
368 |
dc = sc.newDbControl(":Share "+itemType); |
1993 |
15 Feb 06 |
nicklas |
369 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
370 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
1993 |
15 Feb 06 |
nicklas |
371 |
dc.close(); |
1993 |
15 Feb 06 |
nicklas |
372 |
cc.setObject("MultiPermissions", permissions); |
1993 |
15 Feb 06 |
nicklas |
373 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1993 |
15 Feb 06 |
nicklas |
374 |
} |
4578 |
13 Oct 08 |
martin |
375 |
else if ("SetOwnerOfItem".equals(cmd)) |
2921 |
15 Nov 06 |
nicklas |
376 |
{ |
4578 |
13 Oct 08 |
martin |
377 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
378 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2921 |
15 Nov 06 |
nicklas |
379 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
380 |
OwnedItem item = (OwnedItem)itemType.getById(dc, cc.getId()); |
4587 |
15 Oct 08 |
martin |
381 |
cc.setObject("OwnedItems", Collections.singleton(item)); |
4578 |
13 Oct 08 |
martin |
382 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2921 |
15 Nov 06 |
nicklas |
383 |
} |
4578 |
13 Oct 08 |
martin |
384 |
else if ("SetOwnerOfItems".equals(cmd)) |
2921 |
15 Nov 06 |
nicklas |
385 |
{ |
4578 |
13 Oct 08 |
martin |
386 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
387 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2921 |
15 Nov 06 |
nicklas |
388 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
389 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
4587 |
15 Oct 08 |
martin |
390 |
for (Integer id : cc.getSelected()) |
4587 |
15 Oct 08 |
martin |
391 |
{ |
4587 |
15 Oct 08 |
martin |
392 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
4587 |
15 Oct 08 |
martin |
393 |
} |
4587 |
15 Oct 08 |
martin |
394 |
dc.close(); |
4587 |
15 Oct 08 |
martin |
395 |
cc.setObject("OwnedItems", items); |
4578 |
13 Oct 08 |
martin |
396 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2921 |
15 Nov 06 |
nicklas |
397 |
} |
1993 |
15 Feb 06 |
nicklas |
398 |
else if ("ExportItems".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
399 |
{ |
1993 |
15 Feb 06 |
nicklas |
400 |
// Run an export plugin in a list context |
1993 |
15 Feb 06 |
nicklas |
401 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
402 |
final ItemQuery<PluginDefinition> query = PluginDefinition.getQuery(); |
3452 |
05 Jun 07 |
nicklas |
403 |
query.join(Hql.leftJoin("guiContexts", "ctx")); |
3452 |
05 Jun 07 |
nicklas |
404 |
query.setDistinct(true); |
7954 |
12 May 21 |
nicklas |
405 |
dc = sc.newDbControl(":Export "+itemType); |
7914 |
23 Feb 21 |
nicklas |
406 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
407 |
cc.configureQuery(dc, query, jspContext, true); |
1993 |
15 Feb 06 |
nicklas |
408 |
cc.setQuery(query); |
4906 |
24 Apr 09 |
martin |
409 |
registerExportUtils(cc); |
7604 |
25 Feb 19 |
nicklas |
410 |
ExtensionsInvoker<ListColumnAction<PluginDefinition,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
411 |
listInvoker.render(new ListColumnExportRenderer<PluginDefinition>(cc)); |
6045 |
03 Apr 12 |
nicklas |
412 |
dc.close(); |
1993 |
15 Feb 06 |
nicklas |
413 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+plugins"; |
1993 |
15 Feb 06 |
nicklas |
414 |
} |
1993 |
15 Feb 06 |
nicklas |
415 |
else if ("ExportItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
416 |
{ |
1993 |
15 Feb 06 |
nicklas |
417 |
// Run an export plugin in single-item context |
1993 |
15 Feb 06 |
nicklas |
418 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4906 |
24 Apr 09 |
martin |
419 |
registerExportUtils(cc); |
1993 |
15 Feb 06 |
nicklas |
420 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+plugin"; |
1993 |
15 Feb 06 |
nicklas |
421 |
} |
1993 |
15 Feb 06 |
nicklas |
422 |
else if ("ImportItems".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
423 |
{ |
1993 |
15 Feb 06 |
nicklas |
424 |
// Run an import plugin in a list context |
1993 |
15 Feb 06 |
nicklas |
425 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
426 |
final ItemQuery<PluginDefinition> query = PluginDefinition.getQuery(); |
3452 |
05 Jun 07 |
nicklas |
427 |
query.join(Hql.leftJoin("guiContexts", "ctx")); |
3452 |
05 Jun 07 |
nicklas |
428 |
query.setDistinct(true); |
7954 |
12 May 21 |
nicklas |
429 |
dc = sc.newDbControl(":Import "+itemType); |
7914 |
23 Feb 21 |
nicklas |
430 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
431 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
432 |
dc.close(); |
1993 |
15 Feb 06 |
nicklas |
433 |
cc.setQuery(query); |
1993 |
15 Feb 06 |
nicklas |
434 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+plugins"; |
1993 |
15 Feb 06 |
nicklas |
435 |
} |
1993 |
15 Feb 06 |
nicklas |
436 |
else if ("ImportItem".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
437 |
{ |
1993 |
15 Feb 06 |
nicklas |
438 |
// Run an import plugin in single-item context |
1993 |
15 Feb 06 |
nicklas |
439 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
440 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+plugin"; |
1993 |
15 Feb 06 |
nicklas |
441 |
} |
1993 |
15 Feb 06 |
nicklas |
442 |
else if ("RunListPlugin".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
443 |
{ |
1993 |
15 Feb 06 |
nicklas |
444 |
// Run another plugin in a list context |
1993 |
15 Feb 06 |
nicklas |
445 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
446 |
final ItemQuery<PluginDefinition> query = PluginDefinition.getQuery(); |
3452 |
05 Jun 07 |
nicklas |
447 |
query.join(Hql.leftJoin("guiContexts", "ctx")); |
3452 |
05 Jun 07 |
nicklas |
448 |
query.setDistinct(true); |
7954 |
12 May 21 |
nicklas |
449 |
dc = sc.newDbControl(":Run plugin "+itemType); |
7914 |
23 Feb 21 |
nicklas |
450 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
451 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
452 |
dc.close(); |
1993 |
15 Feb 06 |
nicklas |
453 |
cc.setQuery(query); |
1993 |
15 Feb 06 |
nicklas |
454 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
1993 |
15 Feb 06 |
nicklas |
455 |
} |
1993 |
15 Feb 06 |
nicklas |
456 |
else if ("RunPlugin".equals(cmd)) |
1993 |
15 Feb 06 |
nicklas |
457 |
{ |
1993 |
15 Feb 06 |
nicklas |
458 |
// Run another plugin in single-item context |
1993 |
15 Feb 06 |
nicklas |
459 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1993 |
15 Feb 06 |
nicklas |
460 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
1993 |
15 Feb 06 |
nicklas |
461 |
} |
1993 |
15 Feb 06 |
nicklas |
462 |
else |
1993 |
15 Feb 06 |
nicklas |
463 |
{ |
1993 |
15 Feb 06 |
nicklas |
464 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
1993 |
15 Feb 06 |
nicklas |
465 |
} |
1342 |
15 Sep 05 |
nicklas |
466 |
} |
1342 |
15 Sep 05 |
nicklas |
467 |
finally |
1342 |
15 Sep 05 |
nicklas |
468 |
{ |
1342 |
15 Sep 05 |
nicklas |
469 |
if (dc != null) dc.close(); |
1342 |
15 Sep 05 |
nicklas |
470 |
} |
1993 |
15 Feb 06 |
nicklas |
471 |
|
1993 |
15 Feb 06 |
nicklas |
472 |
if (forward != null) |
1993 |
15 Feb 06 |
nicklas |
473 |
{ |
6192 |
31 Oct 12 |
nicklas |
474 |
sc.setSessionSetting("alert-message", message); |
1993 |
15 Feb 06 |
nicklas |
475 |
pageContext.forward(forward); |
1993 |
15 Feb 06 |
nicklas |
476 |
} |
1993 |
15 Feb 06 |
nicklas |
477 |
else if (redirect != null) |
1993 |
15 Feb 06 |
nicklas |
478 |
{ |
6192 |
31 Oct 12 |
nicklas |
479 |
sc.setSessionSetting("alert-message", message); |
1993 |
15 Feb 06 |
nicklas |
480 |
response.sendRedirect(redirect); |
1993 |
15 Feb 06 |
nicklas |
481 |
} |
1993 |
15 Feb 06 |
nicklas |
482 |
else if (message == null) |
1993 |
15 Feb 06 |
nicklas |
483 |
{ |
1993 |
15 Feb 06 |
nicklas |
484 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
1993 |
15 Feb 06 |
nicklas |
485 |
} |
1993 |
15 Feb 06 |
nicklas |
486 |
else |
1993 |
15 Feb 06 |
nicklas |
487 |
{ |
1993 |
15 Feb 06 |
nicklas |
488 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
1993 |
15 Feb 06 |
nicklas |
489 |
} |
1993 |
15 Feb 06 |
nicklas |
490 |
%> |
1993 |
15 Feb 06 |
nicklas |
491 |
|