1606 |
14 Nov 05 |
nicklas |
1 |
<%-- $Id$ |
1606 |
14 Nov 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, Martin Svensson |
1606 |
14 Nov 05 |
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/ |
1606 |
14 Nov 05 |
nicklas |
8 |
|
1606 |
14 Nov 05 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
1606 |
14 Nov 05 |
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 |
1606 |
14 Nov 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
1606 |
14 Nov 05 |
nicklas |
13 |
|
1606 |
14 Nov 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
1606 |
14 Nov 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1606 |
14 Nov 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1606 |
14 Nov 05 |
nicklas |
17 |
GNU General Public License for more details. |
1606 |
14 Nov 05 |
nicklas |
18 |
|
1606 |
14 Nov 05 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1606 |
14 Nov 05 |
nicklas |
21 |
------------------------------------------------------------------ |
1606 |
14 Nov 05 |
nicklas |
22 |
|
1606 |
14 Nov 05 |
nicklas |
23 |
@author Nicklas |
1606 |
14 Nov 05 |
nicklas |
24 |
@version 2.0 |
1606 |
14 Nov 05 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1606 |
14 Nov 05 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
1606 |
14 Nov 05 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
1606 |
14 Nov 05 |
nicklas |
29 |
import="net.sf.basedb.core.SystemItems" |
1606 |
14 Nov 05 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
1727 |
19 Dec 05 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
1606 |
14 Nov 05 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
1606 |
14 Nov 05 |
nicklas |
33 |
import="net.sf.basedb.core.ExtendedProperties" |
1606 |
14 Nov 05 |
nicklas |
34 |
import="net.sf.basedb.core.ExtendedProperty" |
1606 |
14 Nov 05 |
nicklas |
35 |
import="net.sf.basedb.core.Type" |
1606 |
14 Nov 05 |
nicklas |
36 |
import="net.sf.basedb.core.Reporter" |
1606 |
14 Nov 05 |
nicklas |
37 |
import="net.sf.basedb.core.ReporterType" |
1606 |
14 Nov 05 |
nicklas |
38 |
import="net.sf.basedb.core.data.ReporterData" |
1606 |
14 Nov 05 |
nicklas |
39 |
import="net.sf.basedb.core.ItemQuery" |
1606 |
14 Nov 05 |
nicklas |
40 |
import="net.sf.basedb.core.ItemResultIterator" |
1606 |
14 Nov 05 |
nicklas |
41 |
import="net.sf.basedb.core.PermissionDeniedException" |
1606 |
14 Nov 05 |
nicklas |
42 |
import="net.sf.basedb.core.query.Orders" |
1606 |
14 Nov 05 |
nicklas |
43 |
import="net.sf.basedb.core.query.Hql" |
1606 |
14 Nov 05 |
nicklas |
44 |
import="net.sf.basedb.clients.web.Base" |
1606 |
14 Nov 05 |
nicklas |
45 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
46 |
import="net.sf.basedb.util.Values" |
2942 |
22 Nov 06 |
nicklas |
47 |
import="net.sf.basedb.util.formatter.Formatter" |
6315 |
06 Sep 13 |
nicklas |
48 |
import="net.sf.basedb.util.json.JsonUtil" |
6315 |
06 Sep 13 |
nicklas |
49 |
import="net.sf.basedb.util.json.JsonConverter" |
2942 |
22 Nov 06 |
nicklas |
50 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
2942 |
22 Nov 06 |
nicklas |
51 |
import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
5501 |
18 Nov 10 |
nicklas |
52 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
53 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
54 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
nicklas |
55 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
56 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5501 |
18 Nov 10 |
nicklas |
57 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
1606 |
14 Nov 05 |
nicklas |
58 |
import="java.util.Date" |
2747 |
19 Oct 06 |
enell |
59 |
import="java.util.List" |
6315 |
06 Sep 13 |
nicklas |
60 |
import="org.json.simple.JSONArray" |
6315 |
06 Sep 13 |
nicklas |
61 |
import="org.json.simple.JSONObject" |
1606 |
14 Nov 05 |
nicklas |
62 |
%> |
1606 |
14 Nov 05 |
nicklas |
63 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1606 |
14 Nov 05 |
nicklas |
64 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6144 |
21 Sep 12 |
nicklas |
65 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
1606 |
14 Nov 05 |
nicklas |
66 |
<% |
1727 |
19 Dec 05 |
nicklas |
67 |
final Item itemType = Item.REPORTER; |
1727 |
19 Dec 05 |
nicklas |
68 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1727 |
19 Dec 05 |
nicklas |
69 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1727 |
19 Dec 05 |
nicklas |
70 |
final int itemId = cc.getId(); |
1606 |
14 Nov 05 |
nicklas |
71 |
final String ID = sc.getId(); |
1606 |
14 Nov 05 |
nicklas |
72 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
73 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
1606 |
14 Nov 05 |
nicklas |
74 |
ItemResultIterator<ReporterType> reporterTypes = null; |
1606 |
14 Nov 05 |
nicklas |
75 |
try |
1606 |
14 Nov 05 |
nicklas |
76 |
{ |
2747 |
19 Oct 06 |
enell |
77 |
List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData"); |
6315 |
06 Sep 13 |
nicklas |
78 |
JSONArray jsonReporterProperties = JsonUtil.toArray(reporterProperties, new JsonConverter<ExtendedProperty>() |
6315 |
06 Sep 13 |
nicklas |
79 |
{ |
6315 |
06 Sep 13 |
nicklas |
80 |
public Object convert(ExtendedProperty ep) |
6315 |
06 Sep 13 |
nicklas |
81 |
{ |
6315 |
06 Sep 13 |
nicklas |
82 |
JSONObject json = new JSONObject(); |
6315 |
06 Sep 13 |
nicklas |
83 |
json.put("name", ep.getName()); |
6315 |
06 Sep 13 |
nicklas |
84 |
json.put("valueType", ep.getType().name()); |
6315 |
06 Sep 13 |
nicklas |
85 |
json.put("title", ep.getTitle()); |
6315 |
06 Sep 13 |
nicklas |
86 |
json.put("nullable", ep.isNullable()); |
6315 |
06 Sep 13 |
nicklas |
87 |
return json; |
6315 |
06 Sep 13 |
nicklas |
88 |
} |
6315 |
06 Sep 13 |
nicklas |
89 |
}); |
2747 |
19 Oct 06 |
enell |
90 |
|
1606 |
14 Nov 05 |
nicklas |
91 |
String title = null; |
1606 |
14 Nov 05 |
nicklas |
92 |
ReporterData reporter = null; |
1727 |
19 Dec 05 |
nicklas |
93 |
boolean readCurrentReporterType = true; |
1727 |
19 Dec 05 |
nicklas |
94 |
int currentReporterTypeId = 0; |
1727 |
19 Dec 05 |
nicklas |
95 |
|
1727 |
19 Dec 05 |
nicklas |
96 |
if (itemId == 0) |
1606 |
14 Nov 05 |
nicklas |
97 |
{ |
2597 |
25 Aug 06 |
nicklas |
98 |
int recentType = Values.getInt(cc.getRecent(Item.REPORTERTYPE.name(), 0), 0); |
2597 |
25 Aug 06 |
nicklas |
99 |
currentReporterTypeId = Values.getInt(cc.getPropertyValue("reporterType"), recentType); |
1606 |
14 Nov 05 |
nicklas |
100 |
title = "Create reporter"; |
1727 |
19 Dec 05 |
nicklas |
101 |
cc.removeObject("item"); |
1606 |
14 Nov 05 |
nicklas |
102 |
} |
1606 |
14 Nov 05 |
nicklas |
103 |
else |
1606 |
14 Nov 05 |
nicklas |
104 |
{ |
1727 |
19 Dec 05 |
nicklas |
105 |
reporter = Reporter.getById(dc, itemId); |
1606 |
14 Nov 05 |
nicklas |
106 |
title = "Edit reporter -- " + HTML.encodeTags(reporter.getName()); |
1727 |
19 Dec 05 |
nicklas |
107 |
try |
1727 |
19 Dec 05 |
nicklas |
108 |
{ |
1727 |
19 Dec 05 |
nicklas |
109 |
ReporterType rt = Reporter.getReporterType(dc, reporter); |
2197 |
27 Apr 06 |
nicklas |
110 |
if (rt != null) |
2197 |
27 Apr 06 |
nicklas |
111 |
{ |
2197 |
27 Apr 06 |
nicklas |
112 |
currentReporterTypeId = rt.getId(); |
2197 |
27 Apr 06 |
nicklas |
113 |
} |
1727 |
19 Dec 05 |
nicklas |
114 |
} |
1727 |
19 Dec 05 |
nicklas |
115 |
catch (PermissionDeniedException ex) |
1727 |
19 Dec 05 |
nicklas |
116 |
{ |
1727 |
19 Dec 05 |
nicklas |
117 |
readCurrentReporterType = false; |
1727 |
19 Dec 05 |
nicklas |
118 |
} |
1727 |
19 Dec 05 |
nicklas |
119 |
cc.setObject("item", reporter); |
1606 |
14 Nov 05 |
nicklas |
120 |
} |
1727 |
19 Dec 05 |
nicklas |
121 |
if (!sc.hasPermission(Permission.WRITE, itemType)) |
1606 |
14 Nov 05 |
nicklas |
122 |
{ |
1727 |
19 Dec 05 |
nicklas |
123 |
throw new PermissionDeniedException(Permission.WRITE, itemType.toString()); |
1606 |
14 Nov 05 |
nicklas |
124 |
} |
1727 |
19 Dec 05 |
nicklas |
125 |
|
1606 |
14 Nov 05 |
nicklas |
126 |
// Query to retrieve reporter types |
1606 |
14 Nov 05 |
nicklas |
127 |
final ItemQuery<ReporterType> reporterTypeQuery = ReporterType.getQuery(); |
1606 |
14 Nov 05 |
nicklas |
128 |
reporterTypeQuery.order(Orders.asc(Hql.property("name"))); |
2942 |
22 Nov 06 |
nicklas |
129 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
2942 |
22 Nov 06 |
nicklas |
130 |
String dateFormat = FormatterSettings.getDateFormat(sc); |
2942 |
22 Nov 06 |
nicklas |
131 |
String jsDateFormat = HTML.javaScriptEncode(dateFormat); |
2942 |
22 Nov 06 |
nicklas |
132 |
String htmlDateFormat = HTML.encodeTags(dateFormat); |
5432 |
29 Sep 10 |
nicklas |
133 |
Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
5432 |
29 Sep 10 |
nicklas |
134 |
String dateTimeFormat = FormatterSettings.getDateTimeFormat(sc); |
5432 |
29 Sep 10 |
nicklas |
135 |
String jsDateTimeFormat = HTML.javaScriptEncode(dateTimeFormat); |
5432 |
29 Sep 10 |
nicklas |
136 |
String htmlDateTimeFormat = HTML.encodeTags(dateTimeFormat); |
5501 |
18 Nov 10 |
nicklas |
137 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), reporter); |
7604 |
25 Feb 19 |
nicklas |
138 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
1606 |
14 Nov 05 |
nicklas |
139 |
%> |
6315 |
06 Sep 13 |
nicklas |
140 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6315 |
06 Sep 13 |
nicklas |
141 |
<base:head scripts="tabcontrol-2.js,~reporters.js" styles="tabcontrol.css"> |
5501 |
18 Nov 10 |
nicklas |
142 |
<ext:scripts context="<%=jspContext%>" /> |
5501 |
18 Nov 10 |
nicklas |
143 |
<ext:stylesheets context="<%=jspContext%>" /> |
1606 |
14 Nov 05 |
nicklas |
144 |
</base:head> |
1606 |
14 Nov 05 |
nicklas |
145 |
<base:body> |
5916 |
19 Dec 11 |
nicklas |
146 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6315 |
06 Sep 13 |
nicklas |
147 |
|
6387 |
18 Dec 13 |
nicklas |
148 |
<div id="page-data" class="datacontainer" |
6315 |
06 Sep 13 |
nicklas |
149 |
data-date-format="<%=htmlDateFormat%>" |
6315 |
06 Sep 13 |
nicklas |
150 |
data-datetime-format="<%=htmlDateTimeFormat%>" |
6315 |
06 Sep 13 |
nicklas |
151 |
data-extended-properties="<%=HTML.encodeTags(jsonReporterProperties.toJSONString())%>" |
6315 |
06 Sep 13 |
nicklas |
152 |
></div> |
6315 |
06 Sep 13 |
nicklas |
153 |
|
6162 |
10 Oct 12 |
nicklas |
154 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="reporter"> |
1727 |
19 Dec 05 |
nicklas |
155 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1606 |
14 Nov 05 |
nicklas |
156 |
|
5916 |
19 Dec 11 |
nicklas |
157 |
<t:tabcontrol id="settings" |
5916 |
19 Dec 11 |
nicklas |
158 |
subclass="content dialogtabcontrol" |
5501 |
18 Nov 10 |
nicklas |
159 |
position="bottom" remember="<%=reporter != null%>" |
5501 |
18 Nov 10 |
nicklas |
160 |
extensions="<%=invoker%>"> |
6315 |
06 Sep 13 |
nicklas |
161 |
<t:tab id="info" title="Reporter" helpid="reporter.edit"> |
5916 |
19 Dec 11 |
nicklas |
162 |
<table class="fullform input100"> |
1606 |
14 Nov 05 |
nicklas |
163 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
164 |
<th>Name</th> |
6315 |
06 Sep 13 |
nicklas |
165 |
<td><input class="text required auto-init" data-auto-init="<%=reporter == null ? "focus-select" : "focus" %>" |
6315 |
06 Sep 13 |
nicklas |
166 |
type="text" name="name" |
1777 |
17 Jan 06 |
nicklas |
167 |
value="<%=HTML.encodeTags(reporter == null ? Values.getString(cc.getPropertyValue("name"), "New reporter") : reporter.getName())%>" |
5916 |
19 Dec 11 |
nicklas |
168 |
maxlength="<%=ReporterData.MAX_NAME_LENGTH%>"></td> |
5916 |
19 Dec 11 |
nicklas |
169 |
<td></td> |
1606 |
14 Nov 05 |
nicklas |
170 |
</tr> |
1606 |
14 Nov 05 |
nicklas |
171 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
172 |
<th>External ID</th> |
6217 |
14 Dec 12 |
nicklas |
173 |
<td><input class="text required" type="text" name="externalId" |
1727 |
19 Dec 05 |
nicklas |
174 |
value="<%=HTML.encodeTags(reporter == null ? cc.getPropertyValue("externalId") : reporter.getExternalId())%>" |
5916 |
19 Dec 11 |
nicklas |
175 |
maxlength="<%=ReporterData.MAX_EXTERNAL_ID_LENGTH%>"></td> |
5916 |
19 Dec 11 |
nicklas |
176 |
<td></td> |
1606 |
14 Nov 05 |
nicklas |
177 |
</tr> |
1606 |
14 Nov 05 |
nicklas |
178 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
179 |
<th>Type</th> |
1606 |
14 Nov 05 |
nicklas |
180 |
<td> |
5916 |
19 Dec 11 |
nicklas |
181 |
<select name="reportertype_id" <%=!readCurrentReporterType ? "disabled readonly class=\"disabled\"" : ""%> style="width: 15em;"> |
1606 |
14 Nov 05 |
nicklas |
182 |
<% |
1606 |
14 Nov 05 |
nicklas |
183 |
if (!readCurrentReporterType) |
1606 |
14 Nov 05 |
nicklas |
184 |
{ |
1606 |
14 Nov 05 |
nicklas |
185 |
%> |
1606 |
14 Nov 05 |
nicklas |
186 |
<option value="-1">- denied - |
1606 |
14 Nov 05 |
nicklas |
187 |
<% |
1606 |
14 Nov 05 |
nicklas |
188 |
} |
1606 |
14 Nov 05 |
nicklas |
189 |
else |
1606 |
14 Nov 05 |
nicklas |
190 |
{ |
1606 |
14 Nov 05 |
nicklas |
191 |
%> |
1606 |
14 Nov 05 |
nicklas |
192 |
<option value="0">- none - |
1606 |
14 Nov 05 |
nicklas |
193 |
<% |
1606 |
14 Nov 05 |
nicklas |
194 |
reporterTypes = reporterTypeQuery.iterate(dc); |
1606 |
14 Nov 05 |
nicklas |
195 |
while (reporterTypes.hasNext()) |
1606 |
14 Nov 05 |
nicklas |
196 |
{ |
1606 |
14 Nov 05 |
nicklas |
197 |
ReporterType reporterType = reporterTypes.next(); |
1727 |
19 Dec 05 |
nicklas |
198 |
int rtId = reporterType.getId(); |
1606 |
14 Nov 05 |
nicklas |
199 |
%> |
2197 |
27 Apr 06 |
nicklas |
200 |
<option |
2197 |
27 Apr 06 |
nicklas |
201 |
value="<%=rtId == currentReporterTypeId && reporter != null ? -rtId : rtId %>" |
2197 |
27 Apr 06 |
nicklas |
202 |
<%=rtId == currentReporterTypeId ? "selected" : "" %> |
1606 |
14 Nov 05 |
nicklas |
203 |
><%=HTML.encodeTags(reporterType.getName())%> |
1606 |
14 Nov 05 |
nicklas |
204 |
<% |
1606 |
14 Nov 05 |
nicklas |
205 |
} |
1606 |
14 Nov 05 |
nicklas |
206 |
} |
1606 |
14 Nov 05 |
nicklas |
207 |
%> |
1606 |
14 Nov 05 |
nicklas |
208 |
</select> |
1606 |
14 Nov 05 |
nicklas |
209 |
</td> |
5916 |
19 Dec 11 |
nicklas |
210 |
<td></td> |
1606 |
14 Nov 05 |
nicklas |
211 |
</tr> |
1606 |
14 Nov 05 |
nicklas |
212 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
213 |
<th>Gene symbol</th> |
6217 |
14 Dec 12 |
nicklas |
214 |
<td><input class="text" type="text" name="symbol" |
1727 |
19 Dec 05 |
nicklas |
215 |
value="<%=HTML.encodeTags(reporter == null ? cc.getPropertyValue("symbol") : reporter.getSymbol())%>" |
5916 |
19 Dec 11 |
nicklas |
216 |
maxlength="<%=ReporterData.MAX_SYMBOL_LENGTH%>"></td> |
5916 |
19 Dec 11 |
nicklas |
217 |
<td></td> |
1606 |
14 Nov 05 |
nicklas |
218 |
</tr> |
5916 |
19 Dec 11 |
nicklas |
219 |
<tr class="dynamic"> |
5916 |
19 Dec 11 |
nicklas |
220 |
<th>Description</th> |
6144 |
21 Sep 12 |
nicklas |
221 |
<td> |
6217 |
14 Dec 12 |
nicklas |
222 |
<textarea class="text" rows="6" name="description" id="description" |
1727 |
19 Dec 05 |
nicklas |
223 |
><%=HTML.encodeTags(reporter == null ? cc.getPropertyValue("description") : reporter.getDescription())%></textarea> |
1606 |
14 Nov 05 |
nicklas |
224 |
</td> |
5916 |
19 Dec 11 |
nicklas |
225 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
226 |
<base:zoom textarea="description" title="Description" /> |
5916 |
19 Dec 11 |
nicklas |
227 |
</td> |
1606 |
14 Nov 05 |
nicklas |
228 |
</tr> |
1606 |
14 Nov 05 |
nicklas |
229 |
</table> |
5916 |
19 Dec 11 |
nicklas |
230 |
|
1606 |
14 Nov 05 |
nicklas |
231 |
</t:tab> |
1606 |
14 Nov 05 |
nicklas |
232 |
|
2428 |
27 Jun 06 |
nicklas |
233 |
<t:tab id="extended" title="Extended properties" |
6315 |
06 Sep 13 |
nicklas |
234 |
helpid="reporter.edit.extended"> |
5916 |
19 Dec 11 |
nicklas |
235 |
<table class="fullform input100"> |
1606 |
14 Nov 05 |
nicklas |
236 |
<% |
2747 |
19 Oct 06 |
enell |
237 |
if (reporterProperties != null) |
1606 |
14 Nov 05 |
nicklas |
238 |
{ |
7496 |
11 Jul 18 |
nicklas |
239 |
for (ExtendedProperty ep : reporterProperties) |
2747 |
19 Oct 06 |
enell |
240 |
{ |
2747 |
19 Oct 06 |
enell |
241 |
String name = ep.getName(); |
6315 |
06 Sep 13 |
nicklas |
242 |
String fieldName = "ep."+name; |
2747 |
19 Oct 06 |
enell |
243 |
Type type = ep.getType(); |
2747 |
19 Oct 06 |
enell |
244 |
boolean required = !ep.isNullable(); |
2747 |
19 Oct 06 |
enell |
245 |
Object value = reporter == null ? cc.getPropertyValue(name) : reporter.getExtended(name); |
6217 |
14 Dec 12 |
nicklas |
246 |
String theClazz = required ? "text required" : "text"; |
5916 |
19 Dec 11 |
nicklas |
247 |
boolean hasZoom = false; |
2747 |
19 Oct 06 |
enell |
248 |
%> |
5916 |
19 Dec 11 |
nicklas |
249 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
250 |
<th><%=HTML.encodeTags(ep.getTitle())%></th> |
2747 |
19 Oct 06 |
enell |
251 |
<td> |
1606 |
14 Nov 05 |
nicklas |
252 |
<% |
2747 |
19 Oct 06 |
enell |
253 |
if (type == Type.INT || type == Type.LONG) |
1606 |
14 Nov 05 |
nicklas |
254 |
{ |
1606 |
14 Nov 05 |
nicklas |
255 |
%> |
6315 |
06 Sep 13 |
nicklas |
256 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
6315 |
06 Sep 13 |
nicklas |
257 |
value="<%=value == null ? "" : value%>" style="width: 15em;" maxlength="20"> |
1606 |
14 Nov 05 |
nicklas |
258 |
<% |
1606 |
14 Nov 05 |
nicklas |
259 |
} |
2747 |
19 Oct 06 |
enell |
260 |
else if (type == Type.FLOAT || type == Type.DOUBLE) |
2747 |
19 Oct 06 |
enell |
261 |
{ |
2747 |
19 Oct 06 |
enell |
262 |
%> |
6315 |
06 Sep 13 |
nicklas |
263 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
6315 |
06 Sep 13 |
nicklas |
264 |
value="<%=value == null ? "" : value%>" style="width: 15em;" maxlength="20"> |
2747 |
19 Oct 06 |
enell |
265 |
<% |
2747 |
19 Oct 06 |
enell |
266 |
} |
2747 |
19 Oct 06 |
enell |
267 |
else if (type == Type.STRING) |
2747 |
19 Oct 06 |
enell |
268 |
{ |
2747 |
19 Oct 06 |
enell |
269 |
%> |
6315 |
06 Sep 13 |
nicklas |
270 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
2747 |
19 Oct 06 |
enell |
271 |
value="<%=HTML.encodeTags((String)value)%>" |
5916 |
19 Dec 11 |
nicklas |
272 |
maxlength="<%=ep.getLength()%>" |
2747 |
19 Oct 06 |
enell |
273 |
> |
2747 |
19 Oct 06 |
enell |
274 |
<% |
2747 |
19 Oct 06 |
enell |
275 |
} |
2747 |
19 Oct 06 |
enell |
276 |
else if (type == Type.TEXT) |
2747 |
19 Oct 06 |
enell |
277 |
{ |
5916 |
19 Dec 11 |
nicklas |
278 |
hasZoom = true; |
2747 |
19 Oct 06 |
enell |
279 |
%> |
6315 |
06 Sep 13 |
nicklas |
280 |
<textarea class="<%=theClazz%>" name="<%=fieldName%>" id="<%=fieldName%>" rows="6" |
2747 |
19 Oct 06 |
enell |
281 |
><%=HTML.encodeTags((String)value)%></textarea> |
2747 |
19 Oct 06 |
enell |
282 |
<% |
2747 |
19 Oct 06 |
enell |
283 |
} |
2747 |
19 Oct 06 |
enell |
284 |
else if (type == Type.BOOLEAN) |
2747 |
19 Oct 06 |
enell |
285 |
{ |
2747 |
19 Oct 06 |
enell |
286 |
Boolean b = (Boolean)value; |
2747 |
19 Oct 06 |
enell |
287 |
if (!required) |
2747 |
19 Oct 06 |
enell |
288 |
{ |
2747 |
19 Oct 06 |
enell |
289 |
%> |
6315 |
06 Sep 13 |
nicklas |
290 |
<input type="radio" name="<%=fieldName%>" id="<%=fieldName%>.null" value="" |
2747 |
19 Oct 06 |
enell |
291 |
<%=b == null ? "checked" : ""%> |
6315 |
06 Sep 13 |
nicklas |
292 |
><label for="<%=fieldName%>.null"><i>- not specified -</i></label><br> |
2747 |
19 Oct 06 |
enell |
293 |
<% |
2747 |
19 Oct 06 |
enell |
294 |
} |
2747 |
19 Oct 06 |
enell |
295 |
%> |
6315 |
06 Sep 13 |
nicklas |
296 |
<input type="radio" name="<%=fieldName%>" id="<%=fieldName%>.true" value="true" |
2747 |
19 Oct 06 |
enell |
297 |
<%=b != null && b == true ? "checked" : ""%> |
6315 |
06 Sep 13 |
nicklas |
298 |
><label for="<%=fieldName%>.true">true</label><br> |
6315 |
06 Sep 13 |
nicklas |
299 |
<input type="radio" name="<%=fieldName%>" id="<%=fieldName%>.false" value="false" |
2747 |
19 Oct 06 |
enell |
300 |
<%=b != null && b == false ? "checked" : ""%> |
6315 |
06 Sep 13 |
nicklas |
301 |
><label for="<%=fieldName%>.false">false</label> |
2747 |
19 Oct 06 |
enell |
302 |
<% |
2747 |
19 Oct 06 |
enell |
303 |
} |
2747 |
19 Oct 06 |
enell |
304 |
else if (type == Type.DATE) |
2747 |
19 Oct 06 |
enell |
305 |
{ |
2747 |
19 Oct 06 |
enell |
306 |
%> |
2747 |
19 Oct 06 |
enell |
307 |
<table> |
2747 |
19 Oct 06 |
enell |
308 |
<tr> |
2747 |
19 Oct 06 |
enell |
309 |
<td> |
6315 |
06 Sep 13 |
nicklas |
310 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
5916 |
19 Dec 11 |
nicklas |
311 |
value="<%=dateFormatter.format((Date)value)%>" style="width: 15em;" |
5916 |
19 Dec 11 |
nicklas |
312 |
maxlength="20" title="Enter date in format: <%=htmlDateFormat%>" |
2942 |
22 Nov 06 |
nicklas |
313 |
> |
2747 |
19 Oct 06 |
enell |
314 |
</td> |
2747 |
19 Oct 06 |
enell |
315 |
<td> |
6315 |
06 Sep 13 |
nicklas |
316 |
<base:calendar textarea="<%=fieldName%>" title="<%=HTML.encodeTags(ep.getTitle()) %>" /> |
2747 |
19 Oct 06 |
enell |
317 |
</td> |
2747 |
19 Oct 06 |
enell |
318 |
</tr> |
2747 |
19 Oct 06 |
enell |
319 |
</table> |
2747 |
19 Oct 06 |
enell |
320 |
<% |
2747 |
19 Oct 06 |
enell |
321 |
} |
5432 |
29 Sep 10 |
nicklas |
322 |
else if (type == Type.TIMESTAMP) |
5432 |
29 Sep 10 |
nicklas |
323 |
{ |
5432 |
29 Sep 10 |
nicklas |
324 |
%> |
5432 |
29 Sep 10 |
nicklas |
325 |
<table> |
5432 |
29 Sep 10 |
nicklas |
326 |
<tr> |
5432 |
29 Sep 10 |
nicklas |
327 |
<td> |
6315 |
06 Sep 13 |
nicklas |
328 |
<input class="<%=theClazz%>" type="text" name="<%=fieldName%>" id="<%=fieldName%>" |
5916 |
19 Dec 11 |
nicklas |
329 |
value="<%=dateTimeFormatter.format((Date)value)%>" style="width: 15em;" |
5916 |
19 Dec 11 |
nicklas |
330 |
maxlength="20" title="Enter timestamp in format: <%=htmlDateTimeFormat%>" |
5432 |
29 Sep 10 |
nicklas |
331 |
> |
5432 |
29 Sep 10 |
nicklas |
332 |
</td> |
5432 |
29 Sep 10 |
nicklas |
333 |
<td> |
6315 |
06 Sep 13 |
nicklas |
334 |
<base:calendar textarea="<%=fieldName%>" title="<%=HTML.encodeTags(ep.getTitle())%>" |
6216 |
14 Dec 12 |
nicklas |
335 |
data-use-time="1" |
5432 |
29 Sep 10 |
nicklas |
336 |
tooltip="Select a timestamp from a calendar" |
5432 |
29 Sep 10 |
nicklas |
337 |
/> |
5432 |
29 Sep 10 |
nicklas |
338 |
</td> |
5432 |
29 Sep 10 |
nicklas |
339 |
</tr> |
5432 |
29 Sep 10 |
nicklas |
340 |
</table> |
5432 |
29 Sep 10 |
nicklas |
341 |
<% |
5432 |
29 Sep 10 |
nicklas |
342 |
} |
1606 |
14 Nov 05 |
nicklas |
343 |
%> |
1606 |
14 Nov 05 |
nicklas |
344 |
</td> |
5916 |
19 Dec 11 |
nicklas |
345 |
<td style="width: 20px;"> |
5916 |
19 Dec 11 |
nicklas |
346 |
<% |
5916 |
19 Dec 11 |
nicklas |
347 |
if (hasZoom) |
5916 |
19 Dec 11 |
nicklas |
348 |
{ |
5916 |
19 Dec 11 |
nicklas |
349 |
%> |
6315 |
06 Sep 13 |
nicklas |
350 |
<base:zoom textarea="<%=fieldName%>" title="<%=HTML.encodeTags(ep.getTitle()) %>" /> |
6215 |
13 Dec 12 |
nicklas |
351 |
<% |
6215 |
13 Dec 12 |
nicklas |
352 |
} |
6215 |
13 Dec 12 |
nicklas |
353 |
%> |
5916 |
19 Dec 11 |
nicklas |
354 |
</td> |
2747 |
19 Oct 06 |
enell |
355 |
</tr> |
2747 |
19 Oct 06 |
enell |
356 |
<% |
2747 |
19 Oct 06 |
enell |
357 |
} |
1606 |
14 Nov 05 |
nicklas |
358 |
} |
1606 |
14 Nov 05 |
nicklas |
359 |
%> |
5916 |
19 Dec 11 |
nicklas |
360 |
<tr class="dynamic"> |
5916 |
19 Dec 11 |
nicklas |
361 |
<th></th> |
5916 |
19 Dec 11 |
nicklas |
362 |
<td></td> |
5916 |
19 Dec 11 |
nicklas |
363 |
<td></td> |
5916 |
19 Dec 11 |
nicklas |
364 |
</tr> |
1606 |
14 Nov 05 |
nicklas |
365 |
</table> |
1606 |
14 Nov 05 |
nicklas |
366 |
</t:tab> |
1606 |
14 Nov 05 |
nicklas |
367 |
</t:tabcontrol> |
1606 |
14 Nov 05 |
nicklas |
368 |
</form> |
5916 |
19 Dec 11 |
nicklas |
369 |
|
5916 |
19 Dec 11 |
nicklas |
370 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
371 |
<base:icon image="required.png" />= required information |
5916 |
19 Dec 11 |
nicklas |
372 |
</div> |
1606 |
14 Nov 05 |
nicklas |
373 |
|
5916 |
19 Dec 11 |
nicklas |
374 |
<base:buttongroup subclass="dialogbuttons"> |
6315 |
06 Sep 13 |
nicklas |
375 |
<base:button id="btnSave" title="Save" /> |
6315 |
06 Sep 13 |
nicklas |
376 |
<base:button id="close" title="Cancel" /> |
5916 |
19 Dec 11 |
nicklas |
377 |
</base:buttongroup> |
1606 |
14 Nov 05 |
nicklas |
378 |
|
1606 |
14 Nov 05 |
nicklas |
379 |
</base:body> |
1606 |
14 Nov 05 |
nicklas |
380 |
</base:page> |
1606 |
14 Nov 05 |
nicklas |
381 |
<% |
1606 |
14 Nov 05 |
nicklas |
382 |
} |
1606 |
14 Nov 05 |
nicklas |
383 |
finally |
1606 |
14 Nov 05 |
nicklas |
384 |
{ |
1606 |
14 Nov 05 |
nicklas |
385 |
if (reporterTypes != null) reporterTypes.close(); |
1606 |
14 Nov 05 |
nicklas |
386 |
if (dc != null) dc.close(); |
1606 |
14 Nov 05 |
nicklas |
387 |
} |
1606 |
14 Nov 05 |
nicklas |
388 |
|
1606 |
14 Nov 05 |
nicklas |
389 |
%> |