4745 |
10 Feb 09 |
nicklas |
1 |
<%-- $Id$ |
4745 |
10 Feb 09 |
nicklas |
2 |
------------------------------------------------------------------ |
4745 |
10 Feb 09 |
nicklas |
Copyright (C) 2009 Nicklas Nordborg |
4745 |
10 Feb 09 |
nicklas |
4 |
|
4745 |
10 Feb 09 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
4745 |
10 Feb 09 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
4745 |
10 Feb 09 |
nicklas |
7 |
|
4745 |
10 Feb 09 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
4745 |
10 Feb 09 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
4745 |
10 Feb 09 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
4745 |
10 Feb 09 |
nicklas |
11 |
of the License, or (at your option) any later version. |
4745 |
10 Feb 09 |
nicklas |
12 |
|
4745 |
10 Feb 09 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
4745 |
10 Feb 09 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4745 |
10 Feb 09 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4745 |
10 Feb 09 |
nicklas |
16 |
GNU General Public License for more details. |
4745 |
10 Feb 09 |
nicklas |
17 |
|
4745 |
10 Feb 09 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
4745 |
10 Feb 09 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4745 |
10 Feb 09 |
nicklas |
20 |
------------------------------------------------------------------ |
4745 |
10 Feb 09 |
nicklas |
21 |
--%> |
5426 |
24 Sep 10 |
nicklas |
22 |
<%@ page pageEncoding="UTF-8" session="false" |
4745 |
10 Feb 09 |
nicklas |
23 |
import="net.sf.basedb.core.SessionControl" |
4745 |
10 Feb 09 |
nicklas |
24 |
import="net.sf.basedb.core.DbControl" |
4745 |
10 Feb 09 |
nicklas |
25 |
import="net.sf.basedb.core.Project" |
4745 |
10 Feb 09 |
nicklas |
26 |
import="net.sf.basedb.core.Item" |
4745 |
10 Feb 09 |
nicklas |
27 |
import="net.sf.basedb.core.ItemContext" |
4745 |
10 Feb 09 |
nicklas |
28 |
import="net.sf.basedb.core.Permission" |
4745 |
10 Feb 09 |
nicklas |
29 |
import="net.sf.basedb.core.Presets" |
4745 |
10 Feb 09 |
nicklas |
30 |
import="net.sf.basedb.core.Presets.Preset" |
4745 |
10 Feb 09 |
nicklas |
31 |
import="net.sf.basedb.clients.web.Base" |
4745 |
10 Feb 09 |
nicklas |
32 |
import="net.sf.basedb.clients.web.util.HTML" |
4745 |
10 Feb 09 |
nicklas |
33 |
import="net.sf.basedb.util.Values" |
4745 |
10 Feb 09 |
nicklas |
34 |
import="net.sf.basedb.util.overview.GenericOverview" |
4745 |
10 Feb 09 |
nicklas |
35 |
import="net.sf.basedb.util.overview.OverviewUtil" |
4745 |
10 Feb 09 |
nicklas |
36 |
import="net.sf.basedb.util.overview.Node" |
4745 |
10 Feb 09 |
nicklas |
37 |
import="net.sf.basedb.util.overview.ValidationOptions" |
4745 |
10 Feb 09 |
nicklas |
38 |
import="net.sf.basedb.util.overview.Severity" |
4745 |
10 Feb 09 |
nicklas |
39 |
import="net.sf.basedb.util.overview.Validator" |
6047 |
18 Apr 12 |
nicklas |
40 |
import="net.sf.basedb.util.overview.extensions.ValidationRuleAction" |
4745 |
10 Feb 09 |
nicklas |
41 |
import="java.util.List" |
4745 |
10 Feb 09 |
nicklas |
42 |
import="java.util.Map" |
4745 |
10 Feb 09 |
nicklas |
43 |
import="java.util.Iterator" |
4745 |
10 Feb 09 |
nicklas |
44 |
%> |
4745 |
10 Feb 09 |
nicklas |
45 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4745 |
10 Feb 09 |
nicklas |
46 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
4745 |
10 Feb 09 |
nicklas |
47 |
<% |
4745 |
10 Feb 09 |
nicklas |
48 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
4745 |
10 Feb 09 |
nicklas |
49 |
final String ID = sc.getId(); |
4745 |
10 Feb 09 |
nicklas |
50 |
final float scale = Base.getScale(sc); |
4745 |
10 Feb 09 |
nicklas |
51 |
final String presetName = Values.getStringOrNull(request.getParameter("presetName")); |
5076 |
25 Aug 09 |
nicklas |
52 |
final boolean resetToDefault = Values.getBoolean(request.getParameter("resetToDefault")); |
7954 |
12 May 21 |
nicklas |
53 |
final DbControl dc = sc.newDbControl(":Item overview - Validation options"); |
4745 |
10 Feb 09 |
nicklas |
54 |
try |
4745 |
10 Feb 09 |
nicklas |
55 |
{ |
6047 |
18 Apr 12 |
nicklas |
56 |
GenericOverview overview = OverviewUtil.getCurrentOverview(sc); |
4745 |
10 Feb 09 |
nicklas |
57 |
Presets presets = OverviewUtil.getValidationPresets(sc); |
5076 |
25 Aug 09 |
nicklas |
58 |
ValidationOptions options = null; |
5076 |
25 Aug 09 |
nicklas |
59 |
if (resetToDefault) |
5076 |
25 Aug 09 |
nicklas |
60 |
{ |
5076 |
25 Aug 09 |
nicklas |
61 |
options = new ValidationOptions(); |
5076 |
25 Aug 09 |
nicklas |
62 |
} |
5076 |
25 Aug 09 |
nicklas |
63 |
else if (presetName == null) |
5076 |
25 Aug 09 |
nicklas |
64 |
{ |
5076 |
25 Aug 09 |
nicklas |
65 |
options = new ValidationOptions(presets.getDefault()); |
5076 |
25 Aug 09 |
nicklas |
66 |
} |
5076 |
25 Aug 09 |
nicklas |
67 |
else |
5076 |
25 Aug 09 |
nicklas |
68 |
{ |
5076 |
25 Aug 09 |
nicklas |
69 |
options = new ValidationOptions(presets.getPreset(presetName)); |
5076 |
25 Aug 09 |
nicklas |
70 |
} |
6047 |
18 Apr 12 |
nicklas |
71 |
Map<String, List<ValidationRuleAction>> validators = OverviewUtil.getAllRules(dc, overview); |
4745 |
10 Feb 09 |
nicklas |
72 |
%> |
4745 |
10 Feb 09 |
nicklas |
73 |
<base:page title="Validation options" type="popup"> |
6195 |
01 Nov 12 |
nicklas |
74 |
<base:head scripts="~options.js"> |
5914 |
16 Dec 11 |
nicklas |
75 |
<style> |
5929 |
18 Jan 12 |
nicklas |
76 |
|
5929 |
18 Jan 12 |
nicklas |
77 |
table.special |
6607 |
19 Nov 14 |
nicklas |
78 |
{} |
5929 |
18 Jan 12 |
nicklas |
79 |
|
5929 |
18 Jan 12 |
nicklas |
80 |
table.special > tbody > tr > th |
5929 |
18 Jan 12 |
nicklas |
81 |
{ |
6607 |
19 Nov 14 |
nicklas |
82 |
width: 17em; |
6607 |
19 Nov 14 |
nicklas |
83 |
max-width: 17em; |
5914 |
16 Dec 11 |
nicklas |
84 |
} |
5914 |
16 Dec 11 |
nicklas |
85 |
|
6684 |
14 Jan 15 |
nicklas |
86 |
.special select |
6684 |
14 Jan 15 |
nicklas |
87 |
{ |
6684 |
14 Jan 15 |
nicklas |
88 |
min-width: 14em; |
6684 |
14 Jan 15 |
nicklas |
89 |
} |
6684 |
14 Jan 15 |
nicklas |
90 |
|
5914 |
16 Dec 11 |
nicklas |
91 |
.selector |
5914 |
16 Dec 11 |
nicklas |
92 |
{ |
6608 |
20 Nov 14 |
nicklas |
93 |
padding: 2px; |
5914 |
16 Dec 11 |
nicklas |
94 |
border-radius: 4px; |
5914 |
16 Dec 11 |
nicklas |
95 |
} |
5914 |
16 Dec 11 |
nicklas |
96 |
|
5914 |
16 Dec 11 |
nicklas |
97 |
.selector:hover |
5914 |
16 Dec 11 |
nicklas |
98 |
{ |
5914 |
16 Dec 11 |
nicklas |
99 |
cursor: pointer; |
6608 |
20 Nov 14 |
nicklas |
100 |
border-width: 2px; |
6608 |
20 Nov 14 |
nicklas |
101 |
padding: 0; |
5914 |
16 Dec 11 |
nicklas |
102 |
} |
5914 |
16 Dec 11 |
nicklas |
103 |
|
5914 |
16 Dec 11 |
nicklas |
104 |
.validatordescription |
5914 |
16 Dec 11 |
nicklas |
105 |
{ |
5914 |
16 Dec 11 |
nicklas |
106 |
display: none; |
5914 |
16 Dec 11 |
nicklas |
107 |
position: fixed; |
6960 |
01 Oct 15 |
nicklas |
108 |
top: 5.5em; |
6960 |
01 Oct 15 |
nicklas |
109 |
right: 1.5em; |
5914 |
16 Dec 11 |
nicklas |
110 |
height: 10em; |
6960 |
01 Oct 15 |
nicklas |
111 |
width: 25em; |
5914 |
16 Dec 11 |
nicklas |
112 |
} |
5914 |
16 Dec 11 |
nicklas |
113 |
tr:hover .validatordescription |
5914 |
16 Dec 11 |
nicklas |
114 |
{ |
5914 |
16 Dec 11 |
nicklas |
115 |
display: block; |
5914 |
16 Dec 11 |
nicklas |
116 |
} |
5914 |
16 Dec 11 |
nicklas |
117 |
</style> |
4745 |
10 Feb 09 |
nicklas |
118 |
</base:head> |
4745 |
10 Feb 09 |
nicklas |
119 |
<base:body> |
5914 |
16 Dec 11 |
nicklas |
120 |
<h1>Validation options <base:help helpid="item.overview.validationoptions" /></h1> |
4745 |
10 Feb 09 |
nicklas |
121 |
|
4745 |
10 Feb 09 |
nicklas |
122 |
<form name="options" action="index.jsp" method="post"> |
4745 |
10 Feb 09 |
nicklas |
123 |
<input type="hidden" name="ID" value="<%=ID%>"> |
4745 |
10 Feb 09 |
nicklas |
124 |
<input type="hidden" name="cmd" value="SaveValidationOptions"> |
4745 |
10 Feb 09 |
nicklas |
125 |
|
5914 |
16 Dec 11 |
nicklas |
126 |
<div class="content bottomborder"> |
4745 |
10 Feb 09 |
nicklas |
127 |
|
5914 |
16 Dec 11 |
nicklas |
128 |
<div class="absolutefull" style="top: 0px; height: 3em;"> |
5914 |
16 Dec 11 |
nicklas |
129 |
<table class="fullform special"> |
5914 |
16 Dec 11 |
nicklas |
130 |
<tr> |
5914 |
16 Dec 11 |
nicklas |
131 |
<th>Presets</th> |
5914 |
16 Dec 11 |
nicklas |
132 |
<td> |
5914 |
16 Dec 11 |
nicklas |
133 |
<table> |
5914 |
16 Dec 11 |
nicklas |
134 |
<tr> |
5914 |
16 Dec 11 |
nicklas |
135 |
<td> |
6195 |
01 Nov 12 |
nicklas |
136 |
<select name="presets" id="presets" class="selectionlist"> |
6413 |
05 Feb 14 |
nicklas |
137 |
<option value="" <%="".equals(presetName) ? "selected" : "" %>> |
6195 |
01 Nov 12 |
nicklas |
138 |
<option value="---" class="selectoptionheader" disabled>-- predefined -- |
6413 |
05 Feb 14 |
nicklas |
139 |
<option value="">BASE default |
6195 |
01 Nov 12 |
nicklas |
140 |
<option value="---" class="selectoptionheader" disabled>-- user defined -- |
5914 |
16 Dec 11 |
nicklas |
141 |
<% |
5914 |
16 Dec 11 |
nicklas |
142 |
for (Preset preset : presets) |
5914 |
16 Dec 11 |
nicklas |
143 |
{ |
5914 |
16 Dec 11 |
nicklas |
144 |
String name = HTML.encodeTags(preset.getName()); |
5914 |
16 Dec 11 |
nicklas |
145 |
String selected = presetName != null && presetName.equals(preset.getName()) ? |
5914 |
16 Dec 11 |
nicklas |
146 |
"selected" : ""; |
5914 |
16 Dec 11 |
nicklas |
147 |
%> |
5914 |
16 Dec 11 |
nicklas |
148 |
<option value="<%=name%>" <%=selected%>><%=name%> |
5914 |
16 Dec 11 |
nicklas |
149 |
<% |
5914 |
16 Dec 11 |
nicklas |
150 |
} |
5914 |
16 Dec 11 |
nicklas |
151 |
%> |
5914 |
16 Dec 11 |
nicklas |
152 |
</select> |
5914 |
16 Dec 11 |
nicklas |
153 |
</td> |
5914 |
16 Dec 11 |
nicklas |
154 |
<td> |
5914 |
16 Dec 11 |
nicklas |
155 |
<base:buttongroup> |
6195 |
01 Nov 12 |
nicklas |
156 |
<base:button id="btnSaveAsPreset" title="Save as…" /> |
6195 |
01 Nov 12 |
nicklas |
157 |
<base:button id="btnRemovePreset" title="Remove…" /> |
5914 |
16 Dec 11 |
nicklas |
158 |
</base:buttongroup> |
5914 |
16 Dec 11 |
nicklas |
159 |
</td> |
5914 |
16 Dec 11 |
nicklas |
160 |
</tr> |
5914 |
16 Dec 11 |
nicklas |
161 |
</table> |
4745 |
10 Feb 09 |
nicklas |
162 |
</td> |
4745 |
10 Feb 09 |
nicklas |
163 |
</tr> |
5914 |
16 Dec 11 |
nicklas |
164 |
</table> |
5914 |
16 Dec 11 |
nicklas |
165 |
|
5914 |
16 Dec 11 |
nicklas |
166 |
</div> |
5914 |
16 Dec 11 |
nicklas |
167 |
|
5914 |
16 Dec 11 |
nicklas |
168 |
<div class="absolutefull topborder" style="top: 3em; bottom: 0px;"> |
5914 |
16 Dec 11 |
nicklas |
169 |
<table class="fullform special"> |
4745 |
10 Feb 09 |
nicklas |
170 |
<% |
5914 |
16 Dec 11 |
nicklas |
171 |
int grp = 0; |
5914 |
16 Dec 11 |
nicklas |
172 |
StringBuilder descriptions = new StringBuilder(); |
6047 |
18 Apr 12 |
nicklas |
173 |
for (Map.Entry<String, List<ValidationRuleAction>> entry : validators.entrySet()) |
4745 |
10 Feb 09 |
nicklas |
174 |
{ |
5914 |
16 Dec 11 |
nicklas |
175 |
String title = entry.getKey(); |
5914 |
16 Dec 11 |
nicklas |
176 |
++grp; |
5914 |
16 Dec 11 |
nicklas |
177 |
int vld = 0; |
4745 |
10 Feb 09 |
nicklas |
178 |
%> |
5914 |
16 Dec 11 |
nicklas |
179 |
<tr id="grp.<%=grp%>"> |
5914 |
16 Dec 11 |
nicklas |
180 |
<th> |
6608 |
20 Nov 14 |
nicklas |
181 |
<div class="selector interactable auto-init" data-auto-init="group-toggle" data-group-id="<%=grp%>" |
6195 |
01 Nov 12 |
nicklas |
182 |
><base:icon id="<%="grp."+grp+".icon"%>" image="move_right.png" /><%=HTML.encodeTags(title)%></div> |
5914 |
16 Dec 11 |
nicklas |
183 |
</th> |
5914 |
16 Dec 11 |
nicklas |
184 |
<td> |
6195 |
01 Nov 12 |
nicklas |
185 |
<select name="setall.<%=grp%>" class="auto-init" data-auto-init="group-severity" data-group-id="<%=grp%>"> |
5914 |
16 Dec 11 |
nicklas |
186 |
<option value="">- set all in this group - |
4745 |
10 Feb 09 |
nicklas |
187 |
<% |
4745 |
10 Feb 09 |
nicklas |
188 |
for (Severity s : Severity.values()) |
4745 |
10 Feb 09 |
nicklas |
189 |
{ |
4745 |
10 Feb 09 |
nicklas |
190 |
%> |
5914 |
16 Dec 11 |
nicklas |
191 |
<option value="<%=s.name()%>"><%=s%> |
4745 |
10 Feb 09 |
nicklas |
192 |
<% |
4745 |
10 Feb 09 |
nicklas |
193 |
} |
4745 |
10 Feb 09 |
nicklas |
194 |
%> |
6139 |
19 Sep 12 |
nicklas |
195 |
</select> |
4745 |
10 Feb 09 |
nicklas |
196 |
</td> |
4745 |
10 Feb 09 |
nicklas |
197 |
</tr> |
4745 |
10 Feb 09 |
nicklas |
198 |
<% |
6047 |
18 Apr 12 |
nicklas |
199 |
Iterator<ValidationRuleAction> vi = entry.getValue().iterator(); |
5914 |
16 Dec 11 |
nicklas |
200 |
while (vi.hasNext()) |
5914 |
16 Dec 11 |
nicklas |
201 |
{ |
6047 |
18 Apr 12 |
nicklas |
202 |
ValidationRuleAction validator = vi.next(); |
5914 |
16 Dec 11 |
nicklas |
203 |
++vld; |
5914 |
16 Dec 11 |
nicklas |
204 |
Severity option = options.getSeverity(validator); |
5914 |
16 Dec 11 |
nicklas |
205 |
String validatorId = validator.getId(); |
5914 |
16 Dec 11 |
nicklas |
206 |
boolean hasNext = vi.hasNext(); |
6960 |
01 Oct 15 |
nicklas |
207 |
String vtitle = HTML.encodeTags(validator.getTitle()); |
5914 |
16 Dec 11 |
nicklas |
208 |
%> |
5914 |
16 Dec 11 |
nicklas |
209 |
<tr id="vld.<%=grp%>.<%=vld%>" style="display: none;" class="highlight"> |
6960 |
01 Oct 15 |
nicklas |
210 |
<th class="subprompt" title="<%=vtitle %>"><%=vtitle%></th> |
5914 |
16 Dec 11 |
nicklas |
211 |
<td> |
5914 |
16 Dec 11 |
nicklas |
212 |
<select id="select.<%=grp%>.<%=vld%>" name="<%=validatorId%>"> |
5914 |
16 Dec 11 |
nicklas |
213 |
<% |
5914 |
16 Dec 11 |
nicklas |
214 |
for (Severity s : Severity.values()) |
5914 |
16 Dec 11 |
nicklas |
215 |
{ |
5914 |
16 Dec 11 |
nicklas |
216 |
%> |
5914 |
16 Dec 11 |
nicklas |
217 |
<option value="<%=s.name()%>" <%=s == option ? "selected" : "" %>><%=s%> |
5914 |
16 Dec 11 |
nicklas |
218 |
<% |
5914 |
16 Dec 11 |
nicklas |
219 |
} |
5914 |
16 Dec 11 |
nicklas |
220 |
%> |
5914 |
16 Dec 11 |
nicklas |
221 |
</select> |
5914 |
16 Dec 11 |
nicklas |
222 |
<% |
5914 |
16 Dec 11 |
nicklas |
223 |
if (validator == Validator.NONMATCHING_SPOTCOUNT) |
5914 |
16 Dec 11 |
nicklas |
224 |
{ |
5914 |
16 Dec 11 |
nicklas |
225 |
%> |
5914 |
16 Dec 11 |
nicklas |
226 |
Threshold: |
5914 |
16 Dec 11 |
nicklas |
227 |
<input type="text" class="text" |
5914 |
16 Dec 11 |
nicklas |
228 |
name="threshold" |
5914 |
16 Dec 11 |
nicklas |
229 |
title="Threshold, as a percentage or an absolute value" |
5914 |
16 Dec 11 |
nicklas |
230 |
size="8" |
5914 |
16 Dec 11 |
nicklas |
231 |
value="<%=HTML.encodeTags(options.getOption(validator, "threshold", "5%"))%>" > |
5914 |
16 Dec 11 |
nicklas |
232 |
<% |
5914 |
16 Dec 11 |
nicklas |
233 |
} |
5914 |
16 Dec 11 |
nicklas |
234 |
%> |
5914 |
16 Dec 11 |
nicklas |
235 |
<div id="description.<%=validatorId%>" |
6960 |
01 Oct 15 |
nicklas |
236 |
class="validatordescription messagecontainer help"><b><%=vtitle%></b><br><%=HTML.encodeTags(validator.getDescription())%></div> |
5914 |
16 Dec 11 |
nicklas |
237 |
</td> |
5914 |
16 Dec 11 |
nicklas |
238 |
</tr> |
5914 |
16 Dec 11 |
nicklas |
239 |
<% |
5914 |
16 Dec 11 |
nicklas |
240 |
} |
4745 |
10 Feb 09 |
nicklas |
241 |
} |
5914 |
16 Dec 11 |
nicklas |
242 |
%> |
5914 |
16 Dec 11 |
nicklas |
243 |
<tr class="dynamic"> |
5914 |
16 Dec 11 |
nicklas |
244 |
<th></th> |
5914 |
16 Dec 11 |
nicklas |
245 |
<td></td> |
5914 |
16 Dec 11 |
nicklas |
246 |
</tr> |
5914 |
16 Dec 11 |
nicklas |
247 |
</table> |
5914 |
16 Dec 11 |
nicklas |
248 |
|
5914 |
16 Dec 11 |
nicklas |
249 |
</div> |
4745 |
10 Feb 09 |
nicklas |
250 |
</div> |
5914 |
16 Dec 11 |
nicklas |
251 |
</form> |
4745 |
10 Feb 09 |
nicklas |
252 |
|
5914 |
16 Dec 11 |
nicklas |
253 |
<base:buttongroup subclass="dialogbuttons"> |
6195 |
01 Nov 12 |
nicklas |
254 |
<base:button id="btnSave" title="Save" /> |
6195 |
01 Nov 12 |
nicklas |
255 |
<base:button id="close" title="Cancel" /> |
5914 |
16 Dec 11 |
nicklas |
256 |
</base:buttongroup> |
5914 |
16 Dec 11 |
nicklas |
257 |
|
4745 |
10 Feb 09 |
nicklas |
258 |
</base:body> |
4745 |
10 Feb 09 |
nicklas |
259 |
</base:page> |
4745 |
10 Feb 09 |
nicklas |
260 |
<% |
4745 |
10 Feb 09 |
nicklas |
261 |
} |
4745 |
10 Feb 09 |
nicklas |
262 |
finally |
4745 |
10 Feb 09 |
nicklas |
263 |
{ |
4745 |
10 Feb 09 |
nicklas |
264 |
if (dc != null) dc.close(); |
4745 |
10 Feb 09 |
nicklas |
265 |
} |
4745 |
10 Feb 09 |
nicklas |
266 |
%> |