1 | <%@ page |
---|
2 | pageEncoding="UTF-8" |
---|
3 | session="false" |
---|
4 | import="net.sf.basedb.core.User" |
---|
5 | import="net.sf.basedb.core.DbControl" |
---|
6 | import="net.sf.basedb.core.SessionControl" |
---|
7 | import="net.sf.basedb.clients.web.Base" |
---|
8 | %> |
---|
9 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
10 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
11 | <% |
---|
12 | final SessionControl sc = Base.getExistingSessionControl(request, true); |
---|
13 | final String ID = sc.getId(); |
---|
14 | final float scale = Base.getScale(sc); |
---|
15 | DbControl dc = null; |
---|
16 | try |
---|
17 | { |
---|
18 | dc = sc.newDbControl(); |
---|
19 | final User user = User.getById(dc, sc.getLoggedInUserId()); |
---|
20 | %> |
---|
21 | <base:page type="default" > |
---|
22 | <base:head scripts="ajax.js" styles="path.css"> |
---|
23 | <link rel="stylesheet" type="text/css" href="reggie.css"> |
---|
24 | <script language="JavaScript" src="reggie.js" type="text/javascript" charset="UTF-8"></script> |
---|
25 | |
---|
26 | |
---|
27 | <script language="JavaScript"> |
---|
28 | var debug = false; |
---|
29 | var currentStep = 1; |
---|
30 | |
---|
31 | var specimenTubes = null; |
---|
32 | var selectedTubes = null; |
---|
33 | |
---|
34 | var partitionDateIsValid = false; |
---|
35 | |
---|
36 | var spWeightsAreValid; |
---|
37 | var apWeightsAreValid; |
---|
38 | var hisWeightsAreValid; |
---|
39 | var oneOrMoreWeightsAreSet; |
---|
40 | var nofPiecesAreValid; |
---|
41 | |
---|
42 | function init() |
---|
43 | { |
---|
44 | var frm = document.forms['reggie']; |
---|
45 | var selectList = frm.tubesSelect; |
---|
46 | getSpecimenTubes(); |
---|
47 | |
---|
48 | var specimenTubeOptions = ''; |
---|
49 | if (specimenTubes != null && specimenTubes.length > 0) |
---|
50 | { |
---|
51 | for (var i=0;i<specimenTubes.length;i++) |
---|
52 | { |
---|
53 | var tube = specimenTubes[i]; |
---|
54 | selectList.options[selectList.length] = new Option(tube.name, tube.name); |
---|
55 | } |
---|
56 | } |
---|
57 | else |
---|
58 | { |
---|
59 | selectList.disabled = true; |
---|
60 | Main.hide('gonext'); |
---|
61 | setInputStatus('tubes','No tubes available for partition', 'invalid') |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | function goNext() |
---|
66 | { |
---|
67 | setInnerHTML('gonext.message', ''); |
---|
68 | if (currentStep == 1) |
---|
69 | { |
---|
70 | gotoStep2(); |
---|
71 | } |
---|
72 | else if (currentStep == 2) |
---|
73 | { |
---|
74 | partitionDateOnBlur(); |
---|
75 | if (step2IsValid()) gotoStep3(); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | function step2IsValid() |
---|
80 | { |
---|
81 | return partitionDateIsValid; |
---|
82 | } |
---|
83 | |
---|
84 | function step3IsValid() |
---|
85 | { |
---|
86 | for (var i=0; i<spWeightsAreValid.length; i++) |
---|
87 | { |
---|
88 | |
---|
89 | if (spWeightsAreValid[i] == false || |
---|
90 | apWeightsAreValid[i] == false || |
---|
91 | hisWeightsAreValid[i] == false || |
---|
92 | nofPiecesAreValid[i] == false) |
---|
93 | { |
---|
94 | return false; |
---|
95 | } |
---|
96 | if (oneOrMoreWeightsAreSet[i] == false) |
---|
97 | { |
---|
98 | return false; |
---|
99 | } |
---|
100 | } |
---|
101 | return true; |
---|
102 | } |
---|
103 | |
---|
104 | function gotoStep2() |
---|
105 | { |
---|
106 | var frm = document.forms['reggie']; |
---|
107 | var selectList = frm.tubesSelect; |
---|
108 | selectedTubes = new Array(); |
---|
109 | for (var i=0;i<selectList.length; i++) |
---|
110 | { |
---|
111 | if (selectList.options[i].selected) |
---|
112 | selectedTubes.push(specimenTubes[i]); |
---|
113 | } |
---|
114 | |
---|
115 | if (selectedTubes.length == 0) |
---|
116 | { |
---|
117 | setInputStatus('tubes', 'Missing', 'invalid'); |
---|
118 | return; |
---|
119 | } |
---|
120 | |
---|
121 | setInputStatus('tubes', '', 'valid'); |
---|
122 | // Change section |
---|
123 | frm.tubesSelect.disabled = true; |
---|
124 | |
---|
125 | Main.show('partitionSection'); |
---|
126 | Main.show('gocancel'); |
---|
127 | var currentTime = new Date(); |
---|
128 | frm.partitionDate.value = currentTime.getFullYear().toString()+(currentTime.getMonth()+1).toString()+currentTime.getDate().toString(); |
---|
129 | frm.partitionDate.setSelectionRange(0,frm.partitionDate.value.length); |
---|
130 | frm.partitionDate.focus(); |
---|
131 | currentStep = 2; |
---|
132 | } |
---|
133 | |
---|
134 | function gotoStep3() |
---|
135 | { |
---|
136 | var frm = document.forms['reggie']; |
---|
137 | frm.partitionDate.disabled = true; |
---|
138 | |
---|
139 | var inputWeightHtml; |
---|
140 | if (selectedTubes.length > 0) |
---|
141 | { |
---|
142 | spWeightsAreValid = Array(); |
---|
143 | apWeightsAreValid = Array(); |
---|
144 | hisWeightsAreValid = Array(); |
---|
145 | nofPiecesAreValid = Array(); |
---|
146 | oneOrMoreWeightsAreSet = Array(); |
---|
147 | for (var i=0;i<selectedTubes.length;i++) |
---|
148 | { |
---|
149 | spWeightsAreValid[i] = true; |
---|
150 | apWeightsAreValid[i] = true; |
---|
151 | hisWeightsAreValid[i] = true; |
---|
152 | nofPiecesAreValid[i] = false; |
---|
153 | oneOrMoreWeightsAreSet[i] = false; |
---|
154 | } |
---|
155 | |
---|
156 | inputWeightHtml = ''; |
---|
157 | |
---|
158 | var spTitle = 'SpWeight<br>'; |
---|
159 | var apTitle = 'ApWeight<br>'; |
---|
160 | var hisTitle = 'HisWeight<br>'; |
---|
161 | var nofTitle = 'NofPieces<br>'; |
---|
162 | var appearanceTitle = 'Appearance<br>'; |
---|
163 | var necrosisTitle = 'Necrosis%<br>'; |
---|
164 | var fatTitle = 'Fat%<br>'; |
---|
165 | var colouredTitle = 'Coloured<br>'; |
---|
166 | var bloodyTitle = 'Bloody<br>'; |
---|
167 | |
---|
168 | var appearanceOptions = '<option selected ></option>'; |
---|
169 | appearanceOptions += '<option value="HOMOGENOUS">Homogenous</option>'; |
---|
170 | appearanceOptions += '<option value="HETEROGENOUS">Heterogenous</option>'; |
---|
171 | |
---|
172 | var necrosisOptions = '<option selected value="0">0</option>'; |
---|
173 | necrosisOptions += '<option value="20">20</option>'; |
---|
174 | necrosisOptions += '<option value="40">40</option>'; |
---|
175 | necrosisOptions += '<option value="60">60</option>'; |
---|
176 | necrosisOptions += '<option value="80">80</option>'; |
---|
177 | necrosisOptions += '<option value="100">100</option>'; |
---|
178 | |
---|
179 | var fatOptions = '<option selected value=0>0</option>'; |
---|
180 | fatOptions += '<option value=20>20</option>'; |
---|
181 | fatOptions += '<option value=40>40</option>'; |
---|
182 | fatOptions += '<option value=60>60</option>'; |
---|
183 | fatOptions += '<option value=80>80</option>'; |
---|
184 | fatOptions += '<option value=100>100</option>'; |
---|
185 | |
---|
186 | for (var i=0;i<selectedTubes.length; i++) |
---|
187 | { |
---|
188 | var tube = selectedTubes[i]; |
---|
189 | var nextStep = i<(selectedTubes.length-1) ? 'focusOnEnter(event, \'bloody'+(i+1)+'\')' : ''; |
---|
190 | |
---|
191 | inputWeightHtml += '<tr>'; |
---|
192 | inputWeightHtml += '<td rowspan=2 class=prompt>'+tube.name; |
---|
193 | // Only show box information if there is something show. |
---|
194 | if (tube.row != null && tube.column != null) |
---|
195 | { |
---|
196 | inputWeightHtml += ' ['+tube.box+' '+tube.row+tube.column+']'; |
---|
197 | } |
---|
198 | inputWeightHtml += '</td>'; |
---|
199 | |
---|
200 | inputWeightHtml += '<td style="width:400px;">'; |
---|
201 | inputWeightHtml += '<table style="width:100%"><tr>'; |
---|
202 | inputWeightHtml += '<td>'+bloodyTitle+'<input type=checkbox onkeypress="checkOnNumber(event, this);focusOnEnter(event, \'appearance'+i+'\')" onfocus="messageOnFocus(0,'+i+')" name=bloody'+i+' /></td>'; |
---|
203 | inputWeightHtml += '<td>'+appearanceTitle+'<select name=appearance'+i+' onfocus="messageOnFocus(1,'+i+')" onkeypress="focusOnEnter(event, \'necrosis'+i+'\')">'+appearanceOptions+'</select></td>'; |
---|
204 | inputWeightHtml += '<td>'+necrosisTitle+'<select name=necrosis'+i+' onfocus="messageOnFocus(2,'+i+')" onkeypress="focusOnEnter(event, \'fat'+i+'\')">'+necrosisOptions+'</select></td>'; |
---|
205 | inputWeightHtml += '<td>'+fatTitle+'<select name=fat'+i+' onfocus="messageOnFocus(3,'+i+')" onkeypress="focusOnEnter(event, \'coloured'+i+'\')">'+fatOptions+'</select></td>'; |
---|
206 | inputWeightHtml += '<td>'+colouredTitle+'<input type=checkbox name=coloured'+i+' onfocus="messageOnFocus(4,'+i+')" onkeypress="checkOnNumber(event, this);focusOnEnter(event, \'nofPieces'+i+'\')" /></td>' |
---|
207 | inputWeightHtml += '<td>'+nofTitle+'<input name="nofPieces'+i+'" onfocus="messageOnFocus(5,'+i+')" onblur="nofPiecesOnChange('+i+')" onkeypress="focusOnEnter(event, \'spWeight'+i+'\')" size=2 /></td>'; |
---|
208 | inputWeightHtml += '<td>'+spTitle+'<input name="spWeight'+i+'" onfocus="messageOnFocus(6,'+i+')" onblur="spWeightOnChange('+i+')" onkeypress="focusOnEnter(event, \'hisWeight'+i+'\')" size=2 /></td>'; |
---|
209 | inputWeightHtml += '<td>'+hisTitle+'<input name="hisWeight'+i+'" onfocus="messageOnFocus(7,'+i+')" onblur="hisWeightOnChange('+i+')" onkeypress="focusOnEnter(event, \'apWeight'+i+'\')" size=2 /></td>'; |
---|
210 | inputWeightHtml += '<td>'+apTitle+'<input name="apWeight'+i+'" onfocus="messageOnFocus(8,'+i+')" onblur="apWeightOnChange('+i+')" onkeypress="'+nextStep+'" size=2 /></td>'; |
---|
211 | inputWeightHtml += '</tr>'; |
---|
212 | inputWeightHtml += '</table>'; |
---|
213 | inputWeightHtml += '</td>'; |
---|
214 | inputWeightHtml += '<td rowspan=2 class="status" id="'+i+'.status"></td>'; |
---|
215 | inputWeightHtml += '</tr>'; |
---|
216 | |
---|
217 | inputWeightHtml += '<tr>'; |
---|
218 | inputWeightHtml += '<td style="width:400px;" class="help"><span class="message" id="'+i+'.message"></span><span id="'+i+'.help"></span></td>'; |
---|
219 | inputWeightHtml += '</tr>'; |
---|
220 | inputWeightHtml += '<tr><td> </td></tr>'; |
---|
221 | } |
---|
222 | setInnerHTML('weightInputs', inputWeightHtml); |
---|
223 | } |
---|
224 | Main.show('weightSection'); |
---|
225 | Main.hide('gonext'); |
---|
226 | Main.show('gocreate'); |
---|
227 | frm.bloody0.focus(); |
---|
228 | } |
---|
229 | |
---|
230 | function checkOnNumber(event, element) |
---|
231 | { |
---|
232 | if (event.charCode == 48) |
---|
233 | { |
---|
234 | element.checked = false; |
---|
235 | } |
---|
236 | else if (event.charCode == 49) |
---|
237 | { |
---|
238 | element.checked = true; |
---|
239 | } |
---|
240 | return true; |
---|
241 | } |
---|
242 | |
---|
243 | function messageOnFocus(order, tubeIndex) |
---|
244 | { |
---|
245 | var helpMessage; |
---|
246 | switch(order) |
---|
247 | { |
---|
248 | case 0: |
---|
249 | helpMessage = 'Check this if the partition is bloody. Unchecked is default.'; |
---|
250 | break; |
---|
251 | case 1: |
---|
252 | helpMessage = 'Select appearance. Empty is default'; |
---|
253 | break; |
---|
254 | case 2: |
---|
255 | helpMessage = 'Select percentage of necrosis. \'0\' is default.'; |
---|
256 | break; |
---|
257 | case 3: |
---|
258 | helpMessage = 'Select percentage of fat. \'0\' is default.'; |
---|
259 | break; |
---|
260 | case 4: |
---|
261 | helpMessage = 'Check this if the partition is coloured. Unchecked is default.'; |
---|
262 | break; |
---|
263 | case 5: |
---|
264 | helpMessage = 'Number of pieces in this partition.'; |
---|
265 | break; |
---|
266 | case 6: |
---|
267 | helpMessage = 'Sp weight in [mg].'; |
---|
268 | break; |
---|
269 | case 7: |
---|
270 | helpMessage = 'His weight in [mg].'; |
---|
271 | break; |
---|
272 | case 8: |
---|
273 | helpMessage = 'Ap weight in [mg].'; |
---|
274 | break; |
---|
275 | default: |
---|
276 | helpMessage=' '; |
---|
277 | } |
---|
278 | for (var i=0;i<selectedTubes.length;i++) |
---|
279 | { |
---|
280 | if (i!=tubeIndex) setInnerHTML(i+'.help', ' ') |
---|
281 | } |
---|
282 | setInnerHTML(tubeIndex+'.help', helpMessage); |
---|
283 | } |
---|
284 | |
---|
285 | function updateInputStatus(tubeIndex) |
---|
286 | { |
---|
287 | var frm = document.forms['reggie']; |
---|
288 | if(nofPiecesAreValid[tubeIndex] == false) |
---|
289 | { |
---|
290 | setInputStatus(tubeIndex, 'NofPieces is invalid.', 'invalid'); |
---|
291 | frm.elements['nofPieces'+tubeIndex].focus(); |
---|
292 | return ; |
---|
293 | } |
---|
294 | if (spWeightsAreValid[tubeIndex] == false) |
---|
295 | { |
---|
296 | setInputStatus(tubeIndex, 'SpWeight is invalid.','invalid'); |
---|
297 | return; |
---|
298 | } |
---|
299 | if(hisWeightsAreValid[tubeIndex] == false) |
---|
300 | { |
---|
301 | setInputStatus(tubeIndex, 'HisWeight is invalid.', 'invalid'); |
---|
302 | return; |
---|
303 | } |
---|
304 | if(apWeightsAreValid[tubeIndex] == false) |
---|
305 | { |
---|
306 | setInputStatus(tubeIndex, 'APWeight is invalid.', 'invalid'); |
---|
307 | return; |
---|
308 | } |
---|
309 | |
---|
310 | var spWeightValue = frm.elements['spWeight'+tubeIndex].value; |
---|
311 | var apWeightValue = frm.elements['apWeight'+tubeIndex].value; |
---|
312 | var hisWeightValue = frm.elements['hisWeight'+tubeIndex].value; |
---|
313 | if (spWeightValue == '' && apWeightValue == '' && hisWeightValue == '') |
---|
314 | { |
---|
315 | oneOrMoreWeightsAreSet[tubeIndex] = false; |
---|
316 | setInputStatus(tubeIndex, 'No weight is defined.', 'invalid'); |
---|
317 | return; |
---|
318 | } |
---|
319 | oneOrMoreWeightsAreSet[tubeIndex] = true; |
---|
320 | setInputStatus(tubeIndex, '', 'valid'); |
---|
321 | } |
---|
322 | |
---|
323 | function spWeightOnChange(tubeIndex) |
---|
324 | { |
---|
325 | var inputName = 'spWeight'+tubeIndex; |
---|
326 | var frm = document.forms['reggie']; |
---|
327 | var weightInput = frm.elements[inputName].value; |
---|
328 | if (weightInput != '') |
---|
329 | { |
---|
330 | if (weightInput < 0) |
---|
331 | { |
---|
332 | spWeightsAreValid[tubeIndex] = false; |
---|
333 | updateInputStatus(tubeIndex); |
---|
334 | return; |
---|
335 | } |
---|
336 | if (weightInput == '0') |
---|
337 | { |
---|
338 | frm.elements[inputName].value = ''; |
---|
339 | } |
---|
340 | } |
---|
341 | spWeightsAreValid[tubeIndex] = true; |
---|
342 | updateInputStatus(tubeIndex); |
---|
343 | } |
---|
344 | |
---|
345 | function apWeightOnChange(tubeIndex) |
---|
346 | { |
---|
347 | var inputName = 'apWeight'+tubeIndex; |
---|
348 | var frm = document.forms['reggie']; |
---|
349 | var weightInput = frm.elements[inputName].value; |
---|
350 | if (weightInput != '') |
---|
351 | { |
---|
352 | if (weightInput < 0) |
---|
353 | { |
---|
354 | apWeightsAreValid[tubeIndex] = false; |
---|
355 | updateInputStatus(tubeIndex); |
---|
356 | return; |
---|
357 | } |
---|
358 | if (weightInput == '0') |
---|
359 | { |
---|
360 | frm.elements[inputName].value = ''; |
---|
361 | } |
---|
362 | } |
---|
363 | apWeightsAreValid[tubeIndex] = true; |
---|
364 | updateInputStatus(tubeIndex); |
---|
365 | } |
---|
366 | |
---|
367 | function hisWeightOnChange(tubeIndex) |
---|
368 | { |
---|
369 | var inputName = 'hisWeight'+tubeIndex; |
---|
370 | var frm = document.forms['reggie']; |
---|
371 | var weightInput = frm.elements[inputName].value; |
---|
372 | if (weightInput != '') |
---|
373 | { |
---|
374 | if (weightInput < 0) |
---|
375 | { |
---|
376 | hisWeightsAreValid[tubeIndex] = false; |
---|
377 | updateInputStatus(tubeIndex); |
---|
378 | return; |
---|
379 | } |
---|
380 | if (weightInput == '0') |
---|
381 | { |
---|
382 | frm.elements[inputName].value = ''; |
---|
383 | } |
---|
384 | } |
---|
385 | hisWeightsAreValid[tubeIndex] = true; |
---|
386 | updateInputStatus(tubeIndex); |
---|
387 | } |
---|
388 | |
---|
389 | function nofPiecesOnChange(tubeIndex) |
---|
390 | { |
---|
391 | var inputName = 'nofPieces'+tubeIndex; |
---|
392 | var frm = document.forms['reggie']; |
---|
393 | var fieldInput = frm.elements[inputName].value; |
---|
394 | if (fieldInput != '') |
---|
395 | { |
---|
396 | if (fieldInput < 0) |
---|
397 | { |
---|
398 | nofPiecesAreValid[tubeIndex] = false; |
---|
399 | updateInputStatus(tubeIndex); |
---|
400 | return; |
---|
401 | } |
---|
402 | if (fieldInput == '0') |
---|
403 | { |
---|
404 | fieldInput = ''; |
---|
405 | frm.elements[inputName].value = fieldInput; |
---|
406 | } |
---|
407 | } |
---|
408 | if (fieldInput == '') |
---|
409 | { |
---|
410 | nofPiecesAreValid[tubeIndex] = false; |
---|
411 | updateInputStatus(tubeIndex); |
---|
412 | return; |
---|
413 | } |
---|
414 | nofPiecesAreValid[tubeIndex] = true; |
---|
415 | updateInputStatus(tubeIndex); |
---|
416 | } |
---|
417 | |
---|
418 | function partitionDateOnBlur() |
---|
419 | { |
---|
420 | var frm = document.forms['reggie']; |
---|
421 | var partitionDate = frm.partitionDate.value; |
---|
422 | var todaysDate = new Date(); |
---|
423 | partitionDateIsValid = false; |
---|
424 | |
---|
425 | setInputStatus('partitionDate', '', ''); |
---|
426 | |
---|
427 | if (partitionDate != '') |
---|
428 | { |
---|
429 | partitionDate = autoFillDate(partitionDate); |
---|
430 | frm.partitionDate.value = partitionDate; |
---|
431 | |
---|
432 | if (!Dates.isDate(partitionDate, 'yyyyMMdd')) |
---|
433 | { |
---|
434 | setInputStatus('partitionDate', 'Not a valid date', 'invalid'); |
---|
435 | return; |
---|
436 | } |
---|
437 | if (todaysDate < new Date(partitionDate.substring(0,4), new Number(partitionDate.substring(4,6)-1), partitionDate.substring(6))) |
---|
438 | { |
---|
439 | setInputStatus('partitionDate', 'Future dates are not valid','invalid'); |
---|
440 | return; |
---|
441 | } |
---|
442 | setInputStatus('partitionDate','','valid'); |
---|
443 | } |
---|
444 | else |
---|
445 | { |
---|
446 | setInputStatus('partitionDate', 'Missing', 'invalid'); |
---|
447 | return; |
---|
448 | } |
---|
449 | partitionDateIsValid = true; |
---|
450 | } |
---|
451 | |
---|
452 | function getSpecimenTubes() |
---|
453 | { |
---|
454 | var frm = document.forms['reggie']; |
---|
455 | |
---|
456 | var request = Ajax.getXmlHttpRequest(); |
---|
457 | var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=GetSpecimenTubes'; |
---|
458 | request.open("GET", url, false); |
---|
459 | request.send(null); |
---|
460 | |
---|
461 | if (debug) Main.debug(request.responseText); |
---|
462 | var response = JSON.parse(request.responseText); |
---|
463 | if (response.status != 'ok') |
---|
464 | { |
---|
465 | setFatalError(response.message); |
---|
466 | return false; |
---|
467 | } |
---|
468 | specimenTubes = response.tubeInfo.specimenTubes; |
---|
469 | } |
---|
470 | |
---|
471 | function goCreate() |
---|
472 | { |
---|
473 | if (!step3IsValid()) return; |
---|
474 | |
---|
475 | Main.hide('gocancel'); |
---|
476 | Main.hide('gocreate'); |
---|
477 | |
---|
478 | var frm = document.forms['reggie']; |
---|
479 | var tubeInfo = new Object(); |
---|
480 | |
---|
481 | var specimens = selectedTubes; |
---|
482 | var nofTubes = specimens.length; |
---|
483 | var partitionDateValue = frm.elements['partitionDate'].value; |
---|
484 | tubeInfo.partitionDate = partitionDateValue; |
---|
485 | for (var i=0; i<nofTubes; i++) |
---|
486 | { |
---|
487 | frm.elements['spWeight'+i].disabled = true; |
---|
488 | frm.elements['apWeight'+i].disabled = true; |
---|
489 | frm.elements['hisWeight'+i].disabled = true; |
---|
490 | frm.elements['nofPieces'+i].disabled = true; |
---|
491 | frm.elements['bloody'+i].disabled = true; |
---|
492 | frm.elements['appearance'+i].disabled = true; |
---|
493 | frm.elements['necrosis'+i].disabled = true; |
---|
494 | frm.elements['fat'+i].disabled = true; |
---|
495 | frm.elements['coloured'+i].disabled = true; |
---|
496 | |
---|
497 | var specimenTube = specimens[i]; |
---|
498 | |
---|
499 | var spWeightValue = frm.elements['spWeight'+i].value; |
---|
500 | if (spWeightValue != '') specimenTube.spWeight = spWeightValue; |
---|
501 | var apWeightValue = frm.elements['apWeight'+i].value; |
---|
502 | if (apWeightValue != '') specimenTube.apWeight = apWeightValue; |
---|
503 | var hisWeightValue = frm.elements['hisWeight'+i].value; |
---|
504 | if (hisWeightValue != '') specimenTube.hisWeight = hisWeightValue; |
---|
505 | var nofPiecesValue = frm.elements['nofPieces'+i].value; |
---|
506 | if (nofPiecesValue != '') specimenTube.nofPieces = nofPiecesValue; |
---|
507 | |
---|
508 | var partitionComment = ''; |
---|
509 | var appearanceElement = frm.elements['appearance'+i]; |
---|
510 | var necrosisElement = frm.elements['necrosis'+i]; |
---|
511 | var fatElement = frm.elements['fat'+i]; |
---|
512 | var appearanceValue = appearanceElement.options[appearanceElement.selectedIndex].value; |
---|
513 | var necrosisValue = necrosisElement.options[necrosisElement.selectedIndex].value; |
---|
514 | var fatValue = fatElement.options[fatElement.selectedIndex].value; |
---|
515 | |
---|
516 | // Generate partition comment string |
---|
517 | if (frm.elements['bloody'+i].checked == true) partitionComment += 'BLOODY'; |
---|
518 | if (appearanceValue != '') partitionComment += (partitionComment.length>0 ? ';' : '') + appearanceValue; |
---|
519 | if (necrosisValue != '0') partitionComment += (partitionComment.length>0 ? ';' : '') + 'NECROSIS'+necrosisValue+'%'; |
---|
520 | if (fatValue != '0') partitionComment += (partitionComment.length>0 ? ';' : '') + 'FAT'+fatValue+'%'; |
---|
521 | if (frm.elements['coloured'+i].checked == true) partitionComment += partitionComment.length>0 ? ';COLOURED' : 'COLOURED'; |
---|
522 | |
---|
523 | specimenTube.operatorPartitionComment = partitionComment.length > 0 ? partitionComment : null; |
---|
524 | |
---|
525 | specimens[i] = specimenTube; |
---|
526 | } |
---|
527 | tubeInfo.specimens = specimens; |
---|
528 | var submitInfo = new Object(); |
---|
529 | submitInfo.tubeInfo = tubeInfo; |
---|
530 | |
---|
531 | if (debug) Main.debug(JSON.stringify(caseInfo)); |
---|
532 | |
---|
533 | var request = Ajax.getXmlHttpRequest(); |
---|
534 | var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=CreatePartitions'; |
---|
535 | request.open("POST", url, false); |
---|
536 | request.setRequestHeader("Content-Type", "application/json"); |
---|
537 | request.send(JSON.stringify(submitInfo)); |
---|
538 | |
---|
539 | if (debug) Main.debug(request.responseText); |
---|
540 | |
---|
541 | var response = JSON.parse(request.responseText); |
---|
542 | if (response.status != 'ok') |
---|
543 | { |
---|
544 | setFatalError(response.message); |
---|
545 | return false; |
---|
546 | } |
---|
547 | |
---|
548 | var msg = '<ul>'; |
---|
549 | for (var i = 0; i < response.messages.length; i++) |
---|
550 | { |
---|
551 | msg += '<li>' + response.messages[i]; |
---|
552 | } |
---|
553 | msg += '</ul>'; |
---|
554 | setInnerHTML('done', msg); |
---|
555 | |
---|
556 | |
---|
557 | Main.show('done'); |
---|
558 | Main.show('gorestart'); |
---|
559 | } |
---|
560 | </script> |
---|
561 | |
---|
562 | |
---|
563 | </base:head> |
---|
564 | <base:body onload="init()"> |
---|
565 | <p:path style="margin-top: 20px; margin-bottom: 10px;"> |
---|
566 | <p:pathelement title="Reggie" href="<%="index.jsp?ID="+ID%>" /> |
---|
567 | <p:pathelement title="Partition registration" /> |
---|
568 | </p:path> |
---|
569 | |
---|
570 | <% |
---|
571 | if (sc.getActiveProjectId() == 0) |
---|
572 | { |
---|
573 | %> |
---|
574 | <base:note type="warning" style="width: 800px; margin-left: 20px; margin-bottom: 20px; margin-right: 0px; font-weight: bold; color: #cc0000;"> |
---|
575 | No project has been selected. You may proceed with the registration but |
---|
576 | created items will not be shared. |
---|
577 | </base:note> |
---|
578 | <% |
---|
579 | } |
---|
580 | %> |
---|
581 | |
---|
582 | <form name="reggie" onsubmit="return false;"> |
---|
583 | |
---|
584 | <!-- 1. Case name--> |
---|
585 | <table border="0" cellspacing="0" cellpadding="0" class="stepform"> |
---|
586 | <tr> |
---|
587 | <td rowspan="3" class="stepno">1</td> |
---|
588 | <td class="steptitle">Select specimen tubes</td> |
---|
589 | </tr> |
---|
590 | <tr> |
---|
591 | <td class="stepfields"> |
---|
592 | <table border="0" cellspacing="0" cellpadding="0" width="100%"> |
---|
593 | <tr valign="top"> |
---|
594 | <td class="prompt">Specimen tubes</td> |
---|
595 | <td class="input"><select style="width:50%" name="tubeSelect" id="tubesSelect" multiple="multiple" size="5" onkeypress='doOnTab(event, goNext)'></select></td> |
---|
596 | <td class="status" id="tubes.status"></td> |
---|
597 | <td class="help"><span id="tubes.message" class="message" style="display: none;"></span>Select specimen tubes to include in the partition.</td> |
---|
598 | </tr> |
---|
599 | </table> |
---|
600 | </td> |
---|
601 | </tr> |
---|
602 | </table> |
---|
603 | |
---|
604 | <!-- 2. General partition information --> |
---|
605 | <div id="partitionSection" style="display: none;"> |
---|
606 | <p></p> |
---|
607 | <table border="0" cellspacing="0" cellpadding="0" class="stepform"> |
---|
608 | <tr> |
---|
609 | <td rowspan="2" class="stepno">2</td> |
---|
610 | <td class="steptitle">Enter partition information</td> |
---|
611 | </tr> |
---|
612 | <tr> |
---|
613 | <td class="stepfields"> |
---|
614 | <table border="0" cellspacing="0" cellpadding="0" width="100%"> |
---|
615 | <tr valign="top"> |
---|
616 | <td class="prompt">Partition date</td> |
---|
617 | <td class="input"><input type="text" name="partitionDate" |
---|
618 | onkeypress="doOnTabOrEnter(event, goNext)" size="12" maxlength="10" onBlur="partitionDateOnBlur()"></td> |
---|
619 | <td class="status" id="partitionDate.status"></td> |
---|
620 | <td class="help"><span id="partitionDate.message" class="message" style="display: none;"></span>The date when the partition was done.</td> |
---|
621 | </tr> |
---|
622 | </table> |
---|
623 | </td> |
---|
624 | </tr> |
---|
625 | </table> |
---|
626 | </div> |
---|
627 | |
---|
628 | <div id="weightSection" style="display:none;"> |
---|
629 | <p></p> |
---|
630 | <table border="0" cellspacing="0" cellpadding="0" class="stepform"> |
---|
631 | <tr> |
---|
632 | <td rowspan="2" class="stepno">3</td> |
---|
633 | <td class="steptitle">Enter weight information</td> |
---|
634 | </tr> |
---|
635 | <tr> |
---|
636 | <td class="stepfields"> |
---|
637 | <table id="weightInputs" border="0" cellspacing="0" cellpadding="0" width="100%"></table> |
---|
638 | </td> |
---|
639 | </tr> |
---|
640 | </table> |
---|
641 | </div> |
---|
642 | |
---|
643 | <div class="error" id="errorMessage" style="display: none; width: 800px; margin-left: 20px; margin-bottom: 0px;"></div> |
---|
644 | |
---|
645 | <div id="done" class="success" style="display: none; width: 800px; margin-left: 20px; margin-top: 20px;"></div> |
---|
646 | |
---|
647 | <table style="margin-left: 20px; margin-top: 10px;" class="navigation"> |
---|
648 | <tr> |
---|
649 | <td><base:button id="gocancel" title="Cancel" onclick="goRestart(false)" style="display: none;"/></td> |
---|
650 | <td><base:button id="gonext" title="Next" image="gonext.gif" onclick="goNext(true)"/></td> |
---|
651 | <td><base:button id="gocreate" title="Create" image="gonext.gif" onclick="goCreate()" style="display: none;"/></td> |
---|
652 | <td><base:button id="goupdate" title="Update" image="gonext.gif" onclick="goCreate()" style="display: none;"/></td> |
---|
653 | <td><base:button id="gorestart" title="Restart" image="goback.gif" onclick="goRestart(true)" style="display: none;"/></td> |
---|
654 | <td id="gonext.message" class="message"></td> |
---|
655 | </tr> |
---|
656 | </table> |
---|
657 | </form> |
---|
658 | |
---|
659 | </base:body> |
---|
660 | </base:page> |
---|
661 | <% |
---|
662 | } |
---|
663 | finally |
---|
664 | { |
---|
665 | if (dc != null) dc.close(); |
---|
666 | } |
---|
667 | %> |
---|