4198 |
28 Mar 08 |
nicklas |
1 |
<%-- $Id:index.jsp 4187 2008-03-20 11:15:25Z nicklas $ |
4168 |
04 Mar 08 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
4168 |
04 Mar 08 |
nicklas |
4 |
|
4168 |
04 Mar 08 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
4168 |
04 Mar 08 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
4168 |
04 Mar 08 |
nicklas |
7 |
|
4168 |
04 Mar 08 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
4168 |
04 Mar 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 |
4168 |
04 Mar 08 |
nicklas |
11 |
of the License, or (at your option) any later version. |
4168 |
04 Mar 08 |
nicklas |
12 |
|
4168 |
04 Mar 08 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
4168 |
04 Mar 08 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4168 |
04 Mar 08 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4168 |
04 Mar 08 |
nicklas |
16 |
GNU General Public License for more details. |
4168 |
04 Mar 08 |
nicklas |
17 |
|
4168 |
04 Mar 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/>. |
4168 |
04 Mar 08 |
nicklas |
20 |
------------------------------------------------------------------ |
4168 |
04 Mar 08 |
nicklas |
21 |
|
4168 |
04 Mar 08 |
nicklas |
22 |
@author Nicklas |
4168 |
04 Mar 08 |
nicklas |
23 |
@version 2.0 |
4168 |
04 Mar 08 |
nicklas |
24 |
--%> |
5426 |
24 Sep 10 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
4168 |
04 Mar 08 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
4168 |
04 Mar 08 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
4168 |
04 Mar 08 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
4168 |
04 Mar 08 |
nicklas |
29 |
import="net.sf.basedb.clients.web.Base" |
4168 |
04 Mar 08 |
nicklas |
30 |
import="net.sf.basedb.clients.web.WebException" |
4168 |
04 Mar 08 |
nicklas |
31 |
import="net.sf.basedb.util.Values" |
4168 |
04 Mar 08 |
nicklas |
32 |
import="net.sf.basedb.clients.web.util.HTML" |
4168 |
04 Mar 08 |
nicklas |
33 |
import="net.sf.basedb.util.extensions.ExtensionPoint" |
4168 |
04 Mar 08 |
nicklas |
34 |
import="net.sf.basedb.util.extensions.Extension" |
8144 |
21 Apr 23 |
nicklas |
35 |
import="net.sf.basedb.util.extensions.logging.ExtensionsLogger" |
8144 |
21 Apr 23 |
nicklas |
36 |
import="net.sf.basedb.util.extensions.logging.ExtensionsLog" |
4181 |
18 Mar 08 |
nicklas |
37 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
4198 |
28 Mar 08 |
nicklas |
38 |
import="java.util.List" |
4168 |
04 Mar 08 |
nicklas |
39 |
%> |
4168 |
04 Mar 08 |
nicklas |
40 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4168 |
04 Mar 08 |
nicklas |
41 |
<% |
4198 |
28 Mar 08 |
nicklas |
42 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
4168 |
04 Mar 08 |
nicklas |
43 |
final String ID = sc.getId(); |
4168 |
04 Mar 08 |
nicklas |
44 |
final String cmd = request.getParameter("cmd"); |
4168 |
04 Mar 08 |
nicklas |
45 |
final String root = request.getContextPath()+"/"; |
4168 |
04 Mar 08 |
nicklas |
46 |
|
4168 |
04 Mar 08 |
nicklas |
47 |
String forward = null; |
4168 |
04 Mar 08 |
nicklas |
48 |
String redirect = null; |
4168 |
04 Mar 08 |
nicklas |
49 |
String message = null; |
4168 |
04 Mar 08 |
nicklas |
50 |
DbControl dc = null; |
4168 |
04 Mar 08 |
nicklas |
51 |
try |
4168 |
04 Mar 08 |
nicklas |
52 |
{ |
4168 |
04 Mar 08 |
nicklas |
53 |
if (cmd == null || "List".equals(cmd)) |
4168 |
04 Mar 08 |
nicklas |
54 |
{ |
4168 |
04 Mar 08 |
nicklas |
55 |
forward = "manager.jsp"; |
4168 |
04 Mar 08 |
nicklas |
56 |
} |
4168 |
04 Mar 08 |
nicklas |
57 |
else if ("EnableExtension".equals(cmd)) |
4168 |
04 Mar 08 |
nicklas |
58 |
{ |
4168 |
04 Mar 08 |
nicklas |
59 |
String extensionId = request.getParameter("extensionId"); |
4168 |
04 Mar 08 |
nicklas |
60 |
boolean enable = Values.getBoolean(request.getParameter("enable")); |
7954 |
12 May 21 |
nicklas |
61 |
dc = sc.newDbControl(":"+(enable?"Enable":"Disable")+" extension: "+extensionId); |
4181 |
18 Mar 08 |
nicklas |
62 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
4181 |
18 Mar 08 |
nicklas |
63 |
ec.enableExtension(extensionId, enable); |
4181 |
18 Mar 08 |
nicklas |
64 |
ec.saveSettings(); |
4168 |
04 Mar 08 |
nicklas |
65 |
redirect = "details.jsp?ID=" + ID + "&extensionId=" + extensionId; |
4168 |
04 Mar 08 |
nicklas |
66 |
} |
4168 |
04 Mar 08 |
nicklas |
67 |
else if ("EnableExtensionPoint".equals(cmd)) |
4168 |
04 Mar 08 |
nicklas |
68 |
{ |
4168 |
04 Mar 08 |
nicklas |
69 |
String extensionPointId = request.getParameter("extensionPointId"); |
4168 |
04 Mar 08 |
nicklas |
70 |
boolean enable = Values.getBoolean(request.getParameter("enable")); |
7954 |
12 May 21 |
nicklas |
71 |
dc = sc.newDbControl(":"+(enable?"Enable":"Disable")+" extension point: "+extensionPointId); |
4181 |
18 Mar 08 |
nicklas |
72 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
4181 |
18 Mar 08 |
nicklas |
73 |
ec.enableExtensionPoint(extensionPointId, enable); |
4181 |
18 Mar 08 |
nicklas |
74 |
ec.saveSettings(); |
4168 |
04 Mar 08 |
nicklas |
75 |
redirect = "details.jsp?ID=" + ID + "&extensionPointId=" + extensionPointId; |
4168 |
04 Mar 08 |
nicklas |
76 |
} |
4198 |
28 Mar 08 |
nicklas |
77 |
else if ("EnableFile".equals(cmd)) |
4198 |
28 Mar 08 |
nicklas |
78 |
{ |
5606 |
14 Apr 11 |
nicklas |
79 |
String fileuri = request.getParameter("fileuri"); |
4198 |
28 Mar 08 |
nicklas |
80 |
boolean enable = Values.getBoolean(request.getParameter("enable")); |
7954 |
12 May 21 |
nicklas |
81 |
dc = sc.newDbControl(":"+(enable?"Enable":"Disable")+" file: "+fileuri); |
4198 |
28 Mar 08 |
nicklas |
82 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
5606 |
14 Apr 11 |
nicklas |
83 |
ec.enableAllInFile(fileuri, enable); |
5615 |
19 Apr 11 |
nicklas |
84 |
dc.commit(); |
4198 |
28 Mar 08 |
nicklas |
85 |
ec.saveSettings(); |
5606 |
14 Apr 11 |
nicklas |
86 |
redirect = "details.jsp?ID=" + ID + "&fileuri=" + HTML.urlEncode(fileuri); |
4198 |
28 Mar 08 |
nicklas |
87 |
} |
4181 |
18 Mar 08 |
nicklas |
88 |
else if ("ManualScan".equals(cmd)) |
4181 |
18 Mar 08 |
nicklas |
89 |
{ |
5616 |
27 Apr 11 |
nicklas |
90 |
forward = "wizard.jsp?ID=" + ID; |
4198 |
28 Mar 08 |
nicklas |
91 |
} |
4198 |
28 Mar 08 |
nicklas |
92 |
else if ("DoManualScan".equals(cmd)) |
4198 |
28 Mar 08 |
nicklas |
93 |
{ |
7954 |
12 May 21 |
nicklas |
94 |
dc = sc.newDbControl(":Extensions installation wizard"); |
4181 |
18 Mar 08 |
nicklas |
95 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
5616 |
27 Apr 11 |
nicklas |
96 |
ec.performActions(request); |
5615 |
19 Apr 11 |
nicklas |
97 |
dc.commit(); |
5616 |
27 Apr 11 |
nicklas |
98 |
|
4198 |
28 Mar 08 |
nicklas |
99 |
redirect = "index.jsp?ID=" + ID + "&cmd=ScanResults"; |
4181 |
18 Mar 08 |
nicklas |
100 |
} |
4198 |
28 Mar 08 |
nicklas |
101 |
else if ("ScanResults".equals(cmd)) |
4198 |
28 Mar 08 |
nicklas |
102 |
{ |
4198 |
28 Mar 08 |
nicklas |
103 |
forward = "scan_results.jsp?ID=" + ID; |
4198 |
28 Mar 08 |
nicklas |
104 |
} |
8144 |
21 Apr 23 |
nicklas |
105 |
else if ("ClearLog".equals(cmd)) |
8144 |
21 Apr 23 |
nicklas |
106 |
{ |
8144 |
21 Apr 23 |
nicklas |
107 |
String extensionId = request.getParameter("extensionId"); |
8144 |
21 Apr 23 |
nicklas |
108 |
ExtensionsLog serviceLog = ExtensionsLog.getLog(extensionId, false); |
8144 |
21 Apr 23 |
nicklas |
109 |
if (serviceLog != null) |
8144 |
21 Apr 23 |
nicklas |
110 |
{ |
8144 |
21 Apr 23 |
nicklas |
111 |
serviceLog.clearLog(); |
8144 |
21 Apr 23 |
nicklas |
112 |
serviceLog.createLogger().info("The log was cleared by "+sc.getLoggedInUserName()+" ("+sc.getLoggedInUserLogin()+")"); |
8144 |
21 Apr 23 |
nicklas |
113 |
} |
8144 |
21 Apr 23 |
nicklas |
114 |
redirect = "view_log.jsp?ID="+ID+"&extensionId="+HTML.urlEncode(extensionId); |
8144 |
21 Apr 23 |
nicklas |
115 |
} |
8144 |
21 Apr 23 |
nicklas |
116 |
else if ("SetLogOptions".equals(cmd)) |
8144 |
21 Apr 23 |
nicklas |
117 |
{ |
8144 |
21 Apr 23 |
nicklas |
118 |
String extensionId = request.getParameter("extensionId"); |
8144 |
21 Apr 23 |
nicklas |
119 |
boolean enableDebug = Values.getBoolean(request.getParameter("enableDebug")); |
8144 |
21 Apr 23 |
nicklas |
120 |
boolean copyToStdout = Values.getBoolean(request.getParameter("copyToStdout")); |
8144 |
21 Apr 23 |
nicklas |
121 |
boolean autoUpdate = Values.getBoolean(request.getParameter("autoUpdate")); |
8144 |
21 Apr 23 |
nicklas |
122 |
ExtensionsLog serviceLog = ExtensionsLog.getLog(extensionId, true); |
8144 |
21 Apr 23 |
nicklas |
123 |
ExtensionsLogger logger = serviceLog.createLogger(); |
8144 |
21 Apr 23 |
nicklas |
124 |
if (copyToStdout != serviceLog.isCopyingToStdout()) |
8144 |
21 Apr 23 |
nicklas |
125 |
{ |
8144 |
21 Apr 23 |
nicklas |
126 |
if (!copyToStdout) logger.info("Stop copy to stdout"); |
8144 |
21 Apr 23 |
nicklas |
127 |
serviceLog.setCopyToStdout(copyToStdout); |
8144 |
21 Apr 23 |
nicklas |
128 |
if (copyToStdout) logger.info("Start copy to stdout"); |
8144 |
21 Apr 23 |
nicklas |
129 |
} |
8144 |
21 Apr 23 |
nicklas |
130 |
if (enableDebug != serviceLog.isDebugEnabled()) |
8144 |
21 Apr 23 |
nicklas |
131 |
{ |
8144 |
21 Apr 23 |
nicklas |
132 |
if (!enableDebug) logger.debug("Debug logging was disabled"); |
8144 |
21 Apr 23 |
nicklas |
133 |
serviceLog.setDebugEnabled(enableDebug); |
8144 |
21 Apr 23 |
nicklas |
134 |
if (enableDebug) logger.debug("Debug logging was enabled"); |
8144 |
21 Apr 23 |
nicklas |
135 |
} |
8144 |
21 Apr 23 |
nicklas |
136 |
redirect = "view_log.jsp?ID="+ID+"&extensionId="+HTML.urlEncode(extensionId)+"&autoUpdate="+autoUpdate; |
8144 |
21 Apr 23 |
nicklas |
137 |
} |
4168 |
04 Mar 08 |
nicklas |
138 |
else |
4168 |
04 Mar 08 |
nicklas |
139 |
{ |
4168 |
04 Mar 08 |
nicklas |
140 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
4168 |
04 Mar 08 |
nicklas |
141 |
} |
4168 |
04 Mar 08 |
nicklas |
142 |
} |
4168 |
04 Mar 08 |
nicklas |
143 |
finally |
4168 |
04 Mar 08 |
nicklas |
144 |
{ |
4168 |
04 Mar 08 |
nicklas |
145 |
if (dc != null) dc.close(); |
4168 |
04 Mar 08 |
nicklas |
146 |
} |
4168 |
04 Mar 08 |
nicklas |
147 |
|
4168 |
04 Mar 08 |
nicklas |
148 |
if (forward != null) |
4168 |
04 Mar 08 |
nicklas |
149 |
{ |
6192 |
31 Oct 12 |
nicklas |
150 |
sc.setSessionSetting("alert-message", message); |
4168 |
04 Mar 08 |
nicklas |
151 |
pageContext.forward(forward); |
4168 |
04 Mar 08 |
nicklas |
152 |
} |
4168 |
04 Mar 08 |
nicklas |
153 |
else if (redirect != null) |
4168 |
04 Mar 08 |
nicklas |
154 |
{ |
6192 |
31 Oct 12 |
nicklas |
155 |
sc.setSessionSetting("alert-message", message); |
4168 |
04 Mar 08 |
nicklas |
156 |
response.sendRedirect(redirect); |
4168 |
04 Mar 08 |
nicklas |
157 |
} |
4168 |
04 Mar 08 |
nicklas |
158 |
else if (message == null) |
4168 |
04 Mar 08 |
nicklas |
159 |
{ |
4168 |
04 Mar 08 |
nicklas |
160 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
4168 |
04 Mar 08 |
nicklas |
161 |
} |
4168 |
04 Mar 08 |
nicklas |
162 |
else |
4168 |
04 Mar 08 |
nicklas |
163 |
{ |
4168 |
04 Mar 08 |
nicklas |
164 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
4168 |
04 Mar 08 |
nicklas |
165 |
} |
4168 |
04 Mar 08 |
nicklas |
166 |
%> |
4168 |
04 Mar 08 |
nicklas |
167 |
|