Changeset 2501


Ignore:
Timestamp:
Jun 12, 2014, 11:31:00 AM (9 years ago)
Author:
olle
Message:

Refs #530. Case summary updated for specific event dates by optional addition of link to pop-up window with lab environment data for the given date in the lab where the event was performed. Initially, the link will be indicated by a thermometer icon:

  1. The functionality uses LabEnv JSP file labenvironmentdatabaseeventpopup.jsp in resources/reports/, added in change set [2463] to LabEnv 1.1. Installation of LabEnv version 1.1 or higher is therefore required (otherwise no working lab environment event data links will be added).
  2. JSP file case_summary.jsp in resources/reports/ updated by calling ExtensionsControl.getHomeUrl(...) to obtain the URL for "net.sf.basedb.labenv.service", and then add it attribute data-home-labenv in div tag with id = "page-data".
  3. JavaScript case-summary.js in resources/reports/ updated:
    a. Call of cs.addColumn(...) for RNA, DNA, and FlowThrough extraction dates, mRNA cleanup date, cDNA synthesis date, library cleanup date, and pooled library pool date extended by calling new function cs.asLabEnvLink(sensor, date, title, icon) for the appropriate lab sensor and date.
    b. New function cs.asLabEnvLink(sensor, date, title, icon) added. It retrieves URL home-labenv from div tag with id = "page-data", and if the URL exists, a link is returned with class "link linked-labenv", and attribute data-sensor set to argument sensor, data-date to date, and data-title to title. The link is represented by the icon defined in the argument list.
    c. New event handler LabEnvs.viewDataOnClick is added to links of class "linked-labenv".
    d. New function LabEnvs.viewDataOnClick(event) added. It retrieves URL home-labenv from div tag with id = "page-data", and values for attributes sensor, date, and title from attributed with same name for event.currentTarget, after which a pop-up window is opened for a URL to LabEnv JSP file reports/labenvironmentdatabaseeventpopup.jsp, with added values for labSensorUrl, originDate, and pageTitle.
  4. New icon image thermometer.png added to resources/images/.
Location:
extensions/net.sf.basedb.reggie/trunk/resources
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/reports/case-summary.js

    r2500 r2501  
    278278        cs.addColumn('rna.storageBox', cs.asBioPlateLocation(r.bioWell));
    279279        cs.addColumn('rna.usedQuantity', cs.asQuantity(r.usedQuantity, ' µg'));
    280         cs.addColumn('rna.extractionDate', cs.asDate(r.extractionDate));
     280        cs.addColumn('rna.extractionDate', cs.asDate(r.extractionDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.extractionDate, 'RNA extraction: ' + r.name, 'thermometer.png'));
    281281        cs.addColumn('rna.extractionProtocol', cs.asLink('PROTOCOL', r.extractionProtocol, truncateAt));
    282282        cs.addColumn('rna.remainingQuantity', cs.asQuantity(r.remainingQuantity, ' µg'));
     
    318318        cs.addColumn('dna.registrationDate', cs.asDate(d.registrationDate));
    319319        cs.addColumn('dna.storageBox', cs.asBioPlateLocation(d.bioWell));
    320         cs.addColumn('dna.extractionDate', cs.asDate(d.extractionDate));
     320        cs.addColumn('dna.extractionDate', cs.asDate(d.extractionDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', d.extractionDate, 'DNA extraction: ' + d.name, 'thermometer.png'));
    321321        cs.addColumn('dna.extractionProtocol', cs.asLink('PROTOCOL', d.extractionProtocol, truncateAt));
    322322        cs.addColumn('dna.remainingQuantity', cs.asQuantity(d.remainingQuantity, ' µg'));
     
    349349        cs.addColumn('ft.registrationDate', cs.asDate(f.registrationDate));
    350350        cs.addColumn('ft.storageBox', cs.asBioPlateLocation(f.bioWell));
    351         cs.addColumn('ft.extractionDate', cs.asDate(f.extractionDate));
     351        cs.addColumn('ft.extractionDate', cs.asDate(f.extractionDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', f.extractionDate, 'FlowThrough extraction: ' + f.name, 'thermometer.png'));
    352352        cs.addColumn('ft.extractionProtocol', cs.asLink('PROTOCOL', f.extractionProtocol, truncateAt));
    353353        cs.addColumn('ft.remainingQuantity', cs.asQuantity(f.remainingQuantity, ' µg'));
     
    380380        cs.addColumn('mrna.storageBox', cs.asBioPlateLocation(r.bioWell)+cs.asFileLink(r.platePdf, 'pdffile.png'));
    381381        cs.addColumn('mrna.result', (r.result && r.result != 'Successful') ? cs.asFailInfo(r.result, 'error.png') : null);
    382         cs.addColumn('mrna.cleanupDate', cs.asDate(r.cleanupDate));
     382        cs.addColumn('mrna.cleanupDate', cs.asDate(r.cleanupDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.cleanupDate, 'mRNA cleanup: ' + r.name, 'thermometer.png'));
    383383        cs.addColumn('mrna.usedQuantity', cs.asQuantity(r.usedQuantity, ' µg'));
    384384        cs.addColumn('mrna.comment', cs.truncate(r.comment, truncateAt));
     
    409409        cs.addColumn('cdna.storageBox', cs.asBioPlateLocation(r.bioWell));
    410410        cs.addColumn('cdna.result', (r.result && r.result != 'Successful') ? cs.asFailInfo(r.result, 'error.png') : null);
    411         cs.addColumn('cdna.synthesisDate', cs.asDate(r.synthesisDate));
     411        cs.addColumn('cdna.synthesisDate', cs.asDate(r.synthesisDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.synthesisDate, 'cDNA synthesis: ' + r.name, 'thermometer.png'));
    412412        cs.addColumn('cdna.comment', cs.truncate(r.comment, truncateAt));
    413413      }
     
    437437        cs.addColumn('lib.storageBox', cs.asBioPlateLocation(r.bioWell));
    438438        cs.addColumn('lib.result', (r.result && r.result != 'Successful') ? cs.asFailInfo(r.result, 'error.png') : null);
    439         cs.addColumn('lib.cleanupDate', cs.asDate(r.cleanupDate));
     439        cs.addColumn('lib.cleanupDate', cs.asDate(r.cleanupDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.cleanupDate, 'Library cleanup: ' + r.name, 'thermometer.png'));
    440440        cs.addColumn('lib.remainingQuantity', cs.asQuantity(r.remainingQuantity, ' ng', 0.001));
    441441        cs.addColumn('lib.originalQuantity', cs.asQuantity(r.originalQuantity, ' ng', 0.001));
     
    470470        cs.addColumn('pooledlib.name', cs.asLink('EXTRACT', r));
    471471        cs.addColumn('pooledlib.registrationDate', cs.asDate(r.registrationDate));
    472         cs.addColumn('pooledlib.poolDate', cs.asDate(r.poolDate));
     472        cs.addColumn('pooledlib.poolDate', cs.asDate(r.poolDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.poolDate, 'Pooled library pooling: ' + r.name, 'thermometer.png'));
    473473        cs.addColumn('pooledlib.remainingQuantity', cs.asQuantity(r.remainingQuantity, ' ng', 0.001));
    474474        cs.addColumn('pooledlib.originalQuantity', cs.asQuantity(r.originalQuantity, ' ng', 0.001));
     
    531531    {
    532532      Events.addEventHandler(linkedFiles[fileNo], 'click', Files.viewFileOnClick);
     533    }
     534   
     535    var linkedLabEnvs = document.getElementsByClassName('linked-labenv');
     536    for (var labEnvNo = 0; labEnvNo < linkedLabEnvs.length; labEnvNo++)
     537    {
     538      Events.addEventHandler(linkedLabEnvs[labEnvNo], 'click', LabEnvs.viewDataOnClick);
    533539    }
    534540   
     
    641647  }
    642648
     649  cs.asLabEnvLink = function(sensor, date, title, icon)
     650  {
     651    var link = '';
     652    // Check if BASE extension LabEnv is installed
     653    var homeLabEnv = Data.get('page-data', 'home-labenv');
     654    if (homeLabEnv)
     655    {
     656      if (date)
     657      {
     658        if (sensor)
     659        {
     660          // Link to pop-up window with lab environment data for the chosen sensor and date
     661          link = '<span class="link linked-labenv" data-sensor="'+sensor+'" data-date="'+date+'" data-title="'+title+'"><img src="../images/'+icon+'"></span>';
     662        }
     663      }
     664    }
     665    return link;
     666  }
     667
    643668  cs.asCaseList = function(allCases, mainCase)
    644669  {
     
    838863}();
    839864
     865var LabEnvs = function()
     866{
     867  var labenvs = {};
     868
     869  /**
     870    Event handler that calls 'labenv.jar/reports/labenvironmentdatabaseeventpopup.jsp'
     871    when clicking on the attached target. The sensor id should be stored
     872    in attribute 'data-sensor', the date in 'data-date',
     873    and the title in 'data-title'.
     874  */
     875  labenvs.viewDataOnClick = function(event)
     876  {
     877    var homeLabEnv = Data.get('page-data', 'home-labenv');
     878    var title = Data.get(event.currentTarget, 'title');
     879    var sensor = Data.get(event.currentTarget, 'sensor');
     880    var date = Data.get(event.currentTarget, 'date');
     881    var url = homeLabEnv;
     882    url += '/reports/labenvironmentdatabaseeventpopup.jsp';
     883    url += '?ID='+App.getSessionId();
     884    url += '&pageTitle='+encodeURIComponent(title);
     885    url += '&labSensorUrl='+encodeURIComponent(sensor);
     886    url += '&originDate='+encodeURIComponent(date);
     887    Dialogs.openPopup(url, title, 820, 768);
     888  }
     889 
     890  return labenvs;
     891}();
     892
    840893Doc.onLoad(CaseSummary.initPage);
  • extensions/net.sf.basedb.reggie/trunk/resources/reports/case_summary.jsp

    r2454 r2501  
    2626final float scale = Base.getScale(sc);
    2727final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie");
     28final String homeLabEnv = ExtensionsControl.getHomeUrl("net.sf.basedb.labenv.service");
    2829DbControl dc = null;
    2930try
     
    7576    data-patient-curator="<%=isPatientCurator ? 1 : 0%>"
    7677    data-page-type="<%=pageType%>"
     78    data-home-labenv="<%=HTML.encodeTags(homeLabEnv)%>"
    7779  ></div>
    7880  <div id="all-content">
Note: See TracChangeset for help on using the changeset viewer.