Changeset 3824


Ignore:
Timestamp:
Apr 4, 2016, 1:53:14 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #861: YellowLabel? tracking wizard

Added dialog for setting the "Completed date" when using the "Mark completed" action.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/yellowlabel/list.js

    r3823 r3824  
    308308  }
    309309
    310   yellow.markAsCompleted = function()
     310  /**
     311    Called when clicking the button and also a callback
     312    for for the dialog. In the second case, options
     313    must be specifed.
     314   */
     315  yellow.markAsCompleted = function(event, options)
    311316  {
    312317    var selected = yellow.checkSelected(null, 'Select at least one specimen');
    313318    if (selected.length == 0) return;
    314319   
    315     var sp = [];
    316     for (var i = 0; i < selected.length; i++)
    317     {
    318       var tmp = {};
    319       tmp.id = selected[i].id;
    320       sp[i] = tmp;
    321     }
    322    
    323     var submitInfo = {};
    324     submitInfo.cmd = 'MarkAsCompleted';
    325     submitInfo.message = 'Marking ' + selected.length + ' specimen as completed';
    326     submitInfo.specimen = sp;
    327     Wizard.goRegister(submitInfo);
     320    if (!options)
     321    {
     322      var url = 'mark-completed.jsp?ID='+App.getSessionId();
     323      url += '&numSelected='+selected.length;
     324      Dialogs.openPopup(url, 'MarkCompleted', 450, 300);
     325    }
     326    else
     327    {
     328      var sp = [];
     329      for (var i = 0; i < selected.length; i++)
     330      {
     331        var tmp = {};
     332        tmp.id = selected[i].id;
     333        sp[i] = tmp;
     334      }
     335     
     336      var submitInfo = {};
     337      submitInfo.cmd = 'MarkAsCompleted';
     338      submitInfo.message = 'Marking ' + selected.length + ' specimen as completed';
     339      submitInfo.specimen = sp;
     340      submitInfo.options = options;
     341      Wizard.goRegister(submitInfo);
     342    }
    328343  }
    329344 
  • extensions/net.sf.basedb.reggie/trunk/resources/yellowlabel/make-zip.jsp

    r3821 r3824  
    6262            data-textarea-id="completedDate"
    6363            data-date-format="yyyyMMdd"
     64            data-title="Completed date"
    6465            image="calendar.png"
    6566            tooltip="Select a date from a calendar"
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java

    r3781 r3824  
    6464 
    6565  /**
     66    Alternate converter for date values with a '-' separator: yyyy-MM-dd
     67    @since 4.3
     68  */
     69  public static final DateToStringConverter CONVERTER_DATE_TO_STRING_WITH_SEPARATOR = new DateToStringConverter(new SimpleDateFormat("yyyy-MM-dd"));
     70 
     71  /**
    6672    Default converter for string values to date values: yyyyMMdd
    6773    @since 2.2
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/YellowLabelServlet.java

    r3823 r3824  
    272272        JSONObject jsonReq = JsonUtil.parseRequest(req);
    273273        JSONArray jsonSpecimen = (JSONArray)jsonReq.get("specimen");
    274         Date now = new Date();
     274        JSONObject jsonOptions = (JSONObject)jsonReq.get("options");
     275       
     276        Date completedDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonOptions.get("completedDate"));
    275277       
    276278        for (int spNo = 0; spNo < jsonSpecimen.size(); spNo++)
     
    280282         
    281283          Sample specimen = Sample.getById(dc, spId.intValue());
    282           Annotationtype.COMPLETED_DATE.setAnnotationValue(dc, specimen, now);
    283         }
    284        
    285         Thread.sleep(5000);
    286         jsonMessages.add(jsonSpecimen.size() + " specimen marked as completed");
     284          Annotationtype.COMPLETED_DATE.setAnnotationValue(dc, specimen, completedDate);
     285        }
     286       
     287        jsonMessages.add(jsonSpecimen.size() + " specimen marked as completed on " + Reggie.CONVERTER_DATE_TO_STRING_WITH_SEPARATOR.convert(completedDate));
    287288        dc.commit();
    288289      }
Note: See TracChangeset for help on using the changeset viewer.