2643 |
15 Sep 06 |
nicklas |
1 |
<%-- $Id$ |
2643 |
15 Sep 06 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2006 Nicklas Nordborg |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg, Martin Svensson |
2643 |
15 Sep 06 |
nicklas |
5 |
|
2643 |
15 Sep 06 |
nicklas |
6 |
This file is part of BASE - BioArray Software Environment. |
2643 |
15 Sep 06 |
nicklas |
7 |
Available at http://base.thep.lu.se/ |
2643 |
15 Sep 06 |
nicklas |
8 |
|
2643 |
15 Sep 06 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
2643 |
15 Sep 06 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
2643 |
15 Sep 06 |
nicklas |
12 |
of the License, or (at your option) any later version. |
2643 |
15 Sep 06 |
nicklas |
13 |
|
2643 |
15 Sep 06 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
2643 |
15 Sep 06 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2643 |
15 Sep 06 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2643 |
15 Sep 06 |
nicklas |
17 |
GNU General Public License for more details. |
2643 |
15 Sep 06 |
nicklas |
18 |
|
2643 |
15 Sep 06 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2643 |
15 Sep 06 |
nicklas |
21 |
------------------------------------------------------------------ |
2643 |
15 Sep 06 |
nicklas |
22 |
|
2643 |
15 Sep 06 |
nicklas |
23 |
@author Nicklas |
2643 |
15 Sep 06 |
nicklas |
24 |
@version 2.0 |
2643 |
15 Sep 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
2643 |
15 Sep 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
2643 |
15 Sep 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
2643 |
15 Sep 06 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
2643 |
15 Sep 06 |
nicklas |
30 |
import="net.sf.basedb.core.PluginDefinition" |
2643 |
15 Sep 06 |
nicklas |
31 |
import="net.sf.basedb.core.PluginConfiguration" |
2643 |
15 Sep 06 |
nicklas |
32 |
import="net.sf.basedb.core.PluginType" |
2643 |
15 Sep 06 |
nicklas |
33 |
import="net.sf.basedb.core.ItemQuery" |
2643 |
15 Sep 06 |
nicklas |
34 |
import="net.sf.basedb.core.ItemResultList" |
2643 |
15 Sep 06 |
nicklas |
35 |
import="net.sf.basedb.core.Include" |
4311 |
23 May 08 |
nicklas |
36 |
import="net.sf.basedb.core.Permission" |
2643 |
15 Sep 06 |
nicklas |
37 |
import="net.sf.basedb.core.Job" |
4311 |
23 May 08 |
nicklas |
38 |
import="net.sf.basedb.core.JobAgent" |
5442 |
07 Oct 10 |
nicklas |
39 |
import="net.sf.basedb.core.User" |
4311 |
23 May 08 |
nicklas |
40 |
import="net.sf.basedb.core.PluginResponse" |
2643 |
15 Sep 06 |
nicklas |
41 |
import="net.sf.basedb.core.query.Hql" |
2643 |
15 Sep 06 |
nicklas |
42 |
import="net.sf.basedb.core.query.Expressions" |
2643 |
15 Sep 06 |
nicklas |
43 |
import="net.sf.basedb.core.query.Restrictions" |
2643 |
15 Sep 06 |
nicklas |
44 |
import="net.sf.basedb.core.query.Orders" |
2643 |
15 Sep 06 |
nicklas |
45 |
import="net.sf.basedb.core.plugin.GuiContext" |
2643 |
15 Sep 06 |
nicklas |
46 |
import="net.sf.basedb.core.plugin.Plugin" |
4311 |
23 May 08 |
nicklas |
47 |
import="net.sf.basedb.core.plugin.Response" |
2643 |
15 Sep 06 |
nicklas |
48 |
import="net.sf.basedb.core.plugin.InteractivePlugin" |
2643 |
15 Sep 06 |
nicklas |
49 |
import="net.sf.basedb.core.plugin.AutoDetectingImporter" |
5442 |
07 Oct 10 |
nicklas |
50 |
import="net.sf.basedb.util.EmailUtil" |
5442 |
07 Oct 10 |
nicklas |
51 |
import="net.sf.basedb.util.Values" |
2643 |
15 Sep 06 |
nicklas |
52 |
import="net.sf.basedb.clients.web.Base" |
2643 |
15 Sep 06 |
nicklas |
53 |
import="net.sf.basedb.clients.web.util.HTML" |
2643 |
15 Sep 06 |
nicklas |
54 |
import="java.util.Set" |
2643 |
15 Sep 06 |
nicklas |
55 |
import="java.util.Map" |
2643 |
15 Sep 06 |
nicklas |
56 |
import="java.util.List" |
2643 |
15 Sep 06 |
nicklas |
57 |
%> |
2643 |
15 Sep 06 |
nicklas |
58 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2643 |
15 Sep 06 |
nicklas |
59 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
2643 |
15 Sep 06 |
nicklas |
60 |
|
2643 |
15 Sep 06 |
nicklas |
61 |
<% |
2643 |
15 Sep 06 |
nicklas |
62 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2643 |
15 Sep 06 |
nicklas |
63 |
final String ID = sc.getId(); |
7954 |
12 May 21 |
nicklas |
64 |
final DbControl dc = sc.newDbControl(":Finish job"); |
2643 |
15 Sep 06 |
nicklas |
65 |
try |
2643 |
15 Sep 06 |
nicklas |
66 |
{ |
7605 |
26 Feb 19 |
nicklas |
67 |
Job job = sc.getSessionSetting("plugin.configure.job"); |
5060 |
19 Aug 09 |
nicklas |
68 |
dc.reattachItem(job, false); |
4311 |
23 May 08 |
nicklas |
69 |
PluginDefinition plugin = job.getPluginDefinition(); |
4311 |
23 May 08 |
nicklas |
70 |
PluginConfiguration pluginConfig = job.getPluginConfiguration(); |
2648 |
19 Sep 06 |
nicklas |
71 |
boolean sendMessage = Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), true); |
5442 |
07 Oct 10 |
nicklas |
72 |
boolean sendMessageAsEmail = EmailUtil.isEnabled(User.getById(dc, sc.getLoggedInUserId())); |
3480 |
13 Jun 07 |
martin |
73 |
boolean removeJobWhenFinished = Values.getBoolean(sc.getUserClientSetting("plugins.removejob"), false); |
4311 |
23 May 08 |
nicklas |
74 |
|
7605 |
26 Feb 19 |
nicklas |
75 |
PluginResponse pluginResponse = sc.getSessionSetting("plugin.configure.response"); |
4311 |
23 May 08 |
nicklas |
76 |
boolean executeImmediately = |
4311 |
23 May 08 |
nicklas |
77 |
pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY; |
4311 |
23 May 08 |
nicklas |
78 |
|
4311 |
23 May 08 |
nicklas |
79 |
List<JobAgent> agents = null; |
4311 |
23 May 08 |
nicklas |
80 |
if (!executeImmediately && sc.hasSystemPermission(Permission.SELECT_JOBAGENT)) |
4311 |
23 May 08 |
nicklas |
81 |
{ |
4311 |
23 May 08 |
nicklas |
82 |
ItemQuery<JobAgent> agentQuery = JobAgent.getQuery(); |
4311 |
23 May 08 |
nicklas |
83 |
agentQuery.join(Hql.innerJoin("plugins", "plg")); |
4311 |
23 May 08 |
nicklas |
84 |
agentQuery.restrict(Restrictions.eq(Hql.index("plg", null), Hql.entity(plugin))); |
4311 |
23 May 08 |
nicklas |
85 |
agentQuery.include(Include.ALL); |
4311 |
23 May 08 |
nicklas |
86 |
agentQuery.order(Orders.asc(Hql.property("name"))); |
4311 |
23 May 08 |
nicklas |
87 |
agents = agentQuery.list(dc); |
4311 |
23 May 08 |
nicklas |
88 |
} |
2643 |
15 Sep 06 |
nicklas |
89 |
%> |
2643 |
15 Sep 06 |
nicklas |
90 |
<base:page type="popup" title="Set job name and options"> |
6200 |
05 Nov 12 |
nicklas |
91 |
<base:head scripts="~finish_job.js" /> |
2761 |
23 Oct 06 |
nicklas |
92 |
<base:body> |
5910 |
14 Dec 11 |
nicklas |
93 |
<h1>Set job name and options <base:help helpid="runplugin.finishjob" /></h1> |
6162 |
10 Oct 12 |
nicklas |
94 |
<form name="plugin" action="index.jsp" method="post"> |
2643 |
15 Sep 06 |
nicklas |
95 |
<input type="hidden" name="ID" value="<%=ID%>"> |
2643 |
15 Sep 06 |
nicklas |
96 |
<input type="hidden" name="cmd" value="FinishNewJob"> |
2643 |
15 Sep 06 |
nicklas |
97 |
|
5910 |
14 Dec 11 |
nicklas |
98 |
<div class="content"> |
5910 |
14 Dec 11 |
nicklas |
99 |
<table class="fullform input100 bottomborder"> |
5910 |
14 Dec 11 |
nicklas |
100 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
101 |
<th>Plugin</th> |
2643 |
15 Sep 06 |
nicklas |
102 |
<td><%=HTML.encodeTags(plugin.getName())%></td> |
5910 |
14 Dec 11 |
nicklas |
103 |
<td></td> |
2643 |
15 Sep 06 |
nicklas |
104 |
</tr> |
5910 |
14 Dec 11 |
nicklas |
105 |
<tr id="configurations"> |
5910 |
14 Dec 11 |
nicklas |
106 |
<th>Configuration</th> |
2643 |
15 Sep 06 |
nicklas |
107 |
<td><%=pluginConfig == null ? "<i>- none -</i>" : HTML.encodeTags(pluginConfig.getName())%></td> |
5910 |
14 Dec 11 |
nicklas |
108 |
<td></td> |
2643 |
15 Sep 06 |
nicklas |
109 |
</tr> |
5910 |
14 Dec 11 |
nicklas |
110 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
111 |
<th>Job name</th> |
2643 |
15 Sep 06 |
nicklas |
112 |
<td><input type="text" class="text required" |
2643 |
15 Sep 06 |
nicklas |
113 |
name="name" value="<%=HTML.encodeTags(job.getName())%>" |
5910 |
14 Dec 11 |
nicklas |
114 |
maxlength="<%=Job.MAX_NAME_LENGTH%>"> |
2643 |
15 Sep 06 |
nicklas |
115 |
</td> |
5910 |
14 Dec 11 |
nicklas |
116 |
<td></td> |
2643 |
15 Sep 06 |
nicklas |
117 |
</tr> |
4311 |
23 May 08 |
nicklas |
118 |
<% |
7317 |
03 Apr 17 |
nicklas |
119 |
if (job.getExecuteCommand() != null) |
7317 |
03 Apr 17 |
nicklas |
120 |
{ |
7317 |
03 Apr 17 |
nicklas |
121 |
%> |
7317 |
03 Apr 17 |
nicklas |
122 |
<tr> |
7317 |
03 Apr 17 |
nicklas |
123 |
<th class="subprompt"></th> |
7317 |
03 Apr 17 |
nicklas |
124 |
<td> |
7317 |
03 Apr 17 |
nicklas |
125 |
<input type="checkbox" name="resume_from_breakpoint" id="resumeFromBreakPoint" value="1"> |
7317 |
03 Apr 17 |
nicklas |
126 |
<label for="resumeFromBreakPoint">Resume from breakpoint: <%=HTML.encodeTags(job.getExecuteCommand()) %></label> |
7317 |
03 Apr 17 |
nicklas |
127 |
</td> |
7317 |
03 Apr 17 |
nicklas |
128 |
</tr> |
7317 |
03 Apr 17 |
nicklas |
129 |
<% |
7317 |
03 Apr 17 |
nicklas |
130 |
} |
7317 |
03 Apr 17 |
nicklas |
131 |
%> |
7317 |
03 Apr 17 |
nicklas |
132 |
<% |
4311 |
23 May 08 |
nicklas |
133 |
if (agents != null && agents.size() > 0) |
4311 |
23 May 08 |
nicklas |
134 |
{ |
4311 |
23 May 08 |
nicklas |
135 |
%> |
5910 |
14 Dec 11 |
nicklas |
136 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
137 |
<th>Use job agent</th> |
4311 |
23 May 08 |
nicklas |
138 |
<td> |
4311 |
23 May 08 |
nicklas |
139 |
<select name="agent_id"> |
4311 |
23 May 08 |
nicklas |
140 |
<option value="">- automatic - |
4311 |
23 May 08 |
nicklas |
141 |
<% |
4311 |
23 May 08 |
nicklas |
142 |
for (JobAgent agent : agents) |
4311 |
23 May 08 |
nicklas |
143 |
{ |
4311 |
23 May 08 |
nicklas |
144 |
%> |
4311 |
23 May 08 |
nicklas |
145 |
<option value="<%=agent.getId()%>"><%=HTML.encodeTags(agent.getName())%> |
4311 |
23 May 08 |
nicklas |
146 |
<% |
4311 |
23 May 08 |
nicklas |
147 |
} |
4311 |
23 May 08 |
nicklas |
148 |
%> |
4311 |
23 May 08 |
nicklas |
149 |
</select> |
4311 |
23 May 08 |
nicklas |
150 |
</td> |
5910 |
14 Dec 11 |
nicklas |
151 |
<td></td> |
4311 |
23 May 08 |
nicklas |
152 |
</tr> |
4311 |
23 May 08 |
nicklas |
153 |
<% |
4311 |
23 May 08 |
nicklas |
154 |
} |
4311 |
23 May 08 |
nicklas |
155 |
%> |
2643 |
15 Sep 06 |
nicklas |
156 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
157 |
<th>Send message</th> |
2643 |
15 Sep 06 |
nicklas |
158 |
<td> |
5812 |
17 Oct 11 |
nicklas |
159 |
<input type="checkbox" name="send_message" id="sendMessage" value="1" <%=sendMessage ? "checked" : "" %>> |
5812 |
17 Oct 11 |
nicklas |
160 |
<label for="sendMessage">Send a |
5812 |
17 Oct 11 |
nicklas |
161 |
message<%=sendMessageAsEmail ? "+email" : "" %> when the job is completed</label> |
2643 |
15 Sep 06 |
nicklas |
162 |
</td> |
5910 |
14 Dec 11 |
nicklas |
163 |
<td></td> |
2643 |
15 Sep 06 |
nicklas |
164 |
</tr> |
2643 |
15 Sep 06 |
nicklas |
165 |
|
3480 |
13 Jun 07 |
martin |
166 |
<tr> |
5910 |
14 Dec 11 |
nicklas |
167 |
<th>Remove job</th> |
3480 |
13 Jun 07 |
martin |
168 |
<% |
3480 |
13 Jun 07 |
martin |
169 |
if (plugin.getMainType().equals(Plugin.MainType.EXPORT) || |
3480 |
13 Jun 07 |
martin |
170 |
plugin.getMainType().equals(Plugin.MainType.IMPORT)) |
3480 |
13 Jun 07 |
martin |
171 |
{ |
3480 |
13 Jun 07 |
martin |
172 |
%> |
3480 |
13 Jun 07 |
martin |
173 |
<td> |
5812 |
17 Oct 11 |
nicklas |
174 |
<input type="checkbox" name="remove_job" id="removeJob" value="1" <%=removeJobWhenFinished ? "checked" : "" %>> |
5812 |
17 Oct 11 |
nicklas |
175 |
<label for="removeJob">Remove job when finished</label> |
3480 |
13 Jun 07 |
martin |
176 |
</td> |
3480 |
13 Jun 07 |
martin |
177 |
<% |
3480 |
13 Jun 07 |
martin |
178 |
} |
3480 |
13 Jun 07 |
martin |
179 |
else |
3480 |
13 Jun 07 |
martin |
180 |
{ |
3480 |
13 Jun 07 |
martin |
181 |
%> |
3480 |
13 Jun 07 |
martin |
182 |
<td><i>- n/a -</i></td> |
3480 |
13 Jun 07 |
martin |
183 |
<% |
3480 |
13 Jun 07 |
martin |
184 |
} |
3480 |
13 Jun 07 |
martin |
185 |
%> |
5910 |
14 Dec 11 |
nicklas |
186 |
<td></td> |
3480 |
13 Jun 07 |
martin |
187 |
</tr> |
5910 |
14 Dec 11 |
nicklas |
188 |
<tr class="dynamic"> |
5910 |
14 Dec 11 |
nicklas |
189 |
<th>Job description</th> |
5910 |
14 Dec 11 |
nicklas |
190 |
<td> |
7352 |
28 Apr 17 |
nicklas |
191 |
<textarea class="text" rows="4" name="description" id="description" |
5910 |
14 Dec 11 |
nicklas |
192 |
><%=HTML.encodeTags(job.getDescription())%></textarea> |
5910 |
14 Dec 11 |
nicklas |
193 |
</td> |
5910 |
14 Dec 11 |
nicklas |
194 |
<td style="width: 20px;"> |
7352 |
28 Apr 17 |
nicklas |
195 |
<base:zoom textarea="description" title="Job description" /> |
5910 |
14 Dec 11 |
nicklas |
196 |
</td> |
5910 |
14 Dec 11 |
nicklas |
197 |
</tr> |
2643 |
15 Sep 06 |
nicklas |
198 |
</table> |
2643 |
15 Sep 06 |
nicklas |
199 |
</div> |
2643 |
15 Sep 06 |
nicklas |
200 |
</form> |
5910 |
14 Dec 11 |
nicklas |
201 |
|
5910 |
14 Dec 11 |
nicklas |
202 |
<base:buttongroup subclass="dialogbuttons"> |
6200 |
05 Nov 12 |
nicklas |
203 |
<base:button id="btnFinish" title="Finish" image="gonext.png" /> |
6200 |
05 Nov 12 |
nicklas |
204 |
<base:button id="close" title="Cancel" /> |
5910 |
14 Dec 11 |
nicklas |
205 |
</base:buttongroup> |
2643 |
15 Sep 06 |
nicklas |
206 |
</base:body> |
2643 |
15 Sep 06 |
nicklas |
207 |
</base:page> |
2643 |
15 Sep 06 |
nicklas |
208 |
<% |
2643 |
15 Sep 06 |
nicklas |
209 |
} |
2643 |
15 Sep 06 |
nicklas |
210 |
finally |
2643 |
15 Sep 06 |
nicklas |
211 |
{ |
2643 |
15 Sep 06 |
nicklas |
212 |
if (dc != null) dc.close(); |
2643 |
15 Sep 06 |
nicklas |
213 |
} |
2643 |
15 Sep 06 |
nicklas |
214 |
%> |
2643 |
15 Sep 06 |
nicklas |
215 |
|