2487 |
04 Aug 06 |
nicklas |
1 |
<%-- $Id$ |
2487 |
04 Aug 06 |
nicklas |
2 |
------------------------------------------------------------------ |
2487 |
04 Aug 06 |
nicklas |
Copyright (C) 2006 Nicklas Nordborg |
2487 |
04 Aug 06 |
nicklas |
4 |
|
2487 |
04 Aug 06 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
2487 |
04 Aug 06 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
2487 |
04 Aug 06 |
nicklas |
7 |
|
2487 |
04 Aug 06 |
nicklas |
8 |
This file is part of BASE. |
2487 |
04 Aug 06 |
nicklas |
9 |
|
2487 |
04 Aug 06 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
2487 |
04 Aug 06 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
2487 |
04 Aug 06 |
nicklas |
13 |
of the License, or (at your option) any later version. |
2487 |
04 Aug 06 |
nicklas |
14 |
|
2487 |
04 Aug 06 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
2487 |
04 Aug 06 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2487 |
04 Aug 06 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2487 |
04 Aug 06 |
nicklas |
18 |
GNU General Public License for more details. |
2487 |
04 Aug 06 |
nicklas |
19 |
|
2487 |
04 Aug 06 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2487 |
04 Aug 06 |
nicklas |
22 |
------------------------------------------------------------------ |
2487 |
04 Aug 06 |
nicklas |
23 |
|
2487 |
04 Aug 06 |
nicklas |
24 |
@author Nicklas |
2487 |
04 Aug 06 |
nicklas |
25 |
@version 2.0 |
2487 |
04 Aug 06 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
2487 |
04 Aug 06 |
nicklas |
28 |
import="net.sf.basedb.core.SessionControl" |
2487 |
04 Aug 06 |
nicklas |
29 |
import="net.sf.basedb.core.DbControl" |
2487 |
04 Aug 06 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
2487 |
04 Aug 06 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
2487 |
04 Aug 06 |
nicklas |
32 |
import="net.sf.basedb.core.BioAssaySet" |
5711 |
30 Aug 11 |
nicklas |
33 |
import="net.sf.basedb.core.DynamicReporterQuery" |
2487 |
04 Aug 06 |
nicklas |
34 |
import="net.sf.basedb.clients.web.Base" |
2487 |
04 Aug 06 |
nicklas |
35 |
import="net.sf.basedb.clients.web.ExperimentExplorer" |
2487 |
04 Aug 06 |
nicklas |
36 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
37 |
import="net.sf.basedb.util.Values" |
2487 |
04 Aug 06 |
nicklas |
38 |
import="net.sf.basedb.clients.web.util.HTML" |
4306 |
21 May 08 |
nicklas |
39 |
import="java.util.Collections" |
2487 |
04 Aug 06 |
nicklas |
40 |
%> |
2487 |
04 Aug 06 |
nicklas |
41 |
<% |
2487 |
04 Aug 06 |
nicklas |
42 |
final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id")); |
2487 |
04 Aug 06 |
nicklas |
43 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2487 |
04 Aug 06 |
nicklas |
44 |
final String ID = sc.getId(); |
2487 |
04 Aug 06 |
nicklas |
45 |
final String cmd = request.getParameter("cmd"); |
2487 |
04 Aug 06 |
nicklas |
46 |
final String root = request.getContextPath()+"/"; |
2487 |
04 Aug 06 |
nicklas |
47 |
|
2487 |
04 Aug 06 |
nicklas |
48 |
final String listPage = "list.jsp?ID="+ID+"&bioassayset_id="+bioAssaySetId; |
2487 |
04 Aug 06 |
nicklas |
49 |
|
2487 |
04 Aug 06 |
nicklas |
50 |
String forward = null; |
2487 |
04 Aug 06 |
nicklas |
51 |
String redirect = null; |
2487 |
04 Aug 06 |
nicklas |
52 |
String message = null; |
2487 |
04 Aug 06 |
nicklas |
53 |
|
2487 |
04 Aug 06 |
nicklas |
54 |
DbControl dc = null; |
2487 |
04 Aug 06 |
nicklas |
55 |
try |
2487 |
04 Aug 06 |
nicklas |
56 |
{ |
7954 |
12 May 21 |
nicklas |
57 |
dc = sc.newDbControl(":Experiment explorer search"); |
2487 |
04 Aug 06 |
nicklas |
58 |
BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId); |
2487 |
04 Aug 06 |
nicklas |
59 |
ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet); |
2487 |
04 Aug 06 |
nicklas |
60 |
if (cmd == null || "List".equals(cmd)) |
2487 |
04 Aug 06 |
nicklas |
61 |
{ |
2490 |
08 Aug 06 |
nicklas |
62 |
ItemContext cc = explorer.getAndSetReporterContext(sc, null); |
2487 |
04 Aug 06 |
nicklas |
63 |
redirect = listPage; |
2487 |
04 Aug 06 |
nicklas |
64 |
} |
2487 |
04 Aug 06 |
nicklas |
65 |
else if ("UpdateContext".equals(cmd)) |
2487 |
04 Aug 06 |
nicklas |
66 |
{ |
2490 |
08 Aug 06 |
nicklas |
67 |
ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext); |
2487 |
04 Aug 06 |
nicklas |
68 |
redirect = listPage; |
2487 |
04 Aug 06 |
nicklas |
69 |
} |
4306 |
21 May 08 |
nicklas |
70 |
else if ("CreateReporterList".equals(cmd)) |
4306 |
21 May 08 |
nicklas |
71 |
{ |
4306 |
21 May 08 |
nicklas |
72 |
ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext); |
5711 |
30 Aug 11 |
nicklas |
73 |
cc.setObject("reporter-list-creator", explorer); |
4306 |
21 May 08 |
nicklas |
74 |
redirect = "../../../reporterlists/index.jsp?ID="+ID+ |
4456 |
05 Sep 08 |
martin |
75 |
"&cmd=NewItem&addReporters=1&formId=reporters&fromContext=" + cc.getItemType().name() + |
4306 |
21 May 08 |
nicklas |
76 |
"&subContext="+cc.getSubContext() + "&name=" + HTML.urlEncode(bioAssaySet.getName()); |
4306 |
21 May 08 |
nicklas |
77 |
} |
4306 |
21 May 08 |
nicklas |
78 |
|
2487 |
04 Aug 06 |
nicklas |
79 |
else |
2487 |
04 Aug 06 |
nicklas |
80 |
{ |
2487 |
04 Aug 06 |
nicklas |
81 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
2487 |
04 Aug 06 |
nicklas |
82 |
} |
2487 |
04 Aug 06 |
nicklas |
83 |
} |
2487 |
04 Aug 06 |
nicklas |
84 |
finally |
2487 |
04 Aug 06 |
nicklas |
85 |
{ |
2487 |
04 Aug 06 |
nicklas |
86 |
if (dc != null) dc.close(); |
2487 |
04 Aug 06 |
nicklas |
87 |
} |
2487 |
04 Aug 06 |
nicklas |
88 |
if (forward != null) |
2487 |
04 Aug 06 |
nicklas |
89 |
{ |
6192 |
31 Oct 12 |
nicklas |
90 |
sc.setSessionSetting("alert-message", message); |
2487 |
04 Aug 06 |
nicklas |
91 |
pageContext.forward(forward); |
2487 |
04 Aug 06 |
nicklas |
92 |
} |
2487 |
04 Aug 06 |
nicklas |
93 |
else if (redirect != null) |
2487 |
04 Aug 06 |
nicklas |
94 |
{ |
6192 |
31 Oct 12 |
nicklas |
95 |
sc.setSessionSetting("alert-message", message); |
2487 |
04 Aug 06 |
nicklas |
96 |
response.sendRedirect(redirect); |
2487 |
04 Aug 06 |
nicklas |
97 |
} |
2487 |
04 Aug 06 |
nicklas |
98 |
else if (message == null) |
2487 |
04 Aug 06 |
nicklas |
99 |
{ |
2487 |
04 Aug 06 |
nicklas |
100 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
2487 |
04 Aug 06 |
nicklas |
101 |
} |
2487 |
04 Aug 06 |
nicklas |
102 |
else |
2487 |
04 Aug 06 |
nicklas |
103 |
{ |
2487 |
04 Aug 06 |
nicklas |
104 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
2487 |
04 Aug 06 |
nicklas |
105 |
} |
2487 |
04 Aug 06 |
nicklas |
106 |
|
2487 |
04 Aug 06 |
nicklas |
107 |
%> |
2487 |
04 Aug 06 |
nicklas |
108 |
|
2487 |
04 Aug 06 |
nicklas |
109 |
|
2487 |
04 Aug 06 |
nicklas |
110 |
|
2487 |
04 Aug 06 |
nicklas |
111 |
|