Changeset 2002


Ignore:
Timestamp:
May 29, 2013, 12:45:56 PM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #473: Register library processing results

Added date and operator fields to the library preparation registration wizard. Already registered plates should be fixed manually.

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

Legend:

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

    r1992 r2002  
    3737var currentStep = 1;
    3838
    39 var libDateIsValid = false;
     39var dateIsValid = [];
    4040var wellTableIsValid = false;
    4141var qubitCsvIsValid = false;
     
    137137  {
    138138    if (debug) Main.debug(JSON.stringify(libInfo));
    139     var failed = document.getElementById('outcomeFailed').checked
     139    var failed = document.getElementById('outcomeFailed').checked;
    140140   
    141     if (libInfo.libDate)
     141    if (libInfo.amplificationDate)
    142142    {
    143       frm.libDate.value = libInfo.libDate;
    144       libDateOnChange();
     143      frm.amplificationDate.value = libInfo.amplificationDate;
     144      frm.amplificationOperator.value = libInfo.amplificationOperator;
     145      dateOnChange('amplificationDate');
     146    }
     147    if (libInfo.cleanupDate)
     148    {
     149      frm.cleanupDate.value = libInfo.cleanupDate;
     150      frm.cleanupOperator.value = libInfo.cleanupOperator;
     151      dateOnChange('cleanupDate');
    145152    }
    146153    if (!failed)
     
    167174      }
    168175    }
    169     if (libInfo.libOperator) frm.libOperator.value = libInfo.libOperator;
    170176    if (libInfo.libComments)
    171177    {
    172178      frm.libComments.value = libInfo.libComments;
    173       libDateOnChange();
    174179    }
    175180  }
    176181 
    177182  Main.show('step.2.section');
    178   frm.libDate.focus();
     183  frm.amplificationDate.focus();
    179184
    180185  // Load Library protocols
     
    282287  if (lastPrefix == 'welltable')
    283288  {
     289    saveToLocalStorage(frm.bioplate.value);
    284290    setTimeout(preValidateCsvFile, 100);
    285291  }
     
    294300}
    295301
    296 function libDateOnChange()
    297 {
    298   var frm = document.forms['reggie'];
    299   libDateIsValid = false;
    300   setInputStatus('libDate', '', '');
    301  
    302   var libDate = frm.libDate.value;
    303   if (libDate == '')
    304   {
    305     setInputStatus('libDate', 'Missing', 'invalid');
     302function dateOnChange(dateField)
     303{
     304  var frm = document.forms['reggie'];
     305
     306  setInputStatus(dateField, '', '');
     307  dateIsValid[dateField] = true;
     308  var date = frm[dateField].value;
     309
     310  if (date == '')
     311  {
     312    setInputStatus(dateField, 'Missing date', 'warning');
    306313    return;
    307314  }
    308315
    309316  // Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits.   
    310   libDate = autoFillDate(libDate);
    311   frm.libDate.value = libDate;
    312  
    313   if (!Dates.isDate(libDate, 'yyyyMMdd'))
    314   {
    315     setInputStatus('libDate', 'Not a valid date', 'invalid');
     317  date = autoFillDate(date);
     318  frm[dateField].value = date;
     319  if (!Dates.isDate(date, 'yyyyMMdd'))
     320  {
     321    setInputStatus(dateField, 'Not a valid date', 'invalid');
     322    dateIsValid[dateField] = false;
    316323    return;
    317324  }
    318325 
    319   setInputStatus('libDate', '', 'valid');
    320   libDateIsValid = true;
     326  setInputStatus(dateField, '', 'valid');
     327}
     328
     329function setDate(frmName, dateField, date)
     330{
     331  var frm = document.forms['reggie'];
     332  frm[dateField].value = date;
     333  dateOnChange(dateField);
     334  frm[dateField].focus();
    321335}
    322336
     
    428442function step2IsValid()
    429443{
     444  if (dateIsValid['amplificationDate'] == false) return false;
     445  if (dateIsValid['cleanupDate'] == false) return false;
     446 
    430447  var failed = document.getElementById('outcomeFailed').checked;
    431448  if (failed)
    432449  {
    433     return libDateIsValid && libCommentsIsValid;
     450    return libCommentsIsValid;
    434451  }
    435452  else
    436453  {
    437     return libDateIsValid && wellTableIsValid && qubitCsvIsValid;
     454    return wellTableIsValid && qubitCsvIsValid;
    438455  }
    439456}
     
    466483  }
    467484   
    468   submitInfo.libDate = frm.libDate.value;
     485  submitInfo.amplificationDate = frm.amplificationDate.value;
     486  submitInfo.amplificationOperator = frm.amplificationOperator.value;
     487  submitInfo.cleanupDate = frm.cleanupDate.value;
     488  submitInfo.cleanupOperator = frm.cleanupOperator.value;
    469489  submitInfo.libProtocol = parseInt(frm.libProtocol.value, 10);
    470   submitInfo.libOperator = frm.libOperator.value;
    471490  submitInfo.libComments = frm.libComments.value;
    472491 
     
    536555    var libInfo = new Object();
    537556    libInfo.id = libPlateId;
    538     libInfo.libDate = frm.libDate.value;
     557    libInfo.amplificationDate = frm.amplificationDate.value;
     558    libInfo.amplificationOperator = frm.amplificationOperator.value;
     559    libInfo.cleanupDate = frm.cleanupDate.value;
     560    libInfo.cleanupOperator = frm.cleanupOperator.value;
    539561    libInfo.wellTable = { id: frm['welltable.id'].value, path: frm['welltable.path'].value };
    540562    libInfo.caliperGxd = { id: frm['calipergxd.id'].value, path: frm['calipergxd.path'].value };
     
    542564    libInfo.qubitCsv = { id: frm['qubitcsv.id'].value, path: frm['qubitcsv.path'].value };
    543565    libInfo.libProtocol = frm.libProtocol.value;
    544     libInfo.libOperator = frm.libOperator.value;
    545566    libInfo.libComments = frm.libComments.value;
    546567   
     
    659680      <table>
    660681      <tr valign="top">
    661         <td class="prompt">Date</td>
    662         <td class="input">
    663           <input type="text" class="required" name="libDate" value="" size="12" maxlength="10"
    664             onblur="libDateOnChange()" onkeypress="focusOnEnter(event, 'qubitcsv.path')">
    665         </td>
    666         <td class="status" id="libDate.status"></td>
    667         <td class="help">
    668           <span id="libDate.message" class="message" style="display: none;"></span>(YYYYMMDD or MMDD)
    669         </td>
     682        <td class="prompt">Step</td>
     683        <td style="width: 11em;"><b>Date</b></td>
     684        <td><b>Operator</b></td>
     685        <td class="status"></td>
     686        <td class="help" rowspan="3">
     687          <span id="mrnaDate.message" class="message" style="display: none;"></span>
     688          Enter date and operator for each step in the library preparation.
     689          (YYYYMMDD or MMDD)
     690        </td>
     691      </tr>
     692      <tr>
     693        <td class="subprompt">Amplification</td>
     694        <td>
     695          <input type="text" name="amplificationDate" maxlength="10" style="width: 8em;"
     696            onblur="dateOnChange('amplificationDate')" onkeypress="focusOnEnter(event, 'amplificationOperator')">
     697            <base:icon
     698              onclick="Dates.selectDate('Amplification date', 'reggie', 'amplificationDate', 'setDate', 'yyyyMMdd')"
     699              image="calendar.png"
     700              tooltip="Select a date from a calendar"
     701              tabindex="-1"
     702            />
     703        </td>
     704        <td>
     705          <input type="text" name="amplificationOperator" value="<%=HTML.encodeTags(user.getName()) %>"
     706            style="width: 95%;" maxlength="255" onkeypress="focusOnEnter(event, 'cleanupDate')">
     707        </td>
     708        <td class="status" id="amplificationDate.status"></td>
     709      </tr>
     710      <tr>
     711        <td class="subprompt">Cleanup</td>
     712        <td>
     713          <input type="text" name="cleanupDate" maxlength="10" style="width: 8em;"
     714            onblur="dateOnChange('cleanupDate')" onkeypress="focusOnEnter(event, 'cleanupOperator')">
     715            <base:icon
     716              onclick="Dates.selectDate('Cleanup date', 'reggie', 'cleanupDate', 'setDate', 'yyyyMMdd')"
     717              image="calendar.png"
     718              tooltip="Select a date from a calendar"
     719              tabindex="-1"
     720            />
     721        </td>
     722        <td>
     723          <input type="text" name="cleanupOperator" value="<%=HTML.encodeTags(user.getName()) %>"
     724            style="width: 95%;" maxlength="255" onkeypress="focusOnEnter(event, 'qubitcsv.path')">
     725        </td>
     726        <td class="status" id="cleanupDate.status"></td>
    670727      </tr>
    671728      <tbody id="filesSection">
    672729      <tr>
    673730        <td class="prompt">Qubit files</td>
    674         <td class="input"></td>
     731        <td class="input" colspan="2"></td>
    675732        <td class="status"></td>
    676733        <td class="help"></td>
     
    678735      <tr valign="top">
    679736        <td class="subprompt">Conc. CSV</td>
    680         <td class="input">
     737        <td class="input" colspan="2">
    681738          <input type="hidden" name="qubitcsv.id" value="">
    682739          <table>
     
    704761      <tr>
    705762        <td class="prompt">Caliper files</td>
    706         <td class="input"></td>
     763        <td class="input" colspan="2"></td>
    707764        <td class="status"></td>
    708765        <td class="help"></td>
     
    710767      <tr valign="top">
    711768        <td class="subprompt">Well table CSV</td>
    712         <td class="input">
     769        <td class="input" colspan="2">
    713770          <input type="hidden" name="welltable.id" value="">
    714771          <table>
     
    736793      <tr valign="top">
    737794        <td class="subprompt">GXD raw data</td>
    738         <td class="input">
     795        <td class="input" colspan="2">
    739796          <input type="hidden" name="calipergxd.id" value="">
    740797          <table>
     
    760817      <tr valign="top">
    761818        <td class="subprompt">PDF file</td>
    762         <td class="input">
     819        <td class="input" colspan="2">
    763820          <input type="hidden" name="caliperpdf.id" value="">
    764821          <table>
     
    786843      <tr valign="top">
    787844        <td class="prompt">Protocol</td>
    788         <td class="input"><select style="width:90%" name="libProtocol" id="libProtocol"
    789           onkeypress="focusOnEnter(event, 'libOperator')"></select></td>
     845        <td class="input" colspan="2"><select style="width:90%" name="libProtocol" id="libProtocol"
     846          onkeypress="focusOnEnter(event, 'libComments')"></select></td>
    790847        <td class="status" id="libProtocol.status"></td>
    791848        <td class="help"><span id="libProtocol.message" class="message" style="display: none;"></span>
     
    794851      </tr>
    795852      <tr valign="top">
    796         <td class="prompt">Operator</td>
    797         <td class="input">
    798           <input type="text" name="libOperator" value="<%=HTML.encodeTags(user.getName()) %>"
    799             style="width: 90%;" maxlength="255" onkeypress="focusOnEnter(event, 'libComments')">
    800         </td>
    801         <td class="status" id="libOperator.status"></td>
    802         <td class="help">
    803           <span id="libOperator.message" class="message" style="display: none;"></span>
    804         </td>
    805       </tr>
    806       <tr valign="top">
    807853        <td class="prompt">Comments</td>
    808         <td class="input"><textarea rows="4" cols="50" style="width: 90%;" name="libComments" value="" onblur="libCommentsOnChange()"></textarea></td>
     854        <td class="input" colspan="2"><textarea rows="4" cols="50" style="width: 90%;" name="libComments" value="" onblur="libCommentsOnChange()"></textarea></td>
    809855        <td class="status" id="libComments.status"></td>
    810856        <td class="help"><span id="libComments.message" class="message" style="display: none;"></span>Comments about the library preparation.</td>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r1999 r2002  
    421421      new Annotationtype("SynthesisOperator", Type.STRING, Item.BIOPLATE);
    422422 
     423  /**
     424    Annotation for Lib amplification date.
     425    @since 2.12
     426  */
     427  public static final Annotationtype AMPLIFICATION_DATE =
     428      new Annotationtype("AmplificationDate", Type.DATE, Item.BIOPLATE);
     429 
     430  /**
     431    Annotation for Lib amplification operator.
     432    @since 2.12
     433  */
     434  public static final Annotationtype AMPLIFICATION_OPERATOR =
     435      new Annotationtype("AmplificationOperator", Type.STRING, Item.BIOPLATE);
     436
    423437 
    424438  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1999 r2002  
    270270        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SYNTHESIS_DATE, 1, null, effectiveOptions, createIfMissing));
    271271        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SYNTHESIS_OPERATOR, 1, null, effectiveOptions, createIfMissing));
     272        jsonChecks.add(checkAnnotationType(dc, Annotationtype.AMPLIFICATION_DATE, 1, null, effectiveOptions, createIfMissing));
     273        jsonChecks.add(checkAnnotationType(dc, Annotationtype.AMPLIFICATION_OPERATOR, 1, null, effectiveOptions, createIfMissing));
    272274
    273275        // Annotation type categories
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/LibPrepServlet.java

    r1993 r2002  
    528528
    529529        // Set date and protocol for the event
    530         Date libDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("libDate"));
     530        Date libDate = new Date();
     531       
     532        Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("libDate"));
    531533        libPlate.setEventDate(libDate);
    532         String operator = Values.getStringOrNull((String)jsonReq.get("libOperator"));
    533         Annotationtype.OPERATOR.setAnnotationValue(dc, libPlate, operator);
     534       
     535        // Dates and operators
     536        Annotationtype.AMPLIFICATION_DATE.setAnnotationValue(dc, libPlate, Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("amplificationDate")));
     537        Annotationtype.AMPLIFICATION_OPERATOR.setAnnotationValue(dc, libPlate, Values.getStringOrNull((String)jsonReq.get("amplificationOperator")));
     538        Annotationtype.CLEANUP_DATE.setAnnotationValue(dc, libPlate, Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("cleanupDate")));
     539        Annotationtype.CLEANUP_OPERATOR.setAnnotationValue(dc, libPlate, Values.getStringOrNull((String)jsonReq.get("cleanupOperator")));
     540       
    534541        Protocol libProtocol = libProtocolId == null ? null : Protocol.getById(dc, libProtocolId.intValue());
    535542        libPlate.setDescription((String)jsonReq.get("libComments"));
Note: See TracChangeset for help on using the changeset viewer.