source: branches/2.8-stable/www/common/plugin/finish_job.jsp @ 4506

Last change on this file since 4506 was 4506, checked in by Nicklas Nordborg, 14 years ago

References #118: Change problematic forms to use POST instead of GET

I have changed most of the forms I could find to use POST instead of GET. Many of them are probably not problematic, but I found some:

  • Form for JEP extra value calculator plug-in
  • Form for JEP intensity transformer plug-in
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 6.8 KB
Line 
1<%-- $Id: finish_job.jsp 4506 2008-09-11 09:29:40Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Nicklas Nordborg
4  Copyright (C) 2007 Nicklas Nordborg, Martin Svensson
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330,
22  Boston, MA  02111-1307, USA.
23  ------------------------------------------------------------------
24
25  @author Nicklas
26  @version 2.0
27--%>
28<%@ page session="false"
29  import="net.sf.basedb.core.SessionControl"
30  import="net.sf.basedb.core.DbControl"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.PluginDefinition"
33  import="net.sf.basedb.core.PluginConfiguration"
34  import="net.sf.basedb.core.PluginType"
35  import="net.sf.basedb.core.ItemQuery"
36  import="net.sf.basedb.core.ItemResultList"
37  import="net.sf.basedb.core.Include"
38  import="net.sf.basedb.core.Permission"
39  import="net.sf.basedb.core.Job"
40  import="net.sf.basedb.core.JobAgent"
41  import="net.sf.basedb.core.PluginResponse"
42  import="net.sf.basedb.core.query.Hql"
43  import="net.sf.basedb.core.query.Expressions"
44  import="net.sf.basedb.core.query.Restrictions"
45  import="net.sf.basedb.core.query.Orders"
46  import="net.sf.basedb.core.plugin.GuiContext"
47  import="net.sf.basedb.core.plugin.Plugin"
48  import="net.sf.basedb.core.plugin.Response"
49  import="net.sf.basedb.core.plugin.InteractivePlugin"
50  import="net.sf.basedb.core.plugin.AutoDetectingImporter"
51  import="net.sf.basedb.clients.web.Base"
52  import="net.sf.basedb.util.Values"
53  import="net.sf.basedb.clients.web.util.HTML"
54  import="java.util.Set"
55  import="java.util.Map"
56  import="java.util.List"
57%>
58<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
59<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
60
61<%
62final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
63final String ID = sc.getId();
64final DbControl dc = sc.newDbControl();
65try
66{
67  Job job = (Job)sc.getSessionSetting("plugin.configure.job");
68  dc.reattachItem(job);
69  PluginDefinition plugin = job.getPluginDefinition();
70  PluginConfiguration pluginConfig = job.getPluginConfiguration();
71  boolean sendMessage = Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), true);
72  boolean removeJobWhenFinished = Values.getBoolean(sc.getUserClientSetting("plugins.removejob"), false);
73
74  PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
75  boolean executeImmediately =
76    pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY;
77
78  List<JobAgent> agents = null;
79  if (!executeImmediately && sc.hasSystemPermission(Permission.SELECT_JOBAGENT))
80  {
81    ItemQuery<JobAgent> agentQuery = JobAgent.getQuery();
82    agentQuery.join(Hql.innerJoin("plugins", "plg"));
83    agentQuery.restrict(Restrictions.eq(Hql.index("plg", null), Hql.entity(plugin)));
84    agentQuery.include(Include.ALL);
85    agentQuery.order(Orders.asc(Hql.property("name")));
86    agents = agentQuery.list(dc);
87  }
88  %>
89  <base:page type="popup" title="Set job name and options">
90  <base:head scripts="plugin.js">
91    <script language="JavaScript">
92    function doFinish()
93    {
94      var frm = document.forms['plugin'];
95      if (Main.trimString(frm.name.value) == '')
96      {
97        frm.name.focus();
98        alert('You must enter a name for the job');
99        return false;
100      }
101      frm.submit();
102    }
103    function doCancel()
104    {
105      location = 'index.jsp?ID=<%=ID%>&cmd=CancelWizard';
106    }
107    </script>
108  </base:head>
109  <base:body>
110    <form name="plugin" action="index.jsp" method="post" onsubmit="return false;">
111    <input type="hidden" name="ID" value="<%=ID%>">
112    <input type="hidden" name="cmd" value="FinishNewJob">
113
114    <h3 class="docked">Set job name and options <base:help helpid="runplugin.finishjob" /></h3>
115    <div class="boxed">
116      <table class="form" width="100%">
117      <tr valign="top">
118        <td class="prompt">Plugin</td>
119        <td><%=HTML.encodeTags(plugin.getName())%></td>
120      </tr>
121      <tr valign="top" id="configurations">
122        <td class="prompt">Configuration</td>
123        <td><%=pluginConfig == null ? "<i>- none -</i>" : HTML.encodeTags(pluginConfig.getName())%></td>
124      </tr>
125
126      <tr valign="top">
127        <td class="prompt">Job name</td>
128        <td><input type="text" class="text required" 
129          name="name" value="<%=HTML.encodeTags(job.getName())%>" 
130          size="40" maxlength="<%=Job.MAX_NAME_LENGTH%>">
131        </td>
132      </tr>
133     
134      <%
135      if (agents != null && agents.size() > 0)
136      {
137        %>
138        <tr valign="top">
139          <td class="prompt">Use job agent</td>
140          <td>
141            <select name="agent_id">
142            <option value="">- automatic -
143            <%
144            for (JobAgent agent : agents)
145            {
146              %>
147              <option value="<%=agent.getId()%>"><%=HTML.encodeTags(agent.getName())%>
148              <%
149            }
150            %>
151            </select>
152          </td>
153        </tr>
154        <%
155      }
156      %>
157     
158      <tr valign="top">
159        <td class="prompt">Job description</td>
160        <td nowrap>
161          <textarea class="text" rows="4" cols="40" name="job_description" wrap="virtual"
162            ><%=HTML.encodeTags(job.getDescription())%></textarea>
163          <a href="javascript:Main.zoom('Job description', 'plugin', 'description')"
164            title="Edit in larger window"><base:icon image="zoom.gif" /></a>
165        </td>
166      </tr>
167     
168      <tr>
169        <td class="prompt">Send message</td>
170        <td>
171          <input type="checkbox" name="send_message" value="1" <%=sendMessage ? "checked" : "" %>>
172          <a href="javascript:document.forms['plugin'].send_message.click();">Send a message when the job is completed</a>
173        </td>
174      </tr>
175     
176      <tr>
177        <td class="prompt">Remove job</td>
178        <%
179        if (plugin.getMainType().equals(Plugin.MainType.EXPORT) || 
180            plugin.getMainType().equals(Plugin.MainType.IMPORT))
181        {
182          %>
183          <td>
184            <input type="checkbox" name="remove_job" value="1" <%=removeJobWhenFinished ? "checked" : "" %>>
185            <a href="javascript:document.forms['plugin'].remove_job.click();">Remove job when finished</a>
186          </td>
187          <%
188        }
189        else
190        {
191          %>
192          <td><i>- n/a -</i></td>
193          <%
194        }
195        %>
196      </tr>
197           
198      </table>
199      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
200    </div>
201    </form>
202 
203    <table align="center">
204    <tr>
205      <td width="50%"><base:button onclick="doFinish();" title="Finish" image="gonext.gif" /></td>
206      <td width="50%"><base:button onclick="doCancel();" title="Cancel" /></td>
207    </tr>
208    </table>
209  </base:body>
210  </base:page>
211  <%
212}
213finally
214{
215  if (dc != null) dc.close();
216}
217%>
218
Note: See TracBrowser for help on using the repository browser.