source: extensions/net.sf.basedb.genepattern/trunk/resources/submit.jsp @ 1102

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

Fixes #221: Configure GenePattern? server

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.0 KB
Line 
1<%-- $Id $
2  ------------------------------------------------------------------
3  Copyright (C) 2009 Nicklas Nordborg
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  BASE is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 3
11  of the License, or (at your option) any later version.
12
13  BASE is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
21
22  @author Nicklas
23--%>
24<%@ page
25  pageEncoding="UTF-8"
26  session="false"
27  import="net.sf.basedb.core.Application"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.User"
31  import="net.sf.basedb.core.Presets"
32  import="net.sf.basedb.core.Presets.Preset"
33  import="net.sf.basedb.clients.web.Base"
34  import="net.sf.basedb.clients.web.WebException"
35  import="net.sf.basedb.clients.web.util.HTML"
36  import="net.sf.basedb.util.Values"
37%>
38<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
39<%
40SessionControl sc = Base.getExistingSessionControl(pageContext, true);
41String ID = sc.getId();
42String cmd = request.getParameter("cmd");
43String root = request.getContextPath()+"/";
44
45String redirect = null;
46String message = null;
47
48try
49{
50  if ("SaveServer".equals(cmd))
51  {
52    String presetsXml = sc.getUserClientSetting("net.sf.basedb.genepattern.options");
53    Presets presets = new Presets();
54    if (presetsXml != null) presets.loadFrom(presetsXml);
55    String gpServer = request.getParameter("gpServer");
56    Preset server = presets.getPreset(gpServer);
57    server.setSetting("server.login", request.getParameter("gpLogin"));
58    server.setSetting("server.password", request.getParameter("gpPassword"));
59    sc.setUserClientSetting("net.sf.basedb.genepattern.options", presets.asXml());
60    message = gpServer + " stored ok";
61  }
62  else if ("RemoveServer".equals(cmd))
63  {
64    String presetsXml = sc.getUserClientSetting("net.sf.basedb.genepattern.options");
65    Presets presets = new Presets();
66    if (presetsXml != null) presets.loadFrom(presetsXml);
67    String gpServer = request.getParameter("gpServer");
68    presets.deletePreset(gpServer);
69    sc.setUserClientSetting("net.sf.basedb.genepattern.options", presets.asXml());
70    message = gpServer + " deleted";   
71  }
72  else
73  {
74    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
75  }
76}
77finally
78{}
79if (message == null)
80{
81  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=0&wait=0");
82}
83else
84{
85  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
86}
87%>
88
Note: See TracBrowser for help on using the repository browser.