3519 |
20 Jun 07 |
nicklas |
1 |
<%@page import="net.sf.basedb.util.ContextUtil.ContextResult"%> |
1730 |
20 Dec 05 |
nicklas |
2 |
<%-- $Id$ |
1730 |
20 Dec 05 |
nicklas |
3 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
1730 |
20 Dec 05 |
nicklas |
7 |
|
2304 |
22 May 06 |
jari |
8 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
9 |
Available at http://base.thep.lu.se/ |
1730 |
20 Dec 05 |
nicklas |
10 |
|
1730 |
20 Dec 05 |
nicklas |
11 |
BASE is free software; you can redistribute it and/or |
1730 |
20 Dec 05 |
nicklas |
12 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
13 |
as published by the Free Software Foundation; either version 3 |
1730 |
20 Dec 05 |
nicklas |
14 |
of the License, or (at your option) any later version. |
1730 |
20 Dec 05 |
nicklas |
15 |
|
1730 |
20 Dec 05 |
nicklas |
16 |
BASE is distributed in the hope that it will be useful, |
1730 |
20 Dec 05 |
nicklas |
17 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1730 |
20 Dec 05 |
nicklas |
18 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1730 |
20 Dec 05 |
nicklas |
19 |
GNU General Public License for more details. |
1730 |
20 Dec 05 |
nicklas |
20 |
|
1730 |
20 Dec 05 |
nicklas |
21 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
22 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1730 |
20 Dec 05 |
nicklas |
23 |
------------------------------------------------------------------ |
1730 |
20 Dec 05 |
nicklas |
24 |
|
1730 |
20 Dec 05 |
nicklas |
25 |
@author Nicklas |
1730 |
20 Dec 05 |
nicklas |
26 |
@version 2.0 |
1730 |
20 Dec 05 |
nicklas |
27 |
--%> |
5426 |
24 Sep 10 |
nicklas |
28 |
<%@ page pageEncoding="UTF-8" session="false" |
1730 |
20 Dec 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
1730 |
20 Dec 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
1730 |
20 Dec 05 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
2677 |
28 Sep 06 |
nicklas |
32 |
import="net.sf.basedb.core.ItemContext" |
1730 |
20 Dec 05 |
nicklas |
33 |
import="net.sf.basedb.core.File" |
1730 |
20 Dec 05 |
nicklas |
34 |
import="net.sf.basedb.core.Job" |
1730 |
20 Dec 05 |
nicklas |
35 |
import="net.sf.basedb.core.Path" |
1730 |
20 Dec 05 |
nicklas |
36 |
import="net.sf.basedb.core.BaseException" |
1772 |
16 Jan 06 |
nicklas |
37 |
import="net.sf.basedb.core.PluginDefinition" |
1772 |
16 Jan 06 |
nicklas |
38 |
import="net.sf.basedb.core.PluginConfiguration" |
1730 |
20 Dec 05 |
nicklas |
39 |
import="net.sf.basedb.core.PluginConfigurationRequest" |
1730 |
20 Dec 05 |
nicklas |
40 |
import="net.sf.basedb.core.PluginExecutionRequest" |
1730 |
20 Dec 05 |
nicklas |
41 |
import="net.sf.basedb.core.PluginResponse" |
1772 |
16 Jan 06 |
nicklas |
42 |
import="net.sf.basedb.core.ItemQuery" |
1772 |
16 Jan 06 |
nicklas |
43 |
import="net.sf.basedb.core.ItemResultList" |
1772 |
16 Jan 06 |
nicklas |
44 |
import="net.sf.basedb.core.Include" |
1772 |
16 Jan 06 |
nicklas |
45 |
import="net.sf.basedb.core.query.Hql" |
1772 |
16 Jan 06 |
nicklas |
46 |
import="net.sf.basedb.core.query.Expressions" |
1772 |
16 Jan 06 |
nicklas |
47 |
import="net.sf.basedb.core.query.Restrictions" |
1772 |
16 Jan 06 |
nicklas |
48 |
import="net.sf.basedb.core.query.Orders" |
1730 |
20 Dec 05 |
nicklas |
49 |
import="net.sf.basedb.core.plugin.Response" |
1772 |
16 Jan 06 |
nicklas |
50 |
import="net.sf.basedb.core.plugin.GuiContext" |
1772 |
16 Jan 06 |
nicklas |
51 |
import="net.sf.basedb.core.plugin.Plugin" |
1772 |
16 Jan 06 |
nicklas |
52 |
import="net.sf.basedb.core.plugin.InteractivePlugin" |
4525 |
16 Sep 08 |
nicklas |
53 |
import="net.sf.basedb.plugins.util.Parameters" |
1730 |
20 Dec 05 |
nicklas |
54 |
import="net.sf.basedb.util.AutoDetectFileFormat" |
1730 |
20 Dec 05 |
nicklas |
55 |
import="net.sf.basedb.clients.web.Base" |
1730 |
20 Dec 05 |
nicklas |
56 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
57 |
import="net.sf.basedb.util.Values" |
3438 |
04 Jun 07 |
nicklas |
58 |
import="net.sf.basedb.util.ContextUtil" |
3438 |
04 Jun 07 |
nicklas |
59 |
import="net.sf.basedb.util.ContextUtil.ContextResult" |
1730 |
20 Dec 05 |
nicklas |
60 |
import="net.sf.basedb.clients.web.util.HTML" |
1730 |
20 Dec 05 |
nicklas |
61 |
import="java.util.List" |
1772 |
16 Jan 06 |
nicklas |
62 |
import="java.util.LinkedList" |
3519 |
20 Jun 07 |
nicklas |
63 |
import="java.util.ArrayList" |
1772 |
16 Jan 06 |
nicklas |
64 |
import="java.util.Map" |
1772 |
16 Jan 06 |
nicklas |
65 |
import="java.util.HashMap" |
2195 |
26 Apr 06 |
nicklas |
66 |
import="java.util.Set" |
2195 |
26 Apr 06 |
nicklas |
67 |
import="java.util.HashSet" |
1730 |
20 Dec 05 |
nicklas |
68 |
%> |
1730 |
20 Dec 05 |
nicklas |
69 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1730 |
20 Dec 05 |
nicklas |
70 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
1730 |
20 Dec 05 |
nicklas |
71 |
|
1730 |
20 Dec 05 |
nicklas |
72 |
<% |
1730 |
20 Dec 05 |
nicklas |
73 |
final String root = request.getContextPath()+"/"; |
1730 |
20 Dec 05 |
nicklas |
74 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1730 |
20 Dec 05 |
nicklas |
75 |
final String ID = sc.getId(); |
1730 |
20 Dec 05 |
nicklas |
76 |
final String cmd = request.getParameter("cmd"); |
1730 |
20 Dec 05 |
nicklas |
77 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
1945 |
09 Feb 06 |
nicklas |
78 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
1772 |
16 Jan 06 |
nicklas |
79 |
final GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type")); |
2868 |
07 Nov 06 |
nicklas |
80 |
final GuiContext context = new GuiContext(itemType, contextType, subContext); |
2677 |
28 Sep 06 |
nicklas |
81 |
final ItemContext cc = sc.getCurrentContext(itemType, subContext); |
1730 |
20 Dec 05 |
nicklas |
82 |
|
3630 |
03 Aug 07 |
nicklas |
83 |
DbControl dc = null;; |
1730 |
20 Dec 05 |
nicklas |
84 |
String forward = null; |
1730 |
20 Dec 05 |
nicklas |
85 |
String message = null; |
1730 |
20 Dec 05 |
nicklas |
86 |
String redirect = null; |
1730 |
20 Dec 05 |
nicklas |
87 |
try |
1730 |
20 Dec 05 |
nicklas |
88 |
{ |
1730 |
20 Dec 05 |
nicklas |
89 |
if ("SelectPlugin".equals(cmd)) |
1730 |
20 Dec 05 |
nicklas |
90 |
{ |
3438 |
04 Jun 07 |
nicklas |
91 |
ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(context, null); |
3438 |
04 Jun 07 |
nicklas |
92 |
pluginQuery.restrict( |
1772 |
16 Jan 06 |
nicklas |
93 |
Restrictions.eq( |
1772 |
16 Jan 06 |
nicklas |
94 |
Hql.property("mainType"), |
1772 |
16 Jan 06 |
nicklas |
95 |
Expressions.integer(Plugin.MainType.IMPORT.getValue()) |
1772 |
16 Jan 06 |
nicklas |
96 |
) |
1772 |
16 Jan 06 |
nicklas |
97 |
); |
5615 |
19 Apr 11 |
nicklas |
98 |
pluginQuery.restrict(Restrictions.eq(Hql.property("disabled"), Expressions.parameter("isDisabled", false))); |
3438 |
04 Jun 07 |
nicklas |
99 |
pluginQuery.order(Orders.asc(Hql.property("name"))); |
3438 |
04 Jun 07 |
nicklas |
100 |
pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); |
3438 |
04 Jun 07 |
nicklas |
101 |
|
3438 |
04 Jun 07 |
nicklas |
102 |
ItemQuery<PluginConfiguration> configQuery = PluginConfiguration.getQuery(); |
3438 |
04 Jun 07 |
nicklas |
103 |
configQuery.restrict( |
3438 |
04 Jun 07 |
nicklas |
104 |
Restrictions.eq( |
3438 |
04 Jun 07 |
nicklas |
105 |
Hql.property("pluginDefinition"), |
3438 |
04 Jun 07 |
nicklas |
106 |
Expressions.parameter("plugin") |
3438 |
04 Jun 07 |
nicklas |
107 |
) |
3438 |
04 Jun 07 |
nicklas |
108 |
); |
8107 |
23 Jan 23 |
nicklas |
109 |
configQuery.restrict(Restrictions.eq(Hql.property("disabled"), Expressions.parameter("isDisabled", false))); |
3438 |
04 Jun 07 |
nicklas |
110 |
configQuery.order(Orders.asc(Hql.property("name"))); |
3438 |
04 Jun 07 |
nicklas |
111 |
configQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); |
3438 |
04 Jun 07 |
nicklas |
112 |
|
7954 |
12 May 21 |
nicklas |
113 |
dc = sc.newDbControl(":Select import plug-in"); |
3438 |
04 Jun 07 |
nicklas |
114 |
Object currentItem = null; |
3438 |
04 Jun 07 |
nicklas |
115 |
if (contextType == GuiContext.Type.ITEM) |
1772 |
16 Jan 06 |
nicklas |
116 |
{ |
3438 |
04 Jun 07 |
nicklas |
117 |
currentItem = itemType.getById(dc, cc.getId()); |
3438 |
04 Jun 07 |
nicklas |
118 |
} |
3438 |
04 Jun 07 |
nicklas |
119 |
List<ContextResult> contextResult = ContextUtil.checkContext(dc, pluginQuery, configQuery, context, currentItem); |
3438 |
04 Jun 07 |
nicklas |
120 |
dc.close(); |
3438 |
04 Jun 07 |
nicklas |
121 |
|
3495 |
14 Jun 07 |
nicklas |
122 |
boolean showWarnings = Values.getBoolean(sc.getUserClientSetting("plugins.showWarnings"), false); |
3438 |
04 Jun 07 |
nicklas |
123 |
int totalPlugins = ContextUtil.countUsuablePlugins(contextResult); |
3438 |
04 Jun 07 |
nicklas |
124 |
Set<String> contextMessages = ContextUtil.getContextMessages(contextResult, showWarnings, true); |
1772 |
16 Jan 06 |
nicklas |
125 |
|
1944 |
08 Feb 06 |
nicklas |
126 |
if (totalPlugins == 0) |
1773 |
16 Jan 06 |
nicklas |
127 |
{ |
5917 |
19 Dec 11 |
nicklas |
128 |
String msg = "<b>No plugins can be used in this context, for the following reasons:</b><br><ul><li>"; |
2392 |
16 Jun 06 |
nicklas |
129 |
if (contextMessages.size() == 0) |
2392 |
16 Jun 06 |
nicklas |
130 |
{ |
3438 |
04 Jun 07 |
nicklas |
131 |
msg += "Could not find any plugins that you have permission to use</ul>"; |
2392 |
16 Jun 06 |
nicklas |
132 |
} |
2392 |
16 Jun 06 |
nicklas |
133 |
else |
2392 |
16 Jun 06 |
nicklas |
134 |
{ |
2392 |
16 Jun 06 |
nicklas |
135 |
msg += Values.getString(contextMessages, "<li>", true) + "</ul>"; |
2392 |
16 Jun 06 |
nicklas |
136 |
} |
3438 |
04 Jun 07 |
nicklas |
137 |
throw new WebException("popup", "No usable plugins found", msg); |
1773 |
16 Jan 06 |
nicklas |
138 |
} |
3438 |
04 Jun 07 |
nicklas |
139 |
sc.setSessionSetting("IMPORTERS", contextResult); |
2430 |
27 Jun 06 |
nicklas |
140 |
sc.setSessionSetting("MESSAGES", contextMessages); |
1730 |
20 Dec 05 |
nicklas |
141 |
forward = "select_plugin.jsp"; |
1730 |
20 Dec 05 |
nicklas |
142 |
} |
1730 |
20 Dec 05 |
nicklas |
143 |
|
1730 |
20 Dec 05 |
nicklas |
144 |
else if ("RunPlugin".equals(cmd)) |
1730 |
20 Dec 05 |
nicklas |
145 |
{ |
1730 |
20 Dec 05 |
nicklas |
146 |
int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id")); |
1730 |
20 Dec 05 |
nicklas |
147 |
int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id")); |
1730 |
20 Dec 05 |
nicklas |
148 |
|
2167 |
19 Apr 06 |
nicklas |
149 |
if (pluginDefinitionId == -1 || pluginConfigurationId == -1) |
1730 |
20 Dec 05 |
nicklas |
150 |
{ |
1730 |
20 Dec 05 |
nicklas |
151 |
// Auto-detect was selected |
1730 |
20 Dec 05 |
nicklas |
152 |
forward = "select_file.jsp"; |
1730 |
20 Dec 05 |
nicklas |
153 |
} |
1730 |
20 Dec 05 |
nicklas |
154 |
else |
1730 |
20 Dec 05 |
nicklas |
155 |
{ |
1730 |
20 Dec 05 |
nicklas |
156 |
// Specific plugin and configuration was selected |
1787 |
18 Jan 06 |
nicklas |
157 |
redirect = "../plugin/index.jsp?ID="+ID+ |
1787 |
18 Jan 06 |
nicklas |
158 |
"&cmd=NewJob&pluginconfiguration_id="+pluginConfigurationId+ |
1787 |
18 Jan 06 |
nicklas |
159 |
"&plugindefinition_id="+pluginDefinitionId+ |
7201 |
17 Oct 16 |
nicklas |
160 |
"&title="+HTML.urlEncode(request.getParameter("title"))+ |
1787 |
18 Jan 06 |
nicklas |
161 |
"&job_name="+HTML.urlEncode(request.getParameter("job_name"))+ |
1789 |
18 Jan 06 |
nicklas |
162 |
"&job_description="+HTML.urlEncode(request.getParameter("job_description"))+ |
1789 |
18 Jan 06 |
nicklas |
163 |
"&item_type="+context.getItem().name()+ |
7201 |
17 Oct 16 |
nicklas |
164 |
"&subcontext="+HTML.urlEncode(subContext)+ |
3518 |
20 Jun 07 |
nicklas |
165 |
"&context_type="+context.getType().name()+ |
3518 |
20 Jun 07 |
nicklas |
166 |
"&warnIfOpen=0"; |
1730 |
20 Dec 05 |
nicklas |
167 |
} |
1730 |
20 Dec 05 |
nicklas |
168 |
} |
1730 |
20 Dec 05 |
nicklas |
169 |
|
1730 |
20 Dec 05 |
nicklas |
170 |
else if ("AutoDetect".equals(cmd)) |
1730 |
20 Dec 05 |
nicklas |
171 |
{ |
1730 |
20 Dec 05 |
nicklas |
172 |
int fileId = Values.getInt(request.getParameter("file_id")); |
1730 |
20 Dec 05 |
nicklas |
173 |
String path = request.getParameter("path"); |
4525 |
16 Sep 08 |
nicklas |
174 |
String charset = request.getParameter("charset"); |
7954 |
12 May 21 |
nicklas |
175 |
dc = sc.newDbControl(":Auto-detect file format"); |
1730 |
20 Dec 05 |
nicklas |
176 |
File f = fileId != 0 ? File.getById(dc, fileId) : File.getByPath(dc, new Path(path, Path.Type.FILE), false); |
2677 |
28 Sep 06 |
nicklas |
177 |
int maxRecent = Base.getMaxRecent(sc); |
7703 |
11 Apr 19 |
nicklas |
178 |
cc.setRecent(Item.FILE, f, maxRecent); |
1730 |
20 Dec 05 |
nicklas |
179 |
|
1772 |
16 Jan 06 |
nicklas |
180 |
int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id")); |
1772 |
16 Jan 06 |
nicklas |
181 |
PluginDefinition plugin = null; |
2167 |
19 Apr 06 |
nicklas |
182 |
if (pluginDefinitionId != -1) |
1772 |
16 Jan 06 |
nicklas |
183 |
{ |
1772 |
16 Jan 06 |
nicklas |
184 |
plugin = PluginDefinition.getById(dc, pluginDefinitionId); |
1772 |
16 Jan 06 |
nicklas |
185 |
} |
1772 |
16 Jan 06 |
nicklas |
186 |
|
1730 |
20 Dec 05 |
nicklas |
187 |
// Auto-detect file format |
1772 |
16 Jan 06 |
nicklas |
188 |
Map<PluginDefinition, List<PluginConfiguration>> plugins = |
4525 |
16 Sep 08 |
nicklas |
189 |
AutoDetectFileFormat.findPlugins(dc, context, f, charset, plugin); |
1730 |
20 Dec 05 |
nicklas |
190 |
|
4111 |
31 Jan 08 |
nicklas |
191 |
cc.setObject("auto-detected-file", f); |
7494 |
04 Jun 18 |
nicklas |
192 |
cc.setObject("last-file-charset", charset); |
1772 |
16 Jan 06 |
nicklas |
193 |
int matches = plugins.size(); |
1730 |
20 Dec 05 |
nicklas |
194 |
if (matches == 0) |
1730 |
20 Dec 05 |
nicklas |
195 |
{ |
2431 |
27 Jun 06 |
nicklas |
196 |
forward = "no_fileformat.jsp?ID="+ID+ |
2431 |
27 Jun 06 |
nicklas |
197 |
"&file_id="+f.getId()+ |
7201 |
17 Oct 16 |
nicklas |
198 |
"&title="+HTML.urlEncode(request.getParameter("title"))+ |
2431 |
27 Jun 06 |
nicklas |
199 |
"&job_name="+HTML.urlEncode(request.getParameter("job_name"))+ |
2431 |
27 Jun 06 |
nicklas |
200 |
"&job_description="+HTML.urlEncode(request.getParameter("job_description"))+ |
2431 |
27 Jun 06 |
nicklas |
201 |
"&item_type="+context.getItem().name()+ |
7201 |
17 Oct 16 |
nicklas |
202 |
"&subcontext="+HTML.urlEncode(subContext)+ |
2431 |
27 Jun 06 |
nicklas |
203 |
"&context_type="+context.getType().name(); |
2431 |
27 Jun 06 |
nicklas |
204 |
//throw new WebException("popup", "Import failed", "Couldn't find any file format matching file {1}", f); |
1730 |
20 Dec 05 |
nicklas |
205 |
} |
1730 |
20 Dec 05 |
nicklas |
206 |
else |
1730 |
20 Dec 05 |
nicklas |
207 |
{ |
1772 |
16 Jan 06 |
nicklas |
208 |
if (matches == 1) |
1772 |
16 Jan 06 |
nicklas |
209 |
{ |
1772 |
16 Jan 06 |
nicklas |
210 |
plugin = plugins.entrySet().iterator().next().getKey(); |
1772 |
16 Jan 06 |
nicklas |
211 |
List<PluginConfiguration> configList = plugins.get(plugin); |
2167 |
19 Apr 06 |
nicklas |
212 |
if (configList != null && configList.size() > 1) |
1772 |
16 Jan 06 |
nicklas |
213 |
{ |
2167 |
19 Apr 06 |
nicklas |
214 |
// Multiple configurations matches |
2167 |
19 Apr 06 |
nicklas |
215 |
matches = configList.size(); |
2167 |
19 Apr 06 |
nicklas |
216 |
} |
2167 |
19 Apr 06 |
nicklas |
217 |
else |
2167 |
19 Apr 06 |
nicklas |
218 |
{ |
2167 |
19 Apr 06 |
nicklas |
219 |
// 0 or 1 configuration matched |
2167 |
19 Apr 06 |
nicklas |
220 |
PluginConfiguration pc = null; |
2167 |
19 Apr 06 |
nicklas |
221 |
if (configList != null && configList.size() == 1) |
2167 |
19 Apr 06 |
nicklas |
222 |
{ |
2167 |
19 Apr 06 |
nicklas |
223 |
pc = configList.get(0); |
2167 |
19 Apr 06 |
nicklas |
224 |
} |
1787 |
18 Jan 06 |
nicklas |
225 |
redirect = "../plugin/index.jsp?ID="+ID+ |
2167 |
19 Apr 06 |
nicklas |
226 |
"&cmd=NewJob" + |
2167 |
19 Apr 06 |
nicklas |
227 |
(pc == null ? "" : "&pluginconfiguration_id="+ pc.getId()) + |
1787 |
18 Jan 06 |
nicklas |
228 |
"&plugindefinition_id="+plugin.getId()+ |
7201 |
17 Oct 16 |
nicklas |
229 |
"&title="+HTML.urlEncode(request.getParameter("title"))+ |
1787 |
18 Jan 06 |
nicklas |
230 |
"&job_name="+HTML.urlEncode(request.getParameter("job_name"))+ |
1789 |
18 Jan 06 |
nicklas |
231 |
"&job_description="+HTML.urlEncode(request.getParameter("job_description"))+ |
1789 |
18 Jan 06 |
nicklas |
232 |
"&item_type="+context.getItem().name()+ |
7201 |
17 Oct 16 |
nicklas |
233 |
"&subcontext="+HTML.urlEncode(subContext)+ |
3518 |
20 Jun 07 |
nicklas |
234 |
"&context_type="+context.getType().name()+ |
4525 |
16 Sep 08 |
nicklas |
235 |
"¶meter:" + Parameters.CHARSET_PARAMETER + "=" + HTML.urlEncode(charset) + |
3518 |
20 Jun 07 |
nicklas |
236 |
"&warnIfOpen=0"; |
1772 |
16 Jan 06 |
nicklas |
237 |
} |
1772 |
16 Jan 06 |
nicklas |
238 |
} |
1772 |
16 Jan 06 |
nicklas |
239 |
if (matches > 1) |
1772 |
16 Jan 06 |
nicklas |
240 |
{ |
3519 |
20 Jun 07 |
nicklas |
241 |
List<ContextResult> importers = new ArrayList<ContextResult>(matches); |
3519 |
20 Jun 07 |
nicklas |
242 |
for (Map.Entry<PluginDefinition, List<PluginConfiguration>> entry : plugins.entrySet()) |
3519 |
20 Jun 07 |
nicklas |
243 |
{ |
3519 |
20 Jun 07 |
nicklas |
244 |
PluginDefinition pd = entry.getKey(); |
3519 |
20 Jun 07 |
nicklas |
245 |
List<PluginConfiguration> configList = entry.getValue(); |
3519 |
20 Jun 07 |
nicklas |
246 |
if (configList != null && configList.size() > 0) |
3519 |
20 Jun 07 |
nicklas |
247 |
{ |
3519 |
20 Jun 07 |
nicklas |
248 |
for (PluginConfiguration pc : configList) |
3519 |
20 Jun 07 |
nicklas |
249 |
{ |
3519 |
20 Jun 07 |
nicklas |
250 |
importers.add(new ContextResult(pd, pc, (String)null)); |
3519 |
20 Jun 07 |
nicklas |
251 |
} |
3519 |
20 Jun 07 |
nicklas |
252 |
} |
3519 |
20 Jun 07 |
nicklas |
253 |
else |
3519 |
20 Jun 07 |
nicklas |
254 |
{ |
3519 |
20 Jun 07 |
nicklas |
255 |
importers.add(new ContextResult(pd, null, (String)null)); |
3519 |
20 Jun 07 |
nicklas |
256 |
} |
3519 |
20 Jun 07 |
nicklas |
257 |
} |
3519 |
20 Jun 07 |
nicklas |
258 |
sc.setSessionSetting("IMPORTERS", importers); |
1772 |
16 Jan 06 |
nicklas |
259 |
forward = "select_plugin.jsp?noautodetect=1&message=Multiple+file+formats+found.+Please+select+one."; |
1772 |
16 Jan 06 |
nicklas |
260 |
} |
1730 |
20 Dec 05 |
nicklas |
261 |
} |
1730 |
20 Dec 05 |
nicklas |
262 |
} |
1772 |
16 Jan 06 |
nicklas |
263 |
|
1730 |
20 Dec 05 |
nicklas |
264 |
} |
1730 |
20 Dec 05 |
nicklas |
265 |
finally |
1730 |
20 Dec 05 |
nicklas |
266 |
{ |
1730 |
20 Dec 05 |
nicklas |
267 |
if (dc != null) dc.close(); |
1730 |
20 Dec 05 |
nicklas |
268 |
} |
1730 |
20 Dec 05 |
nicklas |
269 |
|
1730 |
20 Dec 05 |
nicklas |
270 |
if (forward != null) |
1730 |
20 Dec 05 |
nicklas |
271 |
{ |
6192 |
31 Oct 12 |
nicklas |
272 |
sc.setSessionSetting("alert-message", message); |
1730 |
20 Dec 05 |
nicklas |
273 |
pageContext.forward(forward); |
1730 |
20 Dec 05 |
nicklas |
274 |
} |
1730 |
20 Dec 05 |
nicklas |
275 |
else if (redirect != null) |
1730 |
20 Dec 05 |
nicklas |
276 |
{ |
6192 |
31 Oct 12 |
nicklas |
277 |
sc.setSessionSetting("alert-message", message); |
1730 |
20 Dec 05 |
nicklas |
278 |
response.sendRedirect(redirect); |
1730 |
20 Dec 05 |
nicklas |
279 |
} |
1730 |
20 Dec 05 |
nicklas |
280 |
else if (message == null) |
1730 |
20 Dec 05 |
nicklas |
281 |
{ |
1730 |
20 Dec 05 |
nicklas |
282 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
1730 |
20 Dec 05 |
nicklas |
283 |
} |
1730 |
20 Dec 05 |
nicklas |
284 |
else |
1730 |
20 Dec 05 |
nicklas |
285 |
{ |
1730 |
20 Dec 05 |
nicklas |
286 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
1730 |
20 Dec 05 |
nicklas |
287 |
} |
1730 |
20 Dec 05 |
nicklas |
288 |
%> |
1730 |
20 Dec 05 |
nicklas |
289 |
|