- Timestamp:
- Oct 17, 2011, 4:45:52 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/partitionform.jsp
r1403 r1406 62 62 } 63 63 64 function step3IsValid() 65 { 66 for (var i=0; i<spWeightsAreValid.length; i++) 67 { 68 if (spWeightsAreValid[i] == false || 69 apWeightsAreValid[i] == false || 70 hisWeightsAreValid[i] == false || 71 nofPiecesAreValid[i] == false) 72 { 73 return false; 74 } 75 } 76 return true; 77 } 78 64 79 function gotoStep2() 65 80 { … … 91 106 frm.partitionComment.disabled = true; 92 107 93 var tubes = case SpecimenTubes.specimen;108 var tubes = caseInfo.specimen; 94 109 var inputWeightHtml; 95 110 if (tubes.length > 0) … … 100 115 nofPiecesAreValid = Array(tubes.lenth); 101 116 117 102 118 inputWeightHtml = ''; 119 inputWeightHtml +='<tr>'; 120 inputWeightHtml += '<td class="prompt">Specimen tube</td>'; 121 inputWeightHtml += '<td><table class="prompt" style=width:90% class="input"><tr><td style=width:25%>Sp</td><td style=width:25%>Ap</td><td style=width:25%>His</td><td style=width:25%>NofPieces</td></tr></table></td>'; 122 inputWeightHtml += '<td> </td><td> </td>'; 123 inputWeightHtml +='</tr>'; 103 124 for (var i=0;i<tubes.length; i++) 104 125 { 126 spWeightsAreValid[i] = true; 127 apWeightsAreValid[i] = true; 128 hisWeightsAreValid[i] = true; 129 nofPiecesAreValid[i] = true; 130 105 131 spInputTitle = ''; 106 132 apInputTitle = ''; 107 133 hisInputTitle = ''; 108 134 nofPiecesTitle = ''; 109 if (i==0) 110 { 111 spInputTitle = 'Sp<br>'; 112 apInputTitle = 'Ap<br>'; 113 hisInputTitle = 'His<br>'; 114 nofPiecesTitle = 'NofPieces<br>'; 115 } 135 136 var doOnTab = i==(tubes.length-1) ? 'doOnTab(event, goCreate)' : ''; 116 137 inputWeightHtml += '<tr>'; 117 inputWeightHtml += '<td class=" prompt">Specimen tube '+caseSpecimenTubes.name+'.'+(i+1)+'</td>';138 inputWeightHtml += '<td class="subprompt">'+caseInfo.name+'.'+(i+1)+' ['+tubes[i].box+' '+tubes[i].row+tubes[i].column+']</td>'; 118 139 inputWeightHtml += '<td class="input">'; 119 inputWeightHtml += '<table >';140 inputWeightHtml += '<table style=width:90%>'; 120 141 inputWeightHtml += '<tr>'; 121 inputWeightHtml += '<td>' + spInputTitle + '<input size= 4type="text" onChange="spWeightOnChange('+i+')" name="spWeight'+i+'" /></td>';122 inputWeightHtml += '<td>' + apInputTitle + '<input size= 4type="text" onChange="apWeightOnChange('+i+')" name="apWeight'+i+'" /></td>';123 inputWeightHtml += '<td>' + hisInputTitle + '<input size= 4type="text" onChange="hisWeightOnChange('+i+')" name="hisWeight'+i+'" /></td>';124 inputWeightHtml += '<td>' + nofPiecesTitle + '<input size= 4 type="text" onChange="nofPiecesOnChange('+i+')" name="nofPieces'+i+'" /></td>';142 inputWeightHtml += '<td>' + spInputTitle + '<input size=3 type="text" onChange="spWeightOnChange('+i+')" name="spWeight'+i+'" /></td>'; 143 inputWeightHtml += '<td>' + apInputTitle + '<input size=3 type="text" onChange="apWeightOnChange('+i+')" name="apWeight'+i+'" /></td>'; 144 inputWeightHtml += '<td>' + hisInputTitle + '<input size=3 type="text" onChange="hisWeightOnChange('+i+')" name="hisWeight'+i+'" /></td>'; 145 inputWeightHtml += '<td>' + nofPiecesTitle + '<input size=3 type="text" onkeypress="'+doOnTab+'" onChange="nofPiecesOnChange('+i+')" name="nofPieces'+i+'" /></td>'; 125 146 inputWeightHtml += '</tr>'; 126 147 inputWeightHtml += '</table>'; … … 130 151 inputWeightHtml += '<span id="weight'+i+'.message" class="message" style="display:none;"></span>'; 131 152 inputWeightHtml += 'Weights should be given in [mg]</td>'; 132 inputWeightHtml += '</tr>'; 133 153 inputWeightHtml += '</tr>'; 134 154 } 135 155 setInnerHTML('weightInputs', inputWeightHtml); … … 282 302 else 283 303 { 284 setInputStatus('partitionDate', 'Missing', 'warning'); 304 setInputStatus('partitionDate', 'Missing', 'invalid'); 305 return; 285 306 } 286 307 partitionDateIsValid = true; … … 305 326 return false; 306 327 } 307 caseSpecimenTubes = response.caseInfo; 328 caseInfo = response.caseInfo; 329 } 330 331 function goCreate() 332 { 333 if (!step3IsValid()) return; 334 335 Main.hide('gocancel'); 336 Main.hide('gocreate'); 337 var frm = document.forms['reggie']; 338 339 var specimens = caseInfo.specimen; 340 var nofTubes = specimens.length; 341 var partitionDateValue = frm.elements['partitionDate'].value; 342 var partitionCommentValue = frm.elements['partitionComment'].value; 343 caseInfo.partitionDate = partitionDateValue; 344 if (partitionCommentValue != null) caseInfo.partitionComment = partitionCommentValue; 345 346 for (var i=0; i<nofTubes; i++) 347 { 348 frm.elements['spWeight'+i].disabled = true; 349 frm.elements['apWeight'+i].disabled = true; 350 frm.elements['hisWeight'+i].disabled = true; 351 frm.elements['nofPieces'+i].disabled = true; 352 353 var specimenTube = specimens[i]; 354 355 var spWeightValue = frm.elements['spWeight'+i].value; 356 if (spWeightValue != '') specimenTube.spWeight = spWeightValue; 357 var apWeightValue = frm.elements['apWeight'+i].value; 358 if (apWeightValue != '') specimenTube.apWeight = apWeightValue; 359 var hisWeightValue = frm.elements['hisWeight'+i].value; 360 if (hisWeightValue != '') specimenTube.hisWeight = hisWeightValue; 361 var nofPiecesValue = frm.elements['nofPieces'+i].value; 362 if (nofPiecesValue != '') specimenTube.nofPieces = nofPiecesValue; 363 364 caseInfo.specimen[i] = specimenTube; 365 } 366 var submitInfo = new Object(); 367 submitInfo.caseInfo = caseInfo; 368 369 if (debug) Main.debug(JSON.stringify(caseInfo)); 370 371 var request = Ajax.getXmlHttpRequest(); 372 var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=CreatePartitions'; 373 request.open("POST", url, false); 374 request.setRequestHeader("Content-Type", "application/json"); 375 request.send(JSON.stringify(submitInfo)); 376 377 if (debug) Main.debug(request.responseText); 378 379 var response = JSON.parse(request.responseText); 380 if (response.status != 'ok') 381 { 382 setFatalError(response.message); 383 return false; 384 } 385 386 var msg = '<ul>'; 387 for (var i = 0; i < response.messages.length; i++) 388 { 389 msg += '<li>' + response.messages[i]; 390 } 391 msg += '</ul>'; 392 setInnerHTML('done', msg); 393 394 395 Main.show('done'); 396 Main.show('gorestart'); 308 397 } 309 398 </script> … … 366 455 <td class="prompt">Partition date</td> 367 456 <td class="input"><input type="text" name="partitionDate" 368 size="12" maxlength="10" onBlur="partitionDateOnBlur()"></td>457 onkeypress="focusOnEnter(event, 'partitionComment')" size="12" maxlength="10" onBlur="partitionDateOnBlur()"></td> 369 458 <td class="status" id="partitionDate.status"></td> 370 459 <td class="help"><span id="partitionDate.message" class="message" style="display: none;"></span>The date when the partition was done.</td>
Note: See TracChangeset
for help on using the changeset viewer.