Changeset 1449
- Timestamp:
- Nov 2, 2011, 3:31:39 PM (12 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/partitionform.jsp
r1430 r1449 102 102 } 103 103 104 function sortTubesByPosition(t1, t2) 105 { 106 var box1 = t1.box; 107 var box2 = t2.box; 108 if (box1 < box2) return -1; 109 else if (box1>box2) return 1; 110 else 111 { 112 var row1 = t1.row; 113 var row2 = t2.row; 114 if (row1 < row2) return -1; 115 else if (row1>row2) return 1; 116 else 117 { 118 var col1 = t1.column; 119 var col2 = t2.column; 120 return col1 - col2; 121 } 122 } 123 } 124 104 125 function gotoStep2() 105 126 { … … 112 133 selectedTubes.push(specimenTubes[i]); 113 134 } 114 135 selectedTubes.sort(sortTubesByPosition); 115 136 if (selectedTubes.length == 0) 116 137 { … … 126 147 Main.show('gocancel'); 127 148 var currentTime = new Date(); 128 frm.partitionDate.value = currentTime.getFullYear().toString()+(currentTime.getMonth()+1).toString()+currentTime.getDate().toString(); 149 var currentYear = currentTime.getFullYear().toString(); 150 var currentMonth = (currentTime.getMonth()+1).toString(); 151 currentMonth = currentMonth.length < 2 ? '0'+currentMonth : currentMonth; 152 var currentDate = currentTime.getDate().toString(); 153 currentDate = currentDate.length < 2 ? '0'+currentDate : currentDate; 154 155 var dateString = currentYear + currentMonth + currentDate; 156 157 frm.partitionDate.value = dateString; 129 158 frm.partitionDate.setSelectionRange(0,frm.partitionDate.value.length); 130 159 frm.partitionDate.focus(); … … 136 165 var frm = document.forms['reggie']; 137 166 frm.partitionDate.disabled = true; 138 167 139 168 var inputWeightHtml; 140 169 if (selectedTubes.length > 0) … … 145 174 nofPiecesAreValid = Array(); 146 175 oneOrMoreWeightsAreSet = Array(); 176 147 177 for (var i=0;i<selectedTubes.length;i++) 148 178 { … … 151 181 hisWeightsAreValid[i] = true; 152 182 nofPiecesAreValid[i] = false; 153 oneOrMoreWeightsAreSet[i] = false; 154 } 155 183 oneOrMoreWeightsAreSet[i] = false; 184 } 185 156 186 inputWeightHtml = ''; 157 158 187 var spTitle = 'SpWeight<br>'; 159 188 var apTitle = 'ApWeight<br>'; … … 225 254 Main.hide('gonext'); 226 255 Main.show('gocreate'); 227 frm.bloody0.focus(); 256 frm.bloody0.focus(); 228 257 } 229 258 … … 529 558 submitInfo.tubeInfo = tubeInfo; 530 559 531 if (debug) Main.debug(JSON.stringify(caseInfo)); 532 560 if (debug) Main.debug(JSON.stringify(caseInfo)); 533 561 var request = Ajax.getXmlHttpRequest(); 534 562 var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=CreatePartitions'; … … 557 585 Main.show('done'); 558 586 Main.show('gorestart'); 587 } 588 589 function downloadLabelFile() 590 { 591 var downloadFileInput = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=GetLabelFile'; 592 downloadFileInput += '&tubes='; 593 var separator = ''; 594 for (i in selectedTubes) 595 { 596 downloadFileInput += separator + selectedTubes[i].name; 597 separator = ','; 598 } 599 window.location = downloadFileInput; 559 600 } 560 601 </script> … … 593 634 <tr valign="top"> 594 635 <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>636 <td class="input"><select style="width:50%" name="tubeSelect" id="tubesSelect" multiple="multiple" size="12" onkeypress='doOnTab(event, goNext)'></select></td> 596 637 <td class="status" id="tubes.status"></td> 597 638 <td class="help"><span id="tubes.message" class="message" style="display: none;"></span>Select specimen tubes to include in the partition.</td> … … 608 649 <tr> 609 650 <td rowspan="2" class="stepno">2</td> 610 <td class="steptitle"> Enterpartition information</td>651 <td class="steptitle">General partition information</td> 611 652 </tr> 612 653 <tr> … … 616 657 <td class="prompt">Partition date</td> 617 658 <td class="input"><input type="text" name="partitionDate" 618 onkeypress=" doOnTabOrEnter(event, goNext)" size="12" maxlength="10" onBlur="partitionDateOnBlur()"></td>659 onkeypress="focusOnEnter(event, 'download')" size="12" maxlength="10" onBlur="partitionDateOnBlur()"></td> 619 660 <td class="status" id="partitionDate.status"></td> 620 661 <td class="help"><span id="partitionDate.message" class="message" style="display: none;"></span>The date when the partition was done.</td> 662 </tr> 663 <tr> 664 <td class="prompt">Download label file</td> 665 <td class="input" name="downloadfile.input" id="downloadfile.input"> 666 <base:button id="downloadlabels" title="Download..." onclick="downloadLabelFile()" image="download.gif" style="width:115px"/> 667 </td> 668 <td class="status" id="downloadfile.status"></td> 669 <td class="help"><span id="downloadfile.message" class="message" style="display:none;"></span>Download label file for the selected tubes.</td> 621 670 </tr> 622 671 </table> 623 672 </td> 624 </tr> 673 </tr> 625 674 </table> 626 675 </div> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SpecimenTube.java
r1425 r1449 107 107 tubeQuery.restrict(Restrictions.and(Restrictions.eq(Hql.property("originalQuantity"), null), 108 108 Restrictions.rlike(Hql.property("name"), Expressions.parameter("name", "^.+\\.[0-9]+$", Type.STRING)))); 109 tubeQuery.order(Orders.desc(Hql.property(" name")));109 tubeQuery.order(Orders.desc(Hql.property("id"))); 110 110 tubeQuery.include(Include.ALL); 111 111 … … 113 113 for (Sample tube : tubes) 114 114 { 115 unPartitionedTubes.add(new SpecimenTube(tube)); 115 if (tube.countExtracts() == 0) 116 { 117 unPartitionedTubes.add(new SpecimenTube(tube)); 118 } 116 119 } 117 120 return unPartitionedTubes; … … 121 124 private final String row; 122 125 private final String column; 123 // private final Float originalQuantity;124 126 125 127 private SpecimenTube(Sample sample) … … 134 136 row = wcfRow.format(well.getRow()); 135 137 column = wcfColumn.format(well.getColumn()); 136 // originalQuantity = sample.getOriginalQuantity(); 138 137 139 } 138 140 else … … 141 143 row = null; 142 144 column = null; 143 // originalQuantity = null;144 145 } 145 146 } … … 177 178 return column; 178 179 } 179 // 180 // public Float getOriginalQuantity() 181 // { 182 // return originalQuantity; 183 // } 184 180 185 181 @SuppressWarnings("unchecked") 186 182 @Override … … 190 186 json.put("row", row); 191 187 json.put("column", column); 192 // json.put("originalQuantity", originalQuantity);193 188 } 194 189 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PartitionRegistrationServlet.java
r1430 r1449 7 7 8 8 import javax.servlet.ServletException; 9 import javax.servlet.ServletOutputStream; 9 10 import javax.servlet.http.HttpServlet; 10 11 import javax.servlet.http.HttpServletRequest; … … 58 59 59 60 final SessionControl sc = Application.getSessionControl(ID, req.getRemoteAddr()); 60 DbControl dc = null; 61 61 DbControl dc = null; 62 62 63 try 63 64 { … … 75 76 json.put("tubeInfo", jsonTubeInfo); 76 77 } 78 else if ("GetLabelFile".equals(cmd)) 79 { 80 String firstPart = ""; 81 String secondPart = ""; 82 83 84 String[] tubeNames = req.getParameter("tubes").split(","); 85 86 String separator = ""; 87 String labelString = ""; 88 if (tubeNames != null && tubeNames.length>0) 89 { 90 // Create label-text for each tube 91 for (int i=0; i<tubeNames.length;i++) 92 { 93 String tubeName = tubeNames[i]; 94 firstPart += separator + tubeName; 95 separator = "\n"; 96 firstPart += separator + tubeName+".his"; 97 firstPart += separator + tubeName+".ap"; 98 99 secondPart += separator + tubeName + ".l"; 100 secondPart += separator + tubeName + ".r"; 101 secondPart += separator + tubeName + ".d"; 102 secondPart += separator + tubeName + ".ft"; 103 } 104 labelString = firstPart + secondPart; 105 106 // Send labels in a file to the client. 107 resp.setHeader("Content-Disposition", "attachment; filename=Partition_labels.csv"); 108 resp.setContentType("text/plain"); 109 ServletOutputStream os = resp.getOutputStream(); 110 os.print(labelString); 111 os.flush(); 112 os.close(); 113 } 114 } 77 115 } 78 116 catch (Throwable t) … … 87 125 { 88 126 if (dc!=null) dc.close(); 89 json.writeJSONString(resp.getWriter()); 127 json.writeJSONString(resp.getWriter()); 90 128 } 91 129 } … … 209 247 Reggie.setAnnotationValue(hisSample, partitionDateType, partitionDate); 210 248 } 211 } 212 249 } 213 250 specimen.setOriginalQuantity(originalQuantity); 214 251 … … 217 254 } 218 255 dc.commit(); 219 } 256 } 220 257 json.put("messages", jsonMessages); 221 258 }
Note: See TracChangeset
for help on using the changeset viewer.