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