1730 |
20 Dec 05 |
nicklas |
1 |
<%-- $Id$ |
1730 |
20 Dec 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
4889 |
06 Apr 09 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
1730 |
20 Dec 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/ |
1730 |
20 Dec 05 |
nicklas |
9 |
|
1730 |
20 Dec 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
1730 |
20 Dec 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 |
1730 |
20 Dec 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
1730 |
20 Dec 05 |
nicklas |
14 |
|
1730 |
20 Dec 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
1730 |
20 Dec 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1730 |
20 Dec 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1730 |
20 Dec 05 |
nicklas |
18 |
GNU General Public License for more details. |
1730 |
20 Dec 05 |
nicklas |
19 |
|
1730 |
20 Dec 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/>. |
1730 |
20 Dec 05 |
nicklas |
22 |
------------------------------------------------------------------ |
1730 |
20 Dec 05 |
nicklas |
23 |
|
1730 |
20 Dec 05 |
nicklas |
24 |
@author Nicklas |
1730 |
20 Dec 05 |
nicklas |
25 |
@version 2.0 |
1730 |
20 Dec 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
1730 |
20 Dec 05 |
nicklas |
28 |
import="net.sf.basedb.core.SessionControl" |
1730 |
20 Dec 05 |
nicklas |
29 |
import="net.sf.basedb.core.DbControl" |
1730 |
20 Dec 05 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
1730 |
20 Dec 05 |
nicklas |
31 |
import="net.sf.basedb.core.PluginDefinition" |
1730 |
20 Dec 05 |
nicklas |
32 |
import="net.sf.basedb.core.PluginConfiguration" |
1730 |
20 Dec 05 |
nicklas |
33 |
import="net.sf.basedb.core.PluginType" |
1730 |
20 Dec 05 |
nicklas |
34 |
import="net.sf.basedb.core.ItemQuery" |
1730 |
20 Dec 05 |
nicklas |
35 |
import="net.sf.basedb.core.ItemResultList" |
1730 |
20 Dec 05 |
nicklas |
36 |
import="net.sf.basedb.core.Include" |
1787 |
18 Jan 06 |
nicklas |
37 |
import="net.sf.basedb.core.Job" |
1730 |
20 Dec 05 |
nicklas |
38 |
import="net.sf.basedb.core.query.Hql" |
1730 |
20 Dec 05 |
nicklas |
39 |
import="net.sf.basedb.core.query.Expressions" |
1730 |
20 Dec 05 |
nicklas |
40 |
import="net.sf.basedb.core.query.Restrictions" |
1730 |
20 Dec 05 |
nicklas |
41 |
import="net.sf.basedb.core.query.Orders" |
1730 |
20 Dec 05 |
nicklas |
42 |
import="net.sf.basedb.core.plugin.GuiContext" |
1730 |
20 Dec 05 |
nicklas |
43 |
import="net.sf.basedb.core.plugin.Plugin" |
1730 |
20 Dec 05 |
nicklas |
44 |
import="net.sf.basedb.core.plugin.InteractivePlugin" |
1730 |
20 Dec 05 |
nicklas |
45 |
import="net.sf.basedb.core.plugin.AutoDetectingImporter" |
1730 |
20 Dec 05 |
nicklas |
46 |
import="net.sf.basedb.clients.web.Base" |
2753 |
20 Oct 06 |
nicklas |
47 |
import="net.sf.basedb.util.Values" |
3438 |
04 Jun 07 |
nicklas |
48 |
import="net.sf.basedb.util.ContextUtil" |
3438 |
04 Jun 07 |
nicklas |
49 |
import="net.sf.basedb.util.ContextUtil.ContextResult" |
1730 |
20 Dec 05 |
nicklas |
50 |
import="net.sf.basedb.clients.web.util.HTML" |
2430 |
27 Jun 06 |
nicklas |
51 |
import="java.util.Set" |
1772 |
16 Jan 06 |
nicklas |
52 |
import="java.util.Map" |
1772 |
16 Jan 06 |
nicklas |
53 |
import="java.util.List" |
6200 |
05 Nov 12 |
nicklas |
54 |
import="org.json.simple.JSONObject" |
6200 |
05 Nov 12 |
nicklas |
55 |
import="org.json.simple.JSONArray" |
1730 |
20 Dec 05 |
nicklas |
56 |
%> |
1730 |
20 Dec 05 |
nicklas |
57 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1730 |
20 Dec 05 |
nicklas |
58 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
1730 |
20 Dec 05 |
nicklas |
59 |
|
1730 |
20 Dec 05 |
nicklas |
60 |
<% |
1730 |
20 Dec 05 |
nicklas |
61 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1730 |
20 Dec 05 |
nicklas |
62 |
final String ID = sc.getId(); |
1730 |
20 Dec 05 |
nicklas |
63 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
1945 |
09 Feb 06 |
nicklas |
64 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
1730 |
20 Dec 05 |
nicklas |
65 |
final GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type")); |
1730 |
20 Dec 05 |
nicklas |
66 |
final GuiContext context = new GuiContext(itemType, contextType); |
1730 |
20 Dec 05 |
nicklas |
67 |
final String title = request.getParameter("title"); |
1772 |
16 Jan 06 |
nicklas |
68 |
final boolean noAutodetect = Values.getBoolean(request.getParameter("noautodetect")); |
1772 |
16 Jan 06 |
nicklas |
69 |
final String message = request.getParameter("message"); |
3518 |
20 Jun 07 |
nicklas |
70 |
final boolean anotherIsOpen = sc.getSessionSetting("plugin.configure.plugin") != null; |
7954 |
12 May 21 |
nicklas |
71 |
final DbControl dc = sc.newDbControl(":Import - Select plug-in"); |
4438 |
02 Sep 08 |
nicklas |
72 |
final float scale = Base.getScale(sc); |
1730 |
20 Dec 05 |
nicklas |
73 |
try |
1730 |
20 Dec 05 |
nicklas |
74 |
{ |
1730 |
20 Dec 05 |
nicklas |
75 |
final PluginType autoDetectingType = PluginType.getByInterfaceName(dc, AutoDetectingImporter.class.getName()); |
1730 |
20 Dec 05 |
nicklas |
76 |
|
1787 |
18 Jan 06 |
nicklas |
77 |
String jobName = Values.getString(request.getParameter("job_name"), title); |
1787 |
18 Jan 06 |
nicklas |
78 |
|
7605 |
26 Feb 19 |
nicklas |
79 |
List<ContextResult> contextResults = sc.getSessionSetting("IMPORTERS"); |
7605 |
26 Feb 19 |
nicklas |
80 |
Set<String> messages = sc.getSessionSetting("MESSAGES"); |
3438 |
04 Jun 07 |
nicklas |
81 |
StringBuilder descriptions = new StringBuilder(); |
6200 |
05 Nov 12 |
nicklas |
82 |
|
6200 |
05 Nov 12 |
nicklas |
83 |
JSONArray jsonPlugins = new JSONArray(); |
6200 |
05 Nov 12 |
nicklas |
84 |
PluginDefinition lastPlugin = null; |
6200 |
05 Nov 12 |
nicklas |
85 |
JSONObject jsonPlugin = null; |
6200 |
05 Nov 12 |
nicklas |
86 |
JSONArray jsonConfigurations = null; |
6200 |
05 Nov 12 |
nicklas |
87 |
for (ContextResult result : contextResults) |
6200 |
05 Nov 12 |
nicklas |
88 |
{ |
6200 |
05 Nov 12 |
nicklas |
89 |
if (result.isInContext()) |
1730 |
20 Dec 05 |
nicklas |
90 |
{ |
6200 |
05 Nov 12 |
nicklas |
91 |
PluginDefinition pd = result.getPluginDefinition(); |
6200 |
05 Nov 12 |
nicklas |
92 |
if (!pd.equals(lastPlugin)) |
3518 |
20 Jun 07 |
nicklas |
93 |
{ |
6200 |
05 Nov 12 |
nicklas |
94 |
lastPlugin = pd; |
6200 |
05 Nov 12 |
nicklas |
95 |
dc.reattachItem(pd, false); |
6200 |
05 Nov 12 |
nicklas |
96 |
|
6200 |
05 Nov 12 |
nicklas |
97 |
jsonPlugin = new JSONObject(); |
6200 |
05 Nov 12 |
nicklas |
98 |
jsonConfigurations = new JSONArray(); |
6200 |
05 Nov 12 |
nicklas |
99 |
jsonPlugin.put("id", pd.getId()); |
6200 |
05 Nov 12 |
nicklas |
100 |
jsonPlugin.put("name", pd.getName()); |
6200 |
05 Nov 12 |
nicklas |
101 |
jsonPlugin.put("description", HTML.niceFormat("<b>" + pd.getName() + "</b>\n" + pd.getDescription())); |
6200 |
05 Nov 12 |
nicklas |
102 |
jsonPlugin.put("autoDetect", !noAutodetect && pd.supports(autoDetectingType)); |
6200 |
05 Nov 12 |
nicklas |
103 |
jsonPlugin.put("supportsConfig", pd.supportsConfigurations()); |
6200 |
05 Nov 12 |
nicklas |
104 |
jsonPlugin.put("requiresConfig", noAutodetect || pd.requiresConfiguration()); |
6200 |
05 Nov 12 |
nicklas |
105 |
jsonPlugin.put("configurations", jsonConfigurations); |
6200 |
05 Nov 12 |
nicklas |
106 |
jsonPlugins.add(jsonPlugin); |
3518 |
20 Jun 07 |
nicklas |
107 |
} |
6200 |
05 Nov 12 |
nicklas |
108 |
PluginConfiguration pc = result.getPluginConfiguration(); |
6200 |
05 Nov 12 |
nicklas |
109 |
if (pc != null) |
2677 |
28 Sep 06 |
nicklas |
110 |
{ |
6200 |
05 Nov 12 |
nicklas |
111 |
JSONObject jsonConfig = new JSONObject(); |
6200 |
05 Nov 12 |
nicklas |
112 |
jsonConfig.put("id", pc.getId()); |
6200 |
05 Nov 12 |
nicklas |
113 |
jsonConfig.put("name", pc.getName()); |
6200 |
05 Nov 12 |
nicklas |
114 |
jsonConfig.put("description", HTML.niceFormat("<b>" + pc.getName() + "</b>\n" +pc.getDescription())); |
6200 |
05 Nov 12 |
nicklas |
115 |
jsonConfigurations.add(jsonConfig); |
2677 |
28 Sep 06 |
nicklas |
116 |
} |
3438 |
04 Jun 07 |
nicklas |
117 |
} |
6200 |
05 Nov 12 |
nicklas |
118 |
} |
6200 |
05 Nov 12 |
nicklas |
119 |
%> |
6200 |
05 Nov 12 |
nicklas |
120 |
<base:page type="popup" title="<%=title%>"> |
6200 |
05 Nov 12 |
nicklas |
121 |
<base:head scripts="~../plugin/select_plugin.js" /> |
6200 |
05 Nov 12 |
nicklas |
122 |
<base:body> |
5910 |
14 Dec 11 |
nicklas |
123 |
<h1><%=title%> <base:help helpid="import.selectplugin" /></h1> |
6200 |
05 Nov 12 |
nicklas |
124 |
<div id="page-data" class="datacontainer" |
6200 |
05 Nov 12 |
nicklas |
125 |
data-plugins="<%=HTML.encodeTags(jsonPlugins.toJSONString())%>" |
6200 |
05 Nov 12 |
nicklas |
126 |
data-another-wizard="<%=anotherIsOpen ? 1 : 0%>"></div> |
6200 |
05 Nov 12 |
nicklas |
127 |
<form name="plugin" action="index.jsp" method="post"> |
1730 |
20 Dec 05 |
nicklas |
128 |
<input type="hidden" name="ID" value="<%=ID%>"> |
1730 |
20 Dec 05 |
nicklas |
129 |
<input type="hidden" name="cmd" value="RunPlugin"> |
1730 |
20 Dec 05 |
nicklas |
130 |
<input type="hidden" name="item_type" value="<%=itemType.name()%>"> |
1945 |
09 Feb 06 |
nicklas |
131 |
<input type="hidden" name="subcontext" value="<%=subContext%>"> |
1730 |
20 Dec 05 |
nicklas |
132 |
<input type="hidden" name="context_type" value="<%=contextType.name()%>"> |
1730 |
20 Dec 05 |
nicklas |
133 |
<input type="hidden" name="title" value="<%=title%>"> |
3518 |
20 Jun 07 |
nicklas |
134 |
<input type="hidden" name="warnIfOpen" value="1"> |
5372 |
24 Jun 10 |
nicklas |
135 |
<input type="hidden" name="plugindefinition_id" value=""> |
5372 |
24 Jun 10 |
nicklas |
136 |
<input type="hidden" name="pluginconfiguration_id" value=""> |
1730 |
20 Dec 05 |
nicklas |
137 |
|
5910 |
14 Dec 11 |
nicklas |
138 |
<div class="content bottomborder"> |
6607 |
19 Nov 14 |
nicklas |
139 |
<div class="absolutefull bg-filled-100" style="height: 4.5em;"> |
5910 |
14 Dec 11 |
nicklas |
140 |
<table style="height: 100%; margin: auto;"><tr><td> |
1772 |
16 Jan 06 |
nicklas |
141 |
<% |
5910 |
14 Dec 11 |
nicklas |
142 |
if (anotherIsOpen) |
5910 |
14 Dec 11 |
nicklas |
143 |
{ |
5910 |
14 Dec 11 |
nicklas |
144 |
%> |
5910 |
14 Dec 11 |
nicklas |
145 |
<div class="messagecontainer error" style="margin: 0.2em; padding: 0.2em;"> |
5910 |
14 Dec 11 |
nicklas |
146 |
Another plug-in configuration wizard is open, or it hasn't properly |
5910 |
14 Dec 11 |
nicklas |
147 |
clean up after itself.<br> |
5910 |
14 Dec 11 |
nicklas |
148 |
If you continue unsaved settings in the other wizard is lost. |
5910 |
14 Dec 11 |
nicklas |
149 |
</div> |
5910 |
14 Dec 11 |
nicklas |
150 |
<% |
5910 |
14 Dec 11 |
nicklas |
151 |
} |
5910 |
14 Dec 11 |
nicklas |
152 |
else |
5910 |
14 Dec 11 |
nicklas |
153 |
{ |
5910 |
14 Dec 11 |
nicklas |
154 |
%> |
5910 |
14 Dec 11 |
nicklas |
155 |
<% |
5910 |
14 Dec 11 |
nicklas |
156 |
if (message != null) |
5910 |
14 Dec 11 |
nicklas |
157 |
{ |
5910 |
14 Dec 11 |
nicklas |
158 |
%> |
5910 |
14 Dec 11 |
nicklas |
159 |
<%=message%> |
5910 |
14 Dec 11 |
nicklas |
160 |
<% |
5910 |
14 Dec 11 |
nicklas |
161 |
} |
5910 |
14 Dec 11 |
nicklas |
162 |
else |
5910 |
14 Dec 11 |
nicklas |
163 |
{ |
5910 |
14 Dec 11 |
nicklas |
164 |
%> |
5910 |
14 Dec 11 |
nicklas |
165 |
Please select a plugin and file format to use. |
5910 |
14 Dec 11 |
nicklas |
166 |
<% |
5910 |
14 Dec 11 |
nicklas |
167 |
} |
5910 |
14 Dec 11 |
nicklas |
168 |
%> |
5910 |
14 Dec 11 |
nicklas |
169 |
<% |
5910 |
14 Dec 11 |
nicklas |
170 |
} |
1772 |
16 Jan 06 |
nicklas |
171 |
%> |
5910 |
14 Dec 11 |
nicklas |
172 |
</td></tr></table> |
5910 |
14 Dec 11 |
nicklas |
173 |
</div> |
5910 |
14 Dec 11 |
nicklas |
174 |
|
5911 |
15 Dec 11 |
nicklas |
175 |
<div class="absolutefull topborder" style="top: 4.5em;"> |
5910 |
14 Dec 11 |
nicklas |
176 |
<table class="fullform"> |
2430 |
27 Jun 06 |
nicklas |
177 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
178 |
<th>Plugin + file format</th> |
2430 |
27 Jun 06 |
nicklas |
179 |
<td> |
6200 |
05 Nov 12 |
nicklas |
180 |
<select name="plugins" id="plugins" class="required"> |
5910 |
14 Dec 11 |
nicklas |
181 |
</select> |
5910 |
14 Dec 11 |
nicklas |
182 |
<% |
5910 |
14 Dec 11 |
nicklas |
183 |
if (!noAutodetect) |
5910 |
14 Dec 11 |
nicklas |
184 |
{ |
5910 |
14 Dec 11 |
nicklas |
185 |
%> |
5910 |
14 Dec 11 |
nicklas |
186 |
× = Supports auto-detection |
5910 |
14 Dec 11 |
nicklas |
187 |
<% |
5910 |
14 Dec 11 |
nicklas |
188 |
} |
5910 |
14 Dec 11 |
nicklas |
189 |
%> |
5910 |
14 Dec 11 |
nicklas |
190 |
</td> |
5910 |
14 Dec 11 |
nicklas |
191 |
</tr> |
5910 |
14 Dec 11 |
nicklas |
192 |
<tr class="dynamic"> |
5910 |
14 Dec 11 |
nicklas |
193 |
<th></th> |
5910 |
14 Dec 11 |
nicklas |
194 |
<td> |
5910 |
14 Dec 11 |
nicklas |
195 |
<div id="descriptions" class="messagecontainer help" style="margin-left: 0px;"> |
2430 |
27 Jun 06 |
nicklas |
196 |
</div> |
2430 |
27 Jun 06 |
nicklas |
197 |
</td> |
2430 |
27 Jun 06 |
nicklas |
198 |
</tr> |
2430 |
27 Jun 06 |
nicklas |
199 |
<% |
5910 |
14 Dec 11 |
nicklas |
200 |
if (messages != null && messages.size() > 0) |
5910 |
14 Dec 11 |
nicklas |
201 |
{ |
5910 |
14 Dec 11 |
nicklas |
202 |
%> |
5910 |
14 Dec 11 |
nicklas |
203 |
<tr class="big"> |
5910 |
14 Dec 11 |
nicklas |
204 |
<th></th> |
5910 |
14 Dec 11 |
nicklas |
205 |
<td> |
6200 |
05 Nov 12 |
nicklas |
206 |
<base:icon image="bullet.png" id="pluginMessages" |
6200 |
05 Nov 12 |
nicklas |
207 |
tooltip="Show/hide the messages from the plugins that couldn't be used" |
6200 |
05 Nov 12 |
nicklas |
208 |
>Some plugins couldn't be used</base:icon> |
6200 |
05 Nov 12 |
nicklas |
209 |
<div id="pluginMessages.content" style="display: none;"> |
5910 |
14 Dec 11 |
nicklas |
210 |
<ul> |
5910 |
14 Dec 11 |
nicklas |
211 |
<li><%=Values.getString(messages, "<li>", true)%> |
5910 |
14 Dec 11 |
nicklas |
212 |
</ul> |
5910 |
14 Dec 11 |
nicklas |
213 |
</div> |
5910 |
14 Dec 11 |
nicklas |
214 |
</td> |
5910 |
14 Dec 11 |
nicklas |
215 |
</tr> |
5910 |
14 Dec 11 |
nicklas |
216 |
<% |
5910 |
14 Dec 11 |
nicklas |
217 |
} |
5910 |
14 Dec 11 |
nicklas |
218 |
%> |
5910 |
14 Dec 11 |
nicklas |
219 |
</table> |
2677 |
28 Sep 06 |
nicklas |
220 |
</div> |
1730 |
20 Dec 05 |
nicklas |
221 |
</div> |
1730 |
20 Dec 05 |
nicklas |
222 |
</form> |
1730 |
20 Dec 05 |
nicklas |
223 |
|
5910 |
14 Dec 11 |
nicklas |
224 |
<base:buttongroup subclass="dialogbuttons"> |
6200 |
05 Nov 12 |
nicklas |
225 |
<base:button id="btnNext" title="Next" /> |
6200 |
05 Nov 12 |
nicklas |
226 |
<base:button id="close" title="Cancel" /> |
5910 |
14 Dec 11 |
nicklas |
227 |
</base:buttongroup> |
1730 |
20 Dec 05 |
nicklas |
228 |
</base:body> |
1730 |
20 Dec 05 |
nicklas |
229 |
</base:page> |
1730 |
20 Dec 05 |
nicklas |
230 |
<% |
1730 |
20 Dec 05 |
nicklas |
231 |
} |
1730 |
20 Dec 05 |
nicklas |
232 |
finally |
1730 |
20 Dec 05 |
nicklas |
233 |
{ |
1730 |
20 Dec 05 |
nicklas |
234 |
if (dc != null) dc.close(); |
1730 |
20 Dec 05 |
nicklas |
235 |
} |
1730 |
20 Dec 05 |
nicklas |
236 |
%> |
1730 |
20 Dec 05 |
nicklas |
237 |
|