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" |
2487 |
04 Aug 06 |
nicklas |
33 |
import="net.sf.basedb.clients.web.Base" |
2487 |
04 Aug 06 |
nicklas |
34 |
import="net.sf.basedb.clients.web.ExperimentExplorer" |
2487 |
04 Aug 06 |
nicklas |
35 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
36 |
import="net.sf.basedb.util.Values" |
2487 |
04 Aug 06 |
nicklas |
37 |
import="net.sf.basedb.clients.web.util.HTML" |
5105 |
28 Sep 09 |
nicklas |
38 |
import="java.util.Set" |
5105 |
28 Sep 09 |
nicklas |
39 |
import="java.util.Arrays" |
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 viewPage = "view.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"); |
2487 |
04 Aug 06 |
nicklas |
58 |
BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId); |
2487 |
04 Aug 06 |
nicklas |
59 |
ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet); |
2490 |
08 Aug 06 |
nicklas |
60 |
if (cmd == null || "Explore".equals(cmd)) |
2487 |
04 Aug 06 |
nicklas |
61 |
{ |
2487 |
04 Aug 06 |
nicklas |
62 |
redirect = viewPage; |
2487 |
04 Aug 06 |
nicklas |
63 |
} |
2487 |
04 Aug 06 |
nicklas |
64 |
else if ("UpdateContext".equals(cmd)) |
2487 |
04 Aug 06 |
nicklas |
65 |
{ |
2487 |
04 Aug 06 |
nicklas |
66 |
ItemContext cc = explorer.getAndSetSpotContext(sc, pageContext); |
2487 |
04 Aug 06 |
nicklas |
67 |
redirect = viewPage; |
2487 |
04 Aug 06 |
nicklas |
68 |
} |
5111 |
30 Sep 09 |
nicklas |
69 |
else if ("SetReporterColumns".equals(cmd)) |
5111 |
30 Sep 09 |
nicklas |
70 |
{ |
5111 |
30 Sep 09 |
nicklas |
71 |
ItemContext cc = explorer.getAndSetSpotContext(sc, null); |
5111 |
30 Sep 09 |
nicklas |
72 |
cc.setSetting("reporter-columns", Values.getString(request.getParameter("columns"), cc.getSetting("reporter-columns"))); |
5111 |
30 Sep 09 |
nicklas |
73 |
redirect = viewPage; |
5111 |
30 Sep 09 |
nicklas |
74 |
} |
2487 |
04 Aug 06 |
nicklas |
75 |
else if ("SetReporterIndex".equals(cmd)) |
2487 |
04 Aug 06 |
nicklas |
76 |
{ |
2487 |
04 Aug 06 |
nicklas |
77 |
explorer.setReporterIndex(Values.getInt(request.getParameter("reporterIndex"))); |
2487 |
04 Aug 06 |
nicklas |
78 |
redirect = viewPage; |
2487 |
04 Aug 06 |
nicklas |
79 |
} |
2487 |
04 Aug 06 |
nicklas |
80 |
else if ("SetSpotIndex".equals(cmd)) |
2487 |
04 Aug 06 |
nicklas |
81 |
{ |
2487 |
04 Aug 06 |
nicklas |
82 |
explorer.setPositionIndex(Values.getInt(request.getParameter("spotIndex"))); |
2487 |
04 Aug 06 |
nicklas |
83 |
redirect = viewPage; |
2487 |
04 Aug 06 |
nicklas |
84 |
} |
2490 |
08 Aug 06 |
nicklas |
85 |
else if ("SetAnnotationType".equals(cmd)) |
2490 |
08 Aug 06 |
nicklas |
86 |
{ |
5137 |
15 Oct 09 |
nicklas |
87 |
Integer[] annotationTypes = Values.getInt(request.getParameter("annotationtype_id").split("\\|")); |
5147 |
20 Oct 09 |
nicklas |
88 |
explorer.setAnnotationTypeIds(Arrays.asList(annotationTypes)); |
2490 |
08 Aug 06 |
nicklas |
89 |
|
2502 |
09 Aug 06 |
nicklas |
90 |
// If an annotation type is selected the annotation column must be visible as the first column |
2490 |
08 Aug 06 |
nicklas |
91 |
ItemContext cc = explorer.getAndSetSpotContext(sc, null); |
2490 |
08 Aug 06 |
nicklas |
92 |
String columns = cc.getSetting("columns"); |
5105 |
28 Sep 09 |
nicklas |
93 |
columns = columns.replaceAll("annotation\\.\\d+,", ""); |
5105 |
28 Sep 09 |
nicklas |
94 |
for (Integer atId : annotationTypes) |
2490 |
08 Aug 06 |
nicklas |
95 |
{ |
5105 |
28 Sep 09 |
nicklas |
96 |
columns = "annotation." + atId + "," + columns; |
2490 |
08 Aug 06 |
nicklas |
97 |
} |
2490 |
08 Aug 06 |
nicklas |
98 |
cc.setSetting("columns", columns); |
2490 |
08 Aug 06 |
nicklas |
99 |
redirect = viewPage; |
2490 |
08 Aug 06 |
nicklas |
100 |
} |
2487 |
04 Aug 06 |
nicklas |
101 |
else |
2487 |
04 Aug 06 |
nicklas |
102 |
{ |
2487 |
04 Aug 06 |
nicklas |
103 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
2487 |
04 Aug 06 |
nicklas |
104 |
} |
2487 |
04 Aug 06 |
nicklas |
105 |
} |
2487 |
04 Aug 06 |
nicklas |
106 |
finally |
2487 |
04 Aug 06 |
nicklas |
107 |
{ |
2487 |
04 Aug 06 |
nicklas |
108 |
if (dc != null) dc.close(); |
2487 |
04 Aug 06 |
nicklas |
109 |
} |
2487 |
04 Aug 06 |
nicklas |
110 |
if (forward != null) |
2487 |
04 Aug 06 |
nicklas |
111 |
{ |
6192 |
31 Oct 12 |
nicklas |
112 |
sc.setSessionSetting("alert-message", message); |
2487 |
04 Aug 06 |
nicklas |
113 |
pageContext.forward(forward); |
2487 |
04 Aug 06 |
nicklas |
114 |
} |
2487 |
04 Aug 06 |
nicklas |
115 |
else if (redirect != null) |
2487 |
04 Aug 06 |
nicklas |
116 |
{ |
6192 |
31 Oct 12 |
nicklas |
117 |
sc.setSessionSetting("alert-message", message); |
2487 |
04 Aug 06 |
nicklas |
118 |
response.sendRedirect(redirect); |
2487 |
04 Aug 06 |
nicklas |
119 |
} |
2487 |
04 Aug 06 |
nicklas |
120 |
else if (message == null) |
2487 |
04 Aug 06 |
nicklas |
121 |
{ |
2487 |
04 Aug 06 |
nicklas |
122 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
2487 |
04 Aug 06 |
nicklas |
123 |
} |
2487 |
04 Aug 06 |
nicklas |
124 |
else |
2487 |
04 Aug 06 |
nicklas |
125 |
{ |
2487 |
04 Aug 06 |
nicklas |
126 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
2487 |
04 Aug 06 |
nicklas |
127 |
} |
2487 |
04 Aug 06 |
nicklas |
128 |
|
2487 |
04 Aug 06 |
nicklas |
129 |
%> |
2487 |
04 Aug 06 |
nicklas |
130 |
|
2487 |
04 Aug 06 |
nicklas |
131 |
|
2487 |
04 Aug 06 |
nicklas |
132 |
|
2487 |
04 Aug 06 |
nicklas |
133 |
|