2978 |
25 Nov 14 |
nicklas |
1 |
<%-- |
2978 |
25 Nov 14 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
2978 |
25 Nov 14 |
nicklas |
3 |
|
2978 |
25 Nov 14 |
nicklas |
4 |
This file is part of the Example Code Package for BASE. |
2978 |
25 Nov 14 |
nicklas |
5 |
Available at http://baseplugins.thep.lu.se/ |
2978 |
25 Nov 14 |
nicklas |
6 |
BASE main site: http://base.thep.lu.se/ |
2978 |
25 Nov 14 |
nicklas |
7 |
|
2978 |
25 Nov 14 |
nicklas |
8 |
This is free software; you can redistribute it and/or |
2978 |
25 Nov 14 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
2978 |
25 Nov 14 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
2978 |
25 Nov 14 |
nicklas |
11 |
of the License, or (at your option) any later version. |
2978 |
25 Nov 14 |
nicklas |
12 |
|
2978 |
25 Nov 14 |
nicklas |
13 |
The software is distributed in the hope that it will be useful, |
2978 |
25 Nov 14 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2978 |
25 Nov 14 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2978 |
25 Nov 14 |
nicklas |
16 |
GNU General Public License for more details. |
2978 |
25 Nov 14 |
nicklas |
17 |
|
2978 |
25 Nov 14 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
2978 |
25 Nov 14 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2978 |
25 Nov 14 |
nicklas |
20 |
--%> |
2978 |
25 Nov 14 |
nicklas |
21 |
<%@ page |
2978 |
25 Nov 14 |
nicklas |
22 |
pageEncoding="UTF-8" |
2978 |
25 Nov 14 |
nicklas |
23 |
session="false" |
2978 |
25 Nov 14 |
nicklas |
24 |
import="net.sf.basedb.core.Application" |
2978 |
25 Nov 14 |
nicklas |
25 |
import="net.sf.basedb.core.SessionControl" |
2978 |
25 Nov 14 |
nicklas |
26 |
import="net.sf.basedb.core.DbControl" |
2978 |
25 Nov 14 |
nicklas |
27 |
import="net.sf.basedb.util.Values" |
2978 |
25 Nov 14 |
nicklas |
28 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
2978 |
25 Nov 14 |
nicklas |
29 |
import="net.sf.basedb.clients.web.Base" |
2978 |
25 Nov 14 |
nicklas |
30 |
import="net.sf.basedb.clients.web.util.HTML" |
2978 |
25 Nov 14 |
nicklas |
31 |
import="net.sf.basedb.clients.web.extensions.skin.FixedSkinActionFactory" |
2978 |
25 Nov 14 |
nicklas |
32 |
%> |
2978 |
25 Nov 14 |
nicklas |
33 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2978 |
25 Nov 14 |
nicklas |
34 |
<% |
2978 |
25 Nov 14 |
nicklas |
35 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2978 |
25 Nov 14 |
nicklas |
36 |
final String ID = sc.getId(); |
2978 |
25 Nov 14 |
nicklas |
37 |
final String cmd = request.getParameter("cmd"); |
2978 |
25 Nov 14 |
nicklas |
38 |
final String root = request.getContextPath()+"/"; |
2978 |
25 Nov 14 |
nicklas |
39 |
|
2978 |
25 Nov 14 |
nicklas |
40 |
DbControl dc = null; |
2978 |
25 Nov 14 |
nicklas |
41 |
String message = ""; |
2978 |
25 Nov 14 |
nicklas |
42 |
try |
2978 |
25 Nov 14 |
nicklas |
43 |
{ |
2978 |
25 Nov 14 |
nicklas |
44 |
if ("SaveOptions".equals(cmd)) |
2978 |
25 Nov 14 |
nicklas |
45 |
{ |
2978 |
25 Nov 14 |
nicklas |
46 |
dc = sc.newDbControl(); |
2978 |
25 Nov 14 |
nicklas |
47 |
String serverId = Values.getStringOrNull(request.getParameter("server-id-text")); |
2978 |
25 Nov 14 |
nicklas |
48 |
ExtensionsControl ec = ExtensionsControl.get(dc); |
2978 |
25 Nov 14 |
nicklas |
49 |
|
2978 |
25 Nov 14 |
nicklas |
50 |
// Save as setting so that the value survive server restarts |
2978 |
25 Nov 14 |
nicklas |
51 |
ec.setSetting("net.sf.basedb.skincollection.server-id", "data-text", serverId); |
2978 |
25 Nov 14 |
nicklas |
52 |
ec.saveSettings(); |
2978 |
25 Nov 14 |
nicklas |
53 |
|
2978 |
25 Nov 14 |
nicklas |
54 |
// Modify the existing factory |
2978 |
25 Nov 14 |
nicklas |
55 |
FixedSkinActionFactory factory = (FixedSkinActionFactory)ec.getExtension("net.sf.basedb.skincollection.server-id").getActionFactory(); |
2978 |
25 Nov 14 |
nicklas |
56 |
factory.setParameter("data-text", serverId); |
2978 |
25 Nov 14 |
nicklas |
57 |
|
2978 |
25 Nov 14 |
nicklas |
58 |
message = "Options saved"; |
2978 |
25 Nov 14 |
nicklas |
59 |
} |
2978 |
25 Nov 14 |
nicklas |
60 |
} |
2978 |
25 Nov 14 |
nicklas |
61 |
finally |
2978 |
25 Nov 14 |
nicklas |
62 |
{ |
2978 |
25 Nov 14 |
nicklas |
63 |
if (dc != null) dc.close(); |
2978 |
25 Nov 14 |
nicklas |
64 |
} |
2978 |
25 Nov 14 |
nicklas |
65 |
response.sendRedirect(root + "common/close_popup.jsp?ID="+ID+"&refresh_opener=1&message="+HTML.urlEncode(message)); |
2978 |
25 Nov 14 |
nicklas |
66 |
|
2978 |
25 Nov 14 |
nicklas |
67 |
%> |