Changeset 2264


Ignore:
Timestamp:
Mar 4, 2014, 10:44:54 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #583: Require 'embedding date' in 'Register paraffin blocks' wizard

Location:
extensions/net.sf.basedb.reggie/branches/2.15-stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/2.15-stable/resources/sampleproc/histology_block.jsp

    r2172 r2264  
    5656var debug = false;
    5757var currentStep = 1;
    58 var moveDateIsValid = false;
     58var embedDateIsValid = false;
    5959var workList;
    6060
     
    7575    }
    7676    workListIsValid = true;
    77     frm.moveDate.focus();
     77    frm.embedDate.focus();
    7878    Main.show('gonext');
    7979  }
     
    168168function step1IsValid()
    169169{
    170   return moveDateIsValid;
     170  return embedDateIsValid;
    171171}
    172172
     
    197197 
    198198  frm.workList.disabled = true;
    199   frm.moveDate.disabled = true;
     199  frm.embedDate.disabled = true;
    200200  frm.histologyProtocol.disabled = true;
    201201 
     
    273273  Main.hide('gocreate');
    274274 
    275   workList.moveDate = frm.moveDate.value;
     275  workList.embedDate = frm.embedDate.value;
    276276  workList.protocolId = parseInt(frm.histologyProtocol[frm.histologyProtocol.selectedIndex].value, 10);
    277277
     
    327327}
    328328
    329 function moveDateOnChange()
    330 {
    331   var frm = document.forms['reggie'];
    332   moveDateIsValid = false;
    333   setInputStatus('moveDate', '', '');
    334  
    335   var moveDate = frm.moveDate.value;
    336  
    337   if (moveDate == '')
    338   {
    339     setInputStatus('moveDate', 'Missing', 'warning');
     329function embedDateOnChange()
     330{
     331  var frm = document.forms['reggie'];
     332  embedDateIsValid = false;
     333  setInputStatus('embedDate', '', '');
     334 
     335  var embedDate = frm.embedDate.value;
     336 
     337  if (embedDate == '')
     338  {
     339    setInputStatus('embedDate', 'Missing', 'invalid');
     340    return;
    340341  }
    341342  else
    342343  {
    343344    // Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits.
    344     moveDate = autoFillDate(moveDate);
    345     frm.moveDate.value = moveDate;
    346  
    347     if (!Dates.isDate(moveDate, 'yyyyMMdd'))
     345    embedDate = autoFillDate(embedDate);
     346    frm.embedDate.value = embedDate;
     347 
     348    if (!Dates.isDate(embedDate, 'yyyyMMdd'))
    348349    {
    349       setInputStatus('moveDate', 'Not a valid date', 'invalid');
     350      setInputStatus('embedDate', 'Not a valid date', 'invalid');
    350351      return;
    351352    }
    352     setInputStatus('moveDate', '', 'valid');
    353   }
    354  
    355   moveDateIsValid = true;
     353  }
     354 
     355  setInputStatus('embedDate', '', 'valid');
     356  embedDateIsValid = true;
    356357}
    357358
     
    405406        <td class="prompt">Histology work list</td>
    406407        <td class="input"><select style="width:90%"
    407             name="workList" id="workList"
     408            name="workList" id="workList" class="required"
    408409            onchange="histologyOnChange()"></select>
    409410        </td>
     
    416417        <td class="prompt">Embedding date</td>
    417418        <td class="input">
    418           <input type="text" name="moveDate" value="" size="12" maxlength="10"
    419             onblur="moveDateOnChange()">
     419          <input type="text" class="required" name="embedDate" value="" size="12" maxlength="10"
     420            onblur="embedDateOnChange()">
    420421        </td>
    421         <td class="status" id="moveDate.status"></td>
     422        <td class="status" id="embedDate.status"></td>
    422423        <td class="help">
    423           <span id="moveDate.message" class="message" style="display: none;"></span>(YYYYMMDD or MMDD)
     424          <span id="embedDate.message" class="message" style="display: none;"></span>(YYYYMMDD or MMDD)
    424425        </td>
    425426      </tr>
  • extensions/net.sf.basedb.reggie/branches/2.15-stable/src/net/sf/basedb/reggie/servlet/HistologyServlet.java

    r2244 r2264  
    549549        Number workListId = (Number)jsonReq.get("id");
    550550       
    551         Date moveDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("moveDate"));
     551        Date embedDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("embedDate"));
    552552        Number protocolId = (Number)jsonReq.get("protocolId");
    553553        String storageBox = null;
     
    557557       
    558558        BioPlateEvent placeEvent = BioPlateEvent.getNew(dc, BioPlateEventType.getById(dc, BioPlateEventType.PLACE_ON_PLATE));
    559         placeEvent.setEventDate(moveDate);
    560         placeEvent.setName("Place Histology item on paraffin blocks");
     559        placeEvent.setEventDate(embedDate);
     560        placeEvent.setName("Embed Histology items on paraffin blocks");
    561561        placeEvent.setProtocol(protocol);
    562562        dc.saveItem(placeEvent);
     
    605605           
    606606            paraffinBlock = BioPlate.getById(dc, blockId.intValue());
    607             paraffinBlock.setEventDate(moveDate);
     607            paraffinBlock.setEventDate(embedDate);
    608608            paraffinBlock.setTray(storageBox);
    609609            paraffinBlock.setDescription(Values.getStringOrNull((String)jsonBlock.get("comment")));
     
    620620          // Register date and protocol
    621621          BioMaterialEvent createEvent = his.getCreationEvent();
    622           createEvent.setEventDate(moveDate);
     622          createEvent.setEventDate(embedDate);
    623623          createEvent.setProtocol(protocol);
    624624         
Note: See TracChangeset for help on using the changeset viewer.