Changeset 1778


Ignore:
Timestamp:
Dec 12, 2012, 2:28:44 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #447: The HE glass registration wizard should have a field for the number of slides

Also changed the default number of print labels from 5 to 3 since more than 3 is almost never needed. The most common number of slides are 2 so this is the default in the HE glass registration wizard.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
1 added
4 edited

Legend:

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

    r1653 r1778  
    154154{
    155155  content: url('../images/ok.png');
     156}
     157.status.new:before
     158{
     159  content: url('../images/new.png');
    156160}
    157161.success ul
  • extensions/net.sf.basedb.reggie/trunk/resources/histology_glass.jsp

    r1777 r1778  
    3535
    3636var paraffinBlock;
     37var existingNumberOfHEGlass = 0;
    3738var stainDateIsValid = false;
     39var numHEGlassIsValid = false;
    3840
    3941function init()
     
    222224  setInnerHTML('blockName', paraffinBlock.name);
    223225  frm.comment.value = paraffinBlock.comment;
    224 
     226  if (heGlass)
     227  {
     228    frm.numberOfHEGlass.value = heGlass.length;
     229    existingNumberOfHEGlass = heGlass.length;
     230  }
     231 
    225232  var numWells = 0;
    226233  for (var i = 0; i < paraffinBlock.bioWells.length; i++)
     
    264271 
    265272  stainDateOnChange();
    266   frm['idx.0.0'].focus();
     273  frm['numberOfHEGlass'].focus();
    267274}
    268275
     
    326333function step2IsValid()
    327334{
    328  
    329   var frm = document.forms['reggie'];
    330  
     335  var frm = document.forms['reggie'];
     336  if (!numHEGlassIsValid)
     337  {
     338    frm.numberOfHEGlass.focus();
     339    return false;
     340  }
     341 
     342  var numHEGlass = parseInt(frm.numberOfHEGlass.value, 10);
    331343  var allValid = true;
    332344  for (var i = 0; i < wells.length; i++)
    333345  {
    334346    var field = frm[wells[i]];
    335     if (!(parseInt(field.value, 10) > 0))
     347    var indexValue = parseInt(field.value, 10);
     348    if (!indexValue || indexValue <= 0 || indexValue > numHEGlass)
    336349    {
    337350      setInputStatus(field.name, null, 'invalid');
     
    339352      allValid = false;
    340353    }
     354    else
     355    {
     356      setInputStatus(field.name, null, 'valid');
     357    }
    341358  }
    342359 
    343360  if (!allValid)
    344361  {
    345     setInputStatus('index', 'Value must be >= 1', 'invalid');
     362    setInputStatus('index', 'Value must be between 1–' + numHEGlass, 'invalid');
    346363    return false;
    347364  }
     
    359376{
    360377  var frm = document.forms['reggie'];
    361   if (!(parseInt(frm[field].value, 10) > 0))
    362   {
    363     frm[field].focus();
     378 
     379  var numHEGlass = parseInt(frm.numberOfHEGlass.value, 10) || 1;
     380  var indexValue = parseInt(frm[field].value, 10);
     381
     382  if (!indexValue || indexValue <= 0 || indexValue > numHEGlass)
     383  {
    364384    setInputStatus(field, null, 'invalid');
     385    setInputStatus('index', 'Must be between 1–'+numHEGlass, '');
    365386    return;
    366387  }
    367388
    368389  setInputStatus(field, null, 'valid');
    369  
     390  setInputStatus('index', '', '');
     391}
     392
     393function checkNumHEGlass()
     394{
     395  var frm = document.forms['reggie'];
     396  numHEGlassIsValid = false;
     397 
     398  var numHEGlass = parseInt(frm.numberOfHEGlass.value, 10) || 0;
     399  var limit = Math.max(1, existingNumberOfHEGlass);
     400  if (numHEGlass < limit)
     401  {
     402    setInputStatus('numberOfHEGlass', 'Must be a value &gt;= ' + limit, 'invalid');
     403    return;
     404  }
     405 
     406  setInputStatus('numberOfHEGlass', '', 'valid');
     407  numHEGlassIsValid = true;
     408 
     409  for (var i = 0; i < wells.length; i++)
     410  {
     411    checkIndexValue(wells[i]);
     412  }
     413
    370414}
    371415
     
    378422  frm.stainingProtocol.disabled = true;
    379423  frm.comment.disabled = true;
    380  
    381   var maxIndex = 1;
     424  frm.numberOfHEGlass.disabled = true;
     425 
     426  var numHEGlass = parseInt(frm.numberOfHEGlass.value, 10);
    382427  for (var i = 0; i < wells.length; i++)
    383428  {
    384429    var field = frm[wells[i]];
    385430    field.disabled = true;
    386     if (parseInt(field.value, 10) > maxIndex)
    387     {
    388       maxIndex = parseInt(field.value, 10);
    389     }
    390431  }
    391432
     
    411452  var heGlass = paraffinBlock.heGlass;
    412453 
    413   for (var glassNo = 0; glassNo < maxIndex; glassNo++)
    414   {
    415     var nextStep = glassNo < (maxIndex-1) ? 'focusOnEnter(event, \'glassBox'+(glassNo+1)+'\');' : '';
     454  for (var glassNo = 0; glassNo < numHEGlass; glassNo++)
     455  {
     456    var nextStep = glassNo < (numHEGlass-1) ? 'focusOnEnter(event, \'glassBox'+(glassNo+1)+'\');' : '';
    416457    var heSlide = new Object();
    417458   
     
    463504  setInnerHTML('glassBoxInput', html);
    464505 
    465   for (var glassNo = 0; glassNo < heGlass.length; glassNo++)
    466   {
    467     frm['comment'+glassNo].value = heGlass[glassNo].comment;
    468     glassBoxOnChange(glassNo);
     506  for (var glassNo = 0; glassNo < numHEGlass; glassNo++)
     507  {
     508    if (heGlass && heGlass[glassNo])
     509    {
     510      frm['comment'+glassNo].value = heGlass[glassNo].comment;
     511      glassBoxOnChange(glassNo);
     512    }
     513    else
     514    {
     515      setInputStatus('glassBox'+glassNo, null, 'new');
     516    }
    469517  }
    470518 
     
    765813          <td class="status" id="comment.status"></td>
    766814          <td class="help"></td>
     815        </tr>
     816        <tr valign="top">
     817          <td class="prompt">HE slides created</td>
     818          <td class="input"><input type="text" size="4"
     819            name="numberOfHEGlass" value="2"
     820            onblur="checkNumHEGlass()"
     821            onkeypress="focusOnEnter(event, 'idx.0.0'); return Numbers.integerOnly(event)">
     822          </td>
     823          <td class="status" id="numberOfHEGlass.status"></td>
     824          <td class="help"><span id="numberOfHEGlass.message" class="message" style="display: none;"></span>
     825            Enter the total number of HE glass slides that has been created from the selected paraffin block.
     826          </td>
    767827        </tr>
    768828       
  • extensions/net.sf.basedb.reggie/trunk/resources/histology_protocol2.jsp

    r1726 r1778  
    147147  function downloadHEGlassLabels()
    148148  {
    149     var numLabelsPerBlock = prompt('Number of labels per block?', 5);
     149    var numLabelsPerBlock = prompt('Number of labels per block?', 3);
    150150    if (numLabelsPerBlock == null) return;
    151151   
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/HistologyServlet.java

    r1777 r1778  
    509509        BioPlate pb = BioPlate.getById(dc, plateId.intValue());
    510510        pb.setDescription(Values.getStringOrNull((String)jsonPlate.get("comment")));
    511         int maxGoodStain = 1;
     511        int numHeGlass = jsonHeGlass.size();
    512512        for (int i = 0; i < jsonWells.size(); ++i)
    513513        {
     
    520520          {
    521521            jsonWell.put("histology", histology);
    522             Number goodStain = (Number)jsonWell.get("GoodStain");
    523             if (goodStain.intValue() > maxGoodStain)
    524             {
    525               maxGoodStain = goodStain.intValue();
    526             }
    527522          }
    528523        }
     
    540535        // Create required number of child glass plates
    541536        int numNewHEGlass = 0;
    542         for (int stainNo = 1; stainNo <= maxGoodStain; ++stainNo)
     537        for (int stainNo = 1; stainNo <= numHeGlass; ++stainNo)
    543538        {
    544539          JSONObject jsonGlass = (JSONObject)jsonHeGlass.get(stainNo-1);
Note: See TracChangeset for help on using the changeset viewer.