4731 |
20 Jan 09 |
martin |
1 |
<%-- $Id$ |
4731 |
20 Jan 09 |
martin |
2 |
------------------------------------------------------------------ |
4731 |
20 Jan 09 |
martin |
Copyright (C) 2009 Martin Svensson |
4731 |
20 Jan 09 |
martin |
4 |
|
4731 |
20 Jan 09 |
martin |
5 |
This file is part of BASE - BioArray Software Environment. |
4731 |
20 Jan 09 |
martin |
6 |
Available at http://base.thep.lu.se/ |
4731 |
20 Jan 09 |
martin |
7 |
|
4731 |
20 Jan 09 |
martin |
8 |
BASE is free software; you can redistribute it and/or |
4731 |
20 Jan 09 |
martin |
9 |
modify it under the terms of the GNU General Public License |
4731 |
20 Jan 09 |
martin |
10 |
as published by the Free Software Foundation; either version 3 |
4731 |
20 Jan 09 |
martin |
11 |
of the License, or (at your option) any later version. |
4731 |
20 Jan 09 |
martin |
12 |
|
4731 |
20 Jan 09 |
martin |
13 |
BASE is distributed in the hope that it will be useful, |
4731 |
20 Jan 09 |
martin |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4731 |
20 Jan 09 |
martin |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4731 |
20 Jan 09 |
martin |
16 |
GNU General Public License for more details. |
4731 |
20 Jan 09 |
martin |
17 |
|
4731 |
20 Jan 09 |
martin |
18 |
You should have received a copy of the GNU General Public License |
4731 |
20 Jan 09 |
martin |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4731 |
20 Jan 09 |
martin |
20 |
------------------------------------------------------------------ |
4731 |
20 Jan 09 |
martin |
21 |
@author Martin |
4731 |
20 Jan 09 |
martin |
22 |
@version 2.10 |
4731 |
20 Jan 09 |
martin |
23 |
--%> |
5426 |
24 Sep 10 |
nicklas |
24 |
<%@ page pageEncoding="UTF-8" session="false" |
4731 |
20 Jan 09 |
martin |
25 |
import="net.sf.basedb.core.SessionControl" |
4731 |
20 Jan 09 |
martin |
26 |
import="net.sf.basedb.core.DbControl" |
4731 |
20 Jan 09 |
martin |
27 |
import="net.sf.basedb.core.Item" |
4731 |
20 Jan 09 |
martin |
28 |
import="net.sf.basedb.core.ItemContext" |
4731 |
20 Jan 09 |
martin |
29 |
import="net.sf.basedb.core.Permission" |
4731 |
20 Jan 09 |
martin |
30 |
import="net.sf.basedb.core.BioPlate" |
5262 |
08 Mar 10 |
nicklas |
31 |
import="net.sf.basedb.core.BioPlateType" |
4731 |
20 Jan 09 |
martin |
32 |
import="net.sf.basedb.core.BioWell" |
5709 |
26 Aug 11 |
nicklas |
33 |
import="net.sf.basedb.core.ItemSubtype" |
4731 |
20 Jan 09 |
martin |
34 |
import="net.sf.basedb.core.MeasuredBioMaterial" |
4731 |
20 Jan 09 |
martin |
35 |
import="net.sf.basedb.core.Sample" |
4731 |
20 Jan 09 |
martin |
36 |
import="net.sf.basedb.core.Extract" |
4731 |
20 Jan 09 |
martin |
37 |
import="net.sf.basedb.core.PermissionDeniedException" |
4731 |
20 Jan 09 |
martin |
38 |
import="net.sf.basedb.core.BaseException" |
4731 |
20 Jan 09 |
martin |
39 |
import="net.sf.basedb.clients.web.Base" |
4731 |
20 Jan 09 |
martin |
40 |
import="net.sf.basedb.clients.web.util.HTML" |
4731 |
20 Jan 09 |
martin |
41 |
import="net.sf.basedb.util.Values" |
4869 |
31 Mar 09 |
martin |
42 |
import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
5492 |
16 Nov 10 |
nicklas |
43 |
import="net.sf.basedb.core.plugin.GuiContext" |
5492 |
16 Nov 10 |
nicklas |
44 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5492 |
16 Nov 10 |
nicklas |
45 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5492 |
16 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
47 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5492 |
16 Nov 10 |
nicklas |
48 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
4731 |
20 Jan 09 |
martin |
49 |
import="java.util.List" |
4731 |
20 Jan 09 |
martin |
50 |
%> |
4731 |
20 Jan 09 |
martin |
51 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
6145 |
21 Sep 12 |
nicklas |
52 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
4731 |
20 Jan 09 |
martin |
53 |
<% |
4731 |
20 Jan 09 |
martin |
54 |
final Item itemType = Item.BIOWELL; |
4731 |
20 Jan 09 |
martin |
55 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
4731 |
20 Jan 09 |
martin |
56 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
4731 |
20 Jan 09 |
martin |
57 |
final int itemId = cc.getId(); |
4731 |
20 Jan 09 |
martin |
58 |
final String ID = sc.getId(); |
4731 |
20 Jan 09 |
martin |
59 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
60 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
4731 |
20 Jan 09 |
martin |
61 |
try |
4731 |
20 Jan 09 |
martin |
62 |
{ |
4731 |
20 Jan 09 |
martin |
63 |
String title = null; |
4731 |
20 Jan 09 |
martin |
64 |
BioWell bioWell = BioWell.getById(dc, itemId); |
4731 |
20 Jan 09 |
martin |
65 |
BioPlate bioPlate = bioWell.getPlate(); |
5262 |
08 Mar 10 |
nicklas |
66 |
BioPlateType bioPlateType = bioPlate.getBioPlateType(); |
5262 |
08 Mar 10 |
nicklas |
67 |
Item bioMaterialType = bioPlateType.getBioMaterialType(); |
5709 |
26 Aug 11 |
nicklas |
68 |
ItemSubtype bioMaterialSubType = bioPlateType.getItemSubtype(); |
4731 |
20 Jan 09 |
martin |
69 |
|
6540 |
26 Sep 14 |
nicklas |
70 |
bioWell.checkPermission(Permission.USE); |
4869 |
31 Mar 09 |
martin |
71 |
WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true); |
4869 |
31 Mar 09 |
martin |
72 |
WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false); |
4731 |
20 Jan 09 |
martin |
73 |
|
5708 |
25 Aug 11 |
nicklas |
74 |
title = "Edit biowell -- " + rowFormatter.format(bioWell.getRow()) + columnFormatter.format(bioWell.getColumn()) + " on " + HTML.encodeTags(bioPlate.getName()); |
4731 |
20 Jan 09 |
martin |
75 |
|
4731 |
20 Jan 09 |
martin |
76 |
boolean readCurrentBioMaterial = true; |
4731 |
20 Jan 09 |
martin |
77 |
MeasuredBioMaterial currentBioMaterial = null; |
4731 |
20 Jan 09 |
martin |
78 |
try |
4731 |
20 Jan 09 |
martin |
79 |
{ |
4731 |
20 Jan 09 |
martin |
80 |
currentBioMaterial = bioWell.getBioMaterial(); |
4731 |
20 Jan 09 |
martin |
81 |
} |
4731 |
20 Jan 09 |
martin |
82 |
catch (PermissionDeniedException ex) |
4731 |
20 Jan 09 |
martin |
83 |
{ |
4731 |
20 Jan 09 |
martin |
84 |
readCurrentBioMaterial = false; |
4731 |
20 Jan 09 |
martin |
85 |
} |
5459 |
29 Oct 10 |
nicklas |
86 |
boolean canAddBioMaterial = bioWell.canAddBioMaterial(); |
4731 |
20 Jan 09 |
martin |
87 |
|
4731 |
20 Jan 09 |
martin |
88 |
cc.setObject("item", bioWell); |
5492 |
16 Nov 10 |
nicklas |
89 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), bioWell); |
7604 |
25 Feb 19 |
nicklas |
90 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
4731 |
20 Jan 09 |
martin |
91 |
%> |
6306 |
13 Aug 13 |
nicklas |
92 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6306 |
13 Aug 13 |
nicklas |
93 |
<base:head scripts="~biowells.js" styles="tabcontrol.css"> |
5492 |
16 Nov 10 |
nicklas |
94 |
<ext:scripts context="<%=jspContext%>" /> |
5492 |
16 Nov 10 |
nicklas |
95 |
<ext:stylesheets context="<%=jspContext%>" /> |
4731 |
20 Jan 09 |
martin |
96 |
</base:head> |
4731 |
20 Jan 09 |
martin |
97 |
<base:body> |
5913 |
15 Dec 11 |
nicklas |
98 |
<h1><%=title%> <base:help helpid="biowell.edit" /></h1> |
6162 |
10 Oct 12 |
nicklas |
99 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="biowell"> |
4731 |
20 Jan 09 |
martin |
100 |
<input type="hidden" name="cmd" value="UpdateItem"> |
4731 |
20 Jan 09 |
martin |
101 |
|
5913 |
15 Dec 11 |
nicklas |
102 |
<div class="content bottomborder"> |
5913 |
15 Dec 11 |
nicklas |
103 |
|
5913 |
15 Dec 11 |
nicklas |
104 |
<table class="fullform input100"> |
4731 |
20 Jan 09 |
martin |
105 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
106 |
<th>Bioplate</th> |
4731 |
20 Jan 09 |
martin |
107 |
<td><%=HTML.encodeTags(bioPlate.getName())%></td> |
4731 |
20 Jan 09 |
martin |
108 |
</tr> |
4731 |
20 Jan 09 |
martin |
109 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
110 |
<th>Well location</th> |
5708 |
25 Aug 11 |
nicklas |
111 |
<td><%=rowFormatter.format(bioWell.getRow())%><%=columnFormatter.format(bioWell.getColumn())%></td> |
4731 |
20 Jan 09 |
martin |
112 |
</tr> |
4731 |
20 Jan 09 |
martin |
113 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
114 |
<th>Biomaterial type</th> |
4731 |
20 Jan 09 |
martin |
115 |
<td> |
6306 |
13 Aug 13 |
nicklas |
116 |
<select name="biomaterial_type" <%=bioMaterialType != null ? "disabled": ""%>> |
4731 |
20 Jan 09 |
martin |
117 |
<% |
4731 |
20 Jan 09 |
martin |
118 |
if (!readCurrentBioMaterial) |
4731 |
20 Jan 09 |
martin |
119 |
{ |
4731 |
20 Jan 09 |
martin |
120 |
%> |
4731 |
20 Jan 09 |
martin |
121 |
<option value="-1">- denied - |
4731 |
20 Jan 09 |
martin |
122 |
<% |
4731 |
20 Jan 09 |
martin |
123 |
} |
4731 |
20 Jan 09 |
martin |
124 |
else |
4731 |
20 Jan 09 |
martin |
125 |
{ |
4731 |
20 Jan 09 |
martin |
126 |
Item currentBmType = currentBioMaterial == null ? null : currentBioMaterial.getType(); |
5709 |
26 Aug 11 |
nicklas |
127 |
String subtype = bioMaterialSubType != null ? " ("+HTML.encodeTags(bioMaterialSubType.getName()) + ")" : ""; |
4731 |
20 Jan 09 |
martin |
128 |
%> |
4731 |
20 Jan 09 |
martin |
129 |
<option value="0">- none - |
5348 |
20 May 10 |
nicklas |
130 |
<option value="<%=Item.SAMPLE.name()%>" |
5709 |
26 Aug 11 |
nicklas |
131 |
<%=currentBmType == Item.SAMPLE || bioMaterialType == Item.SAMPLE ? "selected" : ""%>>Sample<%=subtype %> |
5348 |
20 May 10 |
nicklas |
132 |
<option value="<%=Item.EXTRACT.name()%>" |
5709 |
26 Aug 11 |
nicklas |
133 |
<%=currentBmType == Item.EXTRACT || bioMaterialType == Item.EXTRACT ? "selected" : ""%>>Extract<%=subtype %> |
4731 |
20 Jan 09 |
martin |
134 |
<% |
4731 |
20 Jan 09 |
martin |
135 |
} |
4731 |
20 Jan 09 |
martin |
136 |
%> |
4731 |
20 Jan 09 |
martin |
137 |
</select> |
4731 |
20 Jan 09 |
martin |
138 |
</td> |
4731 |
20 Jan 09 |
martin |
139 |
</tr> |
4731 |
20 Jan 09 |
martin |
140 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
141 |
<th>Biomaterial</th> |
4731 |
20 Jan 09 |
martin |
142 |
<td> |
4731 |
20 Jan 09 |
martin |
143 |
<base:select |
4731 |
20 Jan 09 |
martin |
144 |
id="biomaterial_id" |
4731 |
20 Jan 09 |
martin |
145 |
clazz="selectionlist" |
4731 |
20 Jan 09 |
martin |
146 |
required="false" |
4731 |
20 Jan 09 |
martin |
147 |
current="<%=currentBioMaterial%>" |
4731 |
20 Jan 09 |
martin |
148 |
denied="<%=!readCurrentBioMaterial%>" |
4731 |
20 Jan 09 |
martin |
149 |
recent="<%=null%>" |
5459 |
29 Oct 10 |
nicklas |
150 |
newitem="<%=false%>" |
6306 |
13 Aug 13 |
nicklas |
151 |
data-biomaterial-subtype="<%=bioMaterialSubType == null ? "" : bioMaterialSubType.getId() %>" |
4731 |
20 Jan 09 |
martin |
152 |
/> |
4731 |
20 Jan 09 |
martin |
153 |
</td> |
4731 |
20 Jan 09 |
martin |
154 |
</tr> |
5459 |
29 Oct 10 |
nicklas |
155 |
<% |
5459 |
29 Oct 10 |
nicklas |
156 |
if (!canAddBioMaterial && currentBioMaterial != null) |
5459 |
29 Oct 10 |
nicklas |
157 |
{ |
5459 |
29 Oct 10 |
nicklas |
158 |
%> |
5459 |
29 Oct 10 |
nicklas |
159 |
<tr> |
5913 |
15 Dec 11 |
nicklas |
160 |
<th></th> |
5459 |
29 Oct 10 |
nicklas |
161 |
<td> |
5977 |
20 Feb 12 |
nicklas |
162 |
<div class="messagecontainer note"> |
5459 |
29 Oct 10 |
nicklas |
163 |
New biomaterial can't be added to this well if |
5459 |
29 Oct 10 |
nicklas |
164 |
'<%=HTML.encodeTags(currentBioMaterial.getName())%>' is removed. |
5977 |
20 Feb 12 |
nicklas |
165 |
</div> |
5459 |
29 Oct 10 |
nicklas |
166 |
</td> |
5459 |
29 Oct 10 |
nicklas |
167 |
</tr> |
5459 |
29 Oct 10 |
nicklas |
168 |
<% |
5459 |
29 Oct 10 |
nicklas |
169 |
} |
5459 |
29 Oct 10 |
nicklas |
170 |
%> |
5913 |
15 Dec 11 |
nicklas |
171 |
<tr class="dynamic"> |
5913 |
15 Dec 11 |
nicklas |
172 |
<th></th> |
5913 |
15 Dec 11 |
nicklas |
173 |
<td></td> |
5913 |
15 Dec 11 |
nicklas |
174 |
</tr> |
4731 |
20 Jan 09 |
martin |
175 |
</table> |
6145 |
21 Sep 12 |
nicklas |
176 |
</div> |
4731 |
20 Jan 09 |
martin |
177 |
</form> |
5913 |
15 Dec 11 |
nicklas |
178 |
|
5913 |
15 Dec 11 |
nicklas |
179 |
<base:buttongroup subclass="dialogbuttons"> |
6306 |
13 Aug 13 |
nicklas |
180 |
<base:button id="btnSave" title="Save" /> |
6306 |
13 Aug 13 |
nicklas |
181 |
<base:button id="close" title="Cancel" /> |
5913 |
15 Dec 11 |
nicklas |
182 |
</base:buttongroup> |
4731 |
20 Jan 09 |
martin |
183 |
</base:body> |
4731 |
20 Jan 09 |
martin |
184 |
</base:page> |
4731 |
20 Jan 09 |
martin |
185 |
<% |
4731 |
20 Jan 09 |
martin |
186 |
} |
4731 |
20 Jan 09 |
martin |
187 |
finally |
4731 |
20 Jan 09 |
martin |
188 |
{ |
4731 |
20 Jan 09 |
martin |
189 |
if (dc != null) dc.close(); |
4731 |
20 Jan 09 |
martin |
190 |
} |
4731 |
20 Jan 09 |
martin |
191 |
%> |