Ignore:
Timestamp:
Nov 2, 2011, 3:31:39 PM (10 years ago)
Author:
Martin Svensson
Message:

References #330 Following changes are included in this commit.

  • Tubes in step3(weight input table) are now sorted by the tubes' box-positions.
  • Selection list in step1 is sorting the tubes by their BASE-id in descending order.
  • Samples that already have child-extracts are no longer included in the step1 selection list.
  • A csv-file with label-names can now be downloaded in step2.
  • Also fixed a bugg that occoured when default partition date contained month or date less then 10.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/partitionform.jsp

    r1430 r1449  
    102102}
    103103
     104function 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
    104125function gotoStep2()
    105126{
     
    112133      selectedTubes.push(specimenTubes[i]);
    113134  }   
    114  
     135  selectedTubes.sort(sortTubesByPosition);
    115136  if (selectedTubes.length == 0)
    116137  {
     
    126147  Main.show('gocancel');
    127148  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;
    129158  frm.partitionDate.setSelectionRange(0,frm.partitionDate.value.length);
    130159  frm.partitionDate.focus();
     
    136165  var frm = document.forms['reggie'];
    137166  frm.partitionDate.disabled = true; 
    138    
     167 
    139168  var inputWeightHtml; 
    140169  if (selectedTubes.length > 0)
     
    145174    nofPiecesAreValid = Array();
    146175    oneOrMoreWeightsAreSet = Array();
     176   
    147177    for (var i=0;i<selectedTubes.length;i++)
    148178    {
     
    151181      hisWeightsAreValid[i] = true;
    152182      nofPiecesAreValid[i] = false;
    153       oneOrMoreWeightsAreSet[i] = false;
    154     }
    155        
     183      oneOrMoreWeightsAreSet[i] = false;     
     184    }
     185   
    156186    inputWeightHtml = '';
    157 
    158187    var spTitle = 'SpWeight<br>';
    159188    var apTitle = 'ApWeight<br>';
     
    225254  Main.hide('gonext');
    226255  Main.show('gocreate');
    227   frm.bloody0.focus(); 
     256  frm.bloody0.focus();
    228257}
    229258
     
    529558  submitInfo.tubeInfo = tubeInfo;
    530559 
    531   if (debug) Main.debug(JSON.stringify(caseInfo));
    532  
     560  if (debug) Main.debug(JSON.stringify(caseInfo));     
    533561  var request = Ajax.getXmlHttpRequest();
    534562  var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=CreatePartitions';
     
    557585  Main.show('done');
    558586  Main.show('gorestart');
     587}
     588
     589function 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;
    559600}
    560601</script>
     
    593634      <tr valign="top">
    594635        <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>
    596637        <td class="status" id="tubes.status"></td>
    597638        <td class="help"><span id="tubes.message" class="message" style="display: none;"></span>Select specimen tubes to include in the partition.</td>
     
    608649    <tr>
    609650      <td rowspan="2" class="stepno">2</td>
    610       <td class="steptitle">Enter partition information</td>
     651      <td class="steptitle">General partition information</td>
    611652    </tr>
    612653    <tr>
     
    616657          <td class="prompt">Partition date</td>
    617658          <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>
    619660          <td class="status" id="partitionDate.status"></td>
    620661          <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>
    621670        </tr>       
    622671        </table>
    623672      </td>
    624     </tr>
     673    </tr>   
    625674    </table>
    626675  </div>
Note: See TracChangeset for help on using the changeset viewer.