1730 |
20 Dec 05 |
nicklas |
1 |
<%-- $Id$ |
1730 |
20 Dec 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg, Gregory Vincic |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Johan Enell, 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.BasicItem" |
1730 |
20 Dec 05 |
nicklas |
31 |
import="net.sf.basedb.core.Permission" |
1730 |
20 Dec 05 |
nicklas |
32 |
import="net.sf.basedb.core.Item" |
1730 |
20 Dec 05 |
nicklas |
33 |
import="net.sf.basedb.core.File" |
1730 |
20 Dec 05 |
nicklas |
34 |
import="net.sf.basedb.core.Nameable" |
1787 |
18 Jan 06 |
nicklas |
35 |
import="net.sf.basedb.core.Job" |
1773 |
16 Jan 06 |
nicklas |
36 |
import="net.sf.basedb.core.PluginDefinition" |
1730 |
20 Dec 05 |
nicklas |
37 |
import="net.sf.basedb.core.PluginConfiguration" |
1730 |
20 Dec 05 |
nicklas |
38 |
import="net.sf.basedb.core.PluginConfigurationRequest" |
1730 |
20 Dec 05 |
nicklas |
39 |
import="net.sf.basedb.core.RequestInformation" |
1730 |
20 Dec 05 |
nicklas |
40 |
import="net.sf.basedb.core.PluginParameter" |
5437 |
01 Oct 10 |
nicklas |
41 |
import="net.sf.basedb.core.Type" |
1730 |
20 Dec 05 |
nicklas |
42 |
import="net.sf.basedb.core.ParameterType" |
1730 |
20 Dec 05 |
nicklas |
43 |
import="net.sf.basedb.core.StringParameterType" |
1730 |
20 Dec 05 |
nicklas |
44 |
import="net.sf.basedb.core.IntegerParameterType" |
1754 |
11 Jan 06 |
nicklas |
45 |
import="net.sf.basedb.core.LongParameterType" |
1754 |
11 Jan 06 |
nicklas |
46 |
import="net.sf.basedb.core.FloatParameterType" |
1754 |
11 Jan 06 |
nicklas |
47 |
import="net.sf.basedb.core.DoubleParameterType" |
1730 |
20 Dec 05 |
nicklas |
48 |
import="net.sf.basedb.core.ItemParameterType" |
1754 |
11 Jan 06 |
nicklas |
49 |
import="net.sf.basedb.core.DateParameterType" |
5437 |
01 Oct 10 |
nicklas |
50 |
import="net.sf.basedb.core.TimestampParameterType" |
1730 |
20 Dec 05 |
nicklas |
51 |
import="net.sf.basedb.core.BooleanParameterType" |
1730 |
20 Dec 05 |
nicklas |
52 |
import="net.sf.basedb.core.FileParameterType" |
2147 |
04 Apr 06 |
nicklas |
53 |
import="net.sf.basedb.core.PathParameterType" |
1759 |
12 Jan 06 |
nicklas |
54 |
import="net.sf.basedb.core.ItemContext" |
2147 |
04 Apr 06 |
nicklas |
55 |
import="net.sf.basedb.core.Path" |
2190 |
25 Apr 06 |
nicklas |
56 |
import="net.sf.basedb.util.Enumeration" |
6391 |
21 Jan 14 |
nicklas |
57 |
import="net.sf.basedb.util.error.ThrowableUtil" |
6391 |
21 Jan 14 |
nicklas |
58 |
import="net.sf.basedb.util.json.JsonConverter" |
6391 |
21 Jan 14 |
nicklas |
59 |
import="net.sf.basedb.util.json.JsonUtil" |
4521 |
15 Sep 08 |
nicklas |
60 |
import="net.sf.basedb.plugins.util.Parameters" |
1730 |
20 Dec 05 |
nicklas |
61 |
import="net.sf.basedb.clients.web.Base" |
1730 |
20 Dec 05 |
nicklas |
62 |
import="net.sf.basedb.clients.web.WebException" |
1730 |
20 Dec 05 |
nicklas |
63 |
import="net.sf.basedb.clients.web.util.HTML" |
2942 |
22 Nov 06 |
nicklas |
64 |
import="net.sf.basedb.util.formatter.Formatter" |
2942 |
22 Nov 06 |
nicklas |
65 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
2942 |
22 Nov 06 |
nicklas |
66 |
import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
2753 |
20 Oct 06 |
nicklas |
67 |
import="net.sf.basedb.util.Values" |
1730 |
20 Dec 05 |
nicklas |
68 |
import="java.util.Date" |
1730 |
20 Dec 05 |
nicklas |
69 |
import="java.util.List" |
1880 |
01 Feb 06 |
nicklas |
70 |
import="java.util.Arrays" |
7604 |
25 Feb 19 |
nicklas |
71 |
import="java.util.ArrayList" |
6393 |
22 Jan 14 |
nicklas |
72 |
import="java.util.HashSet" |
6393 |
22 Jan 14 |
nicklas |
73 |
import="java.util.Set" |
1730 |
20 Dec 05 |
nicklas |
74 |
import="java.util.Collections" |
6391 |
21 Jan 14 |
nicklas |
75 |
import="org.json.simple.JSONArray" |
6391 |
21 Jan 14 |
nicklas |
76 |
import="org.json.simple.JSONObject" |
1730 |
20 Dec 05 |
nicklas |
77 |
%> |
1730 |
20 Dec 05 |
nicklas |
78 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1730 |
20 Dec 05 |
nicklas |
79 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6391 |
21 Jan 14 |
nicklas |
80 |
<%! |
7604 |
25 Feb 19 |
nicklas |
81 |
List<?> getParameterValues(PluginParameter<?> pp, DbControl dc, javax.servlet.http.HttpServletRequest request, |
7786 |
02 Mar 20 |
nicklas |
82 |
PluginConfigurationRequest pcRequest, ItemContext currentContext, Job job) |
6391 |
21 Jan 14 |
nicklas |
83 |
{ |
7604 |
25 Feb 19 |
nicklas |
84 |
ParameterType<?> pType = pp.getParameterType(); |
6391 |
21 Jan 14 |
nicklas |
85 |
|
6391 |
21 Jan 14 |
nicklas |
86 |
// Get the current values... First we look in the http request object... |
6391 |
21 Jan 14 |
nicklas |
87 |
String[] requestValues = request.getParameterValues("parameter:"+pp.getName()); |
6391 |
21 Jan 14 |
nicklas |
88 |
|
6391 |
21 Jan 14 |
nicklas |
89 |
// ...or in the current values from the job / plugin configuration |
7604 |
25 Feb 19 |
nicklas |
90 |
List<?> values = requestValues != null ? Arrays.asList(requestValues) : pcRequest.getCurrentParameterValues(pp.getName()); |
6391 |
21 Jan 14 |
nicklas |
91 |
|
6391 |
21 Jan 14 |
nicklas |
92 |
// File parameters should also check the auto-detected-file (if not enumeration) |
6391 |
21 Jan 14 |
nicklas |
93 |
if ((values == null || values.size() == 0) && !pType.isEnumeration() && |
6391 |
21 Jan 14 |
nicklas |
94 |
pType instanceof FileParameterType) |
6391 |
21 Jan 14 |
nicklas |
95 |
{ |
6391 |
21 Jan 14 |
nicklas |
96 |
if (currentContext != null && currentContext.getObject("auto-detected-file") != null) |
6391 |
21 Jan 14 |
nicklas |
97 |
{ |
6391 |
21 Jan 14 |
nicklas |
98 |
values = Collections.singletonList(currentContext.getObject("auto-detected-file")); |
6391 |
21 Jan 14 |
nicklas |
99 |
currentContext.setObject("auto-detected-file", null); |
6391 |
21 Jan 14 |
nicklas |
100 |
} |
6391 |
21 Jan 14 |
nicklas |
101 |
} |
7494 |
04 Jun 18 |
nicklas |
102 |
|
7494 |
04 Jun 18 |
nicklas |
103 |
// Special handling for "charset" parameter to make it match the auto-selected file |
7494 |
04 Jun 18 |
nicklas |
104 |
if (currentContext != null && Parameters.CHARSET_PARAMETER.equals(pp.getName())) |
7494 |
04 Jun 18 |
nicklas |
105 |
{ |
7494 |
04 Jun 18 |
nicklas |
106 |
Object charset = currentContext.getObject("last-file-charset"); |
7494 |
04 Jun 18 |
nicklas |
107 |
if (charset != null) values = Collections.singletonList(charset); |
7494 |
04 Jun 18 |
nicklas |
108 |
} |
7494 |
04 Jun 18 |
nicklas |
109 |
|
7786 |
02 Mar 20 |
nicklas |
110 |
// Special handling for "dryRun" parameter which is typically not stored as a job proerty |
7786 |
02 Mar 20 |
nicklas |
111 |
if ((values == null || values.size() == 0) && Parameters.DRY_RUN_PARAMETER.equals(pp.getName())) |
7786 |
02 Mar 20 |
nicklas |
112 |
{ |
7786 |
02 Mar 20 |
nicklas |
113 |
if (job != null && job.isDryRun()) |
7786 |
02 Mar 20 |
nicklas |
114 |
{ |
7786 |
02 Mar 20 |
nicklas |
115 |
values = Collections.singletonList(true); |
7786 |
02 Mar 20 |
nicklas |
116 |
} |
7786 |
02 Mar 20 |
nicklas |
117 |
} |
7786 |
02 Mar 20 |
nicklas |
118 |
|
6391 |
21 Jan 14 |
nicklas |
119 |
// Then, we check the parameters default value |
6391 |
21 Jan 14 |
nicklas |
120 |
if ((values == null || values.size() == 0) && pp.getDefaultValue() != null) |
6391 |
21 Jan 14 |
nicklas |
121 |
{ |
6391 |
21 Jan 14 |
nicklas |
122 |
values = Collections.singletonList(pp.getDefaultValue()); |
6391 |
21 Jan 14 |
nicklas |
123 |
} |
6391 |
21 Jan 14 |
nicklas |
124 |
|
6391 |
21 Jan 14 |
nicklas |
125 |
// Item and File parameters will also look in the current context unless they are enumerated |
6391 |
21 Jan 14 |
nicklas |
126 |
if ((values == null || values.size() == 0) && |
6391 |
21 Jan 14 |
nicklas |
127 |
!pType.isEnumeration() && |
6391 |
21 Jan 14 |
nicklas |
128 |
(pType instanceof ItemParameterType || pType instanceof FileParameterType)) |
6391 |
21 Jan 14 |
nicklas |
129 |
{ |
6391 |
21 Jan 14 |
nicklas |
130 |
Item parameterItemType = Item.fromClass(pType.getParameterClass()); |
6391 |
21 Jan 14 |
nicklas |
131 |
ItemContext cc = currentContext; |
6391 |
21 Jan 14 |
nicklas |
132 |
if (cc == null || parameterItemType != cc.getItemType()) |
6391 |
21 Jan 14 |
nicklas |
133 |
{ |
6391 |
21 Jan 14 |
nicklas |
134 |
cc = dc.getSessionControl().getCurrentContext(parameterItemType); |
6391 |
21 Jan 14 |
nicklas |
135 |
} |
6391 |
21 Jan 14 |
nicklas |
136 |
if (cc.getId() != 0 && pType.getMultiplicity() == 1) |
6391 |
21 Jan 14 |
nicklas |
137 |
{ |
6391 |
21 Jan 14 |
nicklas |
138 |
if (pType instanceof FileParameterType) |
6391 |
21 Jan 14 |
nicklas |
139 |
{ |
6391 |
21 Jan 14 |
nicklas |
140 |
try |
6391 |
21 Jan 14 |
nicklas |
141 |
{ |
7494 |
04 Jun 18 |
nicklas |
142 |
File file = File.getById(dc, cc.getId()); |
7604 |
25 Feb 19 |
nicklas |
143 |
values = Collections.singletonList(file.getPath().toString()); |
7494 |
04 Jun 18 |
nicklas |
144 |
if (currentContext != null && file.getCharacterSet() != null) |
7494 |
04 Jun 18 |
nicklas |
145 |
{ |
7494 |
04 Jun 18 |
nicklas |
146 |
currentContext.setObject("last-file-charset", file.getCharacterSet()); |
7494 |
04 Jun 18 |
nicklas |
147 |
} |
6391 |
21 Jan 14 |
nicklas |
148 |
} |
6391 |
21 Jan 14 |
nicklas |
149 |
catch (Throwable t) |
6391 |
21 Jan 14 |
nicklas |
150 |
{} |
6391 |
21 Jan 14 |
nicklas |
151 |
} |
6391 |
21 Jan 14 |
nicklas |
152 |
else |
6391 |
21 Jan 14 |
nicklas |
153 |
{ |
7604 |
25 Feb 19 |
nicklas |
154 |
values = Collections.singletonList(cc.getId()); |
6391 |
21 Jan 14 |
nicklas |
155 |
} |
6391 |
21 Jan 14 |
nicklas |
156 |
} |
6391 |
21 Jan 14 |
nicklas |
157 |
else if (cc.getSelected().size() > 0 && pType.getMultiplicity() != 1) |
6391 |
21 Jan 14 |
nicklas |
158 |
{ |
7604 |
25 Feb 19 |
nicklas |
159 |
values = new ArrayList<>(cc.getSelected()); |
6391 |
21 Jan 14 |
nicklas |
160 |
} |
6391 |
21 Jan 14 |
nicklas |
161 |
} |
6391 |
21 Jan 14 |
nicklas |
162 |
// Finally, if the parameter has multiplicity=1, is requried and has a list of enumeration values |
6391 |
21 Jan 14 |
nicklas |
163 |
if ((values == null || values.size() == 0) && pType.getNotNull() && |
6391 |
21 Jan 14 |
nicklas |
164 |
pType.getMultiplicity() == 1 && pType.getItems() != null && pType.getItems().size() > 0) |
6391 |
21 Jan 14 |
nicklas |
165 |
{ |
6391 |
21 Jan 14 |
nicklas |
166 |
values = Collections.singletonList(pType.getItems().get(0)); |
6391 |
21 Jan 14 |
nicklas |
167 |
} |
6391 |
21 Jan 14 |
nicklas |
168 |
|
6391 |
21 Jan 14 |
nicklas |
169 |
return values; |
6391 |
21 Jan 14 |
nicklas |
170 |
} |
6391 |
21 Jan 14 |
nicklas |
171 |
|
7604 |
25 Feb 19 |
nicklas |
172 |
JSONArray convertToJson(List<?> values, DbControl dc, ParameterType<?> pType, Formatter<Date> dateFormatter, Formatter<Date> dateTimeFormatter) |
6391 |
21 Jan 14 |
nicklas |
173 |
{ |
6391 |
21 Jan 14 |
nicklas |
174 |
JSONArray json = new JSONArray(); |
6391 |
21 Jan 14 |
nicklas |
175 |
|
6391 |
21 Jan 14 |
nicklas |
176 |
if (values != null && values.size() > 0) |
6391 |
21 Jan 14 |
nicklas |
177 |
{ |
6391 |
21 Jan 14 |
nicklas |
178 |
for (Object value : values) |
6391 |
21 Jan 14 |
nicklas |
179 |
{ |
6391 |
21 Jan 14 |
nicklas |
180 |
if (value instanceof Date) |
6391 |
21 Jan 14 |
nicklas |
181 |
{ |
6391 |
21 Jan 14 |
nicklas |
182 |
if (pType.isEnumeration()) |
6391 |
21 Jan 14 |
nicklas |
183 |
{ |
6391 |
21 Jan 14 |
nicklas |
184 |
value = ((Date)value).getTime(); |
6391 |
21 Jan 14 |
nicklas |
185 |
} |
6391 |
21 Jan 14 |
nicklas |
186 |
else |
6391 |
21 Jan 14 |
nicklas |
187 |
{ |
6391 |
21 Jan 14 |
nicklas |
188 |
if (pType.getValueType() == Type.TIMESTAMP) |
6391 |
21 Jan 14 |
nicklas |
189 |
{ |
6391 |
21 Jan 14 |
nicklas |
190 |
value = dateTimeFormatter.format((Date)value); |
6391 |
21 Jan 14 |
nicklas |
191 |
} |
6391 |
21 Jan 14 |
nicklas |
192 |
else |
6391 |
21 Jan 14 |
nicklas |
193 |
{ |
6391 |
21 Jan 14 |
nicklas |
194 |
value = dateFormatter.format((Date)value); |
6391 |
21 Jan 14 |
nicklas |
195 |
} |
6391 |
21 Jan 14 |
nicklas |
196 |
} |
6391 |
21 Jan 14 |
nicklas |
197 |
} |
6391 |
21 Jan 14 |
nicklas |
198 |
else if (value instanceof File && pType instanceof FileParameterType) |
6391 |
21 Jan 14 |
nicklas |
199 |
{ |
6391 |
21 Jan 14 |
nicklas |
200 |
File file = File.getById(dc, ((File)value).getId()); |
6391 |
21 Jan 14 |
nicklas |
201 |
value = file.getPath().toString(); |
6391 |
21 Jan 14 |
nicklas |
202 |
} |
6391 |
21 Jan 14 |
nicklas |
203 |
else if (value instanceof BasicItem) |
6391 |
21 Jan 14 |
nicklas |
204 |
{ |
6391 |
21 Jan 14 |
nicklas |
205 |
value = ((BasicItem)value).getId(); |
6391 |
21 Jan 14 |
nicklas |
206 |
} |
6391 |
21 Jan 14 |
nicklas |
207 |
if (value != null) |
6391 |
21 Jan 14 |
nicklas |
208 |
{ |
6391 |
21 Jan 14 |
nicklas |
209 |
json.add(value.toString()); |
6391 |
21 Jan 14 |
nicklas |
210 |
} |
6391 |
21 Jan 14 |
nicklas |
211 |
} |
6391 |
21 Jan 14 |
nicklas |
212 |
} |
6391 |
21 Jan 14 |
nicklas |
213 |
return json; |
6391 |
21 Jan 14 |
nicklas |
214 |
} |
6391 |
21 Jan 14 |
nicklas |
215 |
%> |
1730 |
20 Dec 05 |
nicklas |
216 |
<% |
1730 |
20 Dec 05 |
nicklas |
217 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1730 |
20 Dec 05 |
nicklas |
218 |
final String ID = sc.getId(); |
1730 |
20 Dec 05 |
nicklas |
219 |
final float scale = Base.getScale(sc); |
1945 |
09 Feb 06 |
nicklas |
220 |
|
1985 |
14 Feb 06 |
nicklas |
221 |
final Item itemType = request.getParameter("item_type") == null ? null : Item.valueOf(request.getParameter("item_type")); |
1945 |
09 Feb 06 |
nicklas |
222 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
2677 |
28 Sep 06 |
nicklas |
223 |
final ItemContext currentContext = itemType == null ? null : sc.getCurrentContext(itemType, subContext); |
7954 |
12 May 21 |
nicklas |
224 |
final DbControl dc = sc.newDbControl(":Plug-in configuration wizard"); |
1730 |
20 Dec 05 |
nicklas |
225 |
try |
1730 |
20 Dec 05 |
nicklas |
226 |
{ |
6391 |
21 Jan 14 |
nicklas |
227 |
final Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
2942 |
22 Nov 06 |
nicklas |
228 |
String dateFormat = FormatterSettings.getDateFormat(sc); |
2942 |
22 Nov 06 |
nicklas |
229 |
String htmlDateFormat = HTML.encodeTags(dateFormat); |
6391 |
21 Jan 14 |
nicklas |
230 |
final Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
5437 |
01 Oct 10 |
nicklas |
231 |
String dateTimeFormat = FormatterSettings.getDateTimeFormat(sc); |
5437 |
01 Oct 10 |
nicklas |
232 |
String htmlDateTimeFormat = HTML.encodeTags(dateTimeFormat); |
2942 |
22 Nov 06 |
nicklas |
233 |
|
7605 |
26 Feb 19 |
nicklas |
234 |
final PluginConfigurationRequest pcRequest = sc.getSessionSetting("plugin.configure.request"); |
1730 |
20 Dec 05 |
nicklas |
235 |
if (pcRequest == null) throw new WebException("popup", "No request information found", "No request information found"); |
1730 |
20 Dec 05 |
nicklas |
236 |
|
7605 |
26 Feb 19 |
nicklas |
237 |
final PluginDefinition plugin = sc.getSessionSetting("plugin.configure.plugin"); |
7605 |
26 Feb 19 |
nicklas |
238 |
final Job job = sc.getSessionSetting("plugin.configure.job"); |
5060 |
19 Aug 09 |
nicklas |
239 |
dc.reattachItem(plugin, false); |
6393 |
22 Jan 14 |
nicklas |
240 |
|
6393 |
22 Jan 14 |
nicklas |
241 |
final Set<String> options = new HashSet<String>(); |
7605 |
26 Feb 19 |
nicklas |
242 |
final PluginConfiguration pluginConfig = sc.getSessionSetting("plugin.configure.config"); |
7605 |
26 Feb 19 |
nicklas |
243 |
String errorMessage = sc.getSessionSetting("plugin.configure.errors.message"); |
7605 |
26 Feb 19 |
nicklas |
244 |
List<Throwable> errors = sc.getSessionSetting("plugin.configure.errors.list"); |
1773 |
16 Jan 06 |
nicklas |
245 |
|
6391 |
21 Jan 14 |
nicklas |
246 |
final RequestInformation ri = pcRequest.getRequestInformation(); |
1730 |
20 Dec 05 |
nicklas |
247 |
List<PluginParameter<?>> parameters = ri.getParameters(); |
2655 |
22 Sep 06 |
nicklas |
248 |
String title = HTML.encodeTags(ri.getTitle()); |
1787 |
18 Jan 06 |
nicklas |
249 |
String jobName = Values.getString(request.getParameter("job_name"), title); |
1985 |
14 Feb 06 |
nicklas |
250 |
StringBuilder sb = new StringBuilder(); |
5159 |
23 Oct 09 |
nicklas |
251 |
String helpText = ri.getDescription(); |
5159 |
23 Oct 09 |
nicklas |
252 |
if (helpText == null && pluginConfig != null) helpText = pluginConfig.getDescription(); |
5159 |
23 Oct 09 |
nicklas |
253 |
if (helpText == null) helpText = plugin.getDescription(); |
7605 |
26 Feb 19 |
nicklas |
254 |
List<File> recentFiles = currentContext == null ? null : currentContext.getRecent(dc, Item.FILE); |
6391 |
21 Jan 14 |
nicklas |
255 |
|
7604 |
25 Feb 19 |
nicklas |
256 |
JSONArray jsonParameters = JsonUtil.toArray(parameters, new JsonConverter<PluginParameter<?>>() |
6391 |
21 Jan 14 |
nicklas |
257 |
{ |
7604 |
25 Feb 19 |
nicklas |
258 |
public Object convert(PluginParameter<?> pp) |
1750 |
10 Jan 06 |
nicklas |
259 |
{ |
7604 |
25 Feb 19 |
nicklas |
260 |
ParameterType<?> pType = pp.getParameterType(); |
6391 |
21 Jan 14 |
nicklas |
261 |
JSONObject json = new JSONObject(); |
6391 |
21 Jan 14 |
nicklas |
262 |
json.put("name", pp.getName()); |
6391 |
21 Jan 14 |
nicklas |
263 |
json.put("label", pp.getLabel()); |
6391 |
21 Jan 14 |
nicklas |
264 |
json.put("hidden", pp.isHidden() ? 1 : 0); |
6393 |
22 Jan 14 |
nicklas |
265 |
if ("parserSection".equals(pp.getName())) |
6393 |
22 Jan 14 |
nicklas |
266 |
{ |
6393 |
22 Jan 14 |
nicklas |
267 |
if (plugin.supports("net.sf.basedb.util.parser.ConfigureByExample")) |
6393 |
22 Jan 14 |
nicklas |
268 |
{ |
6393 |
22 Jan 14 |
nicklas |
269 |
options.add("configure-by-example"); |
6393 |
22 Jan 14 |
nicklas |
270 |
} |
6393 |
22 Jan 14 |
nicklas |
271 |
} |
6391 |
21 Jan 14 |
nicklas |
272 |
if (pType != null) |
1750 |
10 Jan 06 |
nicklas |
273 |
{ |
6391 |
21 Jan 14 |
nicklas |
274 |
json.put("valueClass", pType.getClass().getSimpleName()); |
6391 |
21 Jan 14 |
nicklas |
275 |
if (pType instanceof PathParameterType) |
1750 |
10 Jan 06 |
nicklas |
276 |
{ |
6391 |
21 Jan 14 |
nicklas |
277 |
PathParameterType ppType = (PathParameterType)pType; |
6391 |
21 Jan 14 |
nicklas |
278 |
json.put("pathType", ppType.getPathType().name()); |
1750 |
10 Jan 06 |
nicklas |
279 |
} |
6391 |
21 Jan 14 |
nicklas |
280 |
json.put("nullable", pType.getNotNull() ? 0 : 1); |
6391 |
21 Jan 14 |
nicklas |
281 |
json.put("enumeration", pType.isEnumeration() ? 1 : 0); |
6391 |
21 Jan 14 |
nicklas |
282 |
json.put("multiplicity", pType.getMultiplicity()); |
7786 |
02 Mar 20 |
nicklas |
283 |
List<?> values = getParameterValues(pp, dc, request, pcRequest, currentContext, job); |
6391 |
21 Jan 14 |
nicklas |
284 |
json.put("values", convertToJson(values, dc, pType, dateFormatter, dateTimeFormatter)); |
1750 |
10 Jan 06 |
nicklas |
285 |
} |
6391 |
21 Jan 14 |
nicklas |
286 |
return json; |
1750 |
10 Jan 06 |
nicklas |
287 |
} |
6391 |
21 Jan 14 |
nicklas |
288 |
}); |
6391 |
21 Jan 14 |
nicklas |
289 |
%> |
6391 |
21 Jan 14 |
nicklas |
290 |
<base:page type="popup" title="<%=title%>"> |
6393 |
22 Jan 14 |
nicklas |
291 |
<base:head scripts="~configure.js" styles="parameters.css" /> |
6391 |
21 Jan 14 |
nicklas |
292 |
<base:body> |
5910 |
14 Dec 11 |
nicklas |
293 |
<h1><%=title%> <base:help |
5910 |
14 Dec 11 |
nicklas |
294 |
helpid="<%="runplugin.configure"+(job != null ? "." + plugin.getMainType().name().toLowerCase() : "") %>" /></h1> |
6391 |
21 Jan 14 |
nicklas |
295 |
<div id="page-data" class="data-container" |
6391 |
21 Jan 14 |
nicklas |
296 |
data-plugin-parameters="<%=HTML.encodeTags(jsonParameters.toJSONString())%>" |
6391 |
21 Jan 14 |
nicklas |
297 |
></div> |
5910 |
14 Dec 11 |
nicklas |
298 |
|
6162 |
10 Oct 12 |
nicklas |
299 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="configure"> |
1730 |
20 Dec 05 |
nicklas |
300 |
<input type="hidden" name="cmd" value="SetParameters"> |
1773 |
16 Jan 06 |
nicklas |
301 |
<input type="hidden" name="title" value="<%=title%>"> |
3518 |
20 Jun 07 |
nicklas |
302 |
<input type="hidden" name="requestId" value="<%=request.getParameter("requestId")%>"> |
1985 |
14 Feb 06 |
nicklas |
303 |
<% |
1985 |
14 Feb 06 |
nicklas |
304 |
if (itemType != null) |
1985 |
14 Feb 06 |
nicklas |
305 |
{ |
1985 |
14 Feb 06 |
nicklas |
306 |
%> |
1985 |
14 Feb 06 |
nicklas |
307 |
<input type="hidden" name="item_type" value="<%=itemType.name()%>"> |
1985 |
14 Feb 06 |
nicklas |
308 |
<% |
1985 |
14 Feb 06 |
nicklas |
309 |
} |
1985 |
14 Feb 06 |
nicklas |
310 |
%> |
1945 |
09 Feb 06 |
nicklas |
311 |
<input type="hidden" name="subcontext" value="<%=subContext%>"> |
1945 |
09 Feb 06 |
nicklas |
312 |
|
5910 |
14 Dec 11 |
nicklas |
313 |
<div class="content bottomborder"> |
5910 |
14 Dec 11 |
nicklas |
314 |
|
6607 |
19 Nov 14 |
nicklas |
315 |
<div class="absolutefull bg-filled-100" style="height: 4.5em;"> |
5911 |
15 Dec 11 |
nicklas |
316 |
<table style="height: 100%; margin:auto;"><tr><td style="padding: 3px;"> |
5910 |
14 Dec 11 |
nicklas |
317 |
<b> |
5910 |
14 Dec 11 |
nicklas |
318 |
<%=plugin == null ? "" : HTML.encodeTags(plugin.getName())%> |
5910 |
14 Dec 11 |
nicklas |
319 |
<%=pluginConfig == null ? "" : "(" + HTML.encodeTags(pluginConfig.getName()) + ")"%> |
5910 |
14 Dec 11 |
nicklas |
320 |
</b><br> |
5159 |
23 Oct 09 |
nicklas |
321 |
<%=HTML.niceFormat(helpText)%> |
5910 |
14 Dec 11 |
nicklas |
322 |
</td></tr></table> |
1758 |
12 Jan 06 |
nicklas |
323 |
</div> |
5910 |
14 Dec 11 |
nicklas |
324 |
|
5911 |
15 Dec 11 |
nicklas |
325 |
<div class="absolutefull topborder" style="top: 4.5em;"> |
6607 |
19 Nov 14 |
nicklas |
326 |
<div class="absolutefull bg-filled-100 rightborder" style="width: 18em;"> |
6391 |
21 Jan 14 |
nicklas |
327 |
<div class="absolutefull parameterlist" id="parameter-list" style="bottom: 2em;"> |
1757 |
11 Jan 06 |
nicklas |
328 |
</div> |
1756 |
11 Jan 06 |
nicklas |
329 |
|
5910 |
14 Dec 11 |
nicklas |
330 |
<div class="absolutefull topborder" style="top: auto; bottom: 0px; height: 2em;"> |
5910 |
14 Dec 11 |
nicklas |
331 |
<table style="height: 100%; margin:auto;"><tr><td> |
6610 |
20 Nov 14 |
nicklas |
332 |
<base:icon image="hasvalues.png" />= has value(s), <base:icon image="required.png" />= required |
5910 |
14 Dec 11 |
nicklas |
333 |
</td></tr></table> |
5910 |
14 Dec 11 |
nicklas |
334 |
</div> |
5910 |
14 Dec 11 |
nicklas |
335 |
</div> |
5910 |
14 Dec 11 |
nicklas |
336 |
|
5910 |
14 Dec 11 |
nicklas |
337 |
<div class="absolutefull input100" style="left: 18em; padding: 8px;"> |
1880 |
01 Feb 06 |
nicklas |
338 |
<% |
2270 |
17 May 06 |
nicklas |
339 |
if (errorMessage != null || (errors != null && errors.size() > 0)) |
1880 |
01 Feb 06 |
nicklas |
340 |
{ |
1880 |
01 Feb 06 |
nicklas |
341 |
%> |
5911 |
15 Dec 11 |
nicklas |
342 |
<div id="errors" style="margin-bottom: 12px;"> |
5911 |
15 Dec 11 |
nicklas |
343 |
<div class="messagecontainer error" style="margin: 0px;"> |
2270 |
17 May 06 |
nicklas |
344 |
<%=errorMessage %> |
1880 |
01 Feb 06 |
nicklas |
345 |
<% |
2270 |
17 May 06 |
nicklas |
346 |
if (errors != null && errors.size() > 0) |
1880 |
01 Feb 06 |
nicklas |
347 |
{ |
1880 |
01 Feb 06 |
nicklas |
348 |
%> |
5911 |
15 Dec 11 |
nicklas |
349 |
<div id="showerrorlist"> |
6391 |
21 Jan 14 |
nicklas |
350 |
<base:icon |
6391 |
21 Jan 14 |
nicklas |
351 |
id="btnShowErrorList" |
6391 |
21 Jan 14 |
nicklas |
352 |
image="gonext.png" |
5911 |
15 Dec 11 |
nicklas |
353 |
style="color: #FFFFFF;" |
5911 |
15 Dec 11 |
nicklas |
354 |
tooltip="Show more information about each error" |
5911 |
15 Dec 11 |
nicklas |
355 |
/> |
2270 |
17 May 06 |
nicklas |
356 |
</div> |
5911 |
15 Dec 11 |
nicklas |
357 |
<div id="errorlist" style="display: none; margin: 0px;"> |
6391 |
21 Jan 14 |
nicklas |
358 |
<base:icon |
6391 |
21 Jan 14 |
nicklas |
359 |
id="btnHideErrorList" |
6391 |
21 Jan 14 |
nicklas |
360 |
image="move_down.png" |
5911 |
15 Dec 11 |
nicklas |
361 |
style="color: #FFFFFF;" |
5911 |
15 Dec 11 |
nicklas |
362 |
tooltip="Show less information" |
5911 |
15 Dec 11 |
nicklas |
363 |
/> |
2270 |
17 May 06 |
nicklas |
364 |
<ol> |
1880 |
01 Feb 06 |
nicklas |
365 |
<% |
3658 |
13 Aug 07 |
nicklas |
366 |
int i = 0; |
2270 |
17 May 06 |
nicklas |
367 |
for (Throwable t : errors) |
2270 |
17 May 06 |
nicklas |
368 |
{ |
3658 |
13 Aug 07 |
nicklas |
369 |
++i; |
2270 |
17 May 06 |
nicklas |
370 |
%> |
5911 |
15 Dec 11 |
nicklas |
371 |
<li><%=t.getMessage()%> |
6391 |
21 Jan 14 |
nicklas |
372 |
<base:icon |
6391 |
21 Jan 14 |
nicklas |
373 |
subclass="auto-init" |
6391 |
21 Jan 14 |
nicklas |
374 |
data-auto-init="toggle-stacktrace" |
6393 |
22 Jan 14 |
nicklas |
375 |
data-stracktrace-index="<%=i%>" |
5911 |
15 Dec 11 |
nicklas |
376 |
image="gonext.png" |
4420 |
27 Aug 08 |
nicklas |
377 |
tooltip="Toggle display of detailed stacktrace" |
4420 |
27 Aug 08 |
nicklas |
378 |
id="<%="stacktracelink." + i %>" |
4420 |
27 Aug 08 |
nicklas |
379 |
/> |
5911 |
15 Dec 11 |
nicklas |
380 |
<div id="stacktrace.<%=i%>" class="stacktrace" |
5911 |
15 Dec 11 |
nicklas |
381 |
style="display:none; height: 15em;"><%=ThrowableUtil.stackTraceToString(t)%></div> |
3658 |
13 Aug 07 |
nicklas |
382 |
<% |
4420 |
27 Aug 08 |
nicklas |
383 |
} |
4420 |
27 Aug 08 |
nicklas |
384 |
%> |
2270 |
17 May 06 |
nicklas |
385 |
</ol> |
2270 |
17 May 06 |
nicklas |
386 |
</div> |
2270 |
17 May 06 |
nicklas |
387 |
<% |
1880 |
01 Feb 06 |
nicklas |
388 |
} |
1880 |
01 Feb 06 |
nicklas |
389 |
%> |
1880 |
01 Feb 06 |
nicklas |
390 |
</div> |
5911 |
15 Dec 11 |
nicklas |
391 |
</div> |
1880 |
01 Feb 06 |
nicklas |
392 |
<% |
1880 |
01 Feb 06 |
nicklas |
393 |
} |
1880 |
01 Feb 06 |
nicklas |
394 |
%> |
1880 |
01 Feb 06 |
nicklas |
395 |
|
1750 |
10 Jan 06 |
nicklas |
396 |
<div id="valuecontainer" style="display: none;"> |
6139 |
19 Sep 12 |
nicklas |
397 |
<table> |
5905 |
12 Dec 11 |
nicklas |
398 |
<tr > |
1750 |
10 Jan 06 |
nicklas |
399 |
<td> |
1750 |
10 Jan 06 |
nicklas |
400 |
<b>Values</b> <span id="multiplicity"></span><br> |
6393 |
22 Jan 14 |
nicklas |
401 |
<select name="values" id="values" size="5" style="width: 20em;" multiple> |
1750 |
10 Jan 06 |
nicklas |
402 |
</select> |
1730 |
20 Dec 05 |
nicklas |
403 |
</td> |
1750 |
10 Jan 06 |
nicklas |
404 |
<td> </td> |
1750 |
10 Jan 06 |
nicklas |
405 |
<td> |
1750 |
10 Jan 06 |
nicklas |
406 |
<td> |
1750 |
10 Jan 06 |
nicklas |
407 |
<br> |
6393 |
22 Jan 14 |
nicklas |
408 |
<base:buttongroup vertical="true"> |
6393 |
22 Jan 14 |
nicklas |
409 |
<base:button id="btnAddValue" subclass="leftaligned" title="Add" /> |
6393 |
22 Jan 14 |
nicklas |
410 |
<base:button id="btnRemoveValue" subclass="leftaligned" title="Remove" /> |
6393 |
22 Jan 14 |
nicklas |
411 |
</base:buttongroup> |
1750 |
10 Jan 06 |
nicklas |
412 |
</td> |
1750 |
10 Jan 06 |
nicklas |
413 |
</table> |
1750 |
10 Jan 06 |
nicklas |
414 |
</div> |
1758 |
12 Jan 06 |
nicklas |
415 |
|
1750 |
10 Jan 06 |
nicklas |
416 |
<% |
1875 |
01 Feb 06 |
nicklas |
417 |
if (parameters != null && parameters.size() > 0) |
1730 |
20 Dec 05 |
nicklas |
418 |
{ |
1875 |
01 Feb 06 |
nicklas |
419 |
for (PluginParameter<?> param : parameters) |
1730 |
20 Dec 05 |
nicklas |
420 |
{ |
2198 |
27 Apr 06 |
nicklas |
421 |
if (!param.isHidden()) |
1750 |
10 Jan 06 |
nicklas |
422 |
{ |
7604 |
25 Feb 19 |
nicklas |
423 |
ParameterType<?> pType = param.getParameterType(); |
6391 |
21 Jan 14 |
nicklas |
424 |
String fieldName = "parameter-"+param.getName(); |
2198 |
27 Apr 06 |
nicklas |
425 |
if (pType != null) |
1875 |
01 Feb 06 |
nicklas |
426 |
{ |
2198 |
27 Apr 06 |
nicklas |
427 |
int multiplicity = pType.getMultiplicity(); |
2198 |
27 Apr 06 |
nicklas |
428 |
String select = null; |
2198 |
27 Apr 06 |
nicklas |
429 |
if (multiplicity == 0) |
1875 |
01 Feb 06 |
nicklas |
430 |
{ |
2992 |
01 Dec 06 |
enell |
431 |
if (pType.getNotNull()) |
2992 |
01 Dec 06 |
enell |
432 |
{ |
2992 |
01 Dec 06 |
enell |
433 |
select = "Select one or more"; |
2992 |
01 Dec 06 |
enell |
434 |
} |
2992 |
01 Dec 06 |
enell |
435 |
else |
2992 |
01 Dec 06 |
enell |
436 |
{ |
2992 |
01 Dec 06 |
enell |
437 |
select = "Select zero or more"; |
2992 |
01 Dec 06 |
enell |
438 |
} |
1875 |
01 Feb 06 |
nicklas |
439 |
} |
2198 |
27 Apr 06 |
nicklas |
440 |
else if (multiplicity == 1) |
2198 |
27 Apr 06 |
nicklas |
441 |
{ |
2198 |
27 Apr 06 |
nicklas |
442 |
select = "Select one"; |
2198 |
27 Apr 06 |
nicklas |
443 |
} |
1875 |
01 Feb 06 |
nicklas |
444 |
else |
1875 |
01 Feb 06 |
nicklas |
445 |
{ |
2992 |
01 Dec 06 |
enell |
446 |
if (pType.getNotNull()) |
2992 |
01 Dec 06 |
enell |
447 |
{ |
2992 |
01 Dec 06 |
enell |
448 |
select = "Select 1 -- " + multiplicity; |
2992 |
01 Dec 06 |
enell |
449 |
} |
2992 |
01 Dec 06 |
enell |
450 |
else |
2992 |
01 Dec 06 |
enell |
451 |
{ |
2992 |
01 Dec 06 |
enell |
452 |
select = "Select 0 -- " + multiplicity; |
2992 |
01 Dec 06 |
enell |
453 |
} |
2198 |
27 Apr 06 |
nicklas |
454 |
} |
2198 |
27 Apr 06 |
nicklas |
455 |
%> |
6391 |
21 Jan 14 |
nicklas |
456 |
<div id="<%=fieldName%>:section" style="display: none;"> |
2198 |
27 Apr 06 |
nicklas |
457 |
<% |
2198 |
27 Apr 06 |
nicklas |
458 |
if (pType.isEnumeration()) |
2198 |
27 Apr 06 |
nicklas |
459 |
{ |
2198 |
27 Apr 06 |
nicklas |
460 |
Enumeration<?, String> enumeration = pType.getEnumeration(); |
2198 |
27 Apr 06 |
nicklas |
461 |
List<?> values = pType.getItems(); |
1875 |
01 Feb 06 |
nicklas |
462 |
%> |
3987 |
22 Nov 07 |
nicklas |
463 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (<%=select%>) |
1875 |
01 Feb 06 |
nicklas |
464 |
<% |
3987 |
22 Nov 07 |
nicklas |
465 |
if (multiplicity != 1) |
3987 |
22 Nov 07 |
nicklas |
466 |
{ |
3987 |
22 Nov 07 |
nicklas |
467 |
%> |
6176 |
19 Oct 12 |
nicklas |
468 |
<base:icon |
6393 |
22 Jan 14 |
nicklas |
469 |
id="<%=fieldName+":select-all"%>" |
6393 |
22 Jan 14 |
nicklas |
470 |
subclass="auto-init" |
6393 |
22 Jan 14 |
nicklas |
471 |
data-auto-init="select-all" |
6393 |
22 Jan 14 |
nicklas |
472 |
data-field="<%=fieldName%>" |
6176 |
19 Oct 12 |
nicklas |
473 |
image="check_uncheck.png" |
6393 |
22 Jan 14 |
nicklas |
474 |
tooltip="Select/deselect all" |
6393 |
22 Jan 14 |
nicklas |
475 |
/> |
3987 |
22 Nov 07 |
nicklas |
476 |
<% |
3987 |
22 Nov 07 |
nicklas |
477 |
} |
3987 |
22 Nov 07 |
nicklas |
478 |
%> |
3987 |
22 Nov 07 |
nicklas |
479 |
<br> |
3987 |
22 Nov 07 |
nicklas |
480 |
<% |
2198 |
27 Apr 06 |
nicklas |
481 |
if (multiplicity == 1) |
2190 |
25 Apr 06 |
nicklas |
482 |
{ |
2198 |
27 Apr 06 |
nicklas |
483 |
%> |
7030 |
25 Nov 15 |
nicklas |
484 |
<select name="<%=fieldName%>" id="<%=fieldName%>" style="min-width: 8em;"> |
2198 |
27 Apr 06 |
nicklas |
485 |
<% |
7679 |
04 Apr 19 |
nicklas |
486 |
if (!pType.getNotNull() && !values.contains(null)) |
2751 |
20 Oct 06 |
nicklas |
487 |
{ |
2751 |
20 Oct 06 |
nicklas |
488 |
%> |
2751 |
20 Oct 06 |
nicklas |
489 |
<option value="" style="font-style: italic;">- not specified - |
2751 |
20 Oct 06 |
nicklas |
490 |
<% |
2751 |
20 Oct 06 |
nicklas |
491 |
} |
2190 |
25 Apr 06 |
nicklas |
492 |
} |
2190 |
25 Apr 06 |
nicklas |
493 |
else |
2190 |
25 Apr 06 |
nicklas |
494 |
{ |
2198 |
27 Apr 06 |
nicklas |
495 |
%> |
6391 |
21 Jan 14 |
nicklas |
496 |
<select name="<%=fieldName%>" id="<%=fieldName%>" |
6391 |
21 Jan 14 |
nicklas |
497 |
multiple size="10" style="width: 30em;"> |
2198 |
27 Apr 06 |
nicklas |
498 |
<% |
2190 |
25 Apr 06 |
nicklas |
499 |
} |
2198 |
27 Apr 06 |
nicklas |
500 |
for (int i = 0; i < values.size(); ++i) |
1875 |
01 Feb 06 |
nicklas |
501 |
{ |
2198 |
27 Apr 06 |
nicklas |
502 |
Object value; |
2198 |
27 Apr 06 |
nicklas |
503 |
String listValue = ""; |
2198 |
27 Apr 06 |
nicklas |
504 |
String listText = ""; |
2198 |
27 Apr 06 |
nicklas |
505 |
String listTitle = ""; |
2198 |
27 Apr 06 |
nicklas |
506 |
if (enumeration != null) |
2126 |
29 Mar 06 |
nicklas |
507 |
{ |
2198 |
27 Apr 06 |
nicklas |
508 |
value = enumeration.getKey(i); |
2198 |
27 Apr 06 |
nicklas |
509 |
listText = HTML.encodeTags(enumeration.getValue(i)); |
2126 |
29 Mar 06 |
nicklas |
510 |
} |
2126 |
29 Mar 06 |
nicklas |
511 |
else |
2126 |
29 Mar 06 |
nicklas |
512 |
{ |
2198 |
27 Apr 06 |
nicklas |
513 |
value = values.get(i); |
2126 |
29 Mar 06 |
nicklas |
514 |
} |
2198 |
27 Apr 06 |
nicklas |
515 |
if (value instanceof Date) |
2198 |
27 Apr 06 |
nicklas |
516 |
{ |
2198 |
27 Apr 06 |
nicklas |
517 |
listValue = Long.toString(((Date)value).getTime()); |
5437 |
01 Oct 10 |
nicklas |
518 |
if (enumeration == null) |
5437 |
01 Oct 10 |
nicklas |
519 |
{ |
5437 |
01 Oct 10 |
nicklas |
520 |
if (pType.getValueType() == Type.TIMESTAMP) |
5437 |
01 Oct 10 |
nicklas |
521 |
{ |
5437 |
01 Oct 10 |
nicklas |
522 |
listText = dateTimeFormatter.format((Date)value); |
5437 |
01 Oct 10 |
nicklas |
523 |
} |
5437 |
01 Oct 10 |
nicklas |
524 |
else |
5437 |
01 Oct 10 |
nicklas |
525 |
{ |
5437 |
01 Oct 10 |
nicklas |
526 |
listText = dateFormatter.format((Date)value); |
5437 |
01 Oct 10 |
nicklas |
527 |
} |
5437 |
01 Oct 10 |
nicklas |
528 |
} |
2198 |
27 Apr 06 |
nicklas |
529 |
} |
2198 |
27 Apr 06 |
nicklas |
530 |
else if (value instanceof BasicItem) |
2198 |
27 Apr 06 |
nicklas |
531 |
{ |
2198 |
27 Apr 06 |
nicklas |
532 |
BasicItem item = (BasicItem)value; |
2198 |
27 Apr 06 |
nicklas |
533 |
listValue = Integer.toString(item.getId()); |
2198 |
27 Apr 06 |
nicklas |
534 |
if (item instanceof Nameable) |
2198 |
27 Apr 06 |
nicklas |
535 |
{ |
2198 |
27 Apr 06 |
nicklas |
536 |
Nameable nameable = (Nameable)item; |
2198 |
27 Apr 06 |
nicklas |
537 |
if (enumeration == null) listText = HTML.encodeTags(nameable.getName()); |
2198 |
27 Apr 06 |
nicklas |
538 |
listTitle = HTML.encodeTags(nameable.getDescription()); |
2198 |
27 Apr 06 |
nicklas |
539 |
} |
2198 |
27 Apr 06 |
nicklas |
540 |
else |
2198 |
27 Apr 06 |
nicklas |
541 |
{ |
2198 |
27 Apr 06 |
nicklas |
542 |
if (enumeration == null) listText = HTML.encodeTags(item.toString()); |
2198 |
27 Apr 06 |
nicklas |
543 |
} |
2198 |
27 Apr 06 |
nicklas |
544 |
} |
2198 |
27 Apr 06 |
nicklas |
545 |
else |
2198 |
27 Apr 06 |
nicklas |
546 |
{ |
2198 |
27 Apr 06 |
nicklas |
547 |
listValue = HTML.encodeTags(value == null ? "" : value.toString()); |
7594 |
20 Feb 19 |
nicklas |
548 |
if (enumeration == null) listText = value == null ? "- not specified -" : listValue; |
2198 |
27 Apr 06 |
nicklas |
549 |
} |
2198 |
27 Apr 06 |
nicklas |
550 |
%> |
2198 |
27 Apr 06 |
nicklas |
551 |
<option value="<%=listValue%>" title="<%=listTitle%>"><%=listText%> |
2198 |
27 Apr 06 |
nicklas |
552 |
<% |
1875 |
01 Feb 06 |
nicklas |
553 |
} |
1875 |
01 Feb 06 |
nicklas |
554 |
%> |
2198 |
27 Apr 06 |
nicklas |
555 |
</select> |
1875 |
01 Feb 06 |
nicklas |
556 |
<% |
1875 |
01 Feb 06 |
nicklas |
557 |
} |
2198 |
27 Apr 06 |
nicklas |
558 |
else if (pType instanceof StringParameterType) |
1754 |
11 Jan 06 |
nicklas |
559 |
{ |
2198 |
27 Apr 06 |
nicklas |
560 |
Integer maxLength = ((StringParameterType)pType).getMaxLength(); |
2455 |
30 Jun 06 |
nicklas |
561 |
int height = pType.getHeight() <= 0 ? 6 : pType.getHeight(); |
2455 |
30 Jun 06 |
nicklas |
562 |
if (height > 20) height = 20; |
6987 |
30 Oct 15 |
nicklas |
563 |
boolean isPassword = pType.isMasked(); |
2455 |
30 Jun 06 |
nicklas |
564 |
if (maxLength == null || maxLength > 255) |
2455 |
30 Jun 06 |
nicklas |
565 |
{ |
2455 |
30 Jun 06 |
nicklas |
566 |
%> |
2455 |
30 Jun 06 |
nicklas |
567 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Text)<br> |
5910 |
14 Dec 11 |
nicklas |
568 |
<table style="width: 100%;"> |
5910 |
14 Dec 11 |
nicklas |
569 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
570 |
<td> |
6217 |
14 Dec 12 |
nicklas |
571 |
<textarea class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
572 |
name="<%=fieldName%>" id="<%=fieldName%>" rows="<%=height%>" |
6391 |
21 Jan 14 |
nicklas |
573 |
></textarea> |
5910 |
14 Dec 11 |
nicklas |
574 |
</td> |
5910 |
14 Dec 11 |
nicklas |
575 |
<td style="width: 20px;"> |
6391 |
21 Jan 14 |
nicklas |
576 |
<base:zoom textarea="<%=fieldName%>" title="<%=HTML.encodeTags(param.getLabel()) %>" /> |
5910 |
14 Dec 11 |
nicklas |
577 |
</td> |
5910 |
14 Dec 11 |
nicklas |
578 |
</tr> |
5910 |
14 Dec 11 |
nicklas |
579 |
</table> |
2455 |
30 Jun 06 |
nicklas |
580 |
<% |
2455 |
30 Jun 06 |
nicklas |
581 |
} |
2455 |
30 Jun 06 |
nicklas |
582 |
else |
2455 |
30 Jun 06 |
nicklas |
583 |
{ |
2455 |
30 Jun 06 |
nicklas |
584 |
%> |
2455 |
30 Jun 06 |
nicklas |
585 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (String)<br> |
6987 |
30 Oct 15 |
nicklas |
586 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6987 |
30 Oct 15 |
nicklas |
587 |
type="<%=isPassword ? "password": "text"%>" |
6391 |
21 Jan 14 |
nicklas |
588 |
name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
589 |
maxlength="<%=maxLength%>"> |
2455 |
30 Jun 06 |
nicklas |
590 |
<% |
2455 |
30 Jun 06 |
nicklas |
591 |
} |
1754 |
11 Jan 06 |
nicklas |
592 |
} |
2198 |
27 Apr 06 |
nicklas |
593 |
else if (pType instanceof IntegerParameterType) |
1759 |
12 Jan 06 |
nicklas |
594 |
{ |
2198 |
27 Apr 06 |
nicklas |
595 |
IntegerParameterType ipType = (IntegerParameterType)pType; |
2198 |
27 Apr 06 |
nicklas |
596 |
Integer minValue = ipType.getLowerLimit(); |
2198 |
27 Apr 06 |
nicklas |
597 |
Integer maxValue = ipType.getUpperLimit(); |
2198 |
27 Apr 06 |
nicklas |
598 |
String minMax = ""; |
2198 |
27 Apr 06 |
nicklas |
599 |
if (minValue != null && maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
600 |
{ |
2198 |
27 Apr 06 |
nicklas |
601 |
minMax = ": " + minValue + " -- " +maxValue; |
2198 |
27 Apr 06 |
nicklas |
602 |
} |
2198 |
27 Apr 06 |
nicklas |
603 |
else if (minValue != null) |
2198 |
27 Apr 06 |
nicklas |
604 |
{ |
2198 |
27 Apr 06 |
nicklas |
605 |
minMax = " >= "+minValue; |
2198 |
27 Apr 06 |
nicklas |
606 |
} |
2198 |
27 Apr 06 |
nicklas |
607 |
else if (maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
608 |
{ |
2198 |
27 Apr 06 |
nicklas |
609 |
minMax = " <= "+maxValue; |
2198 |
27 Apr 06 |
nicklas |
610 |
} |
2198 |
27 Apr 06 |
nicklas |
611 |
%> |
2198 |
27 Apr 06 |
nicklas |
612 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Integer<%=minMax%>)<br> |
6217 |
14 Dec 12 |
nicklas |
613 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
614 |
type="text" name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
615 |
maxlength="20"> |
2198 |
27 Apr 06 |
nicklas |
616 |
<% |
1759 |
12 Jan 06 |
nicklas |
617 |
} |
2198 |
27 Apr 06 |
nicklas |
618 |
else if (pType instanceof LongParameterType) |
1754 |
11 Jan 06 |
nicklas |
619 |
{ |
2198 |
27 Apr 06 |
nicklas |
620 |
LongParameterType ipType = (LongParameterType)pType; |
2198 |
27 Apr 06 |
nicklas |
621 |
Long minValue = ipType.getLowerLimit(); |
2198 |
27 Apr 06 |
nicklas |
622 |
Long maxValue = ipType.getUpperLimit(); |
2198 |
27 Apr 06 |
nicklas |
623 |
String minMax = ""; |
2198 |
27 Apr 06 |
nicklas |
624 |
if (minValue != null && maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
625 |
{ |
2198 |
27 Apr 06 |
nicklas |
626 |
minMax = ": " + minValue + " -- " +maxValue; |
2198 |
27 Apr 06 |
nicklas |
627 |
} |
2198 |
27 Apr 06 |
nicklas |
628 |
else if (minValue != null) |
2198 |
27 Apr 06 |
nicklas |
629 |
{ |
2198 |
27 Apr 06 |
nicklas |
630 |
minMax = " >= "+minValue; |
2198 |
27 Apr 06 |
nicklas |
631 |
} |
2198 |
27 Apr 06 |
nicklas |
632 |
else if (maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
633 |
{ |
2198 |
27 Apr 06 |
nicklas |
634 |
minMax = " <= "+maxValue; |
2198 |
27 Apr 06 |
nicklas |
635 |
} |
2198 |
27 Apr 06 |
nicklas |
636 |
%> |
2198 |
27 Apr 06 |
nicklas |
637 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Long<%=minMax%>)<br> |
6217 |
14 Dec 12 |
nicklas |
638 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
639 |
type="text" name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
640 |
maxlength="20"> |
2198 |
27 Apr 06 |
nicklas |
641 |
<% |
1754 |
11 Jan 06 |
nicklas |
642 |
} |
2198 |
27 Apr 06 |
nicklas |
643 |
else if (pType instanceof FloatParameterType) |
1875 |
01 Feb 06 |
nicklas |
644 |
{ |
2198 |
27 Apr 06 |
nicklas |
645 |
FloatParameterType ipType = (FloatParameterType)pType; |
2198 |
27 Apr 06 |
nicklas |
646 |
Float minValue = ipType.getLowerLimit(); |
2198 |
27 Apr 06 |
nicklas |
647 |
Float maxValue = ipType.getUpperLimit(); |
2198 |
27 Apr 06 |
nicklas |
648 |
String minMax = ""; |
2198 |
27 Apr 06 |
nicklas |
649 |
if (minValue != null && maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
650 |
{ |
2198 |
27 Apr 06 |
nicklas |
651 |
minMax = ": " + minValue + " -- " +maxValue; |
2198 |
27 Apr 06 |
nicklas |
652 |
} |
2198 |
27 Apr 06 |
nicklas |
653 |
else if (minValue != null) |
2198 |
27 Apr 06 |
nicklas |
654 |
{ |
2198 |
27 Apr 06 |
nicklas |
655 |
minMax = " >= "+minValue; |
2198 |
27 Apr 06 |
nicklas |
656 |
} |
2198 |
27 Apr 06 |
nicklas |
657 |
else if (maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
658 |
{ |
2198 |
27 Apr 06 |
nicklas |
659 |
minMax = " <= "+maxValue; |
2198 |
27 Apr 06 |
nicklas |
660 |
} |
2198 |
27 Apr 06 |
nicklas |
661 |
%> |
2198 |
27 Apr 06 |
nicklas |
662 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Float<%=minMax%>)<br> |
6217 |
14 Dec 12 |
nicklas |
663 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
664 |
type="text" name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
665 |
maxlength="20"> |
2198 |
27 Apr 06 |
nicklas |
666 |
<% |
1875 |
01 Feb 06 |
nicklas |
667 |
} |
2198 |
27 Apr 06 |
nicklas |
668 |
else if (pType instanceof DoubleParameterType) |
1875 |
01 Feb 06 |
nicklas |
669 |
{ |
2198 |
27 Apr 06 |
nicklas |
670 |
DoubleParameterType ipType = (DoubleParameterType)pType; |
2198 |
27 Apr 06 |
nicklas |
671 |
Double minValue = ipType.getLowerLimit(); |
2198 |
27 Apr 06 |
nicklas |
672 |
Double maxValue = ipType.getUpperLimit(); |
2198 |
27 Apr 06 |
nicklas |
673 |
String minMax = ""; |
2198 |
27 Apr 06 |
nicklas |
674 |
if (minValue != null && maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
675 |
{ |
2198 |
27 Apr 06 |
nicklas |
676 |
minMax = ": " + minValue + " -- " +maxValue; |
2198 |
27 Apr 06 |
nicklas |
677 |
} |
2198 |
27 Apr 06 |
nicklas |
678 |
else if (minValue != null) |
2198 |
27 Apr 06 |
nicklas |
679 |
{ |
2198 |
27 Apr 06 |
nicklas |
680 |
minMax = " >= "+minValue; |
2198 |
27 Apr 06 |
nicklas |
681 |
} |
2198 |
27 Apr 06 |
nicklas |
682 |
else if (maxValue != null) |
2198 |
27 Apr 06 |
nicklas |
683 |
{ |
2198 |
27 Apr 06 |
nicklas |
684 |
minMax = " <= "+maxValue; |
2198 |
27 Apr 06 |
nicklas |
685 |
} |
2198 |
27 Apr 06 |
nicklas |
686 |
%> |
2198 |
27 Apr 06 |
nicklas |
687 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Double<%=minMax%>)<br> |
6217 |
14 Dec 12 |
nicklas |
688 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
689 |
type="text" name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
690 |
maxlength="20"> |
2198 |
27 Apr 06 |
nicklas |
691 |
<% |
1875 |
01 Feb 06 |
nicklas |
692 |
} |
2198 |
27 Apr 06 |
nicklas |
693 |
else if (pType instanceof DateParameterType) |
1875 |
01 Feb 06 |
nicklas |
694 |
{ |
2198 |
27 Apr 06 |
nicklas |
695 |
%> |
2198 |
27 Apr 06 |
nicklas |
696 |
<table> |
2198 |
27 Apr 06 |
nicklas |
697 |
<tr> |
2198 |
27 Apr 06 |
nicklas |
698 |
<td> |
2198 |
27 Apr 06 |
nicklas |
699 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Date)<br> |
6217 |
14 Dec 12 |
nicklas |
700 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
701 |
type="text" name="<%=fieldName%>" id="<%=fieldName%>" value="" |
2942 |
22 Nov 06 |
nicklas |
702 |
size="20" maxlength="20" title="Enter date in format: <%=htmlDateFormat%>" |
6391 |
21 Jan 14 |
nicklas |
703 |
> |
2198 |
27 Apr 06 |
nicklas |
704 |
</td> |
2198 |
27 Apr 06 |
nicklas |
705 |
<td> |
2198 |
27 Apr 06 |
nicklas |
706 |
<br> |
6391 |
21 Jan 14 |
nicklas |
707 |
<base:calendar textarea="<%=fieldName%>" title="Value" /> |
2198 |
27 Apr 06 |
nicklas |
708 |
</td> |
2198 |
27 Apr 06 |
nicklas |
709 |
</tr> |
2198 |
27 Apr 06 |
nicklas |
710 |
</table> |
2198 |
27 Apr 06 |
nicklas |
711 |
<% |
1875 |
01 Feb 06 |
nicklas |
712 |
} |
5437 |
01 Oct 10 |
nicklas |
713 |
else if (pType instanceof TimestampParameterType) |
5437 |
01 Oct 10 |
nicklas |
714 |
{ |
5437 |
01 Oct 10 |
nicklas |
715 |
%> |
5437 |
01 Oct 10 |
nicklas |
716 |
<table> |
5437 |
01 Oct 10 |
nicklas |
717 |
<tr> |
5437 |
01 Oct 10 |
nicklas |
718 |
<td> |
5437 |
01 Oct 10 |
nicklas |
719 |
<b><%=HTML.encodeTags(param.getLabel())%></b> (Timestamp)<br> |
6217 |
14 Dec 12 |
nicklas |
720 |
<input class="text <%=pType.getNotNull() ? "required" : ""%>" |
6391 |
21 Jan 14 |
nicklas |
721 |
type="text" name="<%=fieldName%>" id="<%=fieldName%>" value="" |
5437 |
01 Oct 10 |
nicklas |
722 |
size="20" maxlength="20" title="Enter timestamp in format: <%=htmlDateTimeFormat%>" |
6391 |
21 Jan 14 |
nicklas |
723 |
> |
5437 |
01 Oct 10 |
nicklas |
724 |
</td> |
5437 |
01 Oct 10 |
nicklas |
725 |
<td> |
5437 |
01 Oct 10 |
nicklas |
726 |
<br> |
6391 |
21 Jan 14 |
nicklas |
727 |
<base:calendar textarea="<%=fieldName%>" title="Value" data-use-time="1" |
5437 |
01 Oct 10 |
nicklas |
728 |
tooltip="Select a timestamp from a calendar" |
5437 |
01 Oct 10 |
nicklas |
729 |
/> |
5437 |
01 Oct 10 |
nicklas |
730 |
</td> |
5437 |
01 Oct 10 |
nicklas |
731 |
</tr> |
5437 |
01 Oct 10 |
nicklas |
732 |
</table> |
5437 |
01 Oct 10 |
nicklas |
733 |
<% |
5437 |
01 Oct 10 |
nicklas |
734 |
} |
2198 |
27 Apr 06 |
nicklas |
735 |
else if (pType instanceof BooleanParameterType) |
1875 |
01 Feb 06 |
nicklas |
736 |
{ |
2198 |
27 Apr 06 |
nicklas |
737 |
%> |
2198 |
27 Apr 06 |
nicklas |
738 |
<b><%=HTML.encodeTags(param.getLabel())%></b><br> |
6391 |
21 Jan 14 |
nicklas |
739 |
<label><input type="radio" name="<%=fieldName%>" id="<%=fieldName%>:null" value="" checked |
6391 |
21 Jan 14 |
nicklas |
740 |
><i>- not specified -</i></label><br> |
6391 |
21 Jan 14 |
nicklas |
741 |
<label><input type="radio" name="<%=fieldName%>" id="<%=fieldName%>:true" value="true" |
6391 |
21 Jan 14 |
nicklas |
742 |
>true</label><br> |
6391 |
21 Jan 14 |
nicklas |
743 |
<label><input type="radio" name="<%=fieldName%>" id="<%=fieldName%>:false" value="false" |
6391 |
21 Jan 14 |
nicklas |
744 |
>false</label> |
2198 |
27 Apr 06 |
nicklas |
745 |
<% |
1875 |
01 Feb 06 |
nicklas |
746 |
} |
2198 |
27 Apr 06 |
nicklas |
747 |
else if (pType instanceof FileParameterType) |
1875 |
01 Feb 06 |
nicklas |
748 |
{ |
2198 |
27 Apr 06 |
nicklas |
749 |
%> |
2444 |
28 Jun 06 |
nicklas |
750 |
<b><%=HTML.encodeTags(param.getLabel())%></b><br> |
5910 |
14 Dec 11 |
nicklas |
751 |
<table style="width: 100%;"> |
2198 |
27 Apr 06 |
nicklas |
752 |
<tr> |
6217 |
14 Dec 12 |
nicklas |
753 |
<td style="width: 98%;"><input class="text <%=pType.getNotNull() ? "required" : ""%>" type="text" |
6391 |
21 Jan 14 |
nicklas |
754 |
name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
755 |
></td> |
2198 |
27 Apr 06 |
nicklas |
756 |
<td><base:button |
6391 |
21 Jan 14 |
nicklas |
757 |
id="<%=fieldName+":browse" %>" |
6391 |
21 Jan 14 |
nicklas |
758 |
data-field="<%=fieldName%>" |
2198 |
27 Apr 06 |
nicklas |
759 |
title="Browse…" |
6391 |
21 Jan 14 |
nicklas |
760 |
/></td> |
2198 |
27 Apr 06 |
nicklas |
761 |
</tr> |
2198 |
27 Apr 06 |
nicklas |
762 |
</table> |
2198 |
27 Apr 06 |
nicklas |
763 |
<% |
2677 |
28 Sep 06 |
nicklas |
764 |
if (recentFiles != null && recentFiles.size() > 0) |
2677 |
28 Sep 06 |
nicklas |
765 |
{ |
2677 |
28 Sep 06 |
nicklas |
766 |
%> |
2677 |
28 Sep 06 |
nicklas |
767 |
<b>Recently used</b><br> |
6391 |
21 Jan 14 |
nicklas |
768 |
<select |
6391 |
21 Jan 14 |
nicklas |
769 |
id="<%=fieldName%>:recent" |
6391 |
21 Jan 14 |
nicklas |
770 |
name="<%=fieldName%>:recent" |
6576 |
22 Oct 14 |
nicklas |
771 |
data-field="<%=fieldName %>" |
6576 |
22 Oct 14 |
nicklas |
772 |
style="width: 98%;"> |
2677 |
28 Sep 06 |
nicklas |
773 |
<option value=""> |
2677 |
28 Sep 06 |
nicklas |
774 |
<% |
2677 |
28 Sep 06 |
nicklas |
775 |
for (File recent : recentFiles) |
2677 |
28 Sep 06 |
nicklas |
776 |
{ |
2677 |
28 Sep 06 |
nicklas |
777 |
%> |
2677 |
28 Sep 06 |
nicklas |
778 |
<option value="<%=recent.getId()%>"><%=HTML.encodeTags(recent.getPath().toString())%> |
2677 |
28 Sep 06 |
nicklas |
779 |
<% |
2677 |
28 Sep 06 |
nicklas |
780 |
} |
2677 |
28 Sep 06 |
nicklas |
781 |
%> |
2677 |
28 Sep 06 |
nicklas |
782 |
</select> |
2677 |
28 Sep 06 |
nicklas |
783 |
<% |
2677 |
28 Sep 06 |
nicklas |
784 |
} |
1875 |
01 Feb 06 |
nicklas |
785 |
} |
2198 |
27 Apr 06 |
nicklas |
786 |
else if (pType instanceof ItemParameterType) |
1875 |
01 Feb 06 |
nicklas |
787 |
{ |
2198 |
27 Apr 06 |
nicklas |
788 |
Item parameterItemType = Item.fromClass(pType.getParameterClass()); |
2745 |
18 Oct 06 |
nicklas |
789 |
BasicItem item = (BasicItem)pcRequest.getCurrentParameterValue(param.getName()); |
2745 |
18 Oct 06 |
nicklas |
790 |
if (item == null) |
2198 |
27 Apr 06 |
nicklas |
791 |
{ |
2745 |
18 Oct 06 |
nicklas |
792 |
ItemContext cc = sc.getCurrentContext(parameterItemType, parameterItemType == itemType ? subContext : ""); |
2745 |
18 Oct 06 |
nicklas |
793 |
if (cc.getId() != 0) |
2745 |
18 Oct 06 |
nicklas |
794 |
{ |
3501 |
15 Jun 07 |
enell |
795 |
try |
3501 |
15 Jun 07 |
enell |
796 |
{ |
3501 |
15 Jun 07 |
enell |
797 |
item = parameterItemType.getById(dc, cc.getId()); |
3501 |
15 Jun 07 |
enell |
798 |
} |
3501 |
15 Jun 07 |
enell |
799 |
catch (Throwable t) |
3501 |
15 Jun 07 |
enell |
800 |
{} |
2745 |
18 Oct 06 |
nicklas |
801 |
} |
2745 |
18 Oct 06 |
nicklas |
802 |
} |
2745 |
18 Oct 06 |
nicklas |
803 |
if (item != null) |
2745 |
18 Oct 06 |
nicklas |
804 |
{ |
2198 |
27 Apr 06 |
nicklas |
805 |
String display = ""; |
2198 |
27 Apr 06 |
nicklas |
806 |
if (item instanceof Nameable) |
2198 |
27 Apr 06 |
nicklas |
807 |
{ |
2198 |
27 Apr 06 |
nicklas |
808 |
Nameable nameable = (Nameable)item; |
2198 |
27 Apr 06 |
nicklas |
809 |
display = nameable.getName(); |
2198 |
27 Apr 06 |
nicklas |
810 |
} |
2198 |
27 Apr 06 |
nicklas |
811 |
else |
2198 |
27 Apr 06 |
nicklas |
812 |
{ |
2198 |
27 Apr 06 |
nicklas |
813 |
display = item.toString(); |
2198 |
27 Apr 06 |
nicklas |
814 |
} |
2198 |
27 Apr 06 |
nicklas |
815 |
%> |
2198 |
27 Apr 06 |
nicklas |
816 |
<b><%=HTML.encodeTags(param.getLabel())%></b><br> |
6391 |
21 Jan 14 |
nicklas |
817 |
<input class="text disabled" size="50" |
6391 |
21 Jan 14 |
nicklas |
818 |
name="<%=fieldName%>" id="<%=fieldName%>" type="text" disabled |
6391 |
21 Jan 14 |
nicklas |
819 |
value="<%=HTML.encodeTags(display)%>"> |
2198 |
27 Apr 06 |
nicklas |
820 |
<% |
2198 |
27 Apr 06 |
nicklas |
821 |
} |
1875 |
01 Feb 06 |
nicklas |
822 |
} |
2198 |
27 Apr 06 |
nicklas |
823 |
else if (pType instanceof PathParameterType) |
1875 |
01 Feb 06 |
nicklas |
824 |
{ |
1875 |
01 Feb 06 |
nicklas |
825 |
%> |
2444 |
28 Jun 06 |
nicklas |
826 |
<b><%=HTML.encodeTags(param.getLabel())%></b><br> |
5910 |
14 Dec 11 |
nicklas |
827 |
<table style="width: 100%;"> |
2198 |
27 Apr 06 |
nicklas |
828 |
<tr> |
6391 |
21 Jan 14 |
nicklas |
829 |
<td style="width: 98%;"><input type="text" class="text" |
6391 |
21 Jan 14 |
nicklas |
830 |
name="<%=fieldName%>" id="<%=fieldName%>" value="" |
6391 |
21 Jan 14 |
nicklas |
831 |
></td> |
2198 |
27 Apr 06 |
nicklas |
832 |
<td><base:button |
6391 |
21 Jan 14 |
nicklas |
833 |
id="<%=fieldName+":browse" %>" |
6391 |
21 Jan 14 |
nicklas |
834 |
data-field="<%=fieldName%>" |
2198 |
27 Apr 06 |
nicklas |
835 |
title="Browse…" |
6124 |
13 Sep 12 |
nicklas |
836 |
/></td> |
2198 |
27 Apr 06 |
nicklas |
837 |
</tr> |
2198 |
27 Apr 06 |
nicklas |
838 |
</table> |
1875 |
01 Feb 06 |
nicklas |
839 |
<% |
1875 |
01 Feb 06 |
nicklas |
840 |
} |
2147 |
04 Apr 06 |
nicklas |
841 |
else |
2147 |
04 Apr 06 |
nicklas |
842 |
{ |
2198 |
27 Apr 06 |
nicklas |
843 |
%> |
2198 |
27 Apr 06 |
nicklas |
844 |
<b><%=HTML.encodeTags(param.getLabel())%></b><br> |
2198 |
27 Apr 06 |
nicklas |
845 |
<% |
2147 |
04 Apr 06 |
nicklas |
846 |
} |
6372 |
06 Dec 13 |
nicklas |
847 |
String help = param.getDescription(); |
6372 |
06 Dec 13 |
nicklas |
848 |
if (help == null || "".equals(help)) help = "<i>No help available for this parameter</i>"; |
2147 |
04 Apr 06 |
nicklas |
849 |
%> |
5910 |
14 Dec 11 |
nicklas |
850 |
<div class="messagecontainer help" style="margin-left: 0px; margin-right: 0px;"> |
6372 |
06 Dec 13 |
nicklas |
851 |
<%=HTML.niceFormat(help)%> |
2198 |
27 Apr 06 |
nicklas |
852 |
</div> |
2198 |
27 Apr 06 |
nicklas |
853 |
</div> |
2147 |
04 Apr 06 |
nicklas |
854 |
<% |
2147 |
04 Apr 06 |
nicklas |
855 |
} |
1875 |
01 Feb 06 |
nicklas |
856 |
else |
1754 |
11 Jan 06 |
nicklas |
857 |
{ |
6372 |
06 Dec 13 |
nicklas |
858 |
String help = param.getDescription(); |
6372 |
06 Dec 13 |
nicklas |
859 |
if (help == null || "".equals(help)) help = "<i>No help available for this parameter</i>"; |
1875 |
01 Feb 06 |
nicklas |
860 |
%> |
6391 |
21 Jan 14 |
nicklas |
861 |
<div id="<%=fieldName%>:section" style="display: none;" class="messagecontainer help"> |
6372 |
06 Dec 13 |
nicklas |
862 |
<%=HTML.niceFormat(help)%> |
2198 |
27 Apr 06 |
nicklas |
863 |
</div> |
1875 |
01 Feb 06 |
nicklas |
864 |
<% |
1754 |
11 Jan 06 |
nicklas |
865 |
} |
1754 |
11 Jan 06 |
nicklas |
866 |
} |
1750 |
10 Jan 06 |
nicklas |
867 |
} |
1730 |
20 Dec 05 |
nicklas |
868 |
} |
1750 |
10 Jan 06 |
nicklas |
869 |
%> |
5910 |
14 Dec 11 |
nicklas |
870 |
|
5910 |
14 Dec 11 |
nicklas |
871 |
</div> |
5910 |
14 Dec 11 |
nicklas |
872 |
|
1750 |
10 Jan 06 |
nicklas |
873 |
</div> |
5910 |
14 Dec 11 |
nicklas |
874 |
|
5910 |
14 Dec 11 |
nicklas |
875 |
</div> |
5910 |
14 Dec 11 |
nicklas |
876 |
|
1730 |
20 Dec 05 |
nicklas |
877 |
</form> |
5910 |
14 Dec 11 |
nicklas |
878 |
|
5910 |
14 Dec 11 |
nicklas |
879 |
<base:buttongroup subclass="dialogbuttons"> |
6391 |
21 Jan 14 |
nicklas |
880 |
<base:button id="btnTestWithFile" title="Test with file…" image="file.png" |
2655 |
22 Sep 06 |
nicklas |
881 |
tooltip="Use an uploaded file to create the regular expressions and column mappings" |
6393 |
22 Jan 14 |
nicklas |
882 |
visible="<%=options.contains("configure-by-example")%>" /> |
6391 |
21 Jan 14 |
nicklas |
883 |
<base:button id="btnNext" title="Next" /> |
6391 |
21 Jan 14 |
nicklas |
884 |
<base:button id="close" title="Cancel" /> |
2655 |
22 Sep 06 |
nicklas |
885 |
</base:buttongroup> |
1730 |
20 Dec 05 |
nicklas |
886 |
</base:body> |
1730 |
20 Dec 05 |
nicklas |
887 |
</base:page> |
1730 |
20 Dec 05 |
nicklas |
888 |
<% |
1730 |
20 Dec 05 |
nicklas |
889 |
} |
1730 |
20 Dec 05 |
nicklas |
890 |
finally |
1730 |
20 Dec 05 |
nicklas |
891 |
{ |
1730 |
20 Dec 05 |
nicklas |
892 |
if (dc != null) dc.close(); |
1730 |
20 Dec 05 |
nicklas |
893 |
} |
1730 |
20 Dec 05 |
nicklas |
894 |
%> |