1406 |
06 Oct 05 |
gregory |
1 |
<%-- $Id$ |
1406 |
06 Oct 05 |
gregory |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg, Gregory Vincic |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
1406 |
06 Oct 05 |
gregory |
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/ |
1406 |
06 Oct 05 |
gregory |
8 |
|
1406 |
06 Oct 05 |
gregory |
9 |
BASE is free software; you can redistribute it and/or |
1406 |
06 Oct 05 |
gregory |
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 |
1406 |
06 Oct 05 |
gregory |
12 |
of the License, or (at your option) any later version. |
1406 |
06 Oct 05 |
gregory |
13 |
|
1406 |
06 Oct 05 |
gregory |
14 |
BASE is distributed in the hope that it will be useful, |
1406 |
06 Oct 05 |
gregory |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1406 |
06 Oct 05 |
gregory |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1406 |
06 Oct 05 |
gregory |
17 |
GNU General Public License for more details. |
1406 |
06 Oct 05 |
gregory |
18 |
|
1406 |
06 Oct 05 |
gregory |
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/>. |
1406 |
06 Oct 05 |
gregory |
21 |
------------------------------------------------------------------ |
1406 |
06 Oct 05 |
gregory |
22 |
|
1806 |
23 Jan 06 |
nicklas |
23 |
@author Nicklas |
1406 |
06 Oct 05 |
gregory |
24 |
@version 2.0 |
1406 |
06 Oct 05 |
gregory |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1419 |
07 Oct 05 |
gregory |
27 |
import="net.sf.basedb.core.SessionControl" |
1419 |
07 Oct 05 |
gregory |
28 |
import="net.sf.basedb.core.DbControl" |
1419 |
07 Oct 05 |
gregory |
29 |
import="net.sf.basedb.core.Item" |
1806 |
23 Jan 06 |
nicklas |
30 |
import="net.sf.basedb.core.Include" |
5642 |
26 May 11 |
nicklas |
31 |
import="net.sf.basedb.core.PhysicalBioAssay" |
1806 |
23 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.ArraySlide" |
1806 |
23 Jan 06 |
nicklas |
33 |
import="net.sf.basedb.core.BioMaterialEvent" |
5662 |
20 Jun 11 |
nicklas |
34 |
import="net.sf.basedb.core.BioMaterialEventSource" |
5641 |
25 May 11 |
nicklas |
35 |
import="net.sf.basedb.core.Extract" |
6994 |
03 Nov 15 |
nicklas |
36 |
import="net.sf.basedb.core.Kit" |
1806 |
23 Jan 06 |
nicklas |
37 |
import="net.sf.basedb.core.Protocol" |
2484 |
03 Aug 06 |
martin |
38 |
import="net.sf.basedb.core.Hardware" |
5649 |
30 May 11 |
nicklas |
39 |
import="net.sf.basedb.core.ItemSubtype" |
5685 |
04 Aug 11 |
nicklas |
40 |
import="net.sf.basedb.core.DerivedBioAssay" |
1806 |
23 Jan 06 |
nicklas |
41 |
import="net.sf.basedb.core.ItemQuery" |
1806 |
23 Jan 06 |
nicklas |
42 |
import="net.sf.basedb.core.ItemResultIterator" |
1419 |
07 Oct 05 |
gregory |
43 |
import="net.sf.basedb.core.Permission" |
1806 |
23 Jan 06 |
nicklas |
44 |
import="net.sf.basedb.core.ItemContext" |
1806 |
23 Jan 06 |
nicklas |
45 |
import="net.sf.basedb.core.MultiPermissions" |
4587 |
15 Oct 08 |
martin |
46 |
import="net.sf.basedb.core.OwnedItem" |
6695 |
28 Jan 15 |
nicklas |
47 |
import="net.sf.basedb.core.AnnotatedItem" |
1419 |
07 Oct 05 |
gregory |
48 |
import="net.sf.basedb.core.PermissionDeniedException" |
1806 |
23 Jan 06 |
nicklas |
49 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
4901 |
23 Apr 09 |
martin |
50 |
import="net.sf.basedb.core.query.Hql" |
4901 |
23 Apr 09 |
martin |
51 |
import="net.sf.basedb.core.query.Orders" |
4901 |
23 Apr 09 |
martin |
52 |
import="net.sf.basedb.core.query.Restrictions" |
4901 |
23 Apr 09 |
martin |
53 |
import="net.sf.basedb.core.query.Expressions" |
1806 |
23 Jan 06 |
nicklas |
54 |
import="net.sf.basedb.util.RemovableUtil" |
1806 |
23 Jan 06 |
nicklas |
55 |
import="net.sf.basedb.util.ShareableUtil" |
2918 |
15 Nov 06 |
nicklas |
56 |
import="net.sf.basedb.util.OwnableUtil" |
1419 |
07 Oct 05 |
gregory |
57 |
import="net.sf.basedb.clients.web.Base" |
1419 |
07 Oct 05 |
gregory |
58 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
59 |
import="net.sf.basedb.util.Values" |
1419 |
07 Oct 05 |
gregory |
60 |
import="net.sf.basedb.clients.web.util.HTML" |
2942 |
22 Nov 06 |
nicklas |
61 |
import="net.sf.basedb.util.formatter.Formatter" |
4901 |
23 Apr 09 |
martin |
62 |
import="net.sf.basedb.util.formatter.NameableFormatter" |
2942 |
22 Nov 06 |
nicklas |
63 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
4901 |
23 Apr 09 |
martin |
64 |
import="net.sf.basedb.clients.web.plugins.ItemQueryLoader" |
5963 |
15 Feb 12 |
nicklas |
65 |
import="net.sf.basedb.clients.web.plugins.BioMaterialEventSourceFormatter" |
5963 |
15 Feb 12 |
nicklas |
66 |
import="net.sf.basedb.clients.web.plugins.ParentBioMaterialEventSourceLoaderFromBioAssay" |
5501 |
18 Nov 10 |
nicklas |
67 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
68 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5501 |
18 Nov 10 |
nicklas |
69 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
70 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
nicklas |
71 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
72 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveAction" |
5501 |
18 Nov 10 |
nicklas |
73 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveRenderer" |
6040 |
30 Mar 12 |
nicklas |
74 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
75 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6040 |
30 Mar 12 |
nicklas |
76 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
1806 |
23 Jan 06 |
nicklas |
77 |
import="java.util.Enumeration" |
1806 |
23 Jan 06 |
nicklas |
78 |
import="java.util.Set" |
1806 |
23 Jan 06 |
nicklas |
79 |
import="java.util.HashSet" |
1460 |
13 Oct 05 |
gregory |
80 |
import="java.util.List" |
1806 |
23 Jan 06 |
nicklas |
81 |
import="java.util.ArrayList" |
1806 |
23 Jan 06 |
nicklas |
82 |
import="java.util.Collections" |
2942 |
22 Nov 06 |
nicklas |
83 |
import="java.util.Date" |
1406 |
06 Oct 05 |
gregory |
84 |
%> |
1406 |
06 Oct 05 |
gregory |
85 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1406 |
06 Oct 05 |
gregory |
86 |
<%! |
5652 |
10 Jun 11 |
nicklas |
87 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,extracts,arraySlide,description"); |
5642 |
26 May 11 |
nicklas |
88 |
private static final Item itemType = Item.PHYSICALBIOASSAY; |
4901 |
23 Apr 09 |
martin |
89 |
|
4901 |
23 Apr 09 |
martin |
90 |
private static void registerExportUtils(ItemContext cc) |
4901 |
23 Apr 09 |
martin |
91 |
{ |
4901 |
23 Apr 09 |
martin |
92 |
// Register formatters |
5963 |
15 Feb 12 |
nicklas |
93 |
cc.setObject("export.formatter.&creationEvent.sources(bioMaterial.name)", new BioMaterialEventSourceFormatter()); |
6721 |
10 Feb 15 |
nicklas |
94 |
cc.setObject("export.formatter.&rootDerivedBioAssays(%name)", new NameableFormatter()); |
4901 |
23 Apr 09 |
martin |
95 |
|
4901 |
23 Apr 09 |
martin |
96 |
// Register dataloaders |
5642 |
26 May 11 |
nicklas |
97 |
String bioassayParameter = "bioassay"; |
5963 |
15 Feb 12 |
nicklas |
98 |
cc.setObject("export.dataloader.&creationEvent.sources(bioMaterial.name)", new ParentBioMaterialEventSourceLoaderFromBioAssay()); |
5652 |
10 Jun 11 |
nicklas |
99 |
|
5685 |
04 Aug 11 |
nicklas |
100 |
ItemQuery<DerivedBioAssay> dbasQuery = DerivedBioAssay.getQuery(); |
5652 |
10 Jun 11 |
nicklas |
101 |
dbasQuery.include(cc.getInclude()); |
6084 |
16 Aug 12 |
nicklas |
102 |
dbasQuery.join(Hql.innerJoin("physicalBioAssays", "pba")); |
6084 |
16 Aug 12 |
nicklas |
103 |
dbasQuery.restrict(Restrictions.eq(Hql.alias("pba"), Expressions.parameter(bioassayParameter))); |
6084 |
16 Aug 12 |
nicklas |
104 |
dbasQuery.restrict(Restrictions.eq(Hql.property("root"), Expressions.bool(true))); |
5652 |
10 Jun 11 |
nicklas |
105 |
dbasQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
106 |
cc.setObject("export.dataloader.&rootDerivedBioAssays(%name)", new ItemQueryLoader<PhysicalBioAssay>(dbasQuery, bioassayParameter)); |
4901 |
23 Apr 09 |
martin |
107 |
} |
1406 |
06 Oct 05 |
gregory |
108 |
%> |
1406 |
06 Oct 05 |
gregory |
109 |
<% |
1806 |
23 Jan 06 |
nicklas |
110 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1806 |
23 Jan 06 |
nicklas |
111 |
final String ID = sc.getId(); |
1806 |
23 Jan 06 |
nicklas |
112 |
final String cmd = request.getParameter("cmd"); |
1806 |
23 Jan 06 |
nicklas |
113 |
final String root = request.getContextPath()+"/"; |
1806 |
23 Jan 06 |
nicklas |
114 |
final String mode = request.getParameter("mode"); |
1806 |
23 Jan 06 |
nicklas |
115 |
final String callback = request.getParameter("callback"); |
1806 |
23 Jan 06 |
nicklas |
116 |
final String itemId = request.getParameter("item_id"); |
5642 |
26 May 11 |
nicklas |
117 |
final String listPage = "list_bioassays.jsp?ID="+ID |
1806 |
23 Jan 06 |
nicklas |
118 |
+(mode == null ? "" : "&mode="+mode) |
1806 |
23 Jan 06 |
nicklas |
119 |
+(callback == null ? "" : "&callback="+callback) |
1806 |
23 Jan 06 |
nicklas |
120 |
+(itemId == null ? "" : "&item_id="+itemId); |
5642 |
26 May 11 |
nicklas |
121 |
final String viewPage = "view_bioassay.jsp?ID="+ID; |
5642 |
26 May 11 |
nicklas |
122 |
final String editPage = "edit_bioassay.jsp?ID="+ID; |
1406 |
06 Oct 05 |
gregory |
123 |
|
1806 |
23 Jan 06 |
nicklas |
124 |
String forward = null; |
1806 |
23 Jan 06 |
nicklas |
125 |
String redirect = null; |
1806 |
23 Jan 06 |
nicklas |
126 |
String message = null; |
1806 |
23 Jan 06 |
nicklas |
127 |
DbControl dc = null; |
1406 |
06 Oct 05 |
gregory |
128 |
|
1406 |
06 Oct 05 |
gregory |
129 |
try |
1406 |
06 Oct 05 |
gregory |
130 |
{ |
1806 |
23 Jan 06 |
nicklas |
131 |
if (cmd == null || "List".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
132 |
{ |
1806 |
23 Jan 06 |
nicklas |
133 |
// Display the list page without updatinging the current context |
2811 |
26 Oct 06 |
nicklas |
134 |
Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
1806 |
23 Jan 06 |
nicklas |
135 |
redirect = listPage; |
1806 |
23 Jan 06 |
nicklas |
136 |
} |
1806 |
23 Jan 06 |
nicklas |
137 |
else if ("UpdateContext".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
138 |
{ |
1806 |
23 Jan 06 |
nicklas |
139 |
// Display the list page after updating the current context from the request parameters |
1806 |
23 Jan 06 |
nicklas |
140 |
Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
141 |
redirect = listPage; |
1806 |
23 Jan 06 |
nicklas |
142 |
} |
1806 |
23 Jan 06 |
nicklas |
143 |
else if ("LoadContext".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
144 |
{ |
1806 |
23 Jan 06 |
nicklas |
145 |
// Display the list page after loading a saved context |
1806 |
23 Jan 06 |
nicklas |
146 |
int contextId = Values.getInt(request.getParameter("context")); |
1806 |
23 Jan 06 |
nicklas |
147 |
Base.loadContext(sc, contextId, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
148 |
redirect = listPage; |
1806 |
23 Jan 06 |
nicklas |
149 |
} |
1406 |
06 Oct 05 |
gregory |
150 |
|
1806 |
23 Jan 06 |
nicklas |
151 |
else if ("ViewItem".equals(cmd)) |
1406 |
06 Oct 05 |
gregory |
152 |
{ |
1806 |
23 Jan 06 |
nicklas |
153 |
// Display the view page for a single item |
1806 |
23 Jan 06 |
nicklas |
154 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
155 |
forward = viewPage; |
1406 |
06 Oct 05 |
gregory |
156 |
} |
1806 |
23 Jan 06 |
nicklas |
157 |
else if ("EditItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
158 |
{ |
1806 |
23 Jan 06 |
nicklas |
159 |
// Display the edit page for a single item (should be opened in a popup) |
1806 |
23 Jan 06 |
nicklas |
160 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
161 |
redirect = editPage; |
1806 |
23 Jan 06 |
nicklas |
162 |
} |
1806 |
23 Jan 06 |
nicklas |
163 |
else if ("NewItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
164 |
{ |
1806 |
23 Jan 06 |
nicklas |
165 |
// Display the edit page for a new item (should be opened in a popup) |
1806 |
23 Jan 06 |
nicklas |
166 |
if (!sc.hasPermission(Permission.CREATE, itemType)) |
1806 |
23 Jan 06 |
nicklas |
167 |
{ |
1806 |
23 Jan 06 |
nicklas |
168 |
throw new PermissionDeniedException(Permission.CREATE, itemType.toString()); |
1806 |
23 Jan 06 |
nicklas |
169 |
} |
1806 |
23 Jan 06 |
nicklas |
170 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
171 |
cc.setId(0); |
2465 |
05 Jul 06 |
martin |
172 |
forward = editPage; |
1806 |
23 Jan 06 |
nicklas |
173 |
} |
1806 |
23 Jan 06 |
nicklas |
174 |
else if ("UpdateItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
175 |
{ |
1806 |
23 Jan 06 |
nicklas |
176 |
// Update the properties on an item (will close the popup) |
1806 |
23 Jan 06 |
nicklas |
177 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
2597 |
25 Aug 06 |
nicklas |
178 |
final int maxRecent = Base.getMaxRecent(sc); |
7954 |
12 May 21 |
nicklas |
179 |
dc = sc.newDbControl(":Edit "+itemType); |
7605 |
26 Feb 19 |
nicklas |
180 |
PhysicalBioAssay pba = cc.getObject("item"); |
1806 |
23 Jan 06 |
nicklas |
181 |
BioMaterialEvent creationEvent = null; |
5642 |
26 May 11 |
nicklas |
182 |
if (pba == null) |
1806 |
23 Jan 06 |
nicklas |
183 |
{ |
5642 |
26 May 11 |
nicklas |
184 |
pba = PhysicalBioAssay.getNew(dc); |
5642 |
26 May 11 |
nicklas |
185 |
creationEvent = pba.getCreationEvent(); |
5642 |
26 May 11 |
nicklas |
186 |
message = "Physical bioassay created"; |
5642 |
26 May 11 |
nicklas |
187 |
dc.saveItem(pba); |
1806 |
23 Jan 06 |
nicklas |
188 |
} |
1806 |
23 Jan 06 |
nicklas |
189 |
else |
1806 |
23 Jan 06 |
nicklas |
190 |
{ |
5642 |
26 May 11 |
nicklas |
191 |
creationEvent = pba.getCreationEvent(); |
5642 |
26 May 11 |
nicklas |
192 |
dc.reattachItem(pba, false); |
5060 |
19 Aug 09 |
nicklas |
193 |
dc.reattachItem(creationEvent, false); |
5642 |
26 May 11 |
nicklas |
194 |
message = "Physical bioassay updated"; |
1806 |
23 Jan 06 |
nicklas |
195 |
} |
5642 |
26 May 11 |
nicklas |
196 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(Item.PHYSICALBIOASSAY), pba); |
7604 |
25 Feb 19 |
nicklas |
197 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5501 |
18 Nov 10 |
nicklas |
198 |
try |
1806 |
23 Jan 06 |
nicklas |
199 |
{ |
5642 |
26 May 11 |
nicklas |
200 |
pba.setName(Values.getStringOrNull(request.getParameter("name"))); |
5642 |
26 May 11 |
nicklas |
201 |
pba.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5642 |
26 May 11 |
nicklas |
202 |
pba.setSize(Values.getInt(request.getParameter("size"), 1)); |
5687 |
09 Aug 11 |
nicklas |
203 |
|
5687 |
09 Aug 11 |
nicklas |
204 |
int subtypeId = Values.getInt(request.getParameter("subtype_id"), -1); |
5687 |
09 Aug 11 |
nicklas |
205 |
ItemSubtype subtype = null; |
5687 |
09 Aug 11 |
nicklas |
206 |
if (subtypeId >= 0) // < 0 = denied or unchanged |
5687 |
09 Aug 11 |
nicklas |
207 |
{ |
5687 |
09 Aug 11 |
nicklas |
208 |
if (subtypeId > 0) subtype = ItemSubtype.getById(dc, subtypeId); |
5687 |
09 Aug 11 |
nicklas |
209 |
pba.setItemSubtype(subtype); |
7703 |
11 Apr 19 |
nicklas |
210 |
cc.setRecent(Item.ITEMSUBTYPE, subtype, maxRecent); |
5687 |
09 Aug 11 |
nicklas |
211 |
} |
5501 |
18 Nov 10 |
nicklas |
212 |
|
5501 |
18 Nov 10 |
nicklas |
213 |
int arraySlideId = Values.getInt(request.getParameter("arrayslide_id"), -1); |
5501 |
18 Nov 10 |
nicklas |
214 |
if (arraySlideId >= 0) // < 0 = denied or unchanged |
5501 |
18 Nov 10 |
nicklas |
215 |
{ |
5501 |
18 Nov 10 |
nicklas |
216 |
ArraySlide slide = arraySlideId == 0 ? null : ArraySlide.getById(dc, arraySlideId); |
5642 |
26 May 11 |
nicklas |
217 |
pba.setArraySlide(slide); |
5501 |
18 Nov 10 |
nicklas |
218 |
} |
5501 |
18 Nov 10 |
nicklas |
219 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
5501 |
18 Nov 10 |
nicklas |
220 |
creationEvent.setEventDate(dateFormatter.parseString(Values.getStringOrNull(request.getParameter("event_date")))); |
5501 |
18 Nov 10 |
nicklas |
221 |
int protocolId = Values.getInt(request.getParameter("protocol_id"), -1); |
5501 |
18 Nov 10 |
nicklas |
222 |
if (protocolId >= 0) // < 0 = denied or unchanged |
5501 |
18 Nov 10 |
nicklas |
223 |
{ |
5501 |
18 Nov 10 |
nicklas |
224 |
Protocol pt = protocolId == 0 ? null : Protocol.getById(dc, protocolId); |
5501 |
18 Nov 10 |
nicklas |
225 |
creationEvent.setProtocol(pt); |
7703 |
11 Apr 19 |
nicklas |
226 |
cc.setRecent(Item.PROTOCOL, pt, subtype, maxRecent); |
5501 |
18 Nov 10 |
nicklas |
227 |
} |
5501 |
18 Nov 10 |
nicklas |
228 |
|
5642 |
26 May 11 |
nicklas |
229 |
//Hardware |
5642 |
26 May 11 |
nicklas |
230 |
int hardwareId = Values.getInt(request.getParameter("hardware_id"), -1); |
5642 |
26 May 11 |
nicklas |
231 |
if (hardwareId >= 0) // < 0 denied or unchanged |
5501 |
18 Nov 10 |
nicklas |
232 |
{ |
5642 |
26 May 11 |
nicklas |
233 |
Hardware hw = hardwareId == 0 ? null : Hardware.getById(dc, hardwareId); |
5501 |
18 Nov 10 |
nicklas |
234 |
creationEvent.setHardware(hw); |
7703 |
11 Apr 19 |
nicklas |
235 |
cc.setRecent(Item.HARDWARE, hw, subtype, maxRecent); |
5501 |
18 Nov 10 |
nicklas |
236 |
} |
5501 |
18 Nov 10 |
nicklas |
237 |
|
6994 |
03 Nov 15 |
nicklas |
238 |
int kitId = Values.getInt(request.getParameter("kit_id"), -1); |
6994 |
03 Nov 15 |
nicklas |
239 |
if (kitId >= 0) // < 0 = denied or unchanged |
6994 |
03 Nov 15 |
nicklas |
240 |
{ |
6994 |
03 Nov 15 |
nicklas |
241 |
Kit kit = kitId == 0 ? null : Kit.getById(dc, kitId); |
6994 |
03 Nov 15 |
nicklas |
242 |
creationEvent.setKit(kit); |
7703 |
11 Apr 19 |
nicklas |
243 |
cc.setRecent(Item.KIT, kit, subtype, maxRecent); |
6994 |
03 Nov 15 |
nicklas |
244 |
} |
6994 |
03 Nov 15 |
nicklas |
245 |
|
5642 |
26 May 11 |
nicklas |
246 |
// Extracts |
6314 |
02 Sep 13 |
nicklas |
247 |
String[] modifiedExtracts = Values.getString(request.getParameter("+EXTRACT")).split(","); |
5642 |
26 May 11 |
nicklas |
248 |
for (int i = 0; i < modifiedExtracts.length; ++i) |
5501 |
18 Nov 10 |
nicklas |
249 |
{ |
5642 |
26 May 11 |
nicklas |
250 |
int extractId = Values.getInt(modifiedExtracts[i], -1); |
5642 |
26 May 11 |
nicklas |
251 |
if (extractId != -1) |
5501 |
18 Nov 10 |
nicklas |
252 |
{ |
5642 |
26 May 11 |
nicklas |
253 |
Extract e = Extract.getById(dc, extractId); |
6314 |
02 Sep 13 |
nicklas |
254 |
String[] extra = request.getParameter("EXTRACT."+extractId).split(":"); |
5501 |
18 Nov 10 |
nicklas |
255 |
Float usedQuantity = Values.getFloat(extra[0], null); |
5657 |
16 Jun 11 |
nicklas |
256 |
int position = extra.length > 1 ? Values.getInt(extra[1], 1) : 1; |
5662 |
20 Jun 11 |
nicklas |
257 |
BioMaterialEventSource evtSrc = creationEvent.addSource(e); |
5662 |
20 Jun 11 |
nicklas |
258 |
evtSrc.setUsedQuantity(usedQuantity); |
5662 |
20 Jun 11 |
nicklas |
259 |
evtSrc.setPosition(position); |
5501 |
18 Nov 10 |
nicklas |
260 |
} |
5501 |
18 Nov 10 |
nicklas |
261 |
} |
6314 |
02 Sep 13 |
nicklas |
262 |
String[] removedExtracts = Values.getString(request.getParameter("-EXTRACT")).split(","); |
5642 |
26 May 11 |
nicklas |
263 |
for (int i = 0; i < removedExtracts.length; ++i) |
5501 |
18 Nov 10 |
nicklas |
264 |
{ |
5642 |
26 May 11 |
nicklas |
265 |
int extractId = Values.getInt(removedExtracts[i], -1); |
5642 |
26 May 11 |
nicklas |
266 |
if (extractId != -1) creationEvent.removeSource(Extract.getById(dc, extractId)); |
5501 |
18 Nov 10 |
nicklas |
267 |
} |
5501 |
18 Nov 10 |
nicklas |
268 |
|
5501 |
18 Nov 10 |
nicklas |
269 |
// Annotations tab |
5642 |
26 May 11 |
nicklas |
270 |
Base.updateAnnotations(dc, pba, pba, request); |
5501 |
18 Nov 10 |
nicklas |
271 |
|
5501 |
18 Nov 10 |
nicklas |
272 |
// OnSave extensions |
5501 |
18 Nov 10 |
nicklas |
273 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5501 |
18 Nov 10 |
nicklas |
274 |
dc.commit(); |
5501 |
18 Nov 10 |
nicklas |
275 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
1806 |
23 Jan 06 |
nicklas |
276 |
} |
5501 |
18 Nov 10 |
nicklas |
277 |
catch (Exception ex) |
1806 |
23 Jan 06 |
nicklas |
278 |
{ |
5501 |
18 Nov 10 |
nicklas |
279 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5501 |
18 Nov 10 |
nicklas |
280 |
throw ex; |
1806 |
23 Jan 06 |
nicklas |
281 |
} |
5501 |
18 Nov 10 |
nicklas |
282 |
finally |
2484 |
03 Aug 06 |
martin |
283 |
{ |
5501 |
18 Nov 10 |
nicklas |
284 |
cc.removeObject("item"); |
2484 |
03 Aug 06 |
martin |
285 |
} |
1806 |
23 Jan 06 |
nicklas |
286 |
} |
1806 |
23 Jan 06 |
nicklas |
287 |
else if ("DeleteItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
288 |
{ |
1806 |
23 Jan 06 |
nicklas |
289 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
290 |
dc = sc.newDbControl(":Delete "+itemType); |
1806 |
23 Jan 06 |
nicklas |
291 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
292 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), true); |
1806 |
23 Jan 06 |
nicklas |
293 |
dc.commit(); |
1806 |
23 Jan 06 |
nicklas |
294 |
redirect = viewPage; |
1806 |
23 Jan 06 |
nicklas |
295 |
} |
1806 |
23 Jan 06 |
nicklas |
296 |
else if ("DeleteItems".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
297 |
{ |
1806 |
23 Jan 06 |
nicklas |
298 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
299 |
dc = sc.newDbControl(":Delete "+itemType); |
1806 |
23 Jan 06 |
nicklas |
300 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
301 |
int numTotal = cc.getSelected().size(); |
1806 |
23 Jan 06 |
nicklas |
302 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true); |
1806 |
23 Jan 06 |
nicklas |
303 |
dc.commit(); |
1806 |
23 Jan 06 |
nicklas |
304 |
if (numTotal != numRemoved) |
1806 |
23 Jan 06 |
nicklas |
305 |
{ |
1806 |
23 Jan 06 |
nicklas |
306 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
1806 |
23 Jan 06 |
nicklas |
307 |
} |
6192 |
31 Oct 12 |
nicklas |
308 |
redirect = listPage; |
1806 |
23 Jan 06 |
nicklas |
309 |
} |
1806 |
23 Jan 06 |
nicklas |
310 |
else if ("RestoreItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
311 |
{ |
1806 |
23 Jan 06 |
nicklas |
312 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
313 |
dc = sc.newDbControl(":Restore "+itemType); |
1806 |
23 Jan 06 |
nicklas |
314 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
315 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), false); |
1806 |
23 Jan 06 |
nicklas |
316 |
dc.commit(); |
1806 |
23 Jan 06 |
nicklas |
317 |
redirect = viewPage; |
1806 |
23 Jan 06 |
nicklas |
318 |
} |
1806 |
23 Jan 06 |
nicklas |
319 |
else if ("RestoreItems".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
320 |
{ |
1806 |
23 Jan 06 |
nicklas |
321 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
322 |
dc = sc.newDbControl(":Restore "+itemType); |
1806 |
23 Jan 06 |
nicklas |
323 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
324 |
int numTotal = cc.getSelected().size(); |
1806 |
23 Jan 06 |
nicklas |
325 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false); |
1806 |
23 Jan 06 |
nicklas |
326 |
dc.commit(); |
1806 |
23 Jan 06 |
nicklas |
327 |
if (numTotal != numRemoved) |
1806 |
23 Jan 06 |
nicklas |
328 |
{ |
2528 |
15 Aug 06 |
martin |
329 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
1806 |
23 Jan 06 |
nicklas |
330 |
} |
6192 |
31 Oct 12 |
nicklas |
331 |
redirect = listPage; |
1806 |
23 Jan 06 |
nicklas |
332 |
} |
1806 |
23 Jan 06 |
nicklas |
333 |
else if ("ShareItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
334 |
{ |
1806 |
23 Jan 06 |
nicklas |
335 |
// Display a popup window for sharing a single item |
7954 |
12 May 21 |
nicklas |
336 |
dc = sc.newDbControl(":Share "+itemType); |
1806 |
23 Jan 06 |
nicklas |
337 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
338 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId())); |
1806 |
23 Jan 06 |
nicklas |
339 |
dc.close(); |
1806 |
23 Jan 06 |
nicklas |
340 |
cc.setObject("MultiPermissions", permissions); |
1806 |
23 Jan 06 |
nicklas |
341 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1806 |
23 Jan 06 |
nicklas |
342 |
} |
1806 |
23 Jan 06 |
nicklas |
343 |
else if ("ShareItems".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
344 |
{ |
1806 |
23 Jan 06 |
nicklas |
345 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
346 |
dc = sc.newDbControl(":Share "+itemType); |
1806 |
23 Jan 06 |
nicklas |
347 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
348 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
1806 |
23 Jan 06 |
nicklas |
349 |
dc.close(); |
1806 |
23 Jan 06 |
nicklas |
350 |
cc.setObject("MultiPermissions", permissions); |
1806 |
23 Jan 06 |
nicklas |
351 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1806 |
23 Jan 06 |
nicklas |
352 |
} |
4578 |
13 Oct 08 |
martin |
353 |
else if ("SetOwnerOfItem".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
354 |
{ |
4578 |
13 Oct 08 |
martin |
355 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
356 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
357 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
358 |
OwnedItem item = (OwnedItem)itemType.getById(dc, cc.getId()); |
4587 |
15 Oct 08 |
martin |
359 |
cc.setObject("OwnedItems", Collections.singleton(item)); |
4578 |
13 Oct 08 |
martin |
360 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
361 |
} |
4578 |
13 Oct 08 |
martin |
362 |
else if ("SetOwnerOfItems".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
363 |
{ |
4578 |
13 Oct 08 |
martin |
364 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
365 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
366 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
367 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
4587 |
15 Oct 08 |
martin |
368 |
for (Integer id : cc.getSelected()) |
4587 |
15 Oct 08 |
martin |
369 |
{ |
4587 |
15 Oct 08 |
martin |
370 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
4587 |
15 Oct 08 |
martin |
371 |
} |
4587 |
15 Oct 08 |
martin |
372 |
dc.close(); |
4587 |
15 Oct 08 |
martin |
373 |
cc.setObject("OwnedItems", items); |
4578 |
13 Oct 08 |
martin |
374 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
375 |
} |
6695 |
28 Jan 15 |
nicklas |
376 |
else if ("InheritAnnotations".equals(cmd)) |
6695 |
28 Jan 15 |
nicklas |
377 |
{ |
6695 |
28 Jan 15 |
nicklas |
378 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
379 |
dc = sc.newDbControl(":Inherit annotations "+itemType); |
6695 |
28 Jan 15 |
nicklas |
380 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6695 |
28 Jan 15 |
nicklas |
381 |
Set<AnnotatedItem> items = new HashSet<AnnotatedItem>(); |
6695 |
28 Jan 15 |
nicklas |
382 |
for (Integer id : cc.getSelected()) |
6695 |
28 Jan 15 |
nicklas |
383 |
{ |
6695 |
28 Jan 15 |
nicklas |
384 |
if (id != null) items.add((AnnotatedItem)itemType.getById(dc, id)); |
6695 |
28 Jan 15 |
nicklas |
385 |
} |
6695 |
28 Jan 15 |
nicklas |
386 |
dc.close(); |
6695 |
28 Jan 15 |
nicklas |
387 |
cc.setObject("AnnotatedItems", items); |
6695 |
28 Jan 15 |
nicklas |
388 |
redirect = "../../common/annotations/batch_inherit.jsp?ID="+ID+"&item_type="+itemType.name(); |
6695 |
28 Jan 15 |
nicklas |
389 |
} |
1806 |
23 Jan 06 |
nicklas |
390 |
else if ("ExportItems".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
391 |
{ |
1806 |
23 Jan 06 |
nicklas |
392 |
// Run an export plugin in a list context |
1806 |
23 Jan 06 |
nicklas |
393 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5642 |
26 May 11 |
nicklas |
394 |
final ItemQuery<PhysicalBioAssay> query = PhysicalBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
395 |
dc = sc.newDbControl(":Export "+itemType); |
7914 |
23 Feb 21 |
nicklas |
396 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
397 |
cc.configureQuery(dc, query, jspContext, true); |
6040 |
30 Mar 12 |
nicklas |
398 |
cc.setQuery(query); |
6040 |
30 Mar 12 |
nicklas |
399 |
registerExportUtils(cc); |
7604 |
25 Feb 19 |
nicklas |
400 |
ExtensionsInvoker<ListColumnAction<PhysicalBioAssay,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
401 |
listInvoker.render(new ListColumnExportRenderer<PhysicalBioAssay>(cc)); |
5590 |
16 Mar 11 |
nicklas |
402 |
dc.close(); |
5642 |
26 May 11 |
nicklas |
403 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+physical+bioassays"; |
1806 |
23 Jan 06 |
nicklas |
404 |
} |
1806 |
23 Jan 06 |
nicklas |
405 |
else if ("ExportItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
406 |
{ |
1806 |
23 Jan 06 |
nicklas |
407 |
// Run an export plugin in single-item context |
1806 |
23 Jan 06 |
nicklas |
408 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4901 |
23 Apr 09 |
martin |
409 |
registerExportUtils(cc); |
5642 |
26 May 11 |
nicklas |
410 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+physical+bioassay"; |
1806 |
23 Jan 06 |
nicklas |
411 |
} |
1806 |
23 Jan 06 |
nicklas |
412 |
else if ("ImportItems".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
413 |
{ |
1806 |
23 Jan 06 |
nicklas |
414 |
// Run an import plugin in a list context |
1806 |
23 Jan 06 |
nicklas |
415 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5642 |
26 May 11 |
nicklas |
416 |
final ItemQuery<PhysicalBioAssay> query = PhysicalBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
417 |
dc = sc.newDbControl(":Import "+itemType); |
7914 |
23 Feb 21 |
nicklas |
418 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
419 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
420 |
dc.close(); |
1806 |
23 Jan 06 |
nicklas |
421 |
cc.setQuery(query); |
5642 |
26 May 11 |
nicklas |
422 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+physical+bioassays"; |
1806 |
23 Jan 06 |
nicklas |
423 |
} |
1806 |
23 Jan 06 |
nicklas |
424 |
else if ("ImportItem".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
425 |
{ |
1806 |
23 Jan 06 |
nicklas |
426 |
// Run an import plugin in single-item context |
1806 |
23 Jan 06 |
nicklas |
427 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5642 |
26 May 11 |
nicklas |
428 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+physical+bioassay"; |
1806 |
23 Jan 06 |
nicklas |
429 |
} |
1806 |
23 Jan 06 |
nicklas |
430 |
else if ("RunListPlugin".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
431 |
{ |
1806 |
23 Jan 06 |
nicklas |
432 |
// Run another plugin in a list context |
1806 |
23 Jan 06 |
nicklas |
433 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5642 |
26 May 11 |
nicklas |
434 |
final ItemQuery<PhysicalBioAssay> query = PhysicalBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
435 |
dc = sc.newDbControl(":Run plugin "+itemType); |
7914 |
23 Feb 21 |
nicklas |
436 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
437 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
438 |
dc.close(); |
1806 |
23 Jan 06 |
nicklas |
439 |
cc.setQuery(query); |
1806 |
23 Jan 06 |
nicklas |
440 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
1806 |
23 Jan 06 |
nicklas |
441 |
} |
1806 |
23 Jan 06 |
nicklas |
442 |
else if ("RunPlugin".equals(cmd)) |
1806 |
23 Jan 06 |
nicklas |
443 |
{ |
1806 |
23 Jan 06 |
nicklas |
444 |
// Run another plugin in single-item context |
1806 |
23 Jan 06 |
nicklas |
445 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1806 |
23 Jan 06 |
nicklas |
446 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
1806 |
23 Jan 06 |
nicklas |
447 |
} |
6813 |
31 Mar 15 |
nicklas |
448 |
else if ("CreateItemList".equals(cmd)) |
6813 |
31 Mar 15 |
nicklas |
449 |
{ |
6813 |
31 Mar 15 |
nicklas |
450 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6813 |
31 Mar 15 |
nicklas |
451 |
final ItemQuery<PhysicalBioAssay> query = PhysicalBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
452 |
dc = sc.newDbControl(":Create "+itemType+" item list"); |
7914 |
23 Feb 21 |
nicklas |
453 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
454 |
cc.configureQuery(dc, query, jspContext, true); |
6813 |
31 Mar 15 |
nicklas |
455 |
dc.close(); |
6813 |
31 Mar 15 |
nicklas |
456 |
cc.setQuery(query); |
6813 |
31 Mar 15 |
nicklas |
457 |
redirect = "../../views/itemlists/index.jsp?ID="+ID+"&cmd=NewItem&addItems=1&memberType=PHYSICALBIOASSAY&formId=bioassays"; |
6813 |
31 Mar 15 |
nicklas |
458 |
} |
7813 |
19 May 20 |
nicklas |
459 |
else if ("AddItemsToList".equals(cmd)) |
7813 |
19 May 20 |
nicklas |
460 |
{ |
7813 |
19 May 20 |
nicklas |
461 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
7813 |
19 May 20 |
nicklas |
462 |
final ItemQuery<PhysicalBioAssay> query = PhysicalBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
463 |
dc = sc.newDbControl(":Add items to "+itemType+" item list"); |
7914 |
23 Feb 21 |
nicklas |
464 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
465 |
cc.configureQuery(dc, query, jspContext, true); |
7813 |
19 May 20 |
nicklas |
466 |
dc.close(); |
7813 |
19 May 20 |
nicklas |
467 |
cc.setQuery(query); |
7813 |
19 May 20 |
nicklas |
468 |
redirect = "../../views/itemlists/add_items.jsp?ID="+ID+"&memberType=PHYSICALBIOASSAY&formId=bioassays"; |
7813 |
19 May 20 |
nicklas |
469 |
} |
6082 |
14 Aug 12 |
nicklas |
470 |
else if ("NewMergedDerivedBioAssay".equals(cmd)) |
6082 |
14 Aug 12 |
nicklas |
471 |
{ |
6082 |
14 Aug 12 |
nicklas |
472 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6082 |
14 Aug 12 |
nicklas |
473 |
redirect = "../derivedbioassays/index.jsp?ID="+ID+"&cmd=NewItem&useParents=PHYISCALBIOASSAY"; |
6082 |
14 Aug 12 |
nicklas |
474 |
} |
1806 |
23 Jan 06 |
nicklas |
475 |
else |
1806 |
23 Jan 06 |
nicklas |
476 |
{ |
1806 |
23 Jan 06 |
nicklas |
477 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
1806 |
23 Jan 06 |
nicklas |
478 |
} |
1406 |
06 Oct 05 |
gregory |
479 |
} |
1406 |
06 Oct 05 |
gregory |
480 |
finally |
1406 |
06 Oct 05 |
gregory |
481 |
{ |
1406 |
06 Oct 05 |
gregory |
482 |
if (dc != null) dc.close(); |
1406 |
06 Oct 05 |
gregory |
483 |
} |
1806 |
23 Jan 06 |
nicklas |
484 |
|
1806 |
23 Jan 06 |
nicklas |
485 |
if (forward != null) |
1806 |
23 Jan 06 |
nicklas |
486 |
{ |
6192 |
31 Oct 12 |
nicklas |
487 |
sc.setSessionSetting("alert-message", message); |
1806 |
23 Jan 06 |
nicklas |
488 |
pageContext.forward(forward); |
1806 |
23 Jan 06 |
nicklas |
489 |
} |
1806 |
23 Jan 06 |
nicklas |
490 |
else if (redirect != null) |
1806 |
23 Jan 06 |
nicklas |
491 |
{ |
6192 |
31 Oct 12 |
nicklas |
492 |
sc.setSessionSetting("alert-message", message); |
1806 |
23 Jan 06 |
nicklas |
493 |
response.sendRedirect(redirect); |
1806 |
23 Jan 06 |
nicklas |
494 |
} |
1806 |
23 Jan 06 |
nicklas |
495 |
else if (message == null) |
1806 |
23 Jan 06 |
nicklas |
496 |
{ |
1806 |
23 Jan 06 |
nicklas |
497 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
1806 |
23 Jan 06 |
nicklas |
498 |
} |
1806 |
23 Jan 06 |
nicklas |
499 |
else |
1806 |
23 Jan 06 |
nicklas |
500 |
{ |
1806 |
23 Jan 06 |
nicklas |
501 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
1806 |
23 Jan 06 |
nicklas |
502 |
} |
1806 |
23 Jan 06 |
nicklas |
503 |
%> |
1806 |
23 Jan 06 |
nicklas |
504 |
|