1 | <%-- $Id: index.jsp 2978 2006-11-30 07:27:42Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Nicklas Nordborg |
---|
4 | |
---|
5 | This file is part of BASE - BioArray Software Environment. |
---|
6 | Available at http://base.thep.lu.se/ |
---|
7 | |
---|
8 | This file is part of BASE. |
---|
9 | |
---|
10 | BASE is free software; you can redistribute it and/or |
---|
11 | modify it under the terms of the GNU General Public License |
---|
12 | as published by the Free Software Foundation; either version 2 |
---|
13 | of the License, or (at your option) any later version. |
---|
14 | |
---|
15 | BASE is distributed in the hope that it will be useful, |
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | GNU General Public License for more details. |
---|
19 | |
---|
20 | You should have received a copy of the GNU General Public License |
---|
21 | along with this program; if not, write to the Free Software |
---|
22 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
23 | Boston, MA 02111-1307, USA. |
---|
24 | ------------------------------------------------------------------ |
---|
25 | |
---|
26 | @author Nicklas |
---|
27 | @version 2.0 |
---|
28 | --%> |
---|
29 | <%@ page session="false" |
---|
30 | import="net.sf.basedb.core.SessionControl" |
---|
31 | import="net.sf.basedb.core.DbControl" |
---|
32 | import="net.sf.basedb.core.Item" |
---|
33 | import="net.sf.basedb.core.ItemContext" |
---|
34 | import="net.sf.basedb.core.BioAssaySet" |
---|
35 | import="net.sf.basedb.clients.web.Base" |
---|
36 | import="net.sf.basedb.clients.web.ExperimentExplorer" |
---|
37 | import="net.sf.basedb.clients.web.WebException" |
---|
38 | import="net.sf.basedb.util.Values" |
---|
39 | import="net.sf.basedb.clients.web.util.HTML" |
---|
40 | %> |
---|
41 | <% |
---|
42 | final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id")); |
---|
43 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
44 | final String ID = sc.getId(); |
---|
45 | final String cmd = request.getParameter("cmd"); |
---|
46 | final String root = request.getContextPath()+"/"; |
---|
47 | |
---|
48 | final String listPage = "list.jsp?ID="+ID+"&bioassayset_id="+bioAssaySetId; |
---|
49 | |
---|
50 | String forward = null; |
---|
51 | String redirect = null; |
---|
52 | String message = null; |
---|
53 | |
---|
54 | DbControl dc = null; |
---|
55 | try |
---|
56 | { |
---|
57 | dc = sc.newDbControl(); |
---|
58 | BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId); |
---|
59 | ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet); |
---|
60 | if (cmd == null || "List".equals(cmd)) |
---|
61 | { |
---|
62 | ItemContext cc = explorer.getAndSetReporterContext(sc, null); |
---|
63 | redirect = listPage; |
---|
64 | } |
---|
65 | else if ("UpdateContext".equals(cmd)) |
---|
66 | { |
---|
67 | ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext); |
---|
68 | redirect = listPage; |
---|
69 | } |
---|
70 | else |
---|
71 | { |
---|
72 | throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
---|
73 | } |
---|
74 | } |
---|
75 | finally |
---|
76 | { |
---|
77 | if (dc != null) dc.close(); |
---|
78 | } |
---|
79 | if (forward != null) |
---|
80 | { |
---|
81 | pageContext.forward(forward); |
---|
82 | } |
---|
83 | else if (redirect != null) |
---|
84 | { |
---|
85 | response.sendRedirect(redirect); |
---|
86 | } |
---|
87 | else if (message == null) |
---|
88 | { |
---|
89 | response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
---|
90 | } |
---|
91 | else |
---|
92 | { |
---|
93 | response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
---|
94 | } |
---|
95 | |
---|
96 | %> |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|