Changeset 3823


Ignore:
Timestamp:
Apr 4, 2016, 12:42:37 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #861: YellowLabel? tracking wizard

Include the site name in the ZIP filename when creating a ZIP file when all reports are from the same site.

Include the current date in the ZIP filename.

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

Legend:

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

    r3822 r3823  
    343343    var selected = yellow.checkSelected(filter, 'Select at least one specimen that has a PilotReport');
    344344    if (selected.length == 0) return;
    345    
     345
    346346    if (!options)
    347347    {
     
    359359        specimen[i] = selected[i].id;
    360360      }
     361     
    361362     
    362363      var url = '../YellowLabel.servlet?ID='+App.getSessionId();
     
    366367      url += '&password='+encodeURIComponent(options.password);
    367368      url += '&completedDate='+encodeURIComponent(options.completedDate);
     369      url += '&site='+encodeURIComponent(frm.siteFilter.value);
    368370      window.open(url);
    369371    }
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/YellowLabelServlet.java

    r3822 r3823  
    181181        }
    182182       
     183        String sitePrefix = Values.getStringOrNull(req.getParameter("site"));
     184        Site commonSite = sitePrefix != null ? Site.findByCaseName(sitePrefix) : null;
     185       
    183186        Integer[] ids = Values.getInt(req.getParameter("rawBioAssays").split(","));
    184187        String password = Values.getStringOrNull(req.getParameter("password"));
     
    187190        for (int id : ids)
    188191        {
    189           rawBioAssays.add(RawBioAssay.getById(dc, id));
     192          RawBioAssay raw = RawBioAssay.getById(dc, id);
     193          Site site = Site.findByCaseName(raw.getName());
     194          // If all selected reports are from the same site we
     195          // want to include the site name to the generated ZIP filename
     196          if (commonSite == null)
     197          {
     198            commonSite = site;
     199          }
     200          else if (commonSite != site)
     201          {
     202            commonSite = Site.UNKNOWN;
     203          }
     204          rawBioAssays.add(raw);
    190205        }
    191206       
     
    194209       
    195210        out.setMimeType(pdf2Zip.getMimeType());
    196         out.setFilename(pdf2Zip.getOutFilename(PdfReportTemplate.PILOT_REPORT.getDefaultFilename()));
     211        String filename = PdfReportTemplate.PILOT_REPORT.getDefaultFilename().replace(".pdf", "");
     212        if (commonSite != null && commonSite != Site.UNKNOWN)
     213        {
     214          // All reports are from the same site
     215          filename += "-"+commonSite.getName().toLowerCase();
     216        }
     217        filename += "-"+Reggie.CONVERTER_DATE_TO_STRING.convert(new Date());
     218        filename += ".zip";
     219        out.setFilename(pdf2Zip.getOutFilename(filename));
    197220       
    198221        GeneReportsCombinerPlugin.PdfReportCombiner combiner =
Note: See TracChangeset for help on using the changeset viewer.