1675 |
01 Dec 05 |
nicklas |
1 |
<%-- $Id$ |
1675 |
01 Dec 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
1675 |
01 Dec 05 |
nicklas |
5 |
|
2304 |
22 May 06 |
jari |
6 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
7 |
Available at http://base.thep.lu.se/ |
1675 |
01 Dec 05 |
nicklas |
8 |
|
1675 |
01 Dec 05 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
1675 |
01 Dec 05 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
1675 |
01 Dec 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
1675 |
01 Dec 05 |
nicklas |
13 |
|
1675 |
01 Dec 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
1675 |
01 Dec 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1675 |
01 Dec 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1675 |
01 Dec 05 |
nicklas |
17 |
GNU General Public License for more details. |
1675 |
01 Dec 05 |
nicklas |
18 |
|
1675 |
01 Dec 05 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1675 |
01 Dec 05 |
nicklas |
21 |
------------------------------------------------------------------ |
1675 |
01 Dec 05 |
nicklas |
22 |
|
1675 |
01 Dec 05 |
nicklas |
23 |
@author Nicklas |
1675 |
01 Dec 05 |
nicklas |
24 |
@version 2.0 |
1675 |
01 Dec 05 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1675 |
01 Dec 05 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
1675 |
01 Dec 05 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
1675 |
01 Dec 05 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
1777 |
17 Jan 06 |
nicklas |
30 |
import="net.sf.basedb.core.Include" |
1675 |
01 Dec 05 |
nicklas |
31 |
import="net.sf.basedb.core.Experiment" |
1777 |
17 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.RawBioAssay" |
6909 |
18 May 15 |
nicklas |
33 |
import="net.sf.basedb.core.RootRawBioAssay" |
2164 |
18 Apr 06 |
nicklas |
34 |
import="net.sf.basedb.core.AnnotationType" |
1675 |
01 Dec 05 |
nicklas |
35 |
import="net.sf.basedb.core.RawDataType" |
1675 |
01 Dec 05 |
nicklas |
36 |
import="net.sf.basedb.core.RawDataTypes" |
1777 |
17 Jan 06 |
nicklas |
37 |
import="net.sf.basedb.core.User" |
2694 |
03 Oct 06 |
nicklas |
38 |
import="net.sf.basedb.core.Directory" |
5878 |
17 Nov 11 |
nicklas |
39 |
import="net.sf.basedb.core.ReporterCloneTemplate" |
5878 |
17 Nov 11 |
nicklas |
40 |
import="net.sf.basedb.core.ReporterCloneBatcher" |
5878 |
17 Nov 11 |
nicklas |
41 |
import="net.sf.basedb.core.PluginDefinition" |
5878 |
17 Nov 11 |
nicklas |
42 |
import="net.sf.basedb.core.Job" |
5878 |
17 Nov 11 |
nicklas |
43 |
import="net.sf.basedb.core.ItemParameterType" |
5897 |
02 Dec 11 |
nicklas |
44 |
import="net.sf.basedb.core.StringParameterType" |
1675 |
01 Dec 05 |
nicklas |
45 |
import="net.sf.basedb.core.ItemQuery" |
1675 |
01 Dec 05 |
nicklas |
46 |
import="net.sf.basedb.core.ItemResultIterator" |
1675 |
01 Dec 05 |
nicklas |
47 |
import="net.sf.basedb.core.Permission" |
1777 |
17 Jan 06 |
nicklas |
48 |
import="net.sf.basedb.core.ItemContext" |
1777 |
17 Jan 06 |
nicklas |
49 |
import="net.sf.basedb.core.MultiPermissions" |
4587 |
15 Oct 08 |
martin |
50 |
import="net.sf.basedb.core.OwnedItem" |
1777 |
17 Jan 06 |
nicklas |
51 |
import="net.sf.basedb.core.PermissionDeniedException" |
1777 |
17 Jan 06 |
nicklas |
52 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
5186 |
06 Nov 09 |
nicklas |
53 |
import="net.sf.basedb.core.SimpleProgressReporter" |
5176 |
30 Oct 09 |
nicklas |
54 |
import="net.sf.basedb.core.snapshot.SnapshotManager" |
5878 |
17 Nov 11 |
nicklas |
55 |
import="net.sf.basedb.plugins.CloneReportersPlugin" |
1777 |
17 Jan 06 |
nicklas |
56 |
import="net.sf.basedb.util.RemovableUtil" |
1777 |
17 Jan 06 |
nicklas |
57 |
import="net.sf.basedb.util.ShareableUtil" |
2918 |
15 Nov 06 |
nicklas |
58 |
import="net.sf.basedb.util.OwnableUtil" |
1675 |
01 Dec 05 |
nicklas |
59 |
import="net.sf.basedb.clients.web.Base" |
1777 |
17 Jan 06 |
nicklas |
60 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
61 |
import="net.sf.basedb.util.Values" |
1675 |
01 Dec 05 |
nicklas |
62 |
import="net.sf.basedb.clients.web.util.HTML" |
2942 |
22 Nov 06 |
nicklas |
63 |
import="net.sf.basedb.util.formatter.Formatter" |
2942 |
22 Nov 06 |
nicklas |
64 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
5503 |
18 Nov 10 |
nicklas |
65 |
import="net.sf.basedb.core.plugin.GuiContext" |
5503 |
18 Nov 10 |
nicklas |
66 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5503 |
18 Nov 10 |
nicklas |
67 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5503 |
18 Nov 10 |
nicklas |
68 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5503 |
18 Nov 10 |
nicklas |
69 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
70 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveAction" |
5503 |
18 Nov 10 |
nicklas |
71 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveRenderer" |
6040 |
30 Mar 12 |
nicklas |
72 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
73 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6040 |
30 Mar 12 |
nicklas |
74 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
1777 |
17 Jan 06 |
nicklas |
75 |
import="java.util.Enumeration" |
1777 |
17 Jan 06 |
nicklas |
76 |
import="java.util.Set" |
1777 |
17 Jan 06 |
nicklas |
77 |
import="java.util.HashSet" |
1675 |
01 Dec 05 |
nicklas |
78 |
import="java.util.List" |
6696 |
28 Jan 15 |
nicklas |
79 |
import="java.util.Arrays" |
1777 |
17 Jan 06 |
nicklas |
80 |
import="java.util.ArrayList" |
1777 |
17 Jan 06 |
nicklas |
81 |
import="java.util.Collections" |
2942 |
22 Nov 06 |
nicklas |
82 |
import="java.util.Date" |
1675 |
01 Dec 05 |
nicklas |
83 |
%> |
1675 |
01 Dec 05 |
nicklas |
84 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1675 |
01 Dec 05 |
nicklas |
85 |
<%! |
1777 |
17 Jan 06 |
nicklas |
86 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,rawDataType,description,actions"); |
1777 |
17 Jan 06 |
nicklas |
87 |
private static final Item itemType = Item.EXPERIMENT; |
1675 |
01 Dec 05 |
nicklas |
88 |
%> |
1675 |
01 Dec 05 |
nicklas |
89 |
<% |
1777 |
17 Jan 06 |
nicklas |
90 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1675 |
01 Dec 05 |
nicklas |
91 |
final String ID = sc.getId(); |
1777 |
17 Jan 06 |
nicklas |
92 |
final String cmd = request.getParameter("cmd"); |
1777 |
17 Jan 06 |
nicklas |
93 |
final String root = request.getContextPath()+"/"; |
1777 |
17 Jan 06 |
nicklas |
94 |
final String mode = request.getParameter("mode"); |
1777 |
17 Jan 06 |
nicklas |
95 |
final String callback = request.getParameter("callback"); |
1777 |
17 Jan 06 |
nicklas |
96 |
final String itemId = request.getParameter("item_id"); |
1777 |
17 Jan 06 |
nicklas |
97 |
final String listPage = "list_experiments.jsp?ID="+ID |
1777 |
17 Jan 06 |
nicklas |
98 |
+(mode == null ? "" : "&mode="+mode) |
1777 |
17 Jan 06 |
nicklas |
99 |
+(callback == null ? "" : "&callback="+callback) |
1777 |
17 Jan 06 |
nicklas |
100 |
+(itemId == null ? "" : "&item_id="+itemId); |
1777 |
17 Jan 06 |
nicklas |
101 |
final String viewPage = "view_experiment.jsp?ID="+ID; |
1777 |
17 Jan 06 |
nicklas |
102 |
final String editPage = "edit_experiment.jsp?ID="+ID; |
1675 |
01 Dec 05 |
nicklas |
103 |
|
1777 |
17 Jan 06 |
nicklas |
104 |
String forward = null; |
1777 |
17 Jan 06 |
nicklas |
105 |
String redirect = null; |
1777 |
17 Jan 06 |
nicklas |
106 |
String message = null; |
1777 |
17 Jan 06 |
nicklas |
107 |
DbControl dc = null; |
1675 |
01 Dec 05 |
nicklas |
108 |
try |
1675 |
01 Dec 05 |
nicklas |
109 |
{ |
1777 |
17 Jan 06 |
nicklas |
110 |
if (cmd == null || "List".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
111 |
{ |
1777 |
17 Jan 06 |
nicklas |
112 |
// Display the list page without updatinging the current context |
2811 |
26 Oct 06 |
nicklas |
113 |
Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
1777 |
17 Jan 06 |
nicklas |
114 |
redirect = listPage; |
1777 |
17 Jan 06 |
nicklas |
115 |
} |
1777 |
17 Jan 06 |
nicklas |
116 |
else if ("UpdateContext".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
117 |
{ |
1777 |
17 Jan 06 |
nicklas |
118 |
// Display the list page after updating the current context from the request parameters |
1777 |
17 Jan 06 |
nicklas |
119 |
Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
120 |
redirect = listPage; |
1777 |
17 Jan 06 |
nicklas |
121 |
} |
1777 |
17 Jan 06 |
nicklas |
122 |
else if ("LoadContext".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
123 |
{ |
1777 |
17 Jan 06 |
nicklas |
124 |
// Display the list page after loading a saved context |
1777 |
17 Jan 06 |
nicklas |
125 |
int contextId = Values.getInt(request.getParameter("context")); |
1777 |
17 Jan 06 |
nicklas |
126 |
Base.loadContext(sc, contextId, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
127 |
redirect = listPage; |
1777 |
17 Jan 06 |
nicklas |
128 |
} |
1675 |
01 Dec 05 |
nicklas |
129 |
|
1777 |
17 Jan 06 |
nicklas |
130 |
else if ("ViewItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
131 |
{ |
1777 |
17 Jan 06 |
nicklas |
132 |
// Display the view page for a single item |
1777 |
17 Jan 06 |
nicklas |
133 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
134 |
forward = viewPage; |
1777 |
17 Jan 06 |
nicklas |
135 |
} |
1777 |
17 Jan 06 |
nicklas |
136 |
else if ("EditItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
137 |
{ |
1777 |
17 Jan 06 |
nicklas |
138 |
// Display the edit page for a single item (should be opened in a popup) |
1777 |
17 Jan 06 |
nicklas |
139 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
140 |
redirect = editPage; |
1777 |
17 Jan 06 |
nicklas |
141 |
} |
1777 |
17 Jan 06 |
nicklas |
142 |
else if ("NewItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
143 |
{ |
1777 |
17 Jan 06 |
nicklas |
144 |
// Display the edit page for a new item (should be opened in a popup) |
1777 |
17 Jan 06 |
nicklas |
145 |
if (!sc.hasPermission(Permission.CREATE, itemType)) |
1675 |
01 Dec 05 |
nicklas |
146 |
{ |
1777 |
17 Jan 06 |
nicklas |
147 |
throw new PermissionDeniedException(Permission.CREATE, itemType.toString()); |
1675 |
01 Dec 05 |
nicklas |
148 |
} |
1777 |
17 Jan 06 |
nicklas |
149 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
150 |
cc.setId(0); |
2420 |
22 Jun 06 |
nicklas |
151 |
forward = editPage; |
1777 |
17 Jan 06 |
nicklas |
152 |
} |
1777 |
17 Jan 06 |
nicklas |
153 |
else if ("UpdateItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
154 |
{ |
1777 |
17 Jan 06 |
nicklas |
155 |
// Update the properties on an item (will close the popup) |
1777 |
17 Jan 06 |
nicklas |
156 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
2597 |
25 Aug 06 |
nicklas |
157 |
final int maxRecent = Base.getMaxRecent(sc); |
7954 |
12 May 21 |
nicklas |
158 |
dc = sc.newDbControl(":Edit "+itemType); |
1777 |
17 Jan 06 |
nicklas |
159 |
|
7605 |
26 Feb 19 |
nicklas |
160 |
Experiment experiment = cc.getObject("item"); |
1777 |
17 Jan 06 |
nicklas |
161 |
if (experiment == null) |
1675 |
01 Dec 05 |
nicklas |
162 |
{ |
1777 |
17 Jan 06 |
nicklas |
163 |
RawDataType rdt = RawDataTypes.getRawDataType(Values.getStringOrNull(request.getParameter("rawdatatype"))); |
1777 |
17 Jan 06 |
nicklas |
164 |
experiment = Experiment.getNew(dc, rdt); |
7703 |
11 Apr 19 |
nicklas |
165 |
cc.setRecent("RawDataType", rdt.getId(), maxRecent); |
1777 |
17 Jan 06 |
nicklas |
166 |
message = "Experiment created"; |
1777 |
17 Jan 06 |
nicklas |
167 |
dc.saveItem(experiment); |
1675 |
01 Dec 05 |
nicklas |
168 |
} |
1777 |
17 Jan 06 |
nicklas |
169 |
else |
1675 |
01 Dec 05 |
nicklas |
170 |
{ |
5060 |
19 Aug 09 |
nicklas |
171 |
dc.reattachItem(experiment, false); |
1777 |
17 Jan 06 |
nicklas |
172 |
message = "Experiment updated"; |
1675 |
01 Dec 05 |
nicklas |
173 |
} |
1777 |
17 Jan 06 |
nicklas |
174 |
|
5503 |
18 Nov 10 |
nicklas |
175 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(Item.EXPERIMENT), experiment); |
7604 |
25 Feb 19 |
nicklas |
176 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5503 |
18 Nov 10 |
nicklas |
177 |
try |
2694 |
03 Oct 06 |
nicklas |
178 |
{ |
5503 |
18 Nov 10 |
nicklas |
179 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
5503 |
18 Nov 10 |
nicklas |
180 |
experiment.setName(Values.getStringOrNull(request.getParameter("name"))); |
5503 |
18 Nov 10 |
nicklas |
181 |
experiment.setTitle(Values.getStringOrNull(request.getParameter("title"))); |
5503 |
18 Nov 10 |
nicklas |
182 |
experiment.setAbstract(Values.getStringOrNull(request.getParameter("abstract"))); |
5503 |
18 Nov 10 |
nicklas |
183 |
experiment.setAffiliations(Values.getStringOrNull(request.getParameter("affiliations"))); |
5503 |
18 Nov 10 |
nicklas |
184 |
experiment.setAuthors(Values.getStringOrNull(request.getParameter("authors"))); |
5503 |
18 Nov 10 |
nicklas |
185 |
experiment.setExperimentDesign(Values.getStringOrNull(request.getParameter("experimentDesign"))); |
5503 |
18 Nov 10 |
nicklas |
186 |
experiment.setExperimentType(Values.getStringOrNull(request.getParameter("experimentType"))); |
5503 |
18 Nov 10 |
nicklas |
187 |
experiment.setPublication(Values.getStringOrNull(request.getParameter("publication"))); |
5503 |
18 Nov 10 |
nicklas |
188 |
experiment.setPublicationDate(dateFormatter.parseString(Values.getStringOrNull(request.getParameter("publicationDate")))); |
5503 |
18 Nov 10 |
nicklas |
189 |
experiment.setPubMedId(Values.getStringOrNull(request.getParameter("pubMedId"))); |
5503 |
18 Nov 10 |
nicklas |
190 |
experiment.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5503 |
18 Nov 10 |
nicklas |
191 |
|
5503 |
18 Nov 10 |
nicklas |
192 |
int directoryId = Values.getInt(request.getParameter("directory_id"), -1); |
5503 |
18 Nov 10 |
nicklas |
193 |
if (directoryId >= 0) // < 0 = denied or unchanged |
5503 |
18 Nov 10 |
nicklas |
194 |
{ |
5503 |
18 Nov 10 |
nicklas |
195 |
Directory dir = directoryId == 0 ? null : Directory.getById(dc, directoryId); |
5503 |
18 Nov 10 |
nicklas |
196 |
experiment.setDirectory(dir); |
7703 |
11 Apr 19 |
nicklas |
197 |
cc.setRecent(Item.DIRECTORY, dir, maxRecent); |
5503 |
18 Nov 10 |
nicklas |
198 |
} |
5503 |
18 Nov 10 |
nicklas |
199 |
|
6315 |
06 Sep 13 |
nicklas |
200 |
String[] removeRawBioAssays = Values.getString(request.getParameter("-RAWBIOASSAY")).split(","); |
5503 |
18 Nov 10 |
nicklas |
201 |
for (int i = 0; i < removeRawBioAssays.length; ++i) |
5503 |
18 Nov 10 |
nicklas |
202 |
{ |
5503 |
18 Nov 10 |
nicklas |
203 |
int rawBioAssayId = Values.getInt(removeRawBioAssays[i], -1); |
5503 |
18 Nov 10 |
nicklas |
204 |
if (rawBioAssayId != -1) experiment.removeRawBioAssay(RawBioAssay.getById(dc, rawBioAssayId)); |
5503 |
18 Nov 10 |
nicklas |
205 |
} |
5503 |
18 Nov 10 |
nicklas |
206 |
|
6315 |
06 Sep 13 |
nicklas |
207 |
String[] addRawBioAssays = Values.getString(request.getParameter("+RAWBIOASSAY")).split(","); |
5503 |
18 Nov 10 |
nicklas |
208 |
for (int i = 0; i < addRawBioAssays.length; ++i) |
5503 |
18 Nov 10 |
nicklas |
209 |
{ |
5503 |
18 Nov 10 |
nicklas |
210 |
int rawBioAssayId = Values.getInt(addRawBioAssays[i], -1); |
5503 |
18 Nov 10 |
nicklas |
211 |
if (rawBioAssayId != -1) experiment.addRawBioAssay(RawBioAssay.getById(dc, rawBioAssayId)); |
5503 |
18 Nov 10 |
nicklas |
212 |
} |
5503 |
18 Nov 10 |
nicklas |
213 |
|
6315 |
06 Sep 13 |
nicklas |
214 |
String[] removeAnnotationTypes = Values.getString(request.getParameter("-ANNOTATIONTYPE")).split(","); |
5503 |
18 Nov 10 |
nicklas |
215 |
for (int i = 0; i < removeAnnotationTypes.length; ++i) |
5503 |
18 Nov 10 |
nicklas |
216 |
{ |
5503 |
18 Nov 10 |
nicklas |
217 |
int annotationTypeId = Values.getInt(removeAnnotationTypes[i], -1); |
5503 |
18 Nov 10 |
nicklas |
218 |
if (annotationTypeId != -1) experiment.removeExperimentalFactor(AnnotationType.getById(dc, annotationTypeId)); |
5503 |
18 Nov 10 |
nicklas |
219 |
} |
5503 |
18 Nov 10 |
nicklas |
220 |
|
6315 |
06 Sep 13 |
nicklas |
221 |
String[] addAnnotationTypes = Values.getString(request.getParameter("+ANNOTATIONTYPE")).split(","); |
5503 |
18 Nov 10 |
nicklas |
222 |
for (int i = 0; i < addAnnotationTypes.length; ++i) |
5503 |
18 Nov 10 |
nicklas |
223 |
{ |
5503 |
18 Nov 10 |
nicklas |
224 |
int annotationTypeId = Values.getInt(addAnnotationTypes[i], -1); |
5503 |
18 Nov 10 |
nicklas |
225 |
if (annotationTypeId != -1) experiment.addExperimentalFactor(AnnotationType.getById(dc, annotationTypeId)); |
5503 |
18 Nov 10 |
nicklas |
226 |
} |
5503 |
18 Nov 10 |
nicklas |
227 |
|
5966 |
16 Feb 12 |
nicklas |
228 |
// Annotations tab |
5966 |
16 Feb 12 |
nicklas |
229 |
Base.updateAnnotations(dc, experiment, experiment, request); |
5966 |
16 Feb 12 |
nicklas |
230 |
|
5503 |
18 Nov 10 |
nicklas |
231 |
// OnSave extensions |
5503 |
18 Nov 10 |
nicklas |
232 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5503 |
18 Nov 10 |
nicklas |
233 |
dc.commit(); |
5503 |
18 Nov 10 |
nicklas |
234 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
2694 |
03 Oct 06 |
nicklas |
235 |
} |
5503 |
18 Nov 10 |
nicklas |
236 |
catch (Exception ex) |
1675 |
01 Dec 05 |
nicklas |
237 |
{ |
5503 |
18 Nov 10 |
nicklas |
238 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5503 |
18 Nov 10 |
nicklas |
239 |
throw ex; |
1675 |
01 Dec 05 |
nicklas |
240 |
} |
5503 |
18 Nov 10 |
nicklas |
241 |
finally |
1675 |
01 Dec 05 |
nicklas |
242 |
{ |
5503 |
18 Nov 10 |
nicklas |
243 |
cc.removeObject("item"); |
1675 |
01 Dec 05 |
nicklas |
244 |
} |
1777 |
17 Jan 06 |
nicklas |
245 |
} |
1777 |
17 Jan 06 |
nicklas |
246 |
else if ("DeleteItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
247 |
{ |
1777 |
17 Jan 06 |
nicklas |
248 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
249 |
dc = sc.newDbControl(":Delete "+itemType); |
1777 |
17 Jan 06 |
nicklas |
250 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2526 |
15 Aug 06 |
martin |
251 |
RemovableUtil.removeRecursively(dc, itemType, Collections.singleton(cc.getId()), true); |
1777 |
17 Jan 06 |
nicklas |
252 |
dc.commit(); |
1777 |
17 Jan 06 |
nicklas |
253 |
redirect = viewPage; |
1777 |
17 Jan 06 |
nicklas |
254 |
} |
1777 |
17 Jan 06 |
nicklas |
255 |
else if ("DeleteItems".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
256 |
{ |
1777 |
17 Jan 06 |
nicklas |
257 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
258 |
dc = sc.newDbControl(":Delete "+itemType); |
1777 |
17 Jan 06 |
nicklas |
259 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
260 |
int numTotal = cc.getSelected().size(); |
2526 |
15 Aug 06 |
martin |
261 |
int[] numRemoved = RemovableUtil.removeRecursively(dc, itemType, cc.getSelected(), true); |
2526 |
15 Aug 06 |
martin |
262 |
numTotal += numRemoved[1]; |
1777 |
17 Jan 06 |
nicklas |
263 |
dc.commit(); |
2526 |
15 Aug 06 |
martin |
264 |
if (numTotal != numRemoved[0]) |
1675 |
01 Dec 05 |
nicklas |
265 |
{ |
2526 |
15 Aug 06 |
martin |
266 |
message = (numRemoved[0] == 0 ? "No" : "Only "+numRemoved[0]+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
1675 |
01 Dec 05 |
nicklas |
267 |
} |
6192 |
31 Oct 12 |
nicklas |
268 |
redirect = listPage; |
1777 |
17 Jan 06 |
nicklas |
269 |
} |
1777 |
17 Jan 06 |
nicklas |
270 |
else if ("RestoreItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
271 |
{ |
1777 |
17 Jan 06 |
nicklas |
272 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
273 |
dc = sc.newDbControl(":Restore "+itemType); |
1777 |
17 Jan 06 |
nicklas |
274 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2526 |
15 Aug 06 |
martin |
275 |
RemovableUtil.removeRecursively(dc, itemType, Collections.singleton(cc.getId()), false); |
1777 |
17 Jan 06 |
nicklas |
276 |
dc.commit(); |
1777 |
17 Jan 06 |
nicklas |
277 |
redirect = viewPage; |
1777 |
17 Jan 06 |
nicklas |
278 |
} |
1777 |
17 Jan 06 |
nicklas |
279 |
else if ("RestoreItems".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
280 |
{ |
1777 |
17 Jan 06 |
nicklas |
281 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
282 |
dc = sc.newDbControl(":Restore "+itemType); |
1777 |
17 Jan 06 |
nicklas |
283 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
284 |
int numTotal = cc.getSelected().size(); |
2526 |
15 Aug 06 |
martin |
285 |
int[] numRemoved = RemovableUtil.removeRecursively(dc, itemType, cc.getSelected(), false); |
2526 |
15 Aug 06 |
martin |
286 |
numTotal += numRemoved[1]; |
1777 |
17 Jan 06 |
nicklas |
287 |
dc.commit(); |
2526 |
15 Aug 06 |
martin |
288 |
if (numTotal != numRemoved[0]) |
1675 |
01 Dec 05 |
nicklas |
289 |
{ |
2526 |
15 Aug 06 |
martin |
290 |
message = (numRemoved[0] == 0 ? "No" : "Only "+numRemoved[0]+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
1675 |
01 Dec 05 |
nicklas |
291 |
} |
6192 |
31 Oct 12 |
nicklas |
292 |
redirect = listPage; |
1777 |
17 Jan 06 |
nicklas |
293 |
} |
1777 |
17 Jan 06 |
nicklas |
294 |
else if ("ShareItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
295 |
{ |
1777 |
17 Jan 06 |
nicklas |
296 |
// Display a popup window for sharing a single item |
7954 |
12 May 21 |
nicklas |
297 |
dc = sc.newDbControl(":Share "+itemType); |
1777 |
17 Jan 06 |
nicklas |
298 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
299 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId())); |
1777 |
17 Jan 06 |
nicklas |
300 |
dc.close(); |
1777 |
17 Jan 06 |
nicklas |
301 |
cc.setObject("MultiPermissions", permissions); |
1777 |
17 Jan 06 |
nicklas |
302 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1777 |
17 Jan 06 |
nicklas |
303 |
} |
1777 |
17 Jan 06 |
nicklas |
304 |
else if ("ShareItems".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
305 |
{ |
1777 |
17 Jan 06 |
nicklas |
306 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
307 |
dc = sc.newDbControl(":Share "+itemType); |
1777 |
17 Jan 06 |
nicklas |
308 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
309 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
1777 |
17 Jan 06 |
nicklas |
310 |
dc.close(); |
1777 |
17 Jan 06 |
nicklas |
311 |
cc.setObject("MultiPermissions", permissions); |
1777 |
17 Jan 06 |
nicklas |
312 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1777 |
17 Jan 06 |
nicklas |
313 |
} |
4578 |
13 Oct 08 |
martin |
314 |
else if ("SetOwnerOfItem".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
315 |
{ |
4578 |
13 Oct 08 |
martin |
316 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
317 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
318 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
319 |
OwnedItem item = (OwnedItem)itemType.getById(dc, cc.getId()); |
4587 |
15 Oct 08 |
martin |
320 |
cc.setObject("OwnedItems", Collections.singleton(item)); |
4578 |
13 Oct 08 |
martin |
321 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
322 |
} |
4578 |
13 Oct 08 |
martin |
323 |
else if ("SetOwnerOfItems".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
324 |
{ |
4578 |
13 Oct 08 |
martin |
325 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
326 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
327 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
328 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
4587 |
15 Oct 08 |
martin |
329 |
for (Integer id : cc.getSelected()) |
4587 |
15 Oct 08 |
martin |
330 |
{ |
4587 |
15 Oct 08 |
martin |
331 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
4587 |
15 Oct 08 |
martin |
332 |
} |
4587 |
15 Oct 08 |
martin |
333 |
dc.close(); |
4587 |
15 Oct 08 |
martin |
334 |
cc.setObject("OwnedItems", items); |
4578 |
13 Oct 08 |
martin |
335 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
336 |
} |
1777 |
17 Jan 06 |
nicklas |
337 |
else if ("ExportItems".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
338 |
{ |
1777 |
17 Jan 06 |
nicklas |
339 |
// Run an export plugin in a list context |
1777 |
17 Jan 06 |
nicklas |
340 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
341 |
final ItemQuery<Experiment> query = Experiment.getQuery(); |
7954 |
12 May 21 |
nicklas |
342 |
dc = sc.newDbControl(":Export "+itemType); |
7914 |
23 Feb 21 |
nicklas |
343 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
344 |
cc.configureQuery(dc, query, jspContext, true); |
6040 |
30 Mar 12 |
nicklas |
345 |
cc.setQuery(query); |
7604 |
25 Feb 19 |
nicklas |
346 |
ExtensionsInvoker<ListColumnAction<Experiment,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
347 |
listInvoker.render(new ListColumnExportRenderer<Experiment>(cc)); |
5590 |
16 Mar 11 |
nicklas |
348 |
dc.close(); |
4835 |
24 Mar 09 |
nicklas |
349 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+experiments"; |
1777 |
17 Jan 06 |
nicklas |
350 |
} |
1777 |
17 Jan 06 |
nicklas |
351 |
else if ("ExportItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
352 |
{ |
1777 |
17 Jan 06 |
nicklas |
353 |
// Run an export plugin in single-item context |
1777 |
17 Jan 06 |
nicklas |
354 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4835 |
24 Mar 09 |
nicklas |
355 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+experiment"; |
1777 |
17 Jan 06 |
nicklas |
356 |
} |
1777 |
17 Jan 06 |
nicklas |
357 |
else if ("ImportItems".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
358 |
{ |
1777 |
17 Jan 06 |
nicklas |
359 |
// Run an import plugin in a list context |
1777 |
17 Jan 06 |
nicklas |
360 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
361 |
final ItemQuery<Experiment> query = Experiment.getQuery(); |
7954 |
12 May 21 |
nicklas |
362 |
dc = sc.newDbControl(":Import "+itemType); |
7914 |
23 Feb 21 |
nicklas |
363 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
364 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
365 |
dc.close(); |
1777 |
17 Jan 06 |
nicklas |
366 |
cc.setQuery(query); |
4835 |
24 Mar 09 |
nicklas |
367 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+experiments"; |
1777 |
17 Jan 06 |
nicklas |
368 |
} |
1777 |
17 Jan 06 |
nicklas |
369 |
else if ("ImportItem".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
370 |
{ |
1777 |
17 Jan 06 |
nicklas |
371 |
// Run an import plugin in single-item context |
1777 |
17 Jan 06 |
nicklas |
372 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4835 |
24 Mar 09 |
nicklas |
373 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+experiment"; |
1777 |
17 Jan 06 |
nicklas |
374 |
} |
1777 |
17 Jan 06 |
nicklas |
375 |
else if ("RunListPlugin".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
376 |
{ |
1777 |
17 Jan 06 |
nicklas |
377 |
// Run another plugin in a list context |
1777 |
17 Jan 06 |
nicklas |
378 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1777 |
17 Jan 06 |
nicklas |
379 |
final ItemQuery<Experiment> query = Experiment.getQuery(); |
7954 |
12 May 21 |
nicklas |
380 |
dc = sc.newDbControl(":Run plugin "+itemType); |
7914 |
23 Feb 21 |
nicklas |
381 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
382 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
383 |
dc.close(); |
1777 |
17 Jan 06 |
nicklas |
384 |
cc.setQuery(query); |
1789 |
18 Jan 06 |
nicklas |
385 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
1777 |
17 Jan 06 |
nicklas |
386 |
} |
1777 |
17 Jan 06 |
nicklas |
387 |
else if ("RunPlugin".equals(cmd)) |
1777 |
17 Jan 06 |
nicklas |
388 |
{ |
1777 |
17 Jan 06 |
nicklas |
389 |
// Run another plugin in single-item context |
1777 |
17 Jan 06 |
nicklas |
390 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1789 |
18 Jan 06 |
nicklas |
391 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
1777 |
17 Jan 06 |
nicklas |
392 |
} |
4630 |
07 Nov 08 |
nicklas |
393 |
else if ("AutoInherit".equals(cmd)) |
4630 |
07 Nov 08 |
nicklas |
394 |
{ |
5186 |
06 Nov 09 |
nicklas |
395 |
Integer[] annotationTypeIds = Values.getInt(request.getParameterValues("autoinherit")); |
5186 |
06 Nov 09 |
nicklas |
396 |
if (annotationTypeIds.length > 0) |
4630 |
07 Nov 08 |
nicklas |
397 |
{ |
7954 |
12 May 21 |
nicklas |
398 |
dc = sc.newDbControl(":Auto-inherit experiment factors"); |
6696 |
28 Jan 15 |
nicklas |
399 |
Set<AnnotationType> annotationTypes = new HashSet<AnnotationType>(annotationTypeIds.length); |
5186 |
06 Nov 09 |
nicklas |
400 |
for (int atId : annotationTypeIds) |
5186 |
06 Nov 09 |
nicklas |
401 |
{ |
5186 |
06 Nov 09 |
nicklas |
402 |
annotationTypes.add(AnnotationType.getById(dc, atId)); |
5186 |
06 Nov 09 |
nicklas |
403 |
} |
6696 |
28 Jan 15 |
nicklas |
404 |
|
6696 |
28 Jan 15 |
nicklas |
405 |
Experiment exp = Experiment.getById(dc, Values.getInt(itemId)); |
6909 |
18 May 15 |
nicklas |
406 |
ItemQuery<RootRawBioAssay> query = exp.getRootRawBioAssays(); |
5186 |
06 Nov 09 |
nicklas |
407 |
query.include(Include.ALL); |
5186 |
06 Nov 09 |
nicklas |
408 |
query.setItemPermission(Permission.WRITE); |
6696 |
28 Jan 15 |
nicklas |
409 |
|
6909 |
18 May 15 |
nicklas |
410 |
List<RootRawBioAssay> all = query.list(dc); |
6909 |
18 May 15 |
nicklas |
411 |
ItemContext rawContext = sc.getCurrentContext(Item.ROOTRAWBIOASSAY); |
7604 |
25 Feb 19 |
nicklas |
412 |
rawContext.setObject("AnnotatedItems", new HashSet<>(all)); |
6696 |
28 Jan 15 |
nicklas |
413 |
rawContext.setObject("AnnotationTypes", annotationTypes); |
6909 |
18 May 15 |
nicklas |
414 |
redirect = "../../common/annotations/batch_inherit.jsp?ID="+ID+"&item_type=ROOTRAWBIOASSAY"; |
4630 |
07 Nov 08 |
nicklas |
415 |
} |
4630 |
07 Nov 08 |
nicklas |
416 |
} |
5878 |
17 Nov 11 |
nicklas |
417 |
else if ("CloneReporters".equals(cmd)) |
5878 |
17 Nov 11 |
nicklas |
418 |
{ |
5878 |
17 Nov 11 |
nicklas |
419 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
5878 |
17 Nov 11 |
nicklas |
420 |
final int maxRecent = Base.getMaxRecent(sc); |
5878 |
17 Nov 11 |
nicklas |
421 |
|
7954 |
12 May 21 |
nicklas |
422 |
dc = sc.newDbControl(":Clone reporters"); |
5886 |
23 Nov 11 |
nicklas |
423 |
int templateId = Values.getInt(request.getParameter("reporterclonetemplate_id")); |
5886 |
23 Nov 11 |
nicklas |
424 |
ReporterCloneTemplate template = null; |
5886 |
23 Nov 11 |
nicklas |
425 |
if (templateId > 0) |
5886 |
23 Nov 11 |
nicklas |
426 |
{ |
5886 |
23 Nov 11 |
nicklas |
427 |
template = ReporterCloneTemplate.getById(dc, templateId); |
7703 |
11 Apr 19 |
nicklas |
428 |
cc.setRecent(Item.REPORTERCLONETEMPLATE, template, maxRecent); |
5886 |
23 Nov 11 |
nicklas |
429 |
} |
5878 |
17 Nov 11 |
nicklas |
430 |
|
5878 |
17 Nov 11 |
nicklas |
431 |
Experiment exp = Experiment.getById(dc, Values.getInt(itemId)); |
5878 |
17 Nov 11 |
nicklas |
432 |
|
5878 |
17 Nov 11 |
nicklas |
433 |
PluginDefinition clonePlugin = PluginDefinition.getByClassName(dc, CloneReportersPlugin.class.getName()); |
5878 |
17 Nov 11 |
nicklas |
434 |
Job cloneJob = Job.getNew(dc, clonePlugin, null, exp); |
5886 |
23 Nov 11 |
nicklas |
435 |
if (template == null) |
5886 |
23 Nov 11 |
nicklas |
436 |
{ |
5886 |
23 Nov 11 |
nicklas |
437 |
cloneJob.setName("Cloning all reporter properties"); |
5886 |
23 Nov 11 |
nicklas |
438 |
} |
5886 |
23 Nov 11 |
nicklas |
439 |
else |
5886 |
23 Nov 11 |
nicklas |
440 |
{ |
5886 |
23 Nov 11 |
nicklas |
441 |
cloneJob.setName("Cloning reporters using template '" + template.getName() + "'"); |
5886 |
23 Nov 11 |
nicklas |
442 |
} |
5878 |
17 Nov 11 |
nicklas |
443 |
cloneJob.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5878 |
17 Nov 11 |
nicklas |
444 |
cloneJob.setParameterValue("template", "Reporter clone template", null, |
5878 |
17 Nov 11 |
nicklas |
445 |
new ItemParameterType<ReporterCloneTemplate>(ReporterCloneTemplate.class, null), template); |
5886 |
23 Nov 11 |
nicklas |
446 |
cloneJob.setParameterValue("cloneSource", "Clone source", null, |
5886 |
23 Nov 11 |
nicklas |
447 |
new StringParameterType(), request.getParameter("cloneSource")); |
6684 |
14 Jan 15 |
nicklas |
448 |
cloneJob.setScheduled(null, null); |
5878 |
17 Nov 11 |
nicklas |
449 |
dc.saveItem(cloneJob); |
5878 |
17 Nov 11 |
nicklas |
450 |
dc.commit(); |
5878 |
17 Nov 11 |
nicklas |
451 |
|
5878 |
17 Nov 11 |
nicklas |
452 |
redirect = "../jobs/index.jsp?ID=" + ID + "&cmd=ViewItem&item_id="+cloneJob.getId(); |
5878 |
17 Nov 11 |
nicklas |
453 |
} |
5878 |
17 Nov 11 |
nicklas |
454 |
else if ("RemoveClonedReporters".equals(cmd)) |
5878 |
17 Nov 11 |
nicklas |
455 |
{ |
5878 |
17 Nov 11 |
nicklas |
456 |
|
7954 |
12 May 21 |
nicklas |
457 |
dc = sc.newDbControl(":Remove cloned reporters"); |
5878 |
17 Nov 11 |
nicklas |
458 |
Experiment exp = Experiment.getById(dc, Values.getInt(itemId)); |
5878 |
17 Nov 11 |
nicklas |
459 |
ReporterCloneBatcher batcher = exp.getReporterCloneBatcher(dc); |
5878 |
17 Nov 11 |
nicklas |
460 |
batcher.dropClonedReporters(); |
5878 |
17 Nov 11 |
nicklas |
461 |
dc.commit(); |
5878 |
17 Nov 11 |
nicklas |
462 |
|
5878 |
17 Nov 11 |
nicklas |
463 |
message = "The cloned reporter annotations has been removed"; |
5878 |
17 Nov 11 |
nicklas |
464 |
|
5878 |
17 Nov 11 |
nicklas |
465 |
} |
1777 |
17 Jan 06 |
nicklas |
466 |
else |
1777 |
17 Jan 06 |
nicklas |
467 |
{ |
1777 |
17 Jan 06 |
nicklas |
468 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
1777 |
17 Jan 06 |
nicklas |
469 |
} |
1675 |
01 Dec 05 |
nicklas |
470 |
} |
1675 |
01 Dec 05 |
nicklas |
471 |
finally |
1675 |
01 Dec 05 |
nicklas |
472 |
{ |
1675 |
01 Dec 05 |
nicklas |
473 |
if (dc != null) dc.close(); |
1675 |
01 Dec 05 |
nicklas |
474 |
} |
1777 |
17 Jan 06 |
nicklas |
475 |
|
1777 |
17 Jan 06 |
nicklas |
476 |
if (forward != null) |
1777 |
17 Jan 06 |
nicklas |
477 |
{ |
6192 |
31 Oct 12 |
nicklas |
478 |
sc.setSessionSetting("alert-message", message); |
1777 |
17 Jan 06 |
nicklas |
479 |
pageContext.forward(forward); |
1777 |
17 Jan 06 |
nicklas |
480 |
} |
1777 |
17 Jan 06 |
nicklas |
481 |
else if (redirect != null) |
1777 |
17 Jan 06 |
nicklas |
482 |
{ |
6192 |
31 Oct 12 |
nicklas |
483 |
sc.setSessionSetting("alert-message", message); |
1777 |
17 Jan 06 |
nicklas |
484 |
response.sendRedirect(redirect); |
1777 |
17 Jan 06 |
nicklas |
485 |
} |
1777 |
17 Jan 06 |
nicklas |
486 |
else if (message == null) |
1777 |
17 Jan 06 |
nicklas |
487 |
{ |
1777 |
17 Jan 06 |
nicklas |
488 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
1777 |
17 Jan 06 |
nicklas |
489 |
} |
1777 |
17 Jan 06 |
nicklas |
490 |
else |
1777 |
17 Jan 06 |
nicklas |
491 |
{ |
1777 |
17 Jan 06 |
nicklas |
492 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
1777 |
17 Jan 06 |
nicklas |
493 |
} |
1777 |
17 Jan 06 |
nicklas |
494 |
%> |
1777 |
17 Jan 06 |
nicklas |
495 |
|