4320 |
29 May 08 |
nicklas |
1 |
<%-- $Id:index.jsp 4187 2008-03-20 11:15:25Z nicklas $ |
4320 |
29 May 08 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
4320 |
29 May 08 |
nicklas |
4 |
|
4320 |
29 May 08 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
4320 |
29 May 08 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
4320 |
29 May 08 |
nicklas |
7 |
|
4320 |
29 May 08 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
4320 |
29 May 08 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
10 |
as published by the Free Software Foundation; either version 3 |
4320 |
29 May 08 |
nicklas |
11 |
of the License, or (at your option) any later version. |
4320 |
29 May 08 |
nicklas |
12 |
|
4320 |
29 May 08 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
4320 |
29 May 08 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4320 |
29 May 08 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4320 |
29 May 08 |
nicklas |
16 |
GNU General Public License for more details. |
4320 |
29 May 08 |
nicklas |
17 |
|
4320 |
29 May 08 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4320 |
29 May 08 |
nicklas |
20 |
------------------------------------------------------------------ |
4320 |
29 May 08 |
nicklas |
21 |
|
4320 |
29 May 08 |
nicklas |
22 |
@author Nicklas |
4320 |
29 May 08 |
nicklas |
23 |
@version 2.0 |
4320 |
29 May 08 |
nicklas |
24 |
--%> |
5426 |
24 Sep 10 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
4320 |
29 May 08 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
4320 |
29 May 08 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
4320 |
29 May 08 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
4320 |
29 May 08 |
nicklas |
29 |
import="net.sf.basedb.clients.web.Base" |
4320 |
29 May 08 |
nicklas |
30 |
import="net.sf.basedb.clients.web.WebException" |
4320 |
29 May 08 |
nicklas |
31 |
import="net.sf.basedb.util.Values" |
4320 |
29 May 08 |
nicklas |
32 |
import="net.sf.basedb.clients.web.util.HTML" |
4320 |
29 May 08 |
nicklas |
33 |
import="net.sf.basedb.util.extensions.ExtensionPoint" |
4320 |
29 May 08 |
nicklas |
34 |
import="net.sf.basedb.util.extensions.Extension" |
4320 |
29 May 08 |
nicklas |
35 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
4320 |
29 May 08 |
nicklas |
36 |
import="java.util.List" |
4320 |
29 May 08 |
nicklas |
37 |
%> |
4320 |
29 May 08 |
nicklas |
38 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4320 |
29 May 08 |
nicklas |
39 |
<% |
4320 |
29 May 08 |
nicklas |
40 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
4320 |
29 May 08 |
nicklas |
41 |
final String ID = sc.getId(); |
4320 |
29 May 08 |
nicklas |
42 |
final String cmd = request.getParameter("cmd"); |
4320 |
29 May 08 |
nicklas |
43 |
final String root = request.getContextPath()+"/"; |
4320 |
29 May 08 |
nicklas |
44 |
|
4320 |
29 May 08 |
nicklas |
45 |
String forward = null; |
4320 |
29 May 08 |
nicklas |
46 |
String redirect = null; |
4320 |
29 May 08 |
nicklas |
47 |
String message = null; |
4320 |
29 May 08 |
nicklas |
48 |
DbControl dc = null; |
4320 |
29 May 08 |
nicklas |
49 |
try |
4320 |
29 May 08 |
nicklas |
50 |
{ |
4320 |
29 May 08 |
nicklas |
51 |
if (cmd == null || "List".equals(cmd)) |
4320 |
29 May 08 |
nicklas |
52 |
{ |
4320 |
29 May 08 |
nicklas |
53 |
forward = "services.jsp"; |
4320 |
29 May 08 |
nicklas |
54 |
} |
4320 |
29 May 08 |
nicklas |
55 |
else if ("Start".equals(cmd)) |
4320 |
29 May 08 |
nicklas |
56 |
{ |
4320 |
29 May 08 |
nicklas |
57 |
String extensionId = request.getParameter("extensionId"); |
7954 |
12 May 21 |
nicklas |
58 |
dc = sc.newDbControl(":Start service: "+extensionId); |
4320 |
29 May 08 |
nicklas |
59 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
4320 |
29 May 08 |
nicklas |
60 |
ec.enableExtension(extensionId, true); |
4320 |
29 May 08 |
nicklas |
61 |
ec.saveSettings(); |
4320 |
29 May 08 |
nicklas |
62 |
redirect = "services.jsp?ID=" + ID; |
4320 |
29 May 08 |
nicklas |
63 |
} |
4320 |
29 May 08 |
nicklas |
64 |
else if ("Stop".equals(cmd)) |
4320 |
29 May 08 |
nicklas |
65 |
{ |
4320 |
29 May 08 |
nicklas |
66 |
String extensionId = request.getParameter("extensionId"); |
7954 |
12 May 21 |
nicklas |
67 |
dc = sc.newDbControl(":Stop service: "+extensionId); |
4320 |
29 May 08 |
nicklas |
68 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
4320 |
29 May 08 |
nicklas |
69 |
ec.enableExtension(extensionId, false); |
4320 |
29 May 08 |
nicklas |
70 |
ec.saveSettings(); |
4320 |
29 May 08 |
nicklas |
71 |
redirect = "services.jsp?ID=" + ID; |
4320 |
29 May 08 |
nicklas |
72 |
} |
4320 |
29 May 08 |
nicklas |
73 |
else |
4320 |
29 May 08 |
nicklas |
74 |
{ |
4320 |
29 May 08 |
nicklas |
75 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
4320 |
29 May 08 |
nicklas |
76 |
} |
4320 |
29 May 08 |
nicklas |
77 |
} |
4320 |
29 May 08 |
nicklas |
78 |
finally |
4320 |
29 May 08 |
nicklas |
79 |
{ |
4320 |
29 May 08 |
nicklas |
80 |
if (dc != null) dc.close(); |
4320 |
29 May 08 |
nicklas |
81 |
} |
4320 |
29 May 08 |
nicklas |
82 |
|
4320 |
29 May 08 |
nicklas |
83 |
if (forward != null) |
4320 |
29 May 08 |
nicklas |
84 |
{ |
6192 |
31 Oct 12 |
nicklas |
85 |
sc.setSessionSetting("alert-message", message); |
4320 |
29 May 08 |
nicklas |
86 |
pageContext.forward(forward); |
4320 |
29 May 08 |
nicklas |
87 |
} |
4320 |
29 May 08 |
nicklas |
88 |
else if (redirect != null) |
4320 |
29 May 08 |
nicklas |
89 |
{ |
6192 |
31 Oct 12 |
nicklas |
90 |
sc.setSessionSetting("alert-message", message); |
4320 |
29 May 08 |
nicklas |
91 |
response.sendRedirect(redirect); |
4320 |
29 May 08 |
nicklas |
92 |
} |
4320 |
29 May 08 |
nicklas |
93 |
else if (message == null) |
4320 |
29 May 08 |
nicklas |
94 |
{ |
4320 |
29 May 08 |
nicklas |
95 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
4320 |
29 May 08 |
nicklas |
96 |
} |
4320 |
29 May 08 |
nicklas |
97 |
else |
4320 |
29 May 08 |
nicklas |
98 |
{ |
4320 |
29 May 08 |
nicklas |
99 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
4320 |
29 May 08 |
nicklas |
100 |
} |
4320 |
29 May 08 |
nicklas |
101 |
%> |
4320 |
29 May 08 |
nicklas |
102 |
|