3145 |
25 Feb 15 |
nicklas |
1 |
<%@ page |
3145 |
25 Feb 15 |
nicklas |
2 |
pageEncoding="UTF-8" |
3145 |
25 Feb 15 |
nicklas |
3 |
session="false" |
3145 |
25 Feb 15 |
nicklas |
4 |
import="net.sf.basedb.core.User" |
3145 |
25 Feb 15 |
nicklas |
5 |
import="net.sf.basedb.core.DbControl" |
3145 |
25 Feb 15 |
nicklas |
6 |
import="net.sf.basedb.core.SessionControl" |
3145 |
25 Feb 15 |
nicklas |
7 |
import="net.sf.basedb.core.Application" |
6721 |
03 May 22 |
nicklas |
8 |
import="net.sf.basedb.core.AnnotationType" |
6721 |
03 May 22 |
nicklas |
9 |
import="net.sf.basedb.core.AnnotationSet" |
6721 |
03 May 22 |
nicklas |
10 |
import="net.sf.basedb.core.Annotation" |
3145 |
25 Feb 15 |
nicklas |
11 |
import="net.sf.basedb.core.Sample" |
3145 |
25 Feb 15 |
nicklas |
12 |
import="net.sf.basedb.core.Hardware" |
3145 |
25 Feb 15 |
nicklas |
13 |
import="net.sf.basedb.core.BioPlate" |
3145 |
25 Feb 15 |
nicklas |
14 |
import="net.sf.basedb.core.BioWell" |
3145 |
25 Feb 15 |
nicklas |
15 |
import="net.sf.basedb.core.PermissionDeniedException" |
3145 |
25 Feb 15 |
nicklas |
16 |
import="net.sf.basedb.util.Values" |
3145 |
25 Feb 15 |
nicklas |
17 |
import="net.sf.basedb.util.extensions.Extension" |
3145 |
25 Feb 15 |
nicklas |
18 |
import="net.sf.basedb.clients.web.Base" |
3145 |
25 Feb 15 |
nicklas |
19 |
import="net.sf.basedb.clients.web.util.HTML" |
3145 |
25 Feb 15 |
nicklas |
20 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
3145 |
25 Feb 15 |
nicklas |
21 |
import="java.util.List" |
3145 |
25 Feb 15 |
nicklas |
22 |
import="java.util.ArrayList" |
3145 |
25 Feb 15 |
nicklas |
23 |
%> |
3145 |
25 Feb 15 |
nicklas |
24 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
3145 |
25 Feb 15 |
nicklas |
25 |
<% |
3976 |
26 May 16 |
nicklas |
26 |
final SessionControl sc = Base.getExistingSessionControl(request, "net.sf.basedb.reggie", true); |
3145 |
25 Feb 15 |
nicklas |
27 |
final String ID = sc.getId(); |
3145 |
25 Feb 15 |
nicklas |
28 |
final float scale = Base.getScale(sc); |
3145 |
25 Feb 15 |
nicklas |
29 |
final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie"); |
3145 |
25 Feb 15 |
nicklas |
30 |
final int BLOCKS_PER_PAGE = 3; |
3145 |
25 Feb 15 |
nicklas |
31 |
DbControl dc = null; |
3145 |
25 Feb 15 |
nicklas |
32 |
try |
3145 |
25 Feb 15 |
nicklas |
33 |
{ |
3145 |
25 Feb 15 |
nicklas |
34 |
dc = sc.newDbControl(); |
3145 |
25 Feb 15 |
nicklas |
35 |
final Extension reggie = ExtensionsControl.get(dc).getExtension("net.sf.basedb.reggie"); |
3145 |
25 Feb 15 |
nicklas |
36 |
final User user = User.getById(dc, sc.getLoggedInUserId()); |
3145 |
25 Feb 15 |
nicklas |
37 |
List<Sample> specimen = new ArrayList<Sample>(); |
6721 |
03 May 22 |
nicklas |
38 |
int tubeLabelId = Values.getInt(request.getParameter("tubeLabelAnnotationType")); |
6721 |
03 May 22 |
nicklas |
39 |
AnnotationType labelType = null; |
6721 |
03 May 22 |
nicklas |
40 |
if (tubeLabelId > 0) |
6721 |
03 May 22 |
nicklas |
41 |
{ |
6721 |
03 May 22 |
nicklas |
42 |
labelType = AnnotationType.getById(dc, tubeLabelId); |
6721 |
03 May 22 |
nicklas |
43 |
} |
3145 |
25 Feb 15 |
nicklas |
44 |
for (String id : request.getParameter("specimen").split(",")) |
3145 |
25 Feb 15 |
nicklas |
45 |
{ |
3145 |
25 Feb 15 |
nicklas |
46 |
specimen.add(Sample.getById(dc, Values.getInt(id))); |
3145 |
25 Feb 15 |
nicklas |
47 |
} |
3145 |
25 Feb 15 |
nicklas |
48 |
%> |
3145 |
25 Feb 15 |
nicklas |
49 |
<base:page id="protocol" type="iframe" noskin="true" |
3145 |
25 Feb 15 |
nicklas |
50 |
favicon="<%=home+"/images/partition.png"%>" |
3145 |
25 Feb 15 |
nicklas |
51 |
title="Pick list protocol for specimen re-extraction"> |
3145 |
25 Feb 15 |
nicklas |
52 |
<base:head |
3145 |
25 Feb 15 |
nicklas |
53 |
scripts="~../reggie-2.js,~reextract_picklist.js" |
3145 |
25 Feb 15 |
nicklas |
54 |
styles="~../css/reggie-2.css,~../css/printable.css" |
3145 |
25 Feb 15 |
nicklas |
55 |
> |
3145 |
25 Feb 15 |
nicklas |
56 |
<style> |
3145 |
25 Feb 15 |
nicklas |
57 |
|
3145 |
25 Feb 15 |
nicklas |
58 |
table.samplelist |
3145 |
25 Feb 15 |
nicklas |
59 |
{ |
3145 |
25 Feb 15 |
nicklas |
60 |
width: 100%; |
3145 |
25 Feb 15 |
nicklas |
61 |
border-collapse: collapse; |
3145 |
25 Feb 15 |
nicklas |
62 |
border: 1px solid #000000; |
3145 |
25 Feb 15 |
nicklas |
63 |
} |
3145 |
25 Feb 15 |
nicklas |
64 |
|
3145 |
25 Feb 15 |
nicklas |
65 |
table.samplelist > tbody > tr |
3145 |
25 Feb 15 |
nicklas |
66 |
{ |
3145 |
25 Feb 15 |
nicklas |
67 |
height: 1.25cm; |
3145 |
25 Feb 15 |
nicklas |
68 |
} |
3145 |
25 Feb 15 |
nicklas |
69 |
|
3145 |
25 Feb 15 |
nicklas |
70 |
table.samplelist > tbody > tr > th |
3145 |
25 Feb 15 |
nicklas |
71 |
{ |
3155 |
27 Feb 15 |
nicklas |
72 |
background-color: #F0F0F0; |
3145 |
25 Feb 15 |
nicklas |
73 |
border: 1px solid #000000; |
3145 |
25 Feb 15 |
nicklas |
74 |
font-size: 1em; |
3145 |
25 Feb 15 |
nicklas |
75 |
} |
3145 |
25 Feb 15 |
nicklas |
76 |
|
3145 |
25 Feb 15 |
nicklas |
77 |
table.samplelist > tbody > tr > td |
3145 |
25 Feb 15 |
nicklas |
78 |
{ |
3145 |
25 Feb 15 |
nicklas |
79 |
border: 1px solid #000000; |
3145 |
25 Feb 15 |
nicklas |
80 |
vertical-align: middle; |
3145 |
25 Feb 15 |
nicklas |
81 |
font-size: 1em; |
3145 |
25 Feb 15 |
nicklas |
82 |
padding: 0.5em; |
3145 |
25 Feb 15 |
nicklas |
83 |
} |
3145 |
25 Feb 15 |
nicklas |
84 |
|
6721 |
03 May 22 |
nicklas |
85 |
.name, td.label |
3145 |
25 Feb 15 |
nicklas |
86 |
{ |
3145 |
25 Feb 15 |
nicklas |
87 |
font-weight: bold; |
6721 |
03 May 22 |
nicklas |
88 |
width: 12%; |
3145 |
25 Feb 15 |
nicklas |
89 |
} |
3145 |
25 Feb 15 |
nicklas |
90 |
.freezer |
3145 |
25 Feb 15 |
nicklas |
91 |
{ |
3145 |
25 Feb 15 |
nicklas |
92 |
width: 30%; |
3145 |
25 Feb 15 |
nicklas |
93 |
} |
3145 |
25 Feb 15 |
nicklas |
94 |
.box |
3145 |
25 Feb 15 |
nicklas |
95 |
{ |
3145 |
25 Feb 15 |
nicklas |
96 |
width: 15%; |
3145 |
25 Feb 15 |
nicklas |
97 |
text-align: center; |
3145 |
25 Feb 15 |
nicklas |
98 |
} |
3145 |
25 Feb 15 |
nicklas |
99 |
.remain |
3145 |
25 Feb 15 |
nicklas |
100 |
{ |
6721 |
03 May 22 |
nicklas |
101 |
width: 10%; |
3145 |
25 Feb 15 |
nicklas |
102 |
text-align: center; |
3145 |
25 Feb 15 |
nicklas |
103 |
} |
3145 |
25 Feb 15 |
nicklas |
104 |
.remark |
3145 |
25 Feb 15 |
nicklas |
105 |
{ |
6721 |
03 May 22 |
nicklas |
106 |
width: 20%; |
3145 |
25 Feb 15 |
nicklas |
107 |
} |
6721 |
03 May 22 |
nicklas |
108 |
.nolabels .label |
6721 |
03 May 22 |
nicklas |
109 |
{ |
6721 |
03 May 22 |
nicklas |
110 |
display: none; |
6721 |
03 May 22 |
nicklas |
111 |
} |
3145 |
25 Feb 15 |
nicklas |
112 |
</style> |
3145 |
25 Feb 15 |
nicklas |
113 |
</base:head> |
3145 |
25 Feb 15 |
nicklas |
114 |
<base:body> |
3145 |
25 Feb 15 |
nicklas |
115 |
|
3145 |
25 Feb 15 |
nicklas |
116 |
<div class="paper"> |
3145 |
25 Feb 15 |
nicklas |
117 |
|
3145 |
25 Feb 15 |
nicklas |
118 |
<form name="reggie" id="wizard"> |
3145 |
25 Feb 15 |
nicklas |
119 |
|
3145 |
25 Feb 15 |
nicklas |
120 |
<div id="wizard-status"></div> |
3145 |
25 Feb 15 |
nicklas |
121 |
|
6721 |
03 May 22 |
nicklas |
122 |
<div id="all-protocol" style="display: none;" class="nolabels"> |
3145 |
25 Feb 15 |
nicklas |
123 |
|
3145 |
25 Feb 15 |
nicklas |
124 |
<div id="print-instructions" class="noprint fullwidth"> |
3145 |
25 Feb 15 |
nicklas |
125 |
<base:button id="print-button" image="<%=home+"/images/print.png"%>" title="Print…" /> |
3145 |
25 Feb 15 |
nicklas |
126 |
<br clear="all"> |
3145 |
25 Feb 15 |
nicklas |
127 |
</div> |
3145 |
25 Feb 15 |
nicklas |
128 |
|
3145 |
25 Feb 15 |
nicklas |
129 |
<h1>Pick list protocol for specimen re-extraction <span class="reggie">Reggie <%=reggie.getAbout().getVersion() %></span></h1> |
3145 |
25 Feb 15 |
nicklas |
130 |
|
3145 |
25 Feb 15 |
nicklas |
131 |
<table style="width: 100%;" class="samplelist"> |
3145 |
25 Feb 15 |
nicklas |
132 |
<tr> |
3145 |
25 Feb 15 |
nicklas |
133 |
<th class="name">Sample</th> |
6721 |
03 May 22 |
nicklas |
134 |
<th class="label">Label¹</th> |
3145 |
25 Feb 15 |
nicklas |
135 |
<th class="freezer">Freezer</th> |
3145 |
25 Feb 15 |
nicklas |
136 |
<th class="box">Box</th> |
3145 |
25 Feb 15 |
nicklas |
137 |
<th class="remain">Remaining quantity</th> |
3145 |
25 Feb 15 |
nicklas |
138 |
<th class="remark">Remark</th> |
3145 |
25 Feb 15 |
nicklas |
139 |
</tr> |
3145 |
25 Feb 15 |
nicklas |
140 |
<% |
6721 |
03 May 22 |
nicklas |
141 |
int numSamples = 0; |
6721 |
03 May 22 |
nicklas |
142 |
int numWithLabel = 0; |
3145 |
25 Feb 15 |
nicklas |
143 |
for (Sample s : specimen) |
3145 |
25 Feb 15 |
nicklas |
144 |
{ |
6721 |
03 May 22 |
nicklas |
145 |
numSamples++; |
3145 |
25 Feb 15 |
nicklas |
146 |
Float reminingQuantity = s.getRemainingQuantity(); |
3145 |
25 Feb 15 |
nicklas |
147 |
BioWell well = s.getBioWell(); |
5782 |
11 Dec 19 |
nicklas |
148 |
BioPlate plate = well == null ? null : well.getPlate(); |
5782 |
11 Dec 19 |
nicklas |
149 |
Hardware freezer = plate == null ? null : plate.getFreezer(); |
5783 |
12 Dec 19 |
nicklas |
150 |
List<String> remarks = new ArrayList<>(); |
5783 |
12 Dec 19 |
nicklas |
151 |
if (!s.getName().matches("\\d+\\.\\d.*")) remarks.add("External specimen"); |
5335 |
28 Mar 19 |
nicklas |
152 |
List<String> freezerLocation = new ArrayList<>(); |
5782 |
11 Dec 19 |
nicklas |
153 |
if (plate != null) |
5782 |
11 Dec 19 |
nicklas |
154 |
{ |
5783 |
12 Dec 19 |
nicklas |
155 |
if (plate.getName().startsWith("PSp")) remarks.add("Paused specimen"); |
5782 |
11 Dec 19 |
nicklas |
156 |
if (plate.getSection() != null) freezerLocation.add("Section " + plate.getSection()); |
5782 |
11 Dec 19 |
nicklas |
157 |
if (plate.getTray() != null) freezerLocation.add("Tray " + plate.getTray()); |
5782 |
11 Dec 19 |
nicklas |
158 |
if (plate.getPosition() != null) freezerLocation.add("Position " + plate.getPosition()); |
5782 |
11 Dec 19 |
nicklas |
159 |
} |
6721 |
03 May 22 |
nicklas |
160 |
String label = null; |
6721 |
03 May 22 |
nicklas |
161 |
if (labelType != null) |
6721 |
03 May 22 |
nicklas |
162 |
{ |
6721 |
03 May 22 |
nicklas |
163 |
AnnotationSet as = s.getAnnotationSet(); |
6721 |
03 May 22 |
nicklas |
164 |
if (as.hasAnnotation(labelType, Annotation.Source.PRIMARY)) |
6721 |
03 May 22 |
nicklas |
165 |
{ |
6721 |
03 May 22 |
nicklas |
166 |
label = (String)as.getAnnotation(labelType).getValues().get(0); |
6721 |
03 May 22 |
nicklas |
167 |
if (label != null) numWithLabel++; |
6721 |
03 May 22 |
nicklas |
168 |
} |
6721 |
03 May 22 |
nicklas |
169 |
} |
3145 |
25 Feb 15 |
nicklas |
170 |
%> |
3145 |
25 Feb 15 |
nicklas |
171 |
<tr> |
3145 |
25 Feb 15 |
nicklas |
172 |
<td class="name"><%=HTML.encodeTags(s.getName()) %></td> |
6721 |
03 May 22 |
nicklas |
173 |
<td class="label"><%=HTML.encodeTags(label)%></td> |
3145 |
25 Feb 15 |
nicklas |
174 |
<td class="freezer"> |
5335 |
28 Mar 19 |
nicklas |
175 |
<% |
5335 |
28 Mar 19 |
nicklas |
176 |
if (freezer == null) |
5335 |
28 Mar 19 |
nicklas |
177 |
{ |
5335 |
28 Mar 19 |
nicklas |
178 |
%><i>- unknown -</i><br><% |
5335 |
28 Mar 19 |
nicklas |
179 |
} |
5335 |
28 Mar 19 |
nicklas |
180 |
else |
5335 |
28 Mar 19 |
nicklas |
181 |
{ |
5335 |
28 Mar 19 |
nicklas |
182 |
%> |
5335 |
28 Mar 19 |
nicklas |
183 |
<%=HTML.encodeTags(freezer.getName()) %><br> |
5335 |
28 Mar 19 |
nicklas |
184 |
<% |
5335 |
28 Mar 19 |
nicklas |
185 |
} |
5335 |
28 Mar 19 |
nicklas |
186 |
%> |
5335 |
28 Mar 19 |
nicklas |
187 |
<%=Values.getString(freezerLocation, ", ", true) %> |
3145 |
25 Feb 15 |
nicklas |
188 |
</td> |
5782 |
11 Dec 19 |
nicklas |
189 |
<td class="box"> |
5782 |
11 Dec 19 |
nicklas |
190 |
<% |
5782 |
11 Dec 19 |
nicklas |
191 |
if (well == null) |
5782 |
11 Dec 19 |
nicklas |
192 |
{ |
5782 |
11 Dec 19 |
nicklas |
193 |
%><i>- unknown -</i><% |
5782 |
11 Dec 19 |
nicklas |
194 |
} |
5782 |
11 Dec 19 |
nicklas |
195 |
else |
5782 |
11 Dec 19 |
nicklas |
196 |
{ |
5782 |
11 Dec 19 |
nicklas |
197 |
%> |
5782 |
11 Dec 19 |
nicklas |
198 |
<%=HTML.encodeTags(plate.getName()) %> <%=well.getCoordinate() %> |
5782 |
11 Dec 19 |
nicklas |
199 |
<% |
5782 |
11 Dec 19 |
nicklas |
200 |
} |
5782 |
11 Dec 19 |
nicklas |
201 |
%> |
5782 |
11 Dec 19 |
nicklas |
202 |
</td> |
5335 |
28 Mar 19 |
nicklas |
203 |
<td class="remain"><%=reminingQuantity == null ? "<i>n/a</i>" : Values.formatNumber(reminingQuantity / 1000, 0, "mg") %></td> |
5783 |
12 Dec 19 |
nicklas |
204 |
<td class="remark"><%=Values.getString(remarks, "; ", true) %></td> |
3145 |
25 Feb 15 |
nicklas |
205 |
</tr> |
3145 |
25 Feb 15 |
nicklas |
206 |
<% |
3145 |
25 Feb 15 |
nicklas |
207 |
} |
3145 |
25 Feb 15 |
nicklas |
208 |
%> |
3145 |
25 Feb 15 |
nicklas |
209 |
</table> |
6721 |
03 May 22 |
nicklas |
210 |
<div id="protocol-footer" class="label" data-num-with-labels="<%=numWithLabel%>" |
6721 |
03 May 22 |
nicklas |
211 |
style="margin-top: 0.5em;">¹ Some SCAN-B tubes have a non-standard label.</div> |
3145 |
25 Feb 15 |
nicklas |
212 |
</div> |
3145 |
25 Feb 15 |
nicklas |
213 |
</form> |
3145 |
25 Feb 15 |
nicklas |
214 |
</div> |
3145 |
25 Feb 15 |
nicklas |
215 |
</base:body> |
3145 |
25 Feb 15 |
nicklas |
216 |
</base:page> |
3145 |
25 Feb 15 |
nicklas |
217 |
<% |
3145 |
25 Feb 15 |
nicklas |
218 |
} |
3145 |
25 Feb 15 |
nicklas |
219 |
finally |
3145 |
25 Feb 15 |
nicklas |
220 |
{ |
3145 |
25 Feb 15 |
nicklas |
221 |
if (dc != null) dc.close(); |
3145 |
25 Feb 15 |
nicklas |
222 |
} |
3145 |
25 Feb 15 |
nicklas |
223 |
%> |