3028 |
11 Dec 14 |
olle |
var CaseSummary = function() |
3028 |
11 Dec 14 |
olle |
2 |
{ |
3028 |
11 Dec 14 |
olle |
var cs = {}; |
3028 |
11 Dec 14 |
olle |
var debug = 0; |
4151 |
04 Oct 16 |
olle |
var sampleItemPrefix = ''; |
4221 |
09 Nov 16 |
olle |
var sampleItemNumDigits = 5; |
3028 |
11 Dec 14 |
olle |
var TRUNCATE_SIZE = [-1, 30, 20, 15]; |
3028 |
11 Dec 14 |
olle |
8 |
|
3028 |
11 Dec 14 |
olle |
cs.initPage = function() |
3028 |
11 Dec 14 |
olle |
10 |
{ |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler('showConfidential', 'change', cs.showConfidentialOnChange); |
3028 |
11 Dec 14 |
olle |
Events.doOnEnter('caseName', cs.caseSummary); |
3028 |
11 Dec 14 |
olle |
Buttons.addClickHandler('btnCaseSummary', cs.caseSummary); |
3028 |
11 Dec 14 |
olle |
Buttons.addClickHandler('printButton', cs.goPrint); |
3028 |
11 Dec 14 |
olle |
Buttons.addClickHandler('close', App.closeWindow); |
3028 |
11 Dec 14 |
olle |
16 |
|
3028 |
11 Dec 14 |
olle |
var caseName = Data.get('page-data', 'case-name'); |
3028 |
11 Dec 14 |
olle |
var isAdmin = Data.int('page-data', 'admin'); |
3028 |
11 Dec 14 |
olle |
var isPatientCurator = Data.int('page-data', 'patient-curator'); |
3028 |
11 Dec 14 |
olle |
20 |
|
3028 |
11 Dec 14 |
olle |
var url = '../CaseSummary.servlet?ID='+App.getSessionId(); |
3028 |
11 Dec 14 |
olle |
url += '&cmd=GetCaseInfo'; |
3028 |
11 Dec 14 |
olle |
url += '&caseName='+encodeURIComponent(caseName); |
3028 |
11 Dec 14 |
olle |
Wizard.showLoadingAnimation('Loading information about case: ' + Strings.encodeTags(caseName)); |
3028 |
11 Dec 14 |
olle |
Wizard.asyncJsonRequest(url, cs.caseInfoLoaded); |
3028 |
11 Dec 14 |
olle |
26 |
} |
3028 |
11 Dec 14 |
olle |
27 |
|
3028 |
11 Dec 14 |
olle |
cs.caseInfoLoaded = function(response) |
3028 |
11 Dec 14 |
olle |
29 |
{ |
3028 |
11 Dec 14 |
olle |
Doc.show('all-info'); |
3028 |
11 Dec 14 |
olle |
31 |
|
3028 |
11 Dec 14 |
olle |
var caseName = Data.get('page-data', 'case-name'); |
3028 |
11 Dec 14 |
olle |
var caseInfo = response.caseInfo; |
3028 |
11 Dec 14 |
olle |
var site = response.site; |
3028 |
11 Dec 14 |
olle |
var patient = response.patient; |
3028 |
11 Dec 14 |
olle |
cs.initSections(response.sections); |
4780 |
20 Apr 18 |
olle |
var consentOk = true; |
4151 |
04 Oct 16 |
olle |
sampleItemPrefix = response.sampleItemPrefix; |
4221 |
09 Nov 16 |
olle |
sampleItemNumDigits = response.sampleItemNumDigits; |
4830 |
04 Jun 18 |
olle |
if (Doc.element('caseName') != null) |
4830 |
04 Jun 18 |
olle |
41 |
{ |
4830 |
04 Jun 18 |
olle |
Doc.element('caseName').setAttribute('title', 'Please enter a case id ("' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits)'); |
4830 |
04 Jun 18 |
olle |
43 |
} |
4241 |
16 Nov 16 |
olle |
var projInfo = response.projInfo; |
3028 |
11 Dec 14 |
olle |
45 |
|
4241 |
16 Nov 16 |
olle |
if (projInfo) |
4241 |
16 Nov 16 |
olle |
47 |
{ |
4241 |
16 Nov 16 |
olle |
cs.addColumn('project.name', cs.asLink('PROJECT', projInfo)); |
4241 |
16 Nov 16 |
olle |
cs.addColumn('project.description', Strings.encodeTags(projInfo.description)); |
4241 |
16 Nov 16 |
olle |
50 |
} |
4241 |
16 Nov 16 |
olle |
else |
4241 |
16 Nov 16 |
olle |
52 |
{ |
4241 |
16 Nov 16 |
olle |
cs.addColumn('project.name', cs.asNoInfo('No project information has been registered')); |
4241 |
16 Nov 16 |
olle |
Doc.hide('project-details'); |
4241 |
16 Nov 16 |
olle |
55 |
} |
4241 |
16 Nov 16 |
olle |
56 |
|
3028 |
11 Dec 14 |
olle |
if (caseInfo) |
3028 |
11 Dec 14 |
olle |
58 |
{ |
3028 |
11 Dec 14 |
olle |
// Use returned case name, as it may have been found from personal number |
3028 |
11 Dec 14 |
olle |
if (!patient || patient.allCases.indexOf(caseName) == -1) |
3028 |
11 Dec 14 |
olle |
61 |
{ |
3028 |
11 Dec 14 |
olle |
caseName = caseInfo.name; |
3028 |
11 Dec 14 |
olle |
Data.set('page-data', 'case-name', caseName); |
3028 |
11 Dec 14 |
olle |
// Update header text to use the potentially changed case name |
3028 |
11 Dec 14 |
olle |
if (Doc.element('path-case-summary')) |
3028 |
11 Dec 14 |
olle |
66 |
{ |
3028 |
11 Dec 14 |
olle |
Doc.element('path-case-summary').innerHTML = 'Case summary - ' + Strings.encodeTags(caseName); |
3028 |
11 Dec 14 |
olle |
68 |
} |
3028 |
11 Dec 14 |
olle |
69 |
} |
3028 |
11 Dec 14 |
olle |
70 |
|
4780 |
20 Apr 18 |
olle |
consentOk = !caseInfo.consent || caseInfo.consent == 'Yes'; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.name', cs.asLink('SAMPLE', caseInfo)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.registrationDate', cs.asDate(caseInfo.registrationDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.tubeContentType', Strings.encodeTags(caseInfo.tubeContentType)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.mutationAnalysis', Strings.encodeTags(caseInfo.mutationAnalysis)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.site', site ? site.name : null); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('case.consent', cs.asConsent(caseInfo.consent, cs.asDate(caseInfo.consentDate))); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.projectFocus', Strings.encodeTags(caseInfo.projectFocus)); |
4732 |
04 Apr 18 |
olle |
cs.addColumn('case.metastasisSite', Strings.encodeTags(caseInfo.metastasisSite)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.nofTubes', caseInfo.nofTubes); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.otherPathNote', Strings.encodeTags(caseInfo.otherPathNote)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.description', Strings.encodeTags(caseInfo.description)); |
3028 |
11 Dec 14 |
olle |
83 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
85 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('case.name', cs.asNoInfo('No case information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('case-details'); |
3028 |
11 Dec 14 |
olle |
88 |
} |
3028 |
11 Dec 14 |
olle |
89 |
|
3028 |
11 Dec 14 |
olle |
if (patient) |
3028 |
11 Dec 14 |
olle |
91 |
{ |
4780 |
20 Apr 18 |
olle |
if (consentOk) |
4780 |
20 Apr 18 |
olle |
93 |
{ |
4780 |
20 Apr 18 |
olle |
try |
4780 |
20 Apr 18 |
olle |
95 |
{ |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.name', cs.asLink('BIOSOURCE', patient)); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.registrationDate', cs.asDate(patient.registrationDate)); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.personalNumber', cs.warnIfMissing(Strings.encodeTags(patient.personalNumber))); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.allFirstNames', cs.warnIfMissing(Strings.encodeTags(patient.allFirstNames))); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.familyName', cs.warnIfMissing(Strings.encodeTags(patient.familyName))); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.gender', Strings.encodeTags(patient.gender)); |
4780 |
20 Apr 18 |
olle |
cs.addColumn('patient.allCases', cs.asCaseList(patient.allCases, caseName)); |
4780 |
20 Apr 18 |
olle |
103 |
} |
4780 |
20 Apr 18 |
olle |
catch (e) |
4780 |
20 Apr 18 |
olle |
105 |
{ |
4780 |
20 Apr 18 |
olle |
cs.logError('patient-info', e); |
4780 |
20 Apr 18 |
olle |
107 |
} |
4780 |
20 Apr 18 |
olle |
108 |
} |
4780 |
20 Apr 18 |
olle |
else |
4780 |
20 Apr 18 |
olle |
110 |
{ |
4780 |
20 Apr 18 |
olle |
Doc.hide('patient-info'); |
4780 |
20 Apr 18 |
olle |
112 |
} |
3028 |
11 Dec 14 |
olle |
113 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
115 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('patient.name', cs.asNoInfo('No patient information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('patient-details'); |
3028 |
11 Dec 14 |
olle |
118 |
} |
3028 |
11 Dec 14 |
olle |
119 |
|
3028 |
11 Dec 14 |
olle |
var specimen = response.specimen; |
3028 |
11 Dec 14 |
olle |
var numSpecimen = 0; |
3028 |
11 Dec 14 |
olle |
if (specimen && specimen.length > 0) |
3028 |
11 Dec 14 |
olle |
123 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(specimen.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < specimen.length; i++) |
3028 |
11 Dec 14 |
olle |
126 |
{ |
3028 |
11 Dec 14 |
olle |
var s = specimen[i]; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.name', cs.asLink('SAMPLE', s)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.registrationDate', cs.asDate(s.registrationDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.specimenType', Strings.encodeTags(s.specimenType)); |
4195 |
31 Oct 16 |
olle |
cs.addColumn('specimen.specimenInputType', Strings.encodeTags(s.specimenInputType)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.storageBox', cs.asBioPlateLocation(s.bioWell)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.samplingDate', cs.warnIfMissing(cs.asDateTime(s.samplingDate))); |
3067 |
08 Jan 15 |
olle |
cs.addColumn('specimen.viableTumourCellsPercent', s.viableTumourCellsPercent); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.plNumber', cs.warnIfMissing(Strings.encodeTags(s.plNumber))); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.pad', cs.warnIfMissing(Strings.encodeTags(s.pad))); |
3028 |
11 Dec 14 |
olle |
137 |
/* |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.remainingQuantity', cs.asQuantity(s.remainingQuantity, ' mg', 1000)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.originalQuantity', cs.asQuantity(s.originalQuantity, ' mg', 1000)); |
3028 |
11 Dec 14 |
olle |
140 |
*/ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.nofSections', s.nofSections); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.operatorDeliveryComment', cs.truncate(s.operatorDeliveryComment, truncateAt)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.description', cs.truncate(s.description, truncateAt)); |
3434 |
29 Jun 15 |
olle |
144 |
/* |
3207 |
23 Mar 15 |
olle |
cs.addColumn('specimen.startPlate', cs.asLink('BIOPLATE', s.startPlate)); |
3434 |
29 Jun 15 |
olle |
146 |
*/ |
3434 |
29 Jun 15 |
olle |
cs.addColumn('specimen.startList', cs.asLink('ITEMLIST', s.startList)); |
3028 |
11 Dec 14 |
olle |
numSpecimen++; |
3028 |
11 Dec 14 |
olle |
149 |
} |
3028 |
11 Dec 14 |
olle |
150 |
} |
3028 |
11 Dec 14 |
olle |
if (numSpecimen == 0) |
3028 |
11 Dec 14 |
olle |
152 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('specimen.name', cs.asNoInfo('No specimen information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('specimen-details'); |
3028 |
11 Dec 14 |
olle |
155 |
} |
3028 |
11 Dec 14 |
olle |
156 |
|
3028 |
11 Dec 14 |
olle |
var rna = response.rna; |
3028 |
11 Dec 14 |
olle |
if (rna && rna.length > 0) |
3028 |
11 Dec 14 |
olle |
159 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(rna.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < rna.length; i++) |
3028 |
11 Dec 14 |
olle |
162 |
{ |
3028 |
11 Dec 14 |
olle |
var r = rna[i]; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.name', cs.asLink('EXTRACT', r)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.flag', r.flag ? cs.asFlagInfo(r.flag, 'flag.png') : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.registrationDate', cs.asDate(r.registrationDate)); |
3318 |
08 May 15 |
olle |
cs.addColumn('rna.specimenType', Strings.encodeTags(r.specimenType)); |
3318 |
08 May 15 |
olle |
cs.addColumn('rna.samplingDate', cs.warnIfMissing(cs.asDateTime(r.samplingDate))); |
3318 |
08 May 15 |
olle |
cs.addColumn('rna.viableTumourCellsPercent', r.viableTumourCellsPercent); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.storageBox', cs.asBioPlateLocation(r.bioWell)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.usedQuantity', cs.asQuantity(r.usedQuantity, ' µg')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.extractionDate', cs.asDate(r.extractionDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.extractionDate, 'RNA extraction: ' + r.name, 'thermometer.png')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.extractionProtocol', cs.asLink('PROTOCOL', r.extractionProtocol, truncateAt)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.remainingQuantity', cs.asQuantity(r.remainingQuantity, ' µg')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.originalQuantity', cs.asQuantity(r.originalQuantity, ' µg')); |
3028 |
11 Dec 14 |
olle |
176 |
/* |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.ndConc', cs.asQuantity(r.ndConc, ' ng/µl')); |
3028 |
11 Dec 14 |
olle |
178 |
*/ |
3318 |
08 May 15 |
olle |
cs.addColumn('rna.operatorDeliveryComment', cs.truncate(r.operatorDeliveryComment, truncateAt)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.description', cs.truncate(r.description, truncateAt)); |
3434 |
29 Jun 15 |
olle |
181 |
/* |
3237 |
10 Apr 15 |
olle |
cs.addColumn('rna.startPlate', cs.asLink('BIOPLATE', r.startPlate)); |
3434 |
29 Jun 15 |
olle |
183 |
*/ |
3434 |
29 Jun 15 |
olle |
cs.addColumn('rna.startList', cs.asLink('ITEMLIST', r.startList)); |
3028 |
11 Dec 14 |
olle |
185 |
/* |
3028 |
11 Dec 14 |
olle |
186 |
|
3028 |
11 Dec 14 |
olle |
var hasQc = r.nofQc ? true : false; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.qc', hasQc ? (r.qcDate ? cs.asDate(r.qcDate) : cs.asNoInfo('Waiting for Caliper...')) : 'No'); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.nofQc', hasQc ? r.nofQc : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.qcProtocol', hasQc ? cs.asLink('PROTOCOL', r.qcProtocol, truncateAt) : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.qcPlate', hasQc ? cs.asBioPlateLocation(r.qcPlate)+cs.asFileLink(r.qcPdf, 'pdffile.png') : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.qcRqs', hasQc && r.qcRqs ? Meludi.formatNumber(r.qcRqs, null, 1) : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.qcRin', hasQc && r.qcRin ? Meludi.formatNumber(r.qcRin, null, 1) : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.qcDescription', hasQc ? cs.truncate(r.qcDescription, truncateAt) : null); |
3028 |
11 Dec 14 |
olle |
195 |
*/ |
3028 |
11 Dec 14 |
olle |
196 |
} |
3028 |
11 Dec 14 |
olle |
197 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
199 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('rna.name', cs.asNoInfo('No RNA information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('rna-details'); |
3028 |
11 Dec 14 |
olle |
202 |
} |
3028 |
11 Dec 14 |
olle |
203 |
|
3028 |
11 Dec 14 |
olle |
var dna = response.dna; |
3028 |
11 Dec 14 |
olle |
if (dna && dna.length > 0) |
3028 |
11 Dec 14 |
olle |
206 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(dna.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < dna.length; i++) |
3028 |
11 Dec 14 |
olle |
209 |
{ |
3028 |
11 Dec 14 |
olle |
var d = dna[i]; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.name', cs.asLink('EXTRACT', d)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.registrationDate', cs.asDate(d.registrationDate)); |
3318 |
08 May 15 |
olle |
cs.addColumn('dna.specimenType', Strings.encodeTags(d.specimenType)); |
3318 |
08 May 15 |
olle |
cs.addColumn('dna.samplingDate', cs.warnIfMissing(cs.asDateTime(d.samplingDate))); |
3318 |
08 May 15 |
olle |
cs.addColumn('dna.viableTumourCellsPercent', d.viableTumourCellsPercent); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.storageBox', cs.asBioPlateLocation(d.bioWell)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.extractionDate', cs.asDate(d.extractionDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', d.extractionDate, 'DNA extraction: ' + d.name, 'thermometer.png')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.extractionProtocol', cs.asLink('PROTOCOL', d.extractionProtocol, truncateAt)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.remainingQuantity', cs.asQuantity(d.remainingQuantity, ' µg')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.originalQuantity', cs.asQuantity(d.originalQuantity, ' µg')); |
3028 |
11 Dec 14 |
olle |
221 |
/* |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.ndConc', cs.asQuantity(d.ndConc, ' ng/µl')); |
3028 |
11 Dec 14 |
olle |
223 |
*/ |
3318 |
08 May 15 |
olle |
cs.addColumn('dna.operatorDeliveryComment', cs.truncate(d.operatorDeliveryComment, truncateAt)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.description', cs.truncate(d.description, truncateAt)); |
3434 |
29 Jun 15 |
olle |
226 |
/* |
3237 |
10 Apr 15 |
olle |
cs.addColumn('dna.startPlate', cs.asLink('BIOPLATE', d.startPlate)); |
3434 |
29 Jun 15 |
olle |
228 |
*/ |
3434 |
29 Jun 15 |
olle |
cs.addColumn('dna.startList', cs.asLink('ITEMLIST', d.startList)); |
3028 |
11 Dec 14 |
olle |
230 |
} |
3028 |
11 Dec 14 |
olle |
231 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
233 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('dna.name', cs.asNoInfo('No DNA information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('dna-details'); |
3028 |
11 Dec 14 |
olle |
236 |
} |
3028 |
11 Dec 14 |
olle |
237 |
|
3028 |
11 Dec 14 |
olle |
238 |
/* |
3028 |
11 Dec 14 |
olle |
var mrna = response.mrna; |
3028 |
11 Dec 14 |
olle |
if (mrna && mrna.length > 0) |
3028 |
11 Dec 14 |
olle |
241 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(mrna.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < mrna.length; i++) |
3028 |
11 Dec 14 |
olle |
244 |
{ |
3028 |
11 Dec 14 |
olle |
var r = mrna[i]; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.name', cs.asLink('EXTRACT', r)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.registrationDate', cs.asDate(r.registrationDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.storageBox', cs.asBioPlateLocation(r.bioWell)+cs.asFileLink(r.platePdf, 'pdffile.png')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.result', (r.result && r.result != 'Successful') ? cs.asFailInfo(r.result, 'error.png') : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.cleanupDate', cs.asDate(r.cleanupDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.cleanupDate, 'mRNA cleanup: ' + r.name, 'thermometer.png')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.usedQuantity', cs.asQuantity(r.usedQuantity, ' µg')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.description', cs.truncate(r.description, truncateAt)); |
3028 |
11 Dec 14 |
olle |
253 |
} |
3028 |
11 Dec 14 |
olle |
254 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
256 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('mrna.name', cs.asNoInfo('No mRNA information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('mrna-details'); |
3028 |
11 Dec 14 |
olle |
259 |
} |
3028 |
11 Dec 14 |
olle |
260 |
|
3028 |
11 Dec 14 |
olle |
var cdna = response.cdna; |
3028 |
11 Dec 14 |
olle |
if (cdna && cdna.length > 0) |
3028 |
11 Dec 14 |
olle |
263 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(cdna.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < cdna.length; i++) |
3028 |
11 Dec 14 |
olle |
266 |
{ |
3028 |
11 Dec 14 |
olle |
var r = cdna[i]; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.name', cs.asLink('EXTRACT', r)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.registrationDate', cs.asDate(r.registrationDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.storageBox', cs.asBioPlateLocation(r.bioWell)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.result', (r.result && r.result != 'Successful') ? cs.asFailInfo(r.result, 'error.png') : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.synthesisDate', cs.asDate(r.synthesisDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.synthesisDate, 'cDNA synthesis: ' + r.name, 'thermometer.png')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.description', cs.truncate(r.description, truncateAt)); |
3028 |
11 Dec 14 |
olle |
274 |
} |
3028 |
11 Dec 14 |
olle |
275 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
277 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('cdna.name', cs.asNoInfo('No cDNA information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('cdna-details'); |
3028 |
11 Dec 14 |
olle |
280 |
} |
3526 |
05 Oct 15 |
olle |
281 |
*/ |
3028 |
11 Dec 14 |
olle |
var lib = response.lib; |
3028 |
11 Dec 14 |
olle |
if (lib && lib.length > 0) |
3028 |
11 Dec 14 |
olle |
284 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(lib.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < lib.length; i++) |
3028 |
11 Dec 14 |
olle |
287 |
{ |
3526 |
05 Oct 15 |
olle |
var d = lib[i]; |
3532 |
05 Oct 15 |
olle |
var barcodeInfo = 'NA'; |
3532 |
05 Oct 15 |
olle |
if (d.index1 != null && d.index2 != null) |
3526 |
05 Oct 15 |
olle |
291 |
{ |
3532 |
05 Oct 15 |
olle |
barcodeInfo = cs.asLink('TAG', d.index2) + ',' + cs.asLink('TAG', d.index1); |
3526 |
05 Oct 15 |
olle |
293 |
} |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.name', cs.asLink('EXTRACT', d)); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.registrationDate', cs.asDate(d.registrationDate)); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.storageBox', cs.asBioPlateLocation(d.bioWell)); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.result', (d.result && d.result != 'Successful') ? cs.asFailInfo(d.result, 'error.png') : null); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.cleanupDate', cs.asDate(d.cleanupDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', d.cleanupDate, 'Library cleanup: ' + d.name, 'thermometer.png')); |
3660 |
09 Dec 15 |
olle |
cs.addColumn('lib.libPrepProtocol', cs.asLink('PROTOCOL', d.libPrepProtocol, truncateAt)); |
3660 |
09 Dec 15 |
olle |
cs.addColumn('lib.libPrepKit', cs.asLink('KIT', d.libPrepKit, truncateAt)); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.remainingQuantity', cs.asQuantity(d.remainingQuantity, ' ng', 0.001)); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.originalQuantity', cs.asQuantity(d.originalQuantity, ' ng', 0.001)); |
3532 |
05 Oct 15 |
olle |
cs.addColumn('lib.barcode.name', barcodeInfo); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.ca_size', cs.asQuantity(d.ca_size, '')); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.molarity', cs.asQuantity(d.library_molarity_est, ' nM')); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.adapterFrac', cs.asPercent(d.library_frac_adpt)); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.qubitconc', cs.asQuantity(d.qubitconc, ' ng/µl')); |
3526 |
05 Oct 15 |
olle |
cs.addColumn('lib.description', cs.truncate(d.description, truncateAt)); |
3028 |
11 Dec 14 |
olle |
309 |
} |
3028 |
11 Dec 14 |
olle |
310 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
312 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('lib.name', cs.asNoInfo('No library information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('lib-details'); |
3028 |
11 Dec 14 |
olle |
315 |
} |
3526 |
05 Oct 15 |
olle |
316 |
/* |
3028 |
11 Dec 14 |
olle |
var pooledLib = response.pooledlib; |
3028 |
11 Dec 14 |
olle |
if (pooledLib && pooledLib.length > 0) |
3028 |
11 Dec 14 |
olle |
319 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(pooledLib.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < pooledLib.length; i++) |
3028 |
11 Dec 14 |
olle |
322 |
{ |
3028 |
11 Dec 14 |
olle |
var r = pooledLib[i]; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.name', cs.asLink('EXTRACT', r)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.registrationDate', cs.asDate(r.registrationDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.poolDate', cs.asDate(r.poolDate)+cs.asLabEnvLink('http://givare2.onk.lu.se/', r.poolDate, 'Pooled library pooling: ' + r.name, 'thermometer.png')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.remainingQuantity', cs.asQuantity(r.remainingQuantity, ' ng', 0.001)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.originalQuantity', cs.asQuantity(r.originalQuantity, ' ng', 0.001)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.poolMolarity', cs.asQuantity(r.poolMolarity, ' nM')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.poolConc', cs.asQuantity(r.poolConc, ' ng/µl')); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.description', cs.truncate(r.description, truncateAt)); |
3028 |
11 Dec 14 |
olle |
332 |
} |
3028 |
11 Dec 14 |
olle |
333 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
335 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('pooledlib.name', cs.asNoInfo('No pooled library information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('pooledlib-details'); |
3028 |
11 Dec 14 |
olle |
338 |
} |
3028 |
11 Dec 14 |
olle |
339 |
|
3028 |
11 Dec 14 |
olle |
var sequencingRuns = response.sequencingRun; |
3028 |
11 Dec 14 |
olle |
if (sequencingRuns && sequencingRuns.length > 0) |
3028 |
11 Dec 14 |
olle |
342 |
{ |
3028 |
11 Dec 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(sequencingRuns.length-1, TRUNCATE_SIZE.length)]; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < sequencingRuns.length; i++) |
3028 |
11 Dec 14 |
olle |
345 |
{ |
3028 |
11 Dec 14 |
olle |
var sr = sequencingRuns[i]; |
3028 |
11 Dec 14 |
olle |
var fc = sr.flowCell; |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.name', cs.asLink('DERIVEDBIOASSAY', sr)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.flowCell', cs.asLink('PHYSICALBIOASSAY', fc)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.result', (sr.result && sr.result != 'Successful') ? cs.asFailInfo(sr.result, 'error.png') : null); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.clusterDate', cs.asDate(fc.clusterDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.startDate', cs.asDate(sr.startDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.endDate', cs.asDate(sr.endDate)); |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.description', cs.truncate(sr.description, truncateAt)); |
3028 |
11 Dec 14 |
olle |
355 |
} |
3028 |
11 Dec 14 |
olle |
356 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
358 |
{ |
3028 |
11 Dec 14 |
olle |
cs.addColumn('sequencingRun.name', cs.asNoInfo('No sequencing information has been registered')); |
3028 |
11 Dec 14 |
olle |
Doc.hide('sequencingRun-details'); |
3028 |
11 Dec 14 |
olle |
361 |
} |
3028 |
11 Dec 14 |
olle |
362 |
*/ |
3028 |
11 Dec 14 |
olle |
363 |
|
3028 |
11 Dec 14 |
olle |
var linkedItems = document.getElementsByClassName('linked-item'); |
3028 |
11 Dec 14 |
olle |
for (var itemNo = 0; itemNo < linkedItems.length; itemNo++) |
3028 |
11 Dec 14 |
olle |
366 |
{ |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler(linkedItems[itemNo], 'click', Items.itemOnClick); |
3028 |
11 Dec 14 |
olle |
368 |
} |
3028 |
11 Dec 14 |
olle |
369 |
|
3028 |
11 Dec 14 |
olle |
var linkedFiles = document.getElementsByClassName('linked-file'); |
3028 |
11 Dec 14 |
olle |
for (var fileNo = 0; fileNo < linkedFiles.length; fileNo++) |
3028 |
11 Dec 14 |
olle |
372 |
{ |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler(linkedFiles[fileNo], 'click', Files.viewFileOnClick); |
3028 |
11 Dec 14 |
olle |
374 |
} |
3191 |
18 Mar 15 |
olle |
375 |
|
3191 |
18 Mar 15 |
olle |
376 |
/* |
3028 |
11 Dec 14 |
olle |
var linkedLabEnvs = document.getElementsByClassName('linked-labenv'); |
3028 |
11 Dec 14 |
olle |
for (var labEnvNo = 0; labEnvNo < linkedLabEnvs.length; labEnvNo++) |
3028 |
11 Dec 14 |
olle |
379 |
{ |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler(linkedLabEnvs[labEnvNo], 'click', LabEnvs.viewDataOnClick); |
3028 |
11 Dec 14 |
olle |
381 |
} |
3191 |
18 Mar 15 |
olle |
382 |
*/ |
3028 |
11 Dec 14 |
olle |
383 |
|
3028 |
11 Dec 14 |
olle |
var linkedCases = document.getElementsByClassName('linked-case'); |
3028 |
11 Dec 14 |
olle |
for (var caseNo = 0; caseNo < linkedCases.length; caseNo++) |
3028 |
11 Dec 14 |
olle |
386 |
{ |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler(linkedCases[caseNo], 'click', cs.caseSummary); |
3028 |
11 Dec 14 |
olle |
388 |
} |
3028 |
11 Dec 14 |
olle |
389 |
} |
3028 |
11 Dec 14 |
olle |
390 |
|
3028 |
11 Dec 14 |
olle |
cs.initSections = function(sections) |
3028 |
11 Dec 14 |
olle |
392 |
{ |
3028 |
11 Dec 14 |
olle |
for (var s = 0; s < sections.length; s++) |
3028 |
11 Dec 14 |
olle |
394 |
{ |
3028 |
11 Dec 14 |
olle |
var section = sections[s]; |
3028 |
11 Dec 14 |
olle |
396 |
|
3028 |
11 Dec 14 |
olle |
var details = Doc.element(section.id+'-details'); |
3028 |
11 Dec 14 |
olle |
// If the details section is 'forcibly' hidden (eg. no items of that type), ignore this call |
3028 |
11 Dec 14 |
olle |
if (details && details.style.display != 'none') |
3028 |
11 Dec 14 |
olle |
400 |
{ |
3028 |
11 Dec 14 |
olle |
var headerDiv = Doc.element(section.id+'-header'); |
3028 |
11 Dec 14 |
olle |
if (headerDiv) |
3028 |
11 Dec 14 |
olle |
403 |
{ |
3028 |
11 Dec 14 |
olle |
Doc.addClass(headerDiv, 'link'); |
3028 |
11 Dec 14 |
olle |
headerDiv.title = 'Hide/show details'; |
3028 |
11 Dec 14 |
olle |
headerDiv.sectionId = section.id; |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler(headerDiv, 'click', cs.toggleDetails); |
3028 |
11 Dec 14 |
olle |
408 |
} |
3028 |
11 Dec 14 |
olle |
409 |
|
3028 |
11 Dec 14 |
olle |
var sectionDiv = Doc.element(section.id+'-info'); |
3028 |
11 Dec 14 |
olle |
Doc.addOrRemoveClass(sectionDiv, 'hide-details', section.hiddenDetails); |
3028 |
11 Dec 14 |
olle |
412 |
} |
3028 |
11 Dec 14 |
olle |
413 |
} |
3028 |
11 Dec 14 |
olle |
414 |
} |
3028 |
11 Dec 14 |
olle |
415 |
|
3028 |
11 Dec 14 |
olle |
cs.toggleDetails = function(event) |
3028 |
11 Dec 14 |
olle |
417 |
{ |
3028 |
11 Dec 14 |
olle |
var sectionId = event.currentTarget.sectionId; |
3028 |
11 Dec 14 |
olle |
var details = Doc.element(sectionId+'-details'); |
3028 |
11 Dec 14 |
olle |
// If the details section is 'forcibly' hidden (eg. no items of that type), ignore this call |
3028 |
11 Dec 14 |
olle |
if (details.style.display == 'none') return; |
3028 |
11 Dec 14 |
olle |
422 |
|
3028 |
11 Dec 14 |
olle |
// Add 'hide-details' class to main <div section-info> if it is visible |
3028 |
11 Dec 14 |
olle |
var section = Doc.element(sectionId+'-info'); |
3028 |
11 Dec 14 |
olle |
var isVisible = section.className.indexOf('hide-details') == -1; |
3028 |
11 Dec 14 |
olle |
Doc.addOrRemoveClass(section, 'hide-details', isVisible); |
3028 |
11 Dec 14 |
olle |
427 |
|
3028 |
11 Dec 14 |
olle |
// Save to BASE setting |
3028 |
11 Dec 14 |
olle |
var url = '../CaseSummary.servlet?ID='+App.getSessionId(); |
3028 |
11 Dec 14 |
olle |
url += '&cmd=SetSectionVisibility'; |
3028 |
11 Dec 14 |
olle |
url += '§ion='+sectionId+'&hidden='+(isVisible ? 1 : 0); |
3028 |
11 Dec 14 |
olle |
Wizard.asyncJsonRequest(url, null, 'POST'); |
3028 |
11 Dec 14 |
olle |
433 |
} |
3028 |
11 Dec 14 |
olle |
434 |
|
3028 |
11 Dec 14 |
olle |
cs.addColumn = function(id, value) |
3028 |
11 Dec 14 |
olle |
436 |
{ |
3028 |
11 Dec 14 |
olle |
var tr = Doc.element(id); |
3028 |
11 Dec 14 |
olle |
var td = document.createElement('td'); |
3028 |
11 Dec 14 |
olle |
if (tr.hasAddedColumns) |
3028 |
11 Dec 14 |
olle |
440 |
{ |
3028 |
11 Dec 14 |
olle |
td.className = 'extra-column'; |
3028 |
11 Dec 14 |
olle |
tr.childNodes[tr.childNodes.length-1].className += ' fixed-column'; |
3028 |
11 Dec 14 |
olle |
443 |
} |
3028 |
11 Dec 14 |
olle |
tr.hasAddedColumns = true; |
3028 |
11 Dec 14 |
olle |
if (value != null) |
3028 |
11 Dec 14 |
olle |
446 |
{ |
3028 |
11 Dec 14 |
olle |
td.innerHTML = value == '' ? ' ' : value; |
3028 |
11 Dec 14 |
olle |
if (tr.className.indexOf('dynamic-column') >= 0) |
3028 |
11 Dec 14 |
olle |
449 |
{ |
3028 |
11 Dec 14 |
olle |
tr.style.display = 'table-row'; |
3028 |
11 Dec 14 |
olle |
451 |
} |
3028 |
11 Dec 14 |
olle |
452 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
454 |
{ |
3028 |
11 Dec 14 |
olle |
td.innerHTML = ' '; |
3028 |
11 Dec 14 |
olle |
456 |
} |
3028 |
11 Dec 14 |
olle |
tr.appendChild(td); |
3028 |
11 Dec 14 |
olle |
458 |
} |
3028 |
11 Dec 14 |
olle |
459 |
|
3028 |
11 Dec 14 |
olle |
cs.asLink = function(itemType, item, maxLength) |
3028 |
11 Dec 14 |
olle |
461 |
{ |
3028 |
11 Dec 14 |
olle |
var link = ''; |
3028 |
11 Dec 14 |
olle |
if (item) |
3028 |
11 Dec 14 |
olle |
464 |
{ |
3028 |
11 Dec 14 |
olle |
var name = cs.truncate(item.name, maxLength); |
3028 |
11 Dec 14 |
olle |
if (item.id) |
3028 |
11 Dec 14 |
olle |
467 |
{ |
3028 |
11 Dec 14 |
olle |
link = '<span class="link linked-item" data-item-type="'+itemType+'" data-item-id="'+item.id+'" data-no-edit="'+(item.editable ? 0 : 1)+'">'; |
3028 |
11 Dec 14 |
olle |
link += name + '</span>'; |
3028 |
11 Dec 14 |
olle |
470 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
472 |
{ |
3028 |
11 Dec 14 |
olle |
link = name; |
3028 |
11 Dec 14 |
olle |
474 |
} |
3028 |
11 Dec 14 |
olle |
475 |
} |
3028 |
11 Dec 14 |
olle |
return link; |
3028 |
11 Dec 14 |
olle |
477 |
} |
3028 |
11 Dec 14 |
olle |
478 |
|
3028 |
11 Dec 14 |
olle |
cs.asFileLink = function(file, icon) |
3028 |
11 Dec 14 |
olle |
480 |
{ |
3028 |
11 Dec 14 |
olle |
var link = ''; |
3028 |
11 Dec 14 |
olle |
if (file) |
3028 |
11 Dec 14 |
olle |
483 |
{ |
3028 |
11 Dec 14 |
olle |
link = '<span class="link linked-file" data-file-id="'+file.id+'"><img src="../images/'+icon+'"></span>'; |
3028 |
11 Dec 14 |
olle |
485 |
} |
3028 |
11 Dec 14 |
olle |
return link; |
3028 |
11 Dec 14 |
olle |
487 |
} |
3028 |
11 Dec 14 |
olle |
488 |
|
3028 |
11 Dec 14 |
olle |
cs.asLabEnvLink = function(sensor, date, title, icon) |
3028 |
11 Dec 14 |
olle |
490 |
{ |
3028 |
11 Dec 14 |
olle |
var link = ''; |
3028 |
11 Dec 14 |
olle |
// Check if BASE extension LabEnv is installed |
3028 |
11 Dec 14 |
olle |
var homeLabEnv = Data.get('page-data', 'home-labenv'); |
3028 |
11 Dec 14 |
olle |
if (homeLabEnv) |
3028 |
11 Dec 14 |
olle |
495 |
{ |
3028 |
11 Dec 14 |
olle |
if (date) |
3028 |
11 Dec 14 |
olle |
497 |
{ |
3028 |
11 Dec 14 |
olle |
if (sensor) |
3028 |
11 Dec 14 |
olle |
499 |
{ |
3028 |
11 Dec 14 |
olle |
// Link to pop-up window with lab environment data for the chosen sensor and date |
3028 |
11 Dec 14 |
olle |
link = '<span class="link linked-labenv" data-sensor="'+sensor+'" data-date="'+date+'" data-title="'+title+'"><img src="../images/'+icon+'"></span>'; |
3028 |
11 Dec 14 |
olle |
502 |
} |
3028 |
11 Dec 14 |
olle |
503 |
} |
3028 |
11 Dec 14 |
olle |
504 |
} |
3028 |
11 Dec 14 |
olle |
return link; |
3028 |
11 Dec 14 |
olle |
506 |
} |
3028 |
11 Dec 14 |
olle |
507 |
|
3028 |
11 Dec 14 |
olle |
cs.asCaseList = function(allCases, mainCase) |
3028 |
11 Dec 14 |
olle |
509 |
{ |
3028 |
11 Dec 14 |
olle |
var html = ''; |
3028 |
11 Dec 14 |
olle |
for (var i = 0; i < allCases.length; i++) |
3028 |
11 Dec 14 |
olle |
512 |
{ |
3028 |
11 Dec 14 |
olle |
var cse = allCases[i]; |
3028 |
11 Dec 14 |
olle |
var cse2 = Strings.encodeTags(cse); |
3028 |
11 Dec 14 |
olle |
if (html != '') html += ', '; |
3028 |
11 Dec 14 |
olle |
if (cse != mainCase) |
3028 |
11 Dec 14 |
olle |
517 |
{ |
3028 |
11 Dec 14 |
olle |
html += '<span class="link linked-case" data-case-name="'+cse2+'" title="Show summary of case #'+cse2+'">'+cse2+'</span>'; |
3028 |
11 Dec 14 |
olle |
519 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
521 |
{ |
3028 |
11 Dec 14 |
olle |
html += '<b>' + cse2 + '</b>'; |
3028 |
11 Dec 14 |
olle |
523 |
} |
3028 |
11 Dec 14 |
olle |
524 |
} |
3028 |
11 Dec 14 |
olle |
return allCases.length > 1 ? html : null; |
3028 |
11 Dec 14 |
olle |
526 |
} |
3028 |
11 Dec 14 |
olle |
527 |
|
3028 |
11 Dec 14 |
olle |
528 |
|
3028 |
11 Dec 14 |
olle |
// Format value as a date |
3028 |
11 Dec 14 |
olle |
cs.asDate = function(value) |
3028 |
11 Dec 14 |
olle |
531 |
{ |
3028 |
11 Dec 14 |
olle |
if (!value) return ''; |
3028 |
11 Dec 14 |
olle |
if (value.length == 8) |
3028 |
11 Dec 14 |
olle |
534 |
{ |
3028 |
11 Dec 14 |
olle |
value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2); |
3028 |
11 Dec 14 |
olle |
536 |
} |
3028 |
11 Dec 14 |
olle |
return value; |
3028 |
11 Dec 14 |
olle |
538 |
} |
3028 |
11 Dec 14 |
olle |
539 |
|
3028 |
11 Dec 14 |
olle |
// Format as date+time value |
3028 |
11 Dec 14 |
olle |
cs.asDateTime = function(value, compareToDate) |
3028 |
11 Dec 14 |
olle |
542 |
{ |
3028 |
11 Dec 14 |
olle |
if (!value) return ''; |
3028 |
11 Dec 14 |
olle |
if (value.length == 8) |
3028 |
11 Dec 14 |
olle |
545 |
{ |
3028 |
11 Dec 14 |
olle |
value = cs.asDate(value); |
3028 |
11 Dec 14 |
olle |
547 |
} |
3028 |
11 Dec 14 |
olle |
else if (value.length == 13) |
3028 |
11 Dec 14 |
olle |
549 |
{ |
3028 |
11 Dec 14 |
olle |
// If the compareToDate is the same day as the 'value' date, skip the date and replace with white-space |
3028 |
11 Dec 14 |
olle |
if (compareToDate && value.substr(0, 8) == compareToDate.substr(0, 8)) |
3028 |
11 Dec 14 |
olle |
552 |
{ |
3028 |
11 Dec 14 |
olle |
value = '<span class="invisible">'+cs.asDate(value.substr(0, 8)) + '</span> ' + value.substr(9, 2) + ':'+value.substr(11, 2) |
3028 |
11 Dec 14 |
olle |
554 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
556 |
{ |
3028 |
11 Dec 14 |
olle |
value = cs.asDate(value.substr(0, 8)) + ' ' + value.substr(9, 2) + ':'+value.substr(11, 2); |
3028 |
11 Dec 14 |
olle |
558 |
} |
3028 |
11 Dec 14 |
olle |
559 |
} |
3028 |
11 Dec 14 |
olle |
return value; |
3028 |
11 Dec 14 |
olle |
561 |
} |
3028 |
11 Dec 14 |
olle |
562 |
|
3028 |
11 Dec 14 |
olle |
// Style the value as a quantity with (optional) unit |
3028 |
11 Dec 14 |
olle |
cs.asQuantity = function(value, unit, scale) |
3028 |
11 Dec 14 |
olle |
565 |
{ |
3028 |
11 Dec 14 |
olle |
var result = ''; |
3028 |
11 Dec 14 |
olle |
if (value != null) |
3028 |
11 Dec 14 |
olle |
568 |
{ |
3028 |
11 Dec 14 |
olle |
if (scale) value = value / scale; |
3028 |
11 Dec 14 |
olle |
result = Meludi.formatNumber(value, unit, 2); |
3028 |
11 Dec 14 |
olle |
571 |
} |
3028 |
11 Dec 14 |
olle |
return result; |
3028 |
11 Dec 14 |
olle |
573 |
} |
3028 |
11 Dec 14 |
olle |
574 |
|
3028 |
11 Dec 14 |
olle |
// Style the value as a percentage value |
3028 |
11 Dec 14 |
olle |
cs.asPercent = function(value) |
3028 |
11 Dec 14 |
olle |
577 |
{ |
3028 |
11 Dec 14 |
olle |
var result = ''; |
3028 |
11 Dec 14 |
olle |
if (value != null) |
3028 |
11 Dec 14 |
olle |
580 |
{ |
3028 |
11 Dec 14 |
olle |
result = value + '%'; |
3028 |
11 Dec 14 |
olle |
582 |
} |
3028 |
11 Dec 14 |
olle |
return result; |
3028 |
11 Dec 14 |
olle |
584 |
} |
3028 |
11 Dec 14 |
olle |
585 |
|
3028 |
11 Dec 14 |
olle |
586 |
|
3028 |
11 Dec 14 |
olle |
// Style the message as a warning message |
3028 |
11 Dec 14 |
olle |
cs.asWarning = function(message) |
3028 |
11 Dec 14 |
olle |
589 |
{ |
3028 |
11 Dec 14 |
olle |
message = '<span class="warning">' + message + '</span>'; |
3028 |
11 Dec 14 |
olle |
return message; |
3028 |
11 Dec 14 |
olle |
592 |
} |
3028 |
11 Dec 14 |
olle |
593 |
|
3028 |
11 Dec 14 |
olle |
// Generate a 'Missing' warning if the value is missing |
3028 |
11 Dec 14 |
olle |
cs.warnIfMissing = function(value) |
3028 |
11 Dec 14 |
olle |
596 |
{ |
3028 |
11 Dec 14 |
olle |
var message = value ? value : cs.asWarning('Missing'); |
3028 |
11 Dec 14 |
olle |
return message; |
3028 |
11 Dec 14 |
olle |
599 |
} |
3028 |
11 Dec 14 |
olle |
600 |
|
3028 |
11 Dec 14 |
olle |
// Style the message as a 'no information' message |
3028 |
11 Dec 14 |
olle |
cs.asNoInfo = function(message) |
3028 |
11 Dec 14 |
olle |
603 |
{ |
3028 |
11 Dec 14 |
olle |
message = '<span class="no-info">' + message + '</span>'; |
3028 |
11 Dec 14 |
olle |
return message; |
3028 |
11 Dec 14 |
olle |
606 |
} |
3028 |
11 Dec 14 |
olle |
607 |
|
3028 |
11 Dec 14 |
olle |
// Style the message as a 'flag information' message |
3028 |
11 Dec 14 |
olle |
cs.asFlagInfo = function(message, icon) |
3028 |
11 Dec 14 |
olle |
610 |
{ |
3028 |
11 Dec 14 |
olle |
message = '<span class="flag-info">' + message + ' ' + '<img src="../images/'+icon+'"></span>'; |
3028 |
11 Dec 14 |
olle |
return message; |
3028 |
11 Dec 14 |
olle |
613 |
} |
3028 |
11 Dec 14 |
olle |
614 |
|
3028 |
11 Dec 14 |
olle |
// Style the message as a 'fail information' message |
3028 |
11 Dec 14 |
olle |
cs.asFailInfo = function(message, icon) |
3028 |
11 Dec 14 |
olle |
617 |
{ |
3028 |
11 Dec 14 |
olle |
message = '<span class="fail-info">' + message + ' ' + '<img src="../images/'+icon+'"></span>'; |
3028 |
11 Dec 14 |
olle |
return message; |
3028 |
11 Dec 14 |
olle |
620 |
} |
3028 |
11 Dec 14 |
olle |
621 |
|
4780 |
20 Apr 18 |
olle |
cs.asConsent = function(consent, consentDate) |
4780 |
20 Apr 18 |
olle |
623 |
{ |
4780 |
20 Apr 18 |
olle |
var warn = !consent || !consentDate; |
4780 |
20 Apr 18 |
olle |
var message; |
4780 |
20 Apr 18 |
olle |
if (!consent) |
4780 |
20 Apr 18 |
olle |
627 |
{ |
4780 |
20 Apr 18 |
olle |
message = 'Missing' + (consentDate ? ', ' + consentDate : ''); |
4780 |
20 Apr 18 |
olle |
629 |
} |
4780 |
20 Apr 18 |
olle |
else |
4780 |
20 Apr 18 |
olle |
631 |
{ |
4780 |
20 Apr 18 |
olle |
message = consent + ', ' + (consentDate ? consentDate : 'Missing date'); |
4780 |
20 Apr 18 |
olle |
633 |
|
4780 |
20 Apr 18 |
olle |
634 |
} |
4780 |
20 Apr 18 |
olle |
return warn ? cs.asWarning(message) : message; |
4780 |
20 Apr 18 |
olle |
636 |
} |
4780 |
20 Apr 18 |
olle |
637 |
|
3028 |
11 Dec 14 |
olle |
// A biowell as the location |
3028 |
11 Dec 14 |
olle |
cs.asBioPlateLocation = function(well) |
3028 |
11 Dec 14 |
olle |
640 |
{ |
3028 |
11 Dec 14 |
olle |
if (!well) return ''; |
3028 |
11 Dec 14 |
olle |
var plate = well.bioPlate; |
3028 |
11 Dec 14 |
olle |
var text = cs.asLink('BIOPLATE', plate) + ' ' + well.location; |
3028 |
11 Dec 14 |
olle |
if (plate.storage) |
3028 |
11 Dec 14 |
olle |
645 |
{ |
3028 |
11 Dec 14 |
olle |
var storage = plate.storage; |
3028 |
11 Dec 14 |
olle |
var tmp = []; |
3028 |
11 Dec 14 |
olle |
if (storage.name) tmp[tmp.length] = Strings.encodeTags(storage.name); |
3028 |
11 Dec 14 |
olle |
if (storage.section) tmp[tmp.length] = 'section: ' +storage.section; |
3028 |
11 Dec 14 |
olle |
if (storage.tray) tmp[tmp.length] = 'tray: ' +storage.tray; |
3028 |
11 Dec 14 |
olle |
if (storage.position) tmp[tmp.length] = 'position: ' +storage.position; |
3028 |
11 Dec 14 |
olle |
652 |
|
3028 |
11 Dec 14 |
olle |
text = '<span class="more-info" title="' + tmp.join('; ')+'">' + text + ' </span>'; |
3028 |
11 Dec 14 |
olle |
654 |
} |
3028 |
11 Dec 14 |
olle |
return text; |
3028 |
11 Dec 14 |
olle |
656 |
} |
3028 |
11 Dec 14 |
olle |
657 |
|
3028 |
11 Dec 14 |
olle |
cs.truncate = function(value, maxLength) |
3028 |
11 Dec 14 |
olle |
659 |
{ |
3028 |
11 Dec 14 |
olle |
if (!value) return value; |
3028 |
11 Dec 14 |
olle |
if (maxLength > 2 && value.length > maxLength) |
3028 |
11 Dec 14 |
olle |
662 |
{ |
3028 |
11 Dec 14 |
olle |
var tmp = '<span class="truncated" title="'+value+'">'+Strings.encodeTags(value.substring(0, maxLength-2)) + '...</span>'; |
3028 |
11 Dec 14 |
olle |
value = tmp; |
3028 |
11 Dec 14 |
olle |
665 |
} |
3028 |
11 Dec 14 |
olle |
else |
3028 |
11 Dec 14 |
olle |
667 |
{ |
3028 |
11 Dec 14 |
olle |
value = Strings.encodeTags(value); |
3028 |
11 Dec 14 |
olle |
669 |
} |
3028 |
11 Dec 14 |
olle |
return value; |
3028 |
11 Dec 14 |
olle |
671 |
} |
3028 |
11 Dec 14 |
olle |
672 |
|
3028 |
11 Dec 14 |
olle |
cs.showConfidentialOnChange = function() |
3028 |
11 Dec 14 |
olle |
674 |
{ |
3028 |
11 Dec 14 |
olle |
var frm = document.forms['meludi']; |
3028 |
11 Dec 14 |
olle |
Doc.addOrRemoveClass('all-info', 'hide-confidential', !frm.showConfidential.checked); |
3028 |
11 Dec 14 |
olle |
677 |
} |
3028 |
11 Dec 14 |
olle |
678 |
|
3028 |
11 Dec 14 |
olle |
cs.caseSummary = function(event) |
3028 |
11 Dec 14 |
olle |
680 |
{ |
3028 |
11 Dec 14 |
olle |
var frm = document.forms['meludi']; |
3028 |
11 Dec 14 |
olle |
var caseName = Data.get(event.currentTarget, 'case-name'); |
3028 |
11 Dec 14 |
olle |
if (!caseName) |
3028 |
11 Dec 14 |
olle |
684 |
{ |
3028 |
11 Dec 14 |
olle |
caseName = frm.caseName.value; |
3028 |
11 Dec 14 |
olle |
if (!caseName) |
3028 |
11 Dec 14 |
olle |
687 |
{ |
4221 |
09 Nov 16 |
olle |
Forms.showNotification('caseName', 'Please enter a case id ("' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits)', null, null, 'left'); |
3028 |
11 Dec 14 |
olle |
return; |
3028 |
11 Dec 14 |
olle |
690 |
} |
3028 |
11 Dec 14 |
olle |
691 |
} |
3028 |
11 Dec 14 |
olle |
var url = 'case_summary.jsp?ID='+App.getSessionId(); |
3028 |
11 Dec 14 |
olle |
url += '&caseName='+encodeURIComponent(caseName); |
3028 |
11 Dec 14 |
olle |
url += '&pageType='+Data.get('page-data', 'page-type'); |
3028 |
11 Dec 14 |
olle |
location.href = url; |
3028 |
11 Dec 14 |
olle |
696 |
} |
3028 |
11 Dec 14 |
olle |
697 |
|
3028 |
11 Dec 14 |
olle |
cs.goPrint = function() |
3028 |
11 Dec 14 |
olle |
699 |
{ |
3028 |
11 Dec 14 |
olle |
var caseName = Data.get('page-data', 'case-name'); |
3028 |
11 Dec 14 |
olle |
var printNote = '<b>Note!</b> For better printing set page orientation to <i>portrait</i>.<br>'; |
3028 |
11 Dec 14 |
olle |
printNote += ' You may have to <i>scale down</i> to fit everything on the width of the page.'; |
3028 |
11 Dec 14 |
olle |
Meludi.openPrintWindow('all-content', 'Case summary - ' + Strings.encodeTags(caseName), 'portrait', printNote, '../', 'case_summary.css'); |
3028 |
11 Dec 14 |
olle |
704 |
} |
3028 |
11 Dec 14 |
olle |
705 |
|
4780 |
20 Apr 18 |
olle |
cs.logError = function(section, err) |
4780 |
20 Apr 18 |
olle |
707 |
{ |
4780 |
20 Apr 18 |
olle |
console.error(err); |
4780 |
20 Apr 18 |
olle |
section = Doc.element(section); |
4780 |
20 Apr 18 |
olle |
var div = document.createElement('div'); |
4780 |
20 Apr 18 |
olle |
div.className = 'messagecontainer error'; |
4780 |
20 Apr 18 |
olle |
div.innerHTML = err; |
4780 |
20 Apr 18 |
olle |
section.parentNode.insertBefore(div, section.nextSibling); |
4780 |
20 Apr 18 |
olle |
714 |
} |
4780 |
20 Apr 18 |
olle |
715 |
|
3028 |
11 Dec 14 |
olle |
return cs; |
3028 |
11 Dec 14 |
olle |
717 |
}(); |
3028 |
11 Dec 14 |
olle |
718 |
|
3028 |
11 Dec 14 |
olle |
var LabEnvs = function() |
3028 |
11 Dec 14 |
olle |
720 |
{ |
3028 |
11 Dec 14 |
olle |
var labenvs = {}; |
3028 |
11 Dec 14 |
olle |
722 |
|
3028 |
11 Dec 14 |
olle |
723 |
/** |
3028 |
11 Dec 14 |
olle |
Event handler that calls 'labenv.jar/reports/labenvironmentdatabaseeventpopup.jsp' |
3028 |
11 Dec 14 |
olle |
when clicking on the attached target. The sensor id should be stored |
3028 |
11 Dec 14 |
olle |
in attribute 'data-sensor', the date in 'data-date', |
3028 |
11 Dec 14 |
olle |
and the title in 'data-title'. |
3028 |
11 Dec 14 |
olle |
728 |
*/ |
3028 |
11 Dec 14 |
olle |
labenvs.viewDataOnClick = function(event) |
3028 |
11 Dec 14 |
olle |
730 |
{ |
3028 |
11 Dec 14 |
olle |
var homeLabEnv = Data.get('page-data', 'home-labenv'); |
3028 |
11 Dec 14 |
olle |
var title = Data.get(event.currentTarget, 'title'); |
3028 |
11 Dec 14 |
olle |
var sensor = Data.get(event.currentTarget, 'sensor'); |
3028 |
11 Dec 14 |
olle |
var date = Data.get(event.currentTarget, 'date'); |
3028 |
11 Dec 14 |
olle |
var url = homeLabEnv; |
3028 |
11 Dec 14 |
olle |
url += '/reports/labenvironmentdatabaseeventpopup.jsp'; |
3028 |
11 Dec 14 |
olle |
url += '?ID='+App.getSessionId(); |
3028 |
11 Dec 14 |
olle |
url += '&pageTitle='+encodeURIComponent(title); |
3028 |
11 Dec 14 |
olle |
url += '&labSensorUrl='+encodeURIComponent(sensor); |
3028 |
11 Dec 14 |
olle |
url += '&originDate='+encodeURIComponent(date); |
3028 |
11 Dec 14 |
olle |
Dialogs.openPopup(url, title, 820, 768); |
3028 |
11 Dec 14 |
olle |
742 |
} |
3028 |
11 Dec 14 |
olle |
743 |
|
3028 |
11 Dec 14 |
olle |
return labenvs; |
3028 |
11 Dec 14 |
olle |
745 |
}(); |
3028 |
11 Dec 14 |
olle |
746 |
|
3028 |
11 Dec 14 |
olle |
Doc.onLoad(CaseSummary.initPage); |