Changeset 3815


Ignore:
Timestamp:
Mar 23, 2016, 2:56:15 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #861: YellowLabel? tracking wizard

Load sites and permissions in a separate request so that it doesn't have to be redone when updating the specimen list due to a change in the "Completed date" filter.

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

Legend:

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

    r3814 r3815  
    3838
    3939    var url = '../YellowLabel.servlet?ID='+App.getSessionId();
     40    url += '&cmd=LoadSitesAndPermissions';
     41    Wizard.asyncJsonRequest(url, yellow.onSitesLoaded);
     42    Wizard.showLoadingAnimation('Loading sites...');
     43  }
     44 
     45  yellow.onSitesLoaded = function(response)
     46  {
     47    var frm = document.forms['reggie'];
     48
     49    sites = response.sites;
     50    permissions = response.permissions;
     51    if (permissions.PatientCurator || permissions.Administrator)
     52    {
     53      Doc.show('yellow-toolbar');
     54    }
     55   
     56    for (var siteNo = 0; siteNo < sites.length; siteNo++)
     57    {
     58      var site = sites[siteNo];
     59      frm.siteFilter[frm.siteFilter.length] = new Option(site.name, site.prefix);
     60    }
     61   
     62    var url = '../YellowLabel.servlet?ID='+App.getSessionId();
    4063    url += '&cmd=LoadActiveYellowSpecimen';
    4164    Wizard.showLoadingAnimation('Loading YellowLabel specimen...');
     
    4871    var frm = document.forms['reggie'];
    4972   
    50     permissions = response.permissions;
    51     if (permissions.PatientCurator || permissions.Administrator)
    52     {
    53       Doc.show('yellow-toolbar');
    54     }
    55    
    56     sites = response.sites;
    5773    var siteCount = [];
    5874    for (var siteNo = 0; siteNo < sites.length; siteNo++)
     
    111127    }
    112128   
    113     if (frm.siteFilter.length < sites.length)
    114     {
    115       for (var siteNo = 0; siteNo < sites.length; siteNo++)
    116       {
    117         var site = sites[siteNo];
    118         frm.siteFilter[frm.siteFilter.length] = new Option(site.name + ' (' + siteCount[site.prefix]+')', site.prefix);
    119       }
     129    // Update the site filter list with current counts
     130    for (var siteNo = 0; siteNo < sites.length; siteNo++)
     131    {
     132      var site = sites[siteNo];
     133      frm.siteFilter[siteNo+1].text = site.name + ' ('+siteCount[site.prefix]+')';
    120134    }
    121135   
     
    124138    Doc.element('num-completed').innerHTML = numCompleted;
    125139   
    126     Doc.show('step-1');
    127 
    128140    var cs = document.getElementsByClassName('case-summary');
    129141    for (var i = 0; i < cs.length; i++)
     
    143155      Events.addEventHandler(linkedFiles[fileNo], 'click', Files.viewFileOnClick);
    144156    }
     157   
     158    Doc.show('step-1');
    145159   
    146160    yellow.filterOnChange();
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/YellowLabelServlet.java

    r3814 r3815  
    8484    try
    8585    {
    86       if ("LoadActiveYellowSpecimen".equals(cmd))
     86      if ("LoadSitesAndPermissions".equals(cmd))
     87      {
     88        dc = sc.newDbControl();
     89        json.put("sites", ReportTableUtil.getJSONSites(Site.SORT_BY_NAME));
     90        json.put("permissions", JsonUtil.getPermissions(dc));
     91      }
     92      else if ("LoadActiveYellowSpecimen".equals(cmd))
    8793      {
    8894        dc = sc.newDbControl();
     
    156162
    157163        json.put("specimen", jsonSpecimen);
    158         json.put("sites", ReportTableUtil.getJSONSites(Site.SORT_BY_NAME));
    159         json.put("permissions", JsonUtil.getPermissions(dc));
    160164      }
    161165      else if ("CreatePilotReportZip".equals(cmd))
Note: See TracChangeset for help on using the changeset viewer.