Changeset 1430


Ignore:
Timestamp:
Oct 31, 2011, 1:22:42 PM (10 years ago)
Author:
Martin Svensson
Message:

References #330 Added some new checks before the partitions are saved: There must be at least one weight set for each tube.
The nofPieces must be set.
The his-sample is not automatically placed in a box.

This commit also contains corrections of misspelled words in the inputs of the OperatorPartitionComment?.
The different parts in the OperatorPartitionComment? are now separated with ';' instead of ':'

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
2 edited

Legend:

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

    r1426 r1430  
    3737var apWeightsAreValid;
    3838var hisWeightsAreValid;
     39var oneOrMoreWeightsAreSet;
    3940var nofPiecesAreValid;
    4041
     
    8586  for (var i=0; i<spWeightsAreValid.length; i++)
    8687  {
     88   
    8789    if (spWeightsAreValid[i] == false ||
    8890        apWeightsAreValid[i] == false ||
    8991        hisWeightsAreValid[i] == false ||
    9092        nofPiecesAreValid[i] == false)
     93    {
     94      return false;
     95    }
     96    if (oneOrMoreWeightsAreSet[i] == false)
    9197    {
    9298      return false;
     
    138144    hisWeightsAreValid = Array();
    139145    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    }
    140155       
    141156    inputWeightHtml = '';
     
    152167   
    153168    var appearanceOptions = '<option selected ></option>'; 
    154     appearanceOptions += '<option value="HOMOGENUS">Homogenus</option>';
    155     appearanceOptions += '<option value="HETEROGENUS">Heterogenus</option>';
     169    appearanceOptions += '<option value="HOMOGENOUS">Homogenous</option>';
     170    appearanceOptions += '<option value="HETEROGENOUS">Heterogenous</option>';
    156171   
    157172    var necrosisOptions = '<option selected value="0">0</option>';
     
    172187    {
    173188      var tube = selectedTubes[i];
    174       var nextStep = i<(selectedTubes.length-1) ? 'focusOnEnter(event, \'bloody'+(i+1)+'\')' : 'doOnTabOrEnter(event, goCreate)';
     189      var nextStep = i<(selectedTubes.length-1) ? 'focusOnEnter(event, \'bloody'+(i+1)+'\')' : '';
    175190     
    176191      inputWeightHtml += '<tr>';
     
    190205      inputWeightHtml += '<td>'+fatTitle+'<select name=fat'+i+' onfocus="messageOnFocus(3,'+i+')" onkeypress="focusOnEnter(event, \'coloured'+i+'\')">'+fatOptions+'</select></td>';
    191206      inputWeightHtml += '<td>'+colouredTitle+'<input type=checkbox name=coloured'+i+' onfocus="messageOnFocus(4,'+i+')" onkeypress="checkOnNumber(event, this);focusOnEnter(event, \'nofPieces'+i+'\')" /></td>'
    192       inputWeightHtml += '<td>'+nofTitle+'<input name="nofPieces'+i+'" onfocus="messageOnFocus(5,'+i+')" onchange="nofPiecesOnChange('+i+')" onkeypress="focusOnEnter(event, \'spWeight'+i+'\')" size=2 /></td>';
    193       inputWeightHtml += '<td>'+spTitle+'<input name="spWeight'+i+'" onfocus="messageOnFocus(6,'+i+')" onchange="spWeightOnChange('+i+')" onkeypress="focusOnEnter(event, \'hisWeight'+i+'\')" size=2 /></td>';
    194       inputWeightHtml += '<td>'+hisTitle+'<input name="hisWeight'+i+'" onfocus="messageOnFocus(7,'+i+')" onchange="hisWeightOnChange('+i+')" onkeypress="focusOnEnter(event, \'apWeight'+i+'\')" size=2 /></td>';
    195       inputWeightHtml += '<td>'+apTitle+'<input name="apWeight'+i+'" onfocus="messageOnFocus(8,'+i+')" onchange="apWeightOnChange('+i+')" onkeypress="'+nextStep+'" size=2 /></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>';     
    196211      inputWeightHtml += '</tr>';
    197212      inputWeightHtml += '</table>';
     
    291306    setInputStatus(tubeIndex, 'APWeight is invalid.', 'invalid');
    292307    return;
    293   }   
     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;
    294320  setInputStatus(tubeIndex, '', 'valid');
    295321}
     
    376402    if (fieldInput == '0')
    377403    {
    378       frm.elements[inputName].value = '';
    379     }
    380   }
     404      fieldInput = '';     
     405      frm.elements[inputName].value = fieldInput;
     406    }
     407  }
     408  if (fieldInput == '')
     409  {
     410    nofPiecesAreValid[tubeIndex] = false;
     411    updateInputStatus(tubeIndex);
     412    return;
     413  }
    381414  nofPiecesAreValid[tubeIndex] = true;
    382415  updateInputStatus(tubeIndex);
     
    483516    // Generate partition comment string
    484517    if (frm.elements['bloody'+i].checked == true) partitionComment += 'BLOODY';
    485     if (appearanceValue != '') partitionComment += (partitionComment.length>0 ? ':' : '') + appearanceValue;
    486     if (necrosisValue != '0') partitionComment += (partitionComment.length>0 ? ':' : '') + 'NECROSIS'+necrosisValue+'%';
    487     if (fatValue != '0') partitionComment += (partitionComment.length>0 ? ':' : '') + 'FAT'+fatValue+'%';
    488     if (frm.elements['coloured'+i].checked == true) partitionComment += partitionComment.length>0 ? ':COLOURED' : 'COLOURED';
     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';
    489522   
    490523    specimenTube.operatorPartitionComment = partitionComment.length > 0 ? partitionComment : null;
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PartitionRegistrationServlet.java

    r1426 r1430  
    208208               
    209209                Reggie.setAnnotationValue(hisSample, partitionDateType, partitionDate);
    210                
    211                 // Set box position
    212                 if (specimenBoxName != null)
    213                 {
    214                   String hisBoxName = "His" + specimenBoxName.substring(2);               
    215                   ItemQuery<BioPlate> hisBoxQuery = BioPlate.getQuery();
    216                   hisBoxQuery.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(hisBoxName)));
    217                   List<BioPlate> hisBoxes = hisBoxQuery.list(dc);
    218                   if (hisBoxes.size()>1)
    219                   {
    220                     throw new InvalidDataException("More then one his-box were found with name: "+hisBoxName+". " +
    221                         "This wizard can not be used until this is fixed.");
    222                   }
    223                   else if (hisBoxes.size()<1)
    224                   {
    225                     throw new InvalidDataException("No his-box was found with name: "+hisBoxName+". " +
    226                         "This wizard can not be used until this is fixed.");
    227                   }
    228                   BioPlate hisBox = hisBoxes.get(0);
    229                   if (!hisBox.getBioWell(specimenWell.getRow(), specimenWell.getColumn()).isEmpty())
    230                   {
    231                     throw new InvalidDataException("Position [" + specimenWell.getRow() + "," + specimenWell.getColumn() + "]" +
    232                         " is not empty in box: " + hisBoxName);
    233                   }
    234                   hisSample.setBioWell(hisBox.getBioWell(specimenWell.getRow(), specimenWell.getColumn()));                 
    235                 }               
    236210              }
    237211            }
Note: See TracChangeset for help on using the changeset viewer.