4733 |
05 Apr 18 |
olle |
var SpecimenTubeReg = function() |
4733 |
05 Apr 18 |
olle |
2 |
{ |
4733 |
05 Apr 18 |
olle |
var streg = {}; |
4733 |
05 Apr 18 |
olle |
var debug = 0; |
4733 |
05 Apr 18 |
olle |
var myPermissions = {}; |
4733 |
05 Apr 18 |
olle |
6 |
|
4733 |
05 Apr 18 |
olle |
var caseInfo; |
4733 |
05 Apr 18 |
olle |
8 |
|
4733 |
05 Apr 18 |
olle |
var sampleItemPrefix = ''; |
4733 |
05 Apr 18 |
olle |
var sampleItemNumDigits = 5; |
4733 |
05 Apr 18 |
olle |
var nofTubesIsValid = false; |
4733 |
05 Apr 18 |
olle |
var samplingDateIsValid = true; |
4733 |
05 Apr 18 |
olle |
var viableTumourCellsPercentIsValid = true; |
4733 |
05 Apr 18 |
olle |
var usesSitePrefix = false; |
4733 |
05 Apr 18 |
olle |
15 |
|
4733 |
05 Apr 18 |
olle |
// Well validation variable for input specimen, DNA, RNA |
4733 |
05 Apr 18 |
olle |
var wellIsValid = []; |
4733 |
05 Apr 18 |
olle |
// Well validation variables for extracts from specimen |
4733 |
05 Apr 18 |
olle |
var dnaWellIsValid = []; |
4733 |
05 Apr 18 |
olle |
var rnaWellIsValid = []; |
4733 |
05 Apr 18 |
olle |
21 |
|
4733 |
05 Apr 18 |
olle |
var restartTimer; |
4733 |
05 Apr 18 |
olle |
var restartAt; |
4733 |
05 Apr 18 |
olle |
24 |
|
4733 |
05 Apr 18 |
olle |
// Page initialization |
4733 |
05 Apr 18 |
olle |
streg.initPage = function() |
4733 |
05 Apr 18 |
olle |
27 |
{ |
4733 |
05 Apr 18 |
olle |
// Step 1 |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', streg.validateStep1); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('caseName', 'keypress', Wizard.goNextOnTabOrEnter); |
4733 |
05 Apr 18 |
olle |
31 |
|
4733 |
05 Apr 18 |
olle |
// Step 2 |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('step-2', 'wizard-initialize', streg.initializeStep2); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', streg.validateStep2); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('pad', 'blur', streg.padOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofTubes', 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofTubes', 'blur', streg.nofTubesOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('arrivalDate', 'blur', Wizard.validateDate); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('samplingDate', 'blur', streg.samplingDateOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('projectFocus', 'change', streg.projectFocusOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('site', 'change', streg.siteOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('specimenType', 'change', streg.specimenTypeOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('viableTumourCellsPercent', 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('viableTumourCellsPercent', 'blur', streg.viableTumourCellsPercentOnChange); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('otherPathNote', 'keypress', Wizard.goNextOnTab); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler('selectAllMutationAnalysis', streg.mutationAnalysisSelectAll); |
4733 |
05 Apr 18 |
olle |
47 |
|
4733 |
05 Apr 18 |
olle |
// Step 3 |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('step-3', 'wizard-initialize', streg.initializeStep3); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('step-3', 'wizard-validate', streg.validateStep3); |
4733 |
05 Apr 18 |
olle |
51 |
|
4733 |
05 Apr 18 |
olle |
// Navigation |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler('gostop', streg.stopAutoRestart); |
4733 |
05 Apr 18 |
olle |
58 |
|
4733 |
05 Apr 18 |
olle |
// Final registration |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('wizard', 'wizard-submit', streg.submit); |
4733 |
05 Apr 18 |
olle |
61 |
|
4733 |
05 Apr 18 |
olle |
// Load permissions |
4733 |
05 Apr 18 |
olle |
streg.initPermissions(); |
4733 |
05 Apr 18 |
olle |
// Load configuration |
4733 |
05 Apr 18 |
olle |
streg.loadConfiguration(); |
4733 |
05 Apr 18 |
olle |
66 |
} |
4733 |
05 Apr 18 |
olle |
67 |
|
4733 |
05 Apr 18 |
olle |
streg.initPermissions = function() |
4733 |
05 Apr 18 |
olle |
69 |
{ |
4733 |
05 Apr 18 |
olle |
// Get permission information |
4733 |
05 Apr 18 |
olle |
var url = '../Install.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=GetPermissions'; |
4733 |
05 Apr 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4733 |
05 Apr 18 |
olle |
request.open("GET", url, true); |
4733 |
05 Apr 18 |
olle |
Ajax.setReadyStateHandler(request, streg.onPermissionsLoaded, streg.onPermissionsLoaded); |
4733 |
05 Apr 18 |
olle |
request.send(null); |
4733 |
05 Apr 18 |
olle |
77 |
} |
4733 |
05 Apr 18 |
olle |
78 |
|
4733 |
05 Apr 18 |
olle |
// Callback when permission information is ready |
4733 |
05 Apr 18 |
olle |
streg.onPermissionsLoaded = function(request) |
4733 |
05 Apr 18 |
olle |
81 |
{ |
4733 |
05 Apr 18 |
olle |
if (debug) App.debug(Strings.encodeTags(request.responseText)); |
4733 |
05 Apr 18 |
olle |
var response; |
4733 |
05 Apr 18 |
olle |
var error = false; |
4733 |
05 Apr 18 |
olle |
try |
4733 |
05 Apr 18 |
olle |
86 |
{ |
4733 |
05 Apr 18 |
olle |
response = JSON.parse(request.responseText); |
4733 |
05 Apr 18 |
olle |
if (response.status != 'ok') |
4733 |
05 Apr 18 |
olle |
89 |
{ |
4733 |
05 Apr 18 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
4733 |
05 Apr 18 |
olle |
91 |
} |
4733 |
05 Apr 18 |
olle |
92 |
} |
4733 |
05 Apr 18 |
olle |
catch (ex) |
4733 |
05 Apr 18 |
olle |
94 |
{ |
4733 |
05 Apr 18 |
olle |
error = ex; |
4733 |
05 Apr 18 |
olle |
96 |
} |
4733 |
05 Apr 18 |
olle |
97 |
|
4733 |
05 Apr 18 |
olle |
if (error) |
4733 |
05 Apr 18 |
olle |
99 |
{ |
4733 |
05 Apr 18 |
olle |
alert(error); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
102 |
} |
4733 |
05 Apr 18 |
olle |
103 |
|
4733 |
05 Apr 18 |
olle |
myPermissions = response.permissions; |
4733 |
05 Apr 18 |
olle |
//var isAdmin = myPermissions['Administrator'] == 1; |
4733 |
05 Apr 18 |
olle |
//var noProjectIsActive = !App.getActiveProjectId(); |
4733 |
05 Apr 18 |
olle |
107 |
} |
4733 |
05 Apr 18 |
olle |
108 |
|
4733 |
05 Apr 18 |
olle |
streg.loadConfiguration = function() |
4733 |
05 Apr 18 |
olle |
110 |
{ |
4733 |
05 Apr 18 |
olle |
var url = '../Session.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=GetConfiguration' |
4733 |
05 Apr 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4733 |
05 Apr 18 |
olle |
request.open("GET", url, true); |
4733 |
05 Apr 18 |
olle |
Ajax.setReadyStateHandler(request, streg.onConfiguration, streg.onConfiguration); |
4733 |
05 Apr 18 |
olle |
request.send(null); |
4733 |
05 Apr 18 |
olle |
117 |
} |
4733 |
05 Apr 18 |
olle |
118 |
|
4733 |
05 Apr 18 |
olle |
streg.onConfiguration = function(request) |
4733 |
05 Apr 18 |
olle |
120 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
122 |
|
4733 |
05 Apr 18 |
olle |
if (debug) |
4733 |
05 Apr 18 |
olle |
124 |
{ |
4733 |
05 Apr 18 |
olle |
App.debug(Strings.encodeTags(request.responseText)); |
4733 |
05 Apr 18 |
olle |
126 |
} |
4733 |
05 Apr 18 |
olle |
127 |
|
4733 |
05 Apr 18 |
olle |
var response; |
4733 |
05 Apr 18 |
olle |
var error = false; |
4733 |
05 Apr 18 |
olle |
try |
4733 |
05 Apr 18 |
olle |
131 |
{ |
4733 |
05 Apr 18 |
olle |
response = JSON.parse(request.responseText); |
4733 |
05 Apr 18 |
olle |
if (response.status != 'ok') |
4733 |
05 Apr 18 |
olle |
134 |
{ |
4733 |
05 Apr 18 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
4733 |
05 Apr 18 |
olle |
136 |
} |
4733 |
05 Apr 18 |
olle |
137 |
} |
4733 |
05 Apr 18 |
olle |
catch (ex) |
4733 |
05 Apr 18 |
olle |
139 |
{ |
4733 |
05 Apr 18 |
olle |
error = ex; |
4733 |
05 Apr 18 |
olle |
141 |
} |
4733 |
05 Apr 18 |
olle |
if (error) App.debug(error); |
4733 |
05 Apr 18 |
olle |
143 |
|
4733 |
05 Apr 18 |
olle |
// Get configuration result |
4733 |
05 Apr 18 |
olle |
var conf = response.configuration; |
4733 |
05 Apr 18 |
olle |
// Check for uses site prefix flag |
4733 |
05 Apr 18 |
olle |
usesSitePrefix = conf.usesSitePrefix; |
4733 |
05 Apr 18 |
olle |
// Check for project focus default |
4733 |
05 Apr 18 |
olle |
var projectFocusDefault = conf.projectFocusDefault; |
4733 |
05 Apr 18 |
olle |
if (projectFocusDefault != null) |
4733 |
05 Apr 18 |
olle |
151 |
{ |
4733 |
05 Apr 18 |
olle |
frm.projectFocus.value = projectFocusDefault; |
4733 |
05 Apr 18 |
olle |
streg.projectFocusOnChange(); |
4733 |
05 Apr 18 |
olle |
154 |
} |
4733 |
05 Apr 18 |
olle |
// Check for specimen type default |
4733 |
05 Apr 18 |
olle |
var specimenTypeDefault = conf.specimenTypeDefault; |
4733 |
05 Apr 18 |
olle |
if (specimenTypeDefault != null) |
4733 |
05 Apr 18 |
olle |
158 |
{ |
4733 |
05 Apr 18 |
olle |
frm.specimenType.value = specimenTypeDefault; |
4733 |
05 Apr 18 |
olle |
160 |
} |
4733 |
05 Apr 18 |
olle |
// Check for specimen input type default |
4733 |
05 Apr 18 |
olle |
var specimenInputTypeDefault = conf.specimenInputTypeDefault; |
4733 |
05 Apr 18 |
olle |
if (specimenInputTypeDefault != null) |
4733 |
05 Apr 18 |
olle |
164 |
{ |
4733 |
05 Apr 18 |
olle |
frm.specimenInputType.value = specimenInputTypeDefault; |
4733 |
05 Apr 18 |
olle |
166 |
} |
4733 |
05 Apr 18 |
olle |
// Check for extracts from first specimen only default |
4733 |
05 Apr 18 |
olle |
var extractsFromFirstSpecimenOnlyDefault = conf.extractsFromFirstSpecimenOnlyDefault; |
4733 |
05 Apr 18 |
olle |
if (extractsFromFirstSpecimenOnlyDefault != null) |
4733 |
05 Apr 18 |
olle |
170 |
{ |
4733 |
05 Apr 18 |
olle |
frm.extractsFromFirstSpecimenOnlyCB.checked = extractsFromFirstSpecimenOnlyDefault; |
4733 |
05 Apr 18 |
olle |
172 |
} |
4733 |
05 Apr 18 |
olle |
173 |
|
4733 |
05 Apr 18 |
olle |
// Continue with initializing info for case |
4733 |
05 Apr 18 |
olle |
var url = '../LabelGeneration.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=CountCases'; |
4733 |
05 Apr 18 |
olle |
Wizard.showLoadingAnimation('Loading cases...'); |
4733 |
05 Apr 18 |
olle |
Wizard.asyncJsonRequest(url, streg.caseInfoLoadedStep1); |
4733 |
05 Apr 18 |
olle |
179 |
} |
4733 |
05 Apr 18 |
olle |
180 |
|
4733 |
05 Apr 18 |
olle |
streg.caseInfoLoadedStep1 = function(response) |
4733 |
05 Apr 18 |
olle |
182 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
184 |
|
4733 |
05 Apr 18 |
olle |
// Disable PAD/CL input field if not Administrator or PatientCurator |
4733 |
05 Apr 18 |
olle |
var isAdmin = myPermissions['Administrator'] == 1; |
4733 |
05 Apr 18 |
olle |
var isPatCur = myPermissions['PatientCurator'] == 1; |
4733 |
05 Apr 18 |
olle |
if (!isAdmin && !isPatCur) |
4733 |
05 Apr 18 |
olle |
189 |
{ |
4733 |
05 Apr 18 |
olle |
frm.pad.disabled = true; |
4733 |
05 Apr 18 |
olle |
191 |
} |
4733 |
05 Apr 18 |
olle |
192 |
|
4733 |
05 Apr 18 |
olle |
sampleItemPrefix = response.sampleItemPrefix; |
4733 |
05 Apr 18 |
olle |
sampleItemNumDigits = response.sampleItemNumDigits; |
4733 |
05 Apr 18 |
olle |
var nofCases = response.count; |
4733 |
05 Apr 18 |
olle |
if (nofCases == null) |
4733 |
05 Apr 18 |
olle |
197 |
{ |
4733 |
05 Apr 18 |
olle |
nofCases = 0; |
4733 |
05 Apr 18 |
olle |
199 |
} |
4733 |
05 Apr 18 |
olle |
var startNum = nofCases + 1; |
4733 |
05 Apr 18 |
olle |
// Pad number with leading zeros to get right number of digits |
4733 |
05 Apr 18 |
olle |
startNum = String('0000000000' + startNum).slice(-sampleItemNumDigits); |
4733 |
05 Apr 18 |
olle |
var startCase = sampleItemPrefix + startNum; |
4733 |
05 Apr 18 |
olle |
if (usesSitePrefix != null && usesSitePrefix) |
4733 |
05 Apr 18 |
olle |
205 |
{ |
4733 |
05 Apr 18 |
olle |
startCase = ''; |
4733 |
05 Apr 18 |
olle |
207 |
} |
4733 |
05 Apr 18 |
olle |
frm.caseName.value = startCase; |
4733 |
05 Apr 18 |
olle |
Doc.element('caseNameText').innerHTML = 'The case name (barcode) associated with this specimen tube ("' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits).'; |
4733 |
05 Apr 18 |
olle |
210 |
|
4733 |
05 Apr 18 |
olle |
Doc.show('step-1'); |
4733 |
05 Apr 18 |
olle |
Doc.show('gonext'); |
4733 |
05 Apr 18 |
olle |
213 |
} |
4733 |
05 Apr 18 |
olle |
214 |
|
4733 |
05 Apr 18 |
olle |
streg.validateStep1 = function(event) |
4733 |
05 Apr 18 |
olle |
216 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
218 |
|
4733 |
05 Apr 18 |
olle |
var caseName = frm.caseName.value; |
4733 |
05 Apr 18 |
olle |
var caseIsValid = false; |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('caseName'); |
4733 |
05 Apr 18 |
olle |
if (caseName == '') |
4733 |
05 Apr 18 |
olle |
223 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Missing'); |
4733 |
05 Apr 18 |
olle |
frm.caseName.focus(); |
4733 |
05 Apr 18 |
olle |
226 |
} |
4733 |
05 Apr 18 |
olle |
else if (!Meludi.isValidCaseName2(caseName, sampleItemPrefix, sampleItemNumDigits)) |
4733 |
05 Apr 18 |
olle |
228 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Only name = "' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits is allowed.'); |
4733 |
05 Apr 18 |
olle |
frm.caseName.focus(); |
4733 |
05 Apr 18 |
olle |
231 |
} |
4733 |
05 Apr 18 |
olle |
else |
4733 |
05 Apr 18 |
olle |
233 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('caseName', 'valid'); |
4733 |
05 Apr 18 |
olle |
caseIsValid = true; |
4733 |
05 Apr 18 |
olle |
236 |
} |
4733 |
05 Apr 18 |
olle |
237 |
|
4733 |
05 Apr 18 |
olle |
// If not valid, we prevent the wizard from moving to the next step |
4733 |
05 Apr 18 |
olle |
if (!caseIsValid) event.preventDefault(); |
4733 |
05 Apr 18 |
olle |
240 |
} |
4733 |
05 Apr 18 |
olle |
241 |
|
4733 |
05 Apr 18 |
olle |
streg.initializeStep2 = function() |
4733 |
05 Apr 18 |
olle |
243 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var caseName = frm.caseName.value; |
4733 |
05 Apr 18 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=GetCaseInfo'; |
4733 |
05 Apr 18 |
olle |
url += '&caseName=' + encodeURIComponent(caseName); |
4733 |
05 Apr 18 |
olle |
249 |
|
4733 |
05 Apr 18 |
olle |
Wizard.showLoadingAnimation('Loading information about case...'); |
4733 |
05 Apr 18 |
olle |
Wizard.asyncJsonRequest(url, streg.caseInfoLoaded); |
4733 |
05 Apr 18 |
olle |
252 |
} |
4733 |
05 Apr 18 |
olle |
253 |
|
4733 |
05 Apr 18 |
olle |
streg.caseInfoLoaded = function(response) |
4733 |
05 Apr 18 |
olle |
255 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
caseInfo = response.caseInfo; |
4733 |
05 Apr 18 |
olle |
258 |
|
4733 |
05 Apr 18 |
olle |
Wizard.setCurrentStep(2); |
4733 |
05 Apr 18 |
olle |
Doc.show('gocancel'); |
4733 |
05 Apr 18 |
olle |
Doc.show('gonext'); |
4733 |
05 Apr 18 |
olle |
262 |
|
4733 |
05 Apr 18 |
olle |
frm.arrivalDate.value = Dates.formatDate(new Date(), 'yyyyMMdd'); |
4733 |
05 Apr 18 |
olle |
264 |
|
4733 |
05 Apr 18 |
olle |
// If site determined by site prefix in case name, set site default value and disable site menu |
4733 |
05 Apr 18 |
olle |
//alert("specimentube.js:: streg.caseInfoLoaded: caseInfo.siteDefault = " + caseInfo.siteDefault); |
4733 |
05 Apr 18 |
olle |
if (caseInfo.siteDefault != null) |
4733 |
05 Apr 18 |
olle |
268 |
{ |
4733 |
05 Apr 18 |
olle |
frm.site.value = caseInfo.siteDefault; |
4733 |
05 Apr 18 |
olle |
frm.site.disabled = true; |
4733 |
05 Apr 18 |
olle |
271 |
} |
4733 |
05 Apr 18 |
olle |
272 |
|
4733 |
05 Apr 18 |
olle |
frm.nofTubes.focus(); |
4733 |
05 Apr 18 |
olle |
frm.nofTubes.setSelectionRange(0,1); |
4734 |
05 Apr 18 |
olle |
frm.mutationAnalysisTst170.checked = true; |
4733 |
05 Apr 18 |
olle |
276 |
} |
4733 |
05 Apr 18 |
olle |
277 |
|
4733 |
05 Apr 18 |
olle |
streg.padOnChange = function() |
4733 |
05 Apr 18 |
olle |
279 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var PAD = frm.pad.value; |
4733 |
05 Apr 18 |
olle |
if (PAD == '') |
4733 |
05 Apr 18 |
olle |
283 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('pad', 'warning', 'Missing'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
286 |
} |
4733 |
05 Apr 18 |
olle |
frm.pad.value = PAD.replace(/\+/, '-'); |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('pad', 'valid'); |
4733 |
05 Apr 18 |
olle |
289 |
} |
4733 |
05 Apr 18 |
olle |
290 |
|
4733 |
05 Apr 18 |
olle |
streg.nofTubesOnChange = function() |
4733 |
05 Apr 18 |
olle |
292 |
{ |
4733 |
05 Apr 18 |
olle |
nofTubesIsValid = false; |
4733 |
05 Apr 18 |
olle |
294 |
|
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var nofTubes = frm.nofTubes.value; |
4733 |
05 Apr 18 |
olle |
297 |
|
4733 |
05 Apr 18 |
olle |
if (nofTubes == '') |
4733 |
05 Apr 18 |
olle |
299 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofTubes', 'invalid', 'Missing'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
302 |
} |
4733 |
05 Apr 18 |
olle |
if (parseInt(nofTubes) < 1) |
4733 |
05 Apr 18 |
olle |
304 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofTubes', 'invalid', 'Must be at least 1'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
307 |
} |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofTubes', 'valid'); |
4733 |
05 Apr 18 |
olle |
nofTubesIsValid = true; |
4733 |
05 Apr 18 |
olle |
310 |
} |
4733 |
05 Apr 18 |
olle |
311 |
|
4733 |
05 Apr 18 |
olle |
streg.samplingDateOnChange = function() |
4733 |
05 Apr 18 |
olle |
313 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
315 |
|
4733 |
05 Apr 18 |
olle |
samplingDateIsValid = false; |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('samplingDate'); |
4733 |
05 Apr 18 |
olle |
318 |
|
4733 |
05 Apr 18 |
olle |
var samplingDate = frm.samplingDate.value; |
4733 |
05 Apr 18 |
olle |
320 |
|
4733 |
05 Apr 18 |
olle |
if (samplingDate != '') |
4733 |
05 Apr 18 |
olle |
322 |
{ |
4733 |
05 Apr 18 |
olle |
// Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. |
4733 |
05 Apr 18 |
olle |
samplingDate = Meludi.autoFillDate(samplingDate); |
4733 |
05 Apr 18 |
olle |
frm.samplingDate.value = samplingDate; |
4733 |
05 Apr 18 |
olle |
326 |
|
4733 |
05 Apr 18 |
olle |
var d = Dates.parseString(samplingDate, 'yyyyMMdd'); |
4733 |
05 Apr 18 |
olle |
if (d == null) |
4733 |
05 Apr 18 |
olle |
329 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('samplingDate', 'invalid', 'Not a valid date'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
332 |
} |
4733 |
05 Apr 18 |
olle |
333 |
|
4733 |
05 Apr 18 |
olle |
var today = new Date(); |
4733 |
05 Apr 18 |
olle |
if (d.getTime() > today.getTime()) |
4733 |
05 Apr 18 |
olle |
336 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('samplingDate', 'invalid', 'Future date is not valid'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
339 |
} |
4733 |
05 Apr 18 |
olle |
340 |
|
4733 |
05 Apr 18 |
olle |
var arrivalDate = frm.arrivalDate.value; |
4733 |
05 Apr 18 |
olle |
if (arrivalDate != '' && arrivalDate < samplingDate) |
4733 |
05 Apr 18 |
olle |
343 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('samplingDate', 'invalid', 'Arrival date is before sampling date'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
346 |
} |
4733 |
05 Apr 18 |
olle |
347 |
|
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('samplingDate', 'valid'); |
4733 |
05 Apr 18 |
olle |
349 |
} |
4733 |
05 Apr 18 |
olle |
samplingDateIsValid = true; |
4733 |
05 Apr 18 |
olle |
351 |
} |
4733 |
05 Apr 18 |
olle |
352 |
|
4733 |
05 Apr 18 |
olle |
streg.projectFocusOnChange = function() |
4733 |
05 Apr 18 |
olle |
354 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var projectFocus = frm.projectFocus.value; |
4733 |
05 Apr 18 |
olle |
357 |
|
4733 |
05 Apr 18 |
olle |
streg.mutationAnalysisReset(); |
4734 |
05 Apr 18 |
olle |
359 |
|
4734 |
05 Apr 18 |
olle |
360 |
/* |
4733 |
05 Apr 18 |
olle |
if (projectFocus == 'melanoma') |
4733 |
05 Apr 18 |
olle |
362 |
{ |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisNras.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisBraf.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKit.checked = true; |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
367 |
} |
4733 |
05 Apr 18 |
olle |
if (projectFocus == 'lungcancer') |
4733 |
05 Apr 18 |
olle |
369 |
{ |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKras.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisEgfr.checked = true; |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
373 |
} |
4733 |
05 Apr 18 |
olle |
if (projectFocus == 'coloncancer') |
4733 |
05 Apr 18 |
olle |
375 |
{ |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKras.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisNras.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisBraf.checked = true; |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
380 |
} |
4733 |
05 Apr 18 |
olle |
if (projectFocus == 'GIST') |
4733 |
05 Apr 18 |
olle |
382 |
{ |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisPdgfra.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKit.checked = true; |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
386 |
} |
4734 |
05 Apr 18 |
olle |
387 |
*/ |
4734 |
05 Apr 18 |
olle |
frm.mutationAnalysisTst170.checked = true; |
4733 |
05 Apr 18 |
olle |
389 |
} |
4733 |
05 Apr 18 |
olle |
390 |
|
4733 |
05 Apr 18 |
olle |
streg.mutationAnalysisReset = function() |
4733 |
05 Apr 18 |
olle |
392 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
394 |
|
4779 |
20 Apr 18 |
olle |
395 |
/* |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKras.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisNras.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisBraf.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisEgfr.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisAlkEml4.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisPdgfra.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKit.checked = false; |
4779 |
20 Apr 18 |
olle |
403 |
*/ |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisTst170.checked = false; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisOther.checked = false; |
4733 |
05 Apr 18 |
olle |
406 |
} |
4733 |
05 Apr 18 |
olle |
407 |
|
4733 |
05 Apr 18 |
olle |
streg.mutationAnalysisSelectAll = function() |
4733 |
05 Apr 18 |
olle |
409 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
411 |
|
4779 |
20 Apr 18 |
olle |
412 |
/* |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKras.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisNras.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisBraf.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisEgfr.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisAlkEml4.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisPdgfra.checked = true; |
4733 |
05 Apr 18 |
olle |
frm.mutationAnalysisKit.checked = true; |
4779 |
20 Apr 18 |
olle |
420 |
*/ |
4733 |
05 Apr 18 |
olle |
//frm.mutationAnalysisTst170.checked = true; |
4733 |
05 Apr 18 |
olle |
//frm.mutationAnalysisOther.checked = true; |
4733 |
05 Apr 18 |
olle |
423 |
} |
4733 |
05 Apr 18 |
olle |
424 |
|
4733 |
05 Apr 18 |
olle |
streg.viableTumourCellsPercentOnChange = function() |
4733 |
05 Apr 18 |
olle |
426 |
{ |
4733 |
05 Apr 18 |
olle |
viableTumourCellsPercentIsValid = false; |
4733 |
05 Apr 18 |
olle |
428 |
|
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var viableTumourCellsPercent = frm.viableTumourCellsPercent.value; |
4733 |
05 Apr 18 |
olle |
431 |
|
4733 |
05 Apr 18 |
olle |
if (viableTumourCellsPercent != null) |
4733 |
05 Apr 18 |
olle |
433 |
{ |
4733 |
05 Apr 18 |
olle |
if (parseInt(viableTumourCellsPercent) < 0) |
4733 |
05 Apr 18 |
olle |
435 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('viableTumourCellsPercent', 'invalid', 'Must be at least 0'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
438 |
} |
4733 |
05 Apr 18 |
olle |
if (parseInt(viableTumourCellsPercent) > 100) |
4733 |
05 Apr 18 |
olle |
440 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('viableTumourCellsPercent', 'invalid', 'Must be at most 100'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
443 |
} |
4733 |
05 Apr 18 |
olle |
444 |
} |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('viableTumourCellsPercent', 'valid'); |
4733 |
05 Apr 18 |
olle |
viableTumourCellsPercentIsValid = true; |
4733 |
05 Apr 18 |
olle |
447 |
} |
4733 |
05 Apr 18 |
olle |
448 |
|
4733 |
05 Apr 18 |
olle |
streg.validateStep2 = function(event) |
4733 |
05 Apr 18 |
olle |
450 |
{ |
4733 |
05 Apr 18 |
olle |
var valid = true; |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
453 |
|
4733 |
05 Apr 18 |
olle |
valid &= nofTubesIsValid; |
4733 |
05 Apr 18 |
olle |
valid &= Wizard.isValid('arrivalDate'); |
4733 |
05 Apr 18 |
olle |
valid &= samplingDateIsValid; |
4733 |
05 Apr 18 |
olle |
valid &= viableTumourCellsPercentIsValid; |
4733 |
05 Apr 18 |
olle |
458 |
|
4733 |
05 Apr 18 |
olle |
if (!valid) event.preventDefault(); |
4733 |
05 Apr 18 |
olle |
460 |
} |
4733 |
05 Apr 18 |
olle |
461 |
|
4733 |
05 Apr 18 |
olle |
streg.initializeStep3 = function() |
4733 |
05 Apr 18 |
olle |
463 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var tubeContentType = frm.tubeContentType.value; |
4733 |
05 Apr 18 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
4733 |
05 Apr 18 |
olle |
nofTubes = streg.fixNofTubes(tubeContentType, nofTubes); |
4733 |
05 Apr 18 |
olle |
frm.nofTubes.value = nofTubes; |
4733 |
05 Apr 18 |
olle |
var extractsFromFirstSpecimenOnly = frm.extractsFromFirstSpecimenOnlyCB.checked; |
4733 |
05 Apr 18 |
olle |
var storageBoxSuffix = streg.fetchStorageBoxSuffix(tubeContentType); |
4733 |
05 Apr 18 |
olle |
if (nofTubes > 2) Doc.addClass('step-2', 'auto-hide'); |
4733 |
05 Apr 18 |
olle |
472 |
|
4733 |
05 Apr 18 |
olle |
var html = ''; |
4733 |
05 Apr 18 |
olle |
474 |
|
4733 |
05 Apr 18 |
olle |
// Add buttons for adding standard comments for all specimens/RNA/DNA |
4733 |
05 Apr 18 |
olle |
html += '<tr class="section-header">'; |
4733 |
05 Apr 18 |
olle |
html += '<td colspan="4">Standard comments</td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
479 |
|
4733 |
05 Apr 18 |
olle |
html += '<tr class="align-top">'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td><div class="button basicbutton interactable" id="addCarvedOutComment" style="font-weight: normal;">Add "Utkarvad" (Carved out)</div></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="addCarvedOutComment.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="addCarvedOutComment.message" class="message"></span>Click button to add standard comment for all items.</td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
486 |
|
4733 |
05 Apr 18 |
olle |
html += '<tr class="align-top">'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td><div class="button basicbutton interactable" id="addMnbComment" style="font-weight: normal;">Add "MNB" (Medium needle biopsy)</div></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="addMnbComment.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="addMnbComment.message" class="message"></span>Click button to add standard comment for all items.</td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
493 |
|
4733 |
05 Apr 18 |
olle |
for (var i=0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
495 |
{ |
4733 |
05 Apr 18 |
olle |
var tubeContentTypeName = streg.fetchTubeContentTypeName(tubeContentType, i); |
4733 |
05 Apr 18 |
olle |
var tubeContentTypeNameInternal = streg.fetchTubeContentTypeNameInternal(tubeContentType, tubeContentTypeName); |
4733 |
05 Apr 18 |
olle |
var tubeName = streg.fetchTubeName(tubeContentType, caseInfo, i); |
4733 |
05 Apr 18 |
olle |
var tubeNo = i+caseInfo.specimenFirstIndex; |
4733 |
05 Apr 18 |
olle |
var tubeIdentifier = streg.fetchTubeIdentifier(tubeContentType, tubeName, tubeNo); |
4733 |
05 Apr 18 |
olle |
html += '<tr class="section-header">'; |
4733 |
05 Apr 18 |
olle |
html += '<td colspan="4">'+tubeContentTypeName+' Tube '+tubeName+'</td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
504 |
|
4733 |
05 Apr 18 |
olle |
505 |
/* |
4733 |
05 Apr 18 |
olle |
var boxMsg = 'Box-number where the '+tubeContentTypeNameInternal+' tube is located in.'; |
4733 |
05 Apr 18 |
olle |
507 |
*/ |
4733 |
05 Apr 18 |
olle |
var boxMsg = 'Box-number and position where the '+tubeContentTypeNameInternal+' tube is located.'; |
4733 |
05 Apr 18 |
olle |
var dnaBoxMsg = 'Box-number and position where the DNA extract will be located.'; |
4733 |
05 Apr 18 |
olle |
var rnaBoxMsg = 'Box-number and position where the RNA extract will be located.'; |
4733 |
05 Apr 18 |
olle |
var disabledAttribute = ''; |
4733 |
05 Apr 18 |
olle |
if (i == 0 && tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
513 |
{ |
4733 |
05 Apr 18 |
olle |
boxMsg = 'No storage space allocated for first '+tubeContentTypeNameInternal+'; all amount expected to be used.'; |
4733 |
05 Apr 18 |
olle |
disabledAttribute = ' disabled'; |
4733 |
05 Apr 18 |
olle |
516 |
} |
4733 |
05 Apr 18 |
olle |
html += '<tr>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt">'+tubeContentTypeName+' '+tubeName+' '+'Box</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="input">'; |
4733 |
05 Apr 18 |
olle |
520 |
/* |
4733 |
05 Apr 18 |
olle |
html += '<input type="text" name="box.'+i+'" id="box.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'></td>'; |
4733 |
05 Apr 18 |
olle |
522 |
*/ |
4733 |
05 Apr 18 |
olle |
html += '<input type="text" name="box.'+i+'" id="box.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Row<input type="text" name="row.'+i+'" id="row.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Column<input type="text" name="column.'+i+'" id="column.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += '</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="box.'+i+'.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="box.'+i+'.message" class="message"></span>'+boxMsg+'<span id="position.'+i+'.message" class="message"></span></td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
530 |
/* |
4733 |
05 Apr 18 |
olle |
html += '<tr>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt">Row</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="input">'; |
4733 |
05 Apr 18 |
olle |
html += '<input type="text" name="row.'+i+'" id="row.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Column<input type="text" name="column.'+i+'" id="column.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += '</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="position.'+i+'.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="position.'+i+'.message" class="message"></span></td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
540 |
*/ |
4733 |
05 Apr 18 |
olle |
541 |
|
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
543 |
{ |
4733 |
05 Apr 18 |
olle |
disabledAttribute = ''; |
4733 |
05 Apr 18 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
4733 |
05 Apr 18 |
olle |
546 |
{ |
4733 |
05 Apr 18 |
olle |
html += '<tr>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt">DNA extract'+' '+tubeName+'.d '+'Box</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="input">'; |
4733 |
05 Apr 18 |
olle |
html += '<input type="text" name="dnaBox.'+i+'" id="dnaBox.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Row<input type="text" name="dnaRow.'+i+'" id="dnaRow.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Column<input type="text" name="dnaColumn.'+i+'" id="dnaColumn.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += '</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="dnaBox.'+i+'.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="dnaBox.'+i+'.message" class="message"></span>'+dnaBoxMsg+'<span id="dnaPosition.'+i+'.message" class="message"></span></td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
557 |
|
4733 |
05 Apr 18 |
olle |
html += '<tr>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt">RNA extract'+' '+tubeName+'.r '+'Box</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="input">'; |
4733 |
05 Apr 18 |
olle |
html += '<input type="text" name="rnaBox.'+i+'" id="rnaBox.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Row<input type="text" name="rnaRow.'+i+'" id="rnaRow.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += ' Column<input type="text" name="rnaColumn.'+i+'" id="rnaColumn.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4733 |
05 Apr 18 |
olle |
html += '</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="rnaBox.'+i+'.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="rnaBox.'+i+'.message" class="message"></span>'+rnaBoxMsg+'<span id="rnaPosition.'+i+'.message" class="message"></span></td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
568 |
} |
4733 |
05 Apr 18 |
olle |
569 |
|
4733 |
05 Apr 18 |
olle |
html += '<tr>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt">Number of sections</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="input">'; |
4733 |
05 Apr 18 |
olle |
html += '<input type="text" name="nofSections.'+i+'" id="nofSections.'+i+'" style="width: 3em;" maxlength="2" value="1">'; |
4733 |
05 Apr 18 |
olle |
html += '</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="nofSections.'+i+'.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="nofSections.'+i+'.message" class="message"></span>Number of sections (slices) in FFPE block.</td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
578 |
} |
4733 |
05 Apr 18 |
olle |
579 |
|
4733 |
05 Apr 18 |
olle |
html += '<tr class="align-top">'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="subprompt">Operator delivery comment</td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="input"><textarea rows="3" name="comment.'+i+'" id="comment.'+i+'"></textarea></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="status" id="comment.'+i+'.status"></td>'; |
4733 |
05 Apr 18 |
olle |
html += '<td class="help"><span id="comment.'+i+'.message" class="message"></span>In this field, enter information specific for '+tubeContentTypeNameInternal+' tube ' +tubeIdentifier+'.</td>'; |
4733 |
05 Apr 18 |
olle |
html += '</tr>'; |
4733 |
05 Apr 18 |
olle |
586 |
} |
4733 |
05 Apr 18 |
olle |
Doc.element('specimen-tubes').innerHTML = html; |
4733 |
05 Apr 18 |
olle |
588 |
|
4733 |
05 Apr 18 |
olle |
// Add click handlers for buttons for adding standard comments for all specimens/RNA/DNA |
4733 |
05 Apr 18 |
olle |
var addCarvedOutCommentGeneralButton = Doc.element('addCarvedOutComment'); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler(addCarvedOutCommentGeneralButton, streg.addCommentGeneral, {'nofTubes': nofTubes, 'text-field': 'comment.', 'text': 'Utkarvad.'}); |
4733 |
05 Apr 18 |
olle |
var addMnbCommentGeneralButton = Doc.element('addMnbComment'); |
4733 |
05 Apr 18 |
olle |
Buttons.addClickHandler(addMnbCommentGeneralButton, streg.addCommentGeneral, {'nofTubes': nofTubes, 'text-field': 'comment.', 'text': 'MNB.'}); |
4733 |
05 Apr 18 |
olle |
594 |
|
4733 |
05 Apr 18 |
olle |
Wizard.setCurrentStep(3); |
4733 |
05 Apr 18 |
olle |
Doc.show('goregister'); |
4733 |
05 Apr 18 |
olle |
Doc.show('gocancel'); |
4733 |
05 Apr 18 |
olle |
frm['comment.0'].focus(); |
4733 |
05 Apr 18 |
olle |
599 |
|
4733 |
05 Apr 18 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=FindStoragePositions'; |
4733 |
05 Apr 18 |
olle |
url += '&nofTubes='+frm.nofTubes.value; |
4733 |
05 Apr 18 |
olle |
url += '&storageBoxSuffix='+storageBoxSuffix; |
4733 |
05 Apr 18 |
olle |
url += '&extractsFromFirstSpecimenOnly='+extractsFromFirstSpecimenOnly; |
4733 |
05 Apr 18 |
olle |
605 |
|
4733 |
05 Apr 18 |
olle |
Wizard.showLoadingAnimation('Looking for empty box positions...'); |
4733 |
05 Apr 18 |
olle |
Wizard.asyncJsonRequest(url, streg.storagePositionsLoaded); |
4733 |
05 Apr 18 |
olle |
608 |
} |
4733 |
05 Apr 18 |
olle |
609 |
|
4733 |
05 Apr 18 |
olle |
streg.addCommentGeneral = function(event) |
4733 |
05 Apr 18 |
olle |
611 |
{ |
4733 |
05 Apr 18 |
olle |
var nofTubes = Data.get(event.currentTarget, 'nofTubes', event.currentTarget.id); |
4733 |
05 Apr 18 |
olle |
var textFieldBase = Data.get(event.currentTarget, 'text-field', event.currentTarget.id); |
4733 |
05 Apr 18 |
olle |
var text = Data.get(event.currentTarget, 'text', event.currentTarget.id); |
4733 |
05 Apr 18 |
olle |
for (var i=0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
616 |
{ |
4733 |
05 Apr 18 |
olle |
var textField = Doc.element(textFieldBase+i); |
4733 |
05 Apr 18 |
olle |
if (textField) |
4733 |
05 Apr 18 |
olle |
619 |
{ |
4733 |
05 Apr 18 |
olle |
if (text && text != '') |
4733 |
05 Apr 18 |
olle |
621 |
{ |
4733 |
05 Apr 18 |
olle |
if (textField.value != '') |
4733 |
05 Apr 18 |
olle |
623 |
{ |
4733 |
05 Apr 18 |
olle |
textField.value += ' '; |
4733 |
05 Apr 18 |
olle |
625 |
} |
4733 |
05 Apr 18 |
olle |
textField.value += text; |
4733 |
05 Apr 18 |
olle |
627 |
} |
4733 |
05 Apr 18 |
olle |
628 |
} |
4733 |
05 Apr 18 |
olle |
629 |
} |
4733 |
05 Apr 18 |
olle |
streg.setNumberOfSectionsFromComment(event); |
4733 |
05 Apr 18 |
olle |
631 |
} |
4733 |
05 Apr 18 |
olle |
632 |
|
4733 |
05 Apr 18 |
olle |
streg.addComment = function(event) |
4733 |
05 Apr 18 |
olle |
634 |
{ |
4733 |
05 Apr 18 |
olle |
var textField = Doc.element(Data.get(event.currentTarget, 'text-field', event.currentTarget.id)); |
4733 |
05 Apr 18 |
olle |
var text = Data.get(event.currentTarget, 'text', event.currentTarget.id); |
4733 |
05 Apr 18 |
olle |
if (textField) |
4733 |
05 Apr 18 |
olle |
638 |
{ |
4733 |
05 Apr 18 |
olle |
if (text && text != '') |
4733 |
05 Apr 18 |
olle |
640 |
{ |
4733 |
05 Apr 18 |
olle |
if (textField.value != '') |
4733 |
05 Apr 18 |
olle |
642 |
{ |
4733 |
05 Apr 18 |
olle |
textField.value += ' '; |
4733 |
05 Apr 18 |
olle |
644 |
} |
4733 |
05 Apr 18 |
olle |
textField.value += text; |
4733 |
05 Apr 18 |
olle |
646 |
} |
4733 |
05 Apr 18 |
olle |
647 |
} |
4733 |
05 Apr 18 |
olle |
streg.setNumberOfSectionsFromComment(event); |
4733 |
05 Apr 18 |
olle |
649 |
} |
4733 |
05 Apr 18 |
olle |
650 |
|
4733 |
05 Apr 18 |
olle |
streg.setNumberOfSectionsFromComment = function(event) |
4733 |
05 Apr 18 |
olle |
652 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var nofTubes = Data.get(event.currentTarget, 'nofTubes', event.currentTarget.id); |
4733 |
05 Apr 18 |
olle |
var textFieldBase = Data.get(event.currentTarget, 'text-field', event.currentTarget.id); |
4733 |
05 Apr 18 |
olle |
for (var i=0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
657 |
{ |
4733 |
05 Apr 18 |
olle |
var numSections = 1; |
4733 |
05 Apr 18 |
olle |
var textField = Doc.element(textFieldBase+i); |
4733 |
05 Apr 18 |
olle |
if (textField) |
4733 |
05 Apr 18 |
olle |
661 |
{ |
4733 |
05 Apr 18 |
olle |
var text = textField.value; |
4733 |
05 Apr 18 |
olle |
if (text && text != '') |
4733 |
05 Apr 18 |
olle |
664 |
{ |
4733 |
05 Apr 18 |
olle |
// If comment "Utkarvad." and not "MNB." => number of sections set to 0 |
4733 |
05 Apr 18 |
olle |
if (text.indexOf('Utkarvad.') >= 0 && text.indexOf('MNB.') < 0) |
4733 |
05 Apr 18 |
olle |
667 |
{ |
4733 |
05 Apr 18 |
olle |
numSections = 0; |
4733 |
05 Apr 18 |
olle |
669 |
} |
4733 |
05 Apr 18 |
olle |
670 |
} |
4733 |
05 Apr 18 |
olle |
671 |
} |
4733 |
05 Apr 18 |
olle |
frm['nofSections.'+i].value = numSections; |
4733 |
05 Apr 18 |
olle |
673 |
} |
4733 |
05 Apr 18 |
olle |
674 |
} |
4733 |
05 Apr 18 |
olle |
675 |
|
4733 |
05 Apr 18 |
olle |
streg.storagePositionsLoaded = function(response) |
4733 |
05 Apr 18 |
olle |
677 |
{ |
4733 |
05 Apr 18 |
olle |
var freeWells = response.wells; |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var tubeContentType = frm.tubeContentType.value; |
4733 |
05 Apr 18 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
4733 |
05 Apr 18 |
olle |
var extractsFromFirstSpecimenOnly = frm.extractsFromFirstSpecimenOnlyCB.checked; |
4733 |
05 Apr 18 |
olle |
683 |
|
4733 |
05 Apr 18 |
olle |
// No storage space is allocated for first specimen, |
4733 |
05 Apr 18 |
olle |
// since all amount is expected to be used for analysis. |
4733 |
05 Apr 18 |
olle |
// Specimen tube with i == 0 is therefore skipped. |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
688 |
{ |
4733 |
05 Apr 18 |
olle |
for (var i = 0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
690 |
{ |
4733 |
05 Apr 18 |
olle |
wellIndex = 3*i; |
4733 |
05 Apr 18 |
olle |
var specWell = null; |
4733 |
05 Apr 18 |
olle |
if (i > 0) |
4733 |
05 Apr 18 |
olle |
694 |
{ |
4733 |
05 Apr 18 |
olle |
specWell = freeWells[wellIndex]; |
4733 |
05 Apr 18 |
olle |
if (!specWell || specWell == '') |
4733 |
05 Apr 18 |
olle |
697 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('box.'+i, 'invalid', 'Missing box'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
700 |
} |
4733 |
05 Apr 18 |
olle |
701 |
} |
4733 |
05 Apr 18 |
olle |
var dnaWell = null; |
4733 |
05 Apr 18 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
4733 |
05 Apr 18 |
olle |
704 |
{ |
4733 |
05 Apr 18 |
olle |
dnaWell = freeWells[wellIndex+1]; |
4733 |
05 Apr 18 |
olle |
if (!dnaWell || dnaWell == '') |
4733 |
05 Apr 18 |
olle |
707 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('dnaBox.'+i, 'invalid', 'Missing box'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
710 |
} |
4733 |
05 Apr 18 |
olle |
711 |
} |
4733 |
05 Apr 18 |
olle |
var rnaWell = null; |
4733 |
05 Apr 18 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
4733 |
05 Apr 18 |
olle |
714 |
{ |
4733 |
05 Apr 18 |
olle |
rnaWell = freeWells[wellIndex+2]; |
4733 |
05 Apr 18 |
olle |
if (!rnaWell || rnaWell == '') |
4733 |
05 Apr 18 |
olle |
717 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('rnaBox.'+i, 'invalid', 'Missing box'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
720 |
} |
4733 |
05 Apr 18 |
olle |
721 |
} |
4733 |
05 Apr 18 |
olle |
722 |
|
4733 |
05 Apr 18 |
olle |
// Update form fields for storage plates |
4733 |
05 Apr 18 |
olle |
if (specWell) |
4733 |
05 Apr 18 |
olle |
725 |
{ |
4733 |
05 Apr 18 |
olle |
frm['box.'+i].value = specWell.bioPlate.name; |
4733 |
05 Apr 18 |
olle |
frm['row.'+i].value = Meludi.wellToAlpha(specWell.row); |
4733 |
05 Apr 18 |
olle |
frm['column.'+i].value = specWell.column+1; |
4733 |
05 Apr 18 |
olle |
729 |
} |
4733 |
05 Apr 18 |
olle |
730 |
|
4733 |
05 Apr 18 |
olle |
if (dnaWell) |
4733 |
05 Apr 18 |
olle |
732 |
{ |
4733 |
05 Apr 18 |
olle |
frm['dnaBox.'+i].value = dnaWell.bioPlate.name; |
4733 |
05 Apr 18 |
olle |
frm['dnaRow.'+i].value = Meludi.wellToAlpha(dnaWell.row); |
4733 |
05 Apr 18 |
olle |
frm['dnaColumn.'+i].value = dnaWell.column+1; |
4733 |
05 Apr 18 |
olle |
736 |
} |
4733 |
05 Apr 18 |
olle |
737 |
|
4733 |
05 Apr 18 |
olle |
if (rnaWell) |
4733 |
05 Apr 18 |
olle |
739 |
{ |
4733 |
05 Apr 18 |
olle |
frm['rnaBox.'+i].value = rnaWell.bioPlate.name; |
4733 |
05 Apr 18 |
olle |
frm['rnaRow.'+i].value = Meludi.wellToAlpha(rnaWell.row); |
4733 |
05 Apr 18 |
olle |
frm['rnaColumn.'+i].value = rnaWell.column+1; |
4733 |
05 Apr 18 |
olle |
743 |
} |
4733 |
05 Apr 18 |
olle |
744 |
|
4733 |
05 Apr 18 |
olle |
// Move focus to next field |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('box.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'row.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('row.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'column.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'dnaBox.'+i }); |
4733 |
05 Apr 18 |
olle |
749 |
|
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaBox.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'dnaRow.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaRow.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'dnaColumn.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaColumn.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'rnaBox.'+i }); |
4733 |
05 Apr 18 |
olle |
753 |
|
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaBox.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'rnaRow.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaRow.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'rnaColumn.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaColumn.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'nofSections.'+i }); |
4733 |
05 Apr 18 |
olle |
757 |
|
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'comment.'+i }); |
4733 |
05 Apr 18 |
olle |
759 |
|
4733 |
05 Apr 18 |
olle |
// Form validation |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('box.'+i, 'change', streg.wellOnChange, { 'boxtype': 'Specimen', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('row.'+i, 'change', streg.wellOnChange, { 'boxtype': 'Specimen', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('column.'+i, 'change', streg.wellOnChange, { 'boxtype': 'Specimen', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('box.'+i, 'keyup', streg.boxOnKeyUp, { 'boxtype': 'Specimen'}); |
4733 |
05 Apr 18 |
olle |
766 |
|
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaColumn.'+i, 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaBox.'+i, 'change', streg.wellOnChange, { 'boxtype': 'DNA', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaRow.'+i, 'change', streg.wellOnChange, { 'boxtype': 'DNA', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaColumn.'+i, 'change', streg.wellOnChange, { 'boxtype': 'DNA', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('dnaBox.'+i, 'keyup', streg.boxOnKeyUp, { 'boxtype': 'DNA'}); |
4733 |
05 Apr 18 |
olle |
772 |
|
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaColumn.'+i, 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaBox.'+i, 'change', streg.wellOnChange, { 'boxtype': 'RNA', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaRow.'+i, 'change', streg.wellOnChange, { 'boxtype': 'RNA', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaColumn.'+i, 'change', streg.wellOnChange, { 'boxtype': 'RNA', 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('rnaBox.'+i, 'keyup', streg.boxOnKeyUp, { 'boxtype': 'RNA'}); |
4733 |
05 Apr 18 |
olle |
778 |
|
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofSections.'+i, 'change', streg.nofSectionsOnChange, { 'index': i }); |
4733 |
05 Apr 18 |
olle |
781 |
|
4733 |
05 Apr 18 |
olle |
wellIsValid[i] = true; |
4733 |
05 Apr 18 |
olle |
dnaWellIsValid[i] = true; |
4733 |
05 Apr 18 |
olle |
rnaWellIsValid[i] = true; |
4733 |
05 Apr 18 |
olle |
785 |
/* |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('position.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
787 |
*/ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('box.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
4733 |
05 Apr 18 |
olle |
790 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('dnaBox.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('rnaBox.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
793 |
} |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
795 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofSections.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
797 |
} |
4733 |
05 Apr 18 |
olle |
798 |
} |
4733 |
05 Apr 18 |
olle |
799 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'DNA' || tubeContentType == 'RNA' || tubeContentType == 'DNA_RNA') |
4733 |
05 Apr 18 |
olle |
801 |
{ |
4733 |
05 Apr 18 |
olle |
for (var i = 0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
803 |
{ |
4733 |
05 Apr 18 |
olle |
var wellIndex = i; |
4733 |
05 Apr 18 |
olle |
var well = freeWells[wellIndex]; |
4733 |
05 Apr 18 |
olle |
if (!well || well == '') |
4733 |
05 Apr 18 |
olle |
807 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('box.'+i, 'invalid', 'Missing box'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
810 |
} |
4733 |
05 Apr 18 |
olle |
frm['box.'+i].value = well.bioPlate.name; |
4733 |
05 Apr 18 |
olle |
frm['row.'+i].value = Meludi.wellToAlpha(well.row); |
4733 |
05 Apr 18 |
olle |
frm['column.'+i].value = well.column+1; |
4733 |
05 Apr 18 |
olle |
814 |
|
4733 |
05 Apr 18 |
olle |
// Move focus to next field |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('box.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'row.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('row.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'column.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'nofSections.'+i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'comment.'+i }); |
4733 |
05 Apr 18 |
olle |
820 |
|
4733 |
05 Apr 18 |
olle |
// Form validation |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('box.'+i, 'change', streg.wellOnChange, { 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('row.'+i, 'change', streg.wellOnChange, { 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('column.'+i, 'change', streg.wellOnChange, { 'index': i }); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('box.'+i, 'keyup', streg.boxOnKeyUp); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Events.integerOnly); |
4733 |
05 Apr 18 |
olle |
Events.addEventHandler('nofSections.'+i, 'change', streg.nofSectionsOnChange, { 'index': i }); |
4733 |
05 Apr 18 |
olle |
829 |
|
4733 |
05 Apr 18 |
olle |
wellIsValid[i] = true; |
4733 |
05 Apr 18 |
olle |
831 |
/* |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('position.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
833 |
*/ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('box.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
836 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofSections.'+i, 'valid'); |
4733 |
05 Apr 18 |
olle |
838 |
} |
4733 |
05 Apr 18 |
olle |
839 |
} |
4733 |
05 Apr 18 |
olle |
840 |
} |
4733 |
05 Apr 18 |
olle |
841 |
} |
4733 |
05 Apr 18 |
olle |
842 |
|
4733 |
05 Apr 18 |
olle |
streg.fixNofTubes = function(tubeContentType, nofTubes) |
4733 |
05 Apr 18 |
olle |
844 |
{ |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'DNA') |
4733 |
05 Apr 18 |
olle |
846 |
{ |
4733 |
05 Apr 18 |
olle |
nofTubes = 1; |
4733 |
05 Apr 18 |
olle |
848 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'RNA') |
4733 |
05 Apr 18 |
olle |
850 |
{ |
4733 |
05 Apr 18 |
olle |
nofTubes = 1; |
4733 |
05 Apr 18 |
olle |
852 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'DNA_RNA') |
4733 |
05 Apr 18 |
olle |
854 |
{ |
4733 |
05 Apr 18 |
olle |
nofTubes = 2; |
4733 |
05 Apr 18 |
olle |
856 |
} |
4733 |
05 Apr 18 |
olle |
return nofTubes; |
4733 |
05 Apr 18 |
olle |
858 |
} |
4733 |
05 Apr 18 |
olle |
859 |
|
4733 |
05 Apr 18 |
olle |
streg.fetchStorageBoxSuffix = function(tubeContentType) |
4733 |
05 Apr 18 |
olle |
861 |
{ |
4733 |
05 Apr 18 |
olle |
var storageBoxSuffix = null; |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
864 |
{ |
4733 |
05 Apr 18 |
olle |
storageBoxSuffix = '_sp'; |
4733 |
05 Apr 18 |
olle |
866 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'DNA') |
4733 |
05 Apr 18 |
olle |
868 |
{ |
4733 |
05 Apr 18 |
olle |
storageBoxSuffix = '_dna'; |
4733 |
05 Apr 18 |
olle |
870 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'RNA') |
4733 |
05 Apr 18 |
olle |
872 |
{ |
4733 |
05 Apr 18 |
olle |
storageBoxSuffix = '_rna'; |
4733 |
05 Apr 18 |
olle |
874 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'DNA_RNA') |
4733 |
05 Apr 18 |
olle |
876 |
{ |
4733 |
05 Apr 18 |
olle |
storageBoxSuffix = '_dna_rna'; |
4733 |
05 Apr 18 |
olle |
878 |
} |
4733 |
05 Apr 18 |
olle |
return storageBoxSuffix; |
4733 |
05 Apr 18 |
olle |
880 |
} |
4733 |
05 Apr 18 |
olle |
881 |
|
4733 |
05 Apr 18 |
olle |
streg.fetchTubeContentTypeName = function(tubeContentType, tubeIndex) |
4733 |
05 Apr 18 |
olle |
883 |
{ |
4733 |
05 Apr 18 |
olle |
var tubeContentTypeName = tubeContentType; |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'DNA_RNA') |
4733 |
05 Apr 18 |
olle |
886 |
{ |
4733 |
05 Apr 18 |
olle |
if (tubeIndex == 0) |
4733 |
05 Apr 18 |
olle |
888 |
{ |
4733 |
05 Apr 18 |
olle |
tubeContentTypeName = 'DNA'; |
4733 |
05 Apr 18 |
olle |
890 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeIndex == 1) |
4733 |
05 Apr 18 |
olle |
892 |
{ |
4733 |
05 Apr 18 |
olle |
tubeContentTypeName = 'RNA'; |
4733 |
05 Apr 18 |
olle |
894 |
} |
4733 |
05 Apr 18 |
olle |
895 |
} |
4733 |
05 Apr 18 |
olle |
return tubeContentTypeName; |
4733 |
05 Apr 18 |
olle |
897 |
} |
4733 |
05 Apr 18 |
olle |
898 |
|
4733 |
05 Apr 18 |
olle |
streg.fetchTubeContentTypeNameInternal = function(tubeContentType, tubeContentTypeName) |
4733 |
05 Apr 18 |
olle |
900 |
{ |
4733 |
05 Apr 18 |
olle |
var tubeContentTypeNameInternal = tubeContentTypeName; |
4733 |
05 Apr 18 |
olle |
// Convert all names except abbreviations to all lower case |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
904 |
{ |
4733 |
05 Apr 18 |
olle |
tubeContentTypeNameInternal = tubeContentTypeName.toLowerCase(); |
4733 |
05 Apr 18 |
olle |
906 |
} |
4733 |
05 Apr 18 |
olle |
return tubeContentTypeNameInternal; |
4733 |
05 Apr 18 |
olle |
908 |
} |
4733 |
05 Apr 18 |
olle |
909 |
|
4733 |
05 Apr 18 |
olle |
streg.fetchTubeName = function(tubeContentType, caseInfo, tubeIndex) |
4733 |
05 Apr 18 |
olle |
911 |
{ |
4733 |
05 Apr 18 |
olle |
var tubeName = Strings.encodeTags(caseInfo.originalName); |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
914 |
{ |
4733 |
05 Apr 18 |
olle |
var tubeNo = tubeIndex + caseInfo.specimenFirstIndex; |
4733 |
05 Apr 18 |
olle |
tubeName = tubeName+'.'+tubeNo; |
4733 |
05 Apr 18 |
olle |
917 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'DNA') |
4733 |
05 Apr 18 |
olle |
919 |
{ |
4733 |
05 Apr 18 |
olle |
tubeName = tubeName+'.d'; |
4733 |
05 Apr 18 |
olle |
921 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'RNA') |
4733 |
05 Apr 18 |
olle |
923 |
{ |
4733 |
05 Apr 18 |
olle |
tubeName = tubeName+'.r'; |
4733 |
05 Apr 18 |
olle |
925 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'DNA_RNA') |
4733 |
05 Apr 18 |
olle |
927 |
{ |
4733 |
05 Apr 18 |
olle |
if (tubeIndex == 0) |
4733 |
05 Apr 18 |
olle |
929 |
{ |
4733 |
05 Apr 18 |
olle |
tubeName = tubeName+'.d'; |
4733 |
05 Apr 18 |
olle |
931 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeIndex == 1) |
4733 |
05 Apr 18 |
olle |
933 |
{ |
4733 |
05 Apr 18 |
olle |
tubeName = tubeName+'.r'; |
4733 |
05 Apr 18 |
olle |
935 |
} |
4733 |
05 Apr 18 |
olle |
936 |
} |
4733 |
05 Apr 18 |
olle |
return tubeName; |
4733 |
05 Apr 18 |
olle |
938 |
} |
4733 |
05 Apr 18 |
olle |
939 |
|
4733 |
05 Apr 18 |
olle |
streg.fetchTubeIdentifier = function(tubeContentType, tubeName, tubeNo) |
4733 |
05 Apr 18 |
olle |
941 |
{ |
4733 |
05 Apr 18 |
olle |
var tubeIdentifier = tubeName; |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
944 |
{ |
4733 |
05 Apr 18 |
olle |
tubeIdentifier = tubeNo; |
4733 |
05 Apr 18 |
olle |
946 |
} |
4733 |
05 Apr 18 |
olle |
return tubeIdentifier; |
4733 |
05 Apr 18 |
olle |
948 |
} |
4733 |
05 Apr 18 |
olle |
949 |
|
4733 |
05 Apr 18 |
olle |
streg.boxOnKeyUp = function(event) |
4733 |
05 Apr 18 |
olle |
951 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var tubeContentType = frm.tubeContentType.value; |
4733 |
05 Apr 18 |
olle |
954 |
|
4733 |
05 Apr 18 |
olle |
var boxType = Data.get(event.currentTarget, 'boxtype'); |
4733 |
05 Apr 18 |
olle |
var index = Data.int(event.currentTarget, 'index'); |
4733 |
05 Apr 18 |
olle |
957 |
|
4733 |
05 Apr 18 |
olle |
// Get box prefix, default is for input tubes |
4733 |
05 Apr 18 |
olle |
var boxPrefix = 'box.'; |
4733 |
05 Apr 18 |
olle |
if (boxType && boxType == 'DNA') |
4733 |
05 Apr 18 |
olle |
961 |
{ |
4733 |
05 Apr 18 |
olle |
boxPrefix = 'dnaBox.'; |
4733 |
05 Apr 18 |
olle |
963 |
} |
4733 |
05 Apr 18 |
olle |
if (boxType && boxType == 'RNA') |
4733 |
05 Apr 18 |
olle |
965 |
{ |
4733 |
05 Apr 18 |
olle |
boxPrefix = 'rnaBox.'; |
4733 |
05 Apr 18 |
olle |
967 |
} |
4733 |
05 Apr 18 |
olle |
968 |
|
4733 |
05 Apr 18 |
olle |
// Check box name |
4733 |
05 Apr 18 |
olle |
var boxIsValid = true; |
4733 |
05 Apr 18 |
olle |
var box = frm[boxPrefix+index].value; |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
4733 |
05 Apr 18 |
olle |
// Check for prefix "ML_" |
4733 |
05 Apr 18 |
olle |
if (box.indexOf('ML_') != 0) |
4733 |
05 Apr 18 |
olle |
975 |
{ |
4733 |
05 Apr 18 |
olle |
boxIsValid = false; |
4733 |
05 Apr 18 |
olle |
977 |
} |
4733 |
05 Apr 18 |
olle |
var suffix = '_sp'; |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'DNA' || (boxType && boxType == 'DNA')) |
4733 |
05 Apr 18 |
olle |
980 |
{ |
4733 |
05 Apr 18 |
olle |
suffix = '_dna'; |
4733 |
05 Apr 18 |
olle |
982 |
} |
4733 |
05 Apr 18 |
olle |
else if (tubeContentType == 'RNA' || (boxType && boxType == 'RNA')) |
4733 |
05 Apr 18 |
olle |
984 |
{ |
4733 |
05 Apr 18 |
olle |
suffix = '_rna'; |
4733 |
05 Apr 18 |
olle |
986 |
} |
4733 |
05 Apr 18 |
olle |
// Check for suffix |
4733 |
05 Apr 18 |
olle |
if (box.indexOf(suffix) != (box.length - suffix.length)) |
4733 |
05 Apr 18 |
olle |
989 |
{ |
4733 |
05 Apr 18 |
olle |
boxIsValid = false; |
4733 |
05 Apr 18 |
olle |
991 |
} |
4733 |
05 Apr 18 |
olle |
992 |
|
4733 |
05 Apr 18 |
olle |
if (!boxIsValid) |
4733 |
05 Apr 18 |
olle |
994 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Box name must start with "ML_" and end with "'+suffix+'"'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
997 |
} |
4733 |
05 Apr 18 |
olle |
998 |
} |
4733 |
05 Apr 18 |
olle |
999 |
|
4733 |
05 Apr 18 |
olle |
streg.wellOnChange = function(event) |
4733 |
05 Apr 18 |
olle |
1001 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var target = event.currentTarget; |
4733 |
05 Apr 18 |
olle |
1004 |
|
4733 |
05 Apr 18 |
olle |
var boxType = Data.get(target, 'boxtype'); |
4733 |
05 Apr 18 |
olle |
var index = Data.int(target, 'index'); |
4733 |
05 Apr 18 |
olle |
1007 |
|
4733 |
05 Apr 18 |
olle |
// Get well position prefixes, default is for input tubes |
4733 |
05 Apr 18 |
olle |
var boxPrefix = 'box.'; |
4733 |
05 Apr 18 |
olle |
var rowPrefix = 'row.'; |
4733 |
05 Apr 18 |
olle |
var columnPrefix = 'column.'; |
4733 |
05 Apr 18 |
olle |
if (boxType && boxType == 'DNA') |
4733 |
05 Apr 18 |
olle |
1013 |
{ |
4733 |
05 Apr 18 |
olle |
boxPrefix = 'dnaBox.'; |
4733 |
05 Apr 18 |
olle |
rowPrefix = 'dnaRow.'; |
4733 |
05 Apr 18 |
olle |
columnPrefix = 'dnaColumn.'; |
4733 |
05 Apr 18 |
olle |
1017 |
} |
4733 |
05 Apr 18 |
olle |
if (boxType && boxType == 'RNA') |
4733 |
05 Apr 18 |
olle |
1019 |
{ |
4733 |
05 Apr 18 |
olle |
boxPrefix = 'rnaBox.'; |
4733 |
05 Apr 18 |
olle |
rowPrefix = 'rnaRow.'; |
4733 |
05 Apr 18 |
olle |
columnPrefix = 'rnaColumn.'; |
4733 |
05 Apr 18 |
olle |
1023 |
} |
4733 |
05 Apr 18 |
olle |
var box = frm[boxPrefix+index].value; |
4733 |
05 Apr 18 |
olle |
var row = frm[rowPrefix+index].value; |
4733 |
05 Apr 18 |
olle |
var column = frm[columnPrefix+index].value; |
4733 |
05 Apr 18 |
olle |
1027 |
|
4733 |
05 Apr 18 |
olle |
//wellIsValid[index] = true; |
4733 |
05 Apr 18 |
olle |
if (!boxType || boxType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
1030 |
{ |
4733 |
05 Apr 18 |
olle |
wellIsValid[index] = false; |
4733 |
05 Apr 18 |
olle |
1032 |
} |
4733 |
05 Apr 18 |
olle |
else if (boxType && boxType == 'DNA') |
4733 |
05 Apr 18 |
olle |
1034 |
{ |
4733 |
05 Apr 18 |
olle |
dnaWellIsValid[index] = false; |
4733 |
05 Apr 18 |
olle |
1036 |
} |
4733 |
05 Apr 18 |
olle |
else if (boxType && boxType == 'RNA') |
4733 |
05 Apr 18 |
olle |
1038 |
{ |
4733 |
05 Apr 18 |
olle |
rnaWellIsValid[index] = false; |
4733 |
05 Apr 18 |
olle |
1040 |
} |
4733 |
05 Apr 18 |
olle |
else |
4733 |
05 Apr 18 |
olle |
1042 |
{ |
4733 |
05 Apr 18 |
olle |
wellIsValid[index] = false; |
4733 |
05 Apr 18 |
olle |
1044 |
} |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
4733 |
05 Apr 18 |
olle |
1046 |
/* |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('position.'+index); |
4733 |
05 Apr 18 |
olle |
1048 |
*/ |
4733 |
05 Apr 18 |
olle |
1049 |
|
4733 |
05 Apr 18 |
olle |
if (box == '') |
4733 |
05 Apr 18 |
olle |
1051 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing box'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1054 |
} |
4733 |
05 Apr 18 |
olle |
1055 |
|
4733 |
05 Apr 18 |
olle |
// Position errors are reported on box message line |
4733 |
05 Apr 18 |
olle |
if (row == '') |
4733 |
05 Apr 18 |
olle |
1058 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing row'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1061 |
} |
4733 |
05 Apr 18 |
olle |
1062 |
|
4733 |
05 Apr 18 |
olle |
if (column == '') |
4733 |
05 Apr 18 |
olle |
1064 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing column'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1067 |
} |
4733 |
05 Apr 18 |
olle |
1068 |
|
4733 |
05 Apr 18 |
olle |
// Check for duplicates |
4733 |
05 Apr 18 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
4733 |
05 Apr 18 |
olle |
for (var i=0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
1072 |
{ |
4733 |
05 Apr 18 |
olle |
if (i != index) |
4733 |
05 Apr 18 |
olle |
1074 |
{ |
4733 |
05 Apr 18 |
olle |
if (box == frm.elements[boxPrefix+i].value && row == frm[rowPrefix+i].value && column == frm[columnPrefix+i].value) |
4733 |
05 Apr 18 |
olle |
1076 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'The position is already used once in this wizard'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1079 |
} |
4733 |
05 Apr 18 |
olle |
1080 |
} |
4733 |
05 Apr 18 |
olle |
1081 |
} |
4733 |
05 Apr 18 |
olle |
1082 |
|
4733 |
05 Apr 18 |
olle |
//Wizard.setInputStatus('position.'+index, 'checking', 'Checking...'); |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'checking', 'Checking...'); |
4733 |
05 Apr 18 |
olle |
1085 |
|
4733 |
05 Apr 18 |
olle |
// Seems to be ok -- check if used by another sample |
4733 |
05 Apr 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4733 |
05 Apr 18 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=ValidateWell'; |
4733 |
05 Apr 18 |
olle |
url += '&box=' + encodeURIComponent(box); |
4733 |
05 Apr 18 |
olle |
url += '&row=' + encodeURIComponent(row); |
4733 |
05 Apr 18 |
olle |
url += '&column=' + encodeURIComponent(column); |
4733 |
05 Apr 18 |
olle |
1093 |
|
4733 |
05 Apr 18 |
olle |
Wizard.asyncJsonRequest(url, function(response) { streg.onBoxValidated(response, boxType, index) } ); |
4733 |
05 Apr 18 |
olle |
1095 |
} |
4733 |
05 Apr 18 |
olle |
1096 |
|
4733 |
05 Apr 18 |
olle |
streg.onBoxValidated = function(response, boxType, index) |
4733 |
05 Apr 18 |
olle |
1098 |
{ |
4733 |
05 Apr 18 |
olle |
// Get well position prefixes, default is for input tubes |
4733 |
05 Apr 18 |
olle |
var boxPrefix = 'box.'; |
4733 |
05 Apr 18 |
olle |
if (boxType && boxType == 'DNA') |
4733 |
05 Apr 18 |
olle |
1102 |
{ |
4733 |
05 Apr 18 |
olle |
boxPrefix = 'dnaBox.'; |
4733 |
05 Apr 18 |
olle |
1104 |
} |
4733 |
05 Apr 18 |
olle |
if (boxType && boxType == 'RNA') |
4733 |
05 Apr 18 |
olle |
1106 |
{ |
4733 |
05 Apr 18 |
olle |
boxPrefix = 'rnaBox.'; |
4733 |
05 Apr 18 |
olle |
1108 |
} |
4733 |
05 Apr 18 |
olle |
1109 |
|
4733 |
05 Apr 18 |
olle |
//Wizard.setInputStatus('position.'+index); |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
4733 |
05 Apr 18 |
olle |
if (response.message) |
4733 |
05 Apr 18 |
olle |
1113 |
{ |
4733 |
05 Apr 18 |
olle |
//Wizard.setInputStatus(response.box ? 'box.'+index : 'position.'+index, 'invalid', Strings.encodeTags(response.message)); |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', Strings.encodeTags(response.message)); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1117 |
} |
4733 |
05 Apr 18 |
olle |
1118 |
|
4733 |
05 Apr 18 |
olle |
//wellIsValid[index] = true; |
4733 |
05 Apr 18 |
olle |
if (!boxType || boxType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
1121 |
{ |
4733 |
05 Apr 18 |
olle |
wellIsValid[index] = true; |
4733 |
05 Apr 18 |
olle |
1123 |
} |
4733 |
05 Apr 18 |
olle |
else if (boxType && boxType == 'DNA') |
4733 |
05 Apr 18 |
olle |
1125 |
{ |
4733 |
05 Apr 18 |
olle |
dnaWellIsValid[index] = true; |
4733 |
05 Apr 18 |
olle |
1127 |
} |
4733 |
05 Apr 18 |
olle |
else if (boxType && boxType == 'RNA') |
4733 |
05 Apr 18 |
olle |
1129 |
{ |
4733 |
05 Apr 18 |
olle |
rnaWellIsValid[index] = true; |
4733 |
05 Apr 18 |
olle |
1131 |
} |
4733 |
05 Apr 18 |
olle |
else |
4733 |
05 Apr 18 |
olle |
1133 |
{ |
4733 |
05 Apr 18 |
olle |
wellIsValid[index] = true; |
4733 |
05 Apr 18 |
olle |
1135 |
} |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'valid'); |
4733 |
05 Apr 18 |
olle |
1137 |
/* |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('position.'+index, 'valid'); |
4733 |
05 Apr 18 |
olle |
1139 |
*/ |
4733 |
05 Apr 18 |
olle |
1140 |
} |
4733 |
05 Apr 18 |
olle |
1141 |
|
4733 |
05 Apr 18 |
olle |
1142 |
|
4733 |
05 Apr 18 |
olle |
streg.nofSectionsOnChange = function(event) |
4733 |
05 Apr 18 |
olle |
1144 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var target = event.currentTarget; |
4733 |
05 Apr 18 |
olle |
1147 |
|
4733 |
05 Apr 18 |
olle |
var index = Data.int(target, 'index'); |
4733 |
05 Apr 18 |
olle |
var nofSections = frm['nofSections.'+index].value; |
4733 |
05 Apr 18 |
olle |
1150 |
|
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofSections.'+index); |
4733 |
05 Apr 18 |
olle |
1152 |
|
4733 |
05 Apr 18 |
olle |
if (nofSections == '') |
4733 |
05 Apr 18 |
olle |
1154 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofSections'+index, 'invalid', 'Missing'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1157 |
} |
4733 |
05 Apr 18 |
olle |
if (parseInt(nofSections) < 1) |
4733 |
05 Apr 18 |
olle |
1159 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofSections'+index, 'invalid', 'Must be at least 1'); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1162 |
} |
4733 |
05 Apr 18 |
olle |
Wizard.setInputStatus('nofSections'+index, 'valid'); |
4733 |
05 Apr 18 |
olle |
1164 |
} |
4733 |
05 Apr 18 |
olle |
1165 |
|
4733 |
05 Apr 18 |
olle |
streg.validateStep3 = function(event) |
4733 |
05 Apr 18 |
olle |
1167 |
{ |
4733 |
05 Apr 18 |
olle |
var valid = false; |
4733 |
05 Apr 18 |
olle |
1169 |
|
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
var tubeContentType = frm.tubeContentType.value; |
4733 |
05 Apr 18 |
olle |
if (tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
1173 |
{ |
4733 |
05 Apr 18 |
olle |
for (var i = 0; i < wellIsValid.length; i++) |
4733 |
05 Apr 18 |
olle |
1175 |
{ |
4733 |
05 Apr 18 |
olle |
// No storage space is allocated for first specimen, |
4733 |
05 Apr 18 |
olle |
// since all amount is expected to be used for analysis. |
4733 |
05 Apr 18 |
olle |
// Specimen tube with i == 0 is therefore skipped. |
4733 |
05 Apr 18 |
olle |
if (i > 0) |
4733 |
05 Apr 18 |
olle |
1180 |
{ |
4733 |
05 Apr 18 |
olle |
if (!wellIsValid[i]) |
4733 |
05 Apr 18 |
olle |
1182 |
{ |
4733 |
05 Apr 18 |
olle |
event.preventDefault(); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1185 |
} |
4733 |
05 Apr 18 |
olle |
1186 |
} |
4733 |
05 Apr 18 |
olle |
if (!dnaWellIsValid[i]) |
4733 |
05 Apr 18 |
olle |
1188 |
{ |
4733 |
05 Apr 18 |
olle |
event.preventDefault(); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1191 |
} |
4733 |
05 Apr 18 |
olle |
if (!rnaWellIsValid[i]) |
4733 |
05 Apr 18 |
olle |
1193 |
{ |
4733 |
05 Apr 18 |
olle |
event.preventDefault(); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1196 |
} |
4733 |
05 Apr 18 |
olle |
1197 |
} |
4733 |
05 Apr 18 |
olle |
1198 |
} |
4733 |
05 Apr 18 |
olle |
else |
4733 |
05 Apr 18 |
olle |
1200 |
{ |
4733 |
05 Apr 18 |
olle |
// Input DNA, RNA, or DNA + RNA |
4733 |
05 Apr 18 |
olle |
for (var i = 0; i < wellIsValid.length; i++) |
4733 |
05 Apr 18 |
olle |
1203 |
{ |
4733 |
05 Apr 18 |
olle |
if (!wellIsValid[i]) |
4733 |
05 Apr 18 |
olle |
1205 |
{ |
4733 |
05 Apr 18 |
olle |
event.preventDefault(); |
4733 |
05 Apr 18 |
olle |
return; |
4733 |
05 Apr 18 |
olle |
1208 |
} |
4733 |
05 Apr 18 |
olle |
1209 |
} |
4733 |
05 Apr 18 |
olle |
1210 |
} |
4733 |
05 Apr 18 |
olle |
1211 |
} |
4733 |
05 Apr 18 |
olle |
1212 |
|
4733 |
05 Apr 18 |
olle |
1213 |
|
4733 |
05 Apr 18 |
olle |
streg.submit = function() |
4733 |
05 Apr 18 |
olle |
1215 |
{ |
4733 |
05 Apr 18 |
olle |
var frm = document.forms['meludi']; |
4733 |
05 Apr 18 |
olle |
1217 |
|
4733 |
05 Apr 18 |
olle |
caseInfo.pad = frm.pad.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.arrivalDate = Strings.trim(frm.arrivalDate.value); |
4733 |
05 Apr 18 |
olle |
caseInfo.samplingDate = Strings.trim(frm.samplingDate.value); |
4779 |
20 Apr 18 |
olle |
1221 |
/* |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisKras = frm.mutationAnalysisKras.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisNras = frm.mutationAnalysisNras.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisBraf = frm.mutationAnalysisBraf.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisEgfr = frm.mutationAnalysisEgfr.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisAlkEml4 = frm.mutationAnalysisAlkEml4.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisPdgfra = frm.mutationAnalysisPdgfra.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisKit = frm.mutationAnalysisKit.checked; |
4779 |
20 Apr 18 |
olle |
1229 |
*/ |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisTst170 = frm.mutationAnalysisTst170.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.mutationAnalysisOther = frm.mutationAnalysisOther.checked; |
4733 |
05 Apr 18 |
olle |
caseInfo.site = frm.site.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.tubeContentType = frm.tubeContentType.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.specimenType = frm.specimenType.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.specimenInputType = frm.specimenInputType.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.projectFocus = frm.projectFocus.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.metastasisSite = frm.metastasisSite.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.viableTumourCellsPercent = frm.viableTumourCellsPercent.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.otherPathNote = frm.otherPathNote.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.extractsFromFirstSpecimenOnly = frm.extractsFromFirstSpecimenOnlyCB.checked; |
4733 |
05 Apr 18 |
olle |
1241 |
|
4733 |
05 Apr 18 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
4733 |
05 Apr 18 |
olle |
caseInfo.specimen = []; |
4733 |
05 Apr 18 |
olle |
for (var i = 0; i < nofTubes; i++) |
4733 |
05 Apr 18 |
olle |
1245 |
{ |
4733 |
05 Apr 18 |
olle |
var specimenTube ={}; |
4733 |
05 Apr 18 |
olle |
specimenTube.name = streg.fetchTubeName(caseInfo.tubeContentType, caseInfo, i); |
4733 |
05 Apr 18 |
olle |
specimenTube.box = frm['box.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.row = frm['row.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.column = frm['column.'+i].value; |
4733 |
05 Apr 18 |
olle |
var nofSections = null; |
4733 |
05 Apr 18 |
olle |
if (caseInfo.tubeContentType == 'Specimen') |
4733 |
05 Apr 18 |
olle |
1253 |
{ |
4733 |
05 Apr 18 |
olle |
if (i == 0 || !caseInfo.extractsFromFirstSpecimenOnly) |
4733 |
05 Apr 18 |
olle |
1255 |
{ |
4733 |
05 Apr 18 |
olle |
// Storage position for DNA extract from specimen |
4733 |
05 Apr 18 |
olle |
specimenTube.dnaBox = frm['dnaBox.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.dnaRow = frm['dnaRow.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.dnaColumn = frm['dnaColumn.'+i].value; |
4733 |
05 Apr 18 |
olle |
1260 |
|
4733 |
05 Apr 18 |
olle |
// Storage position for RNA extract from specimen |
4733 |
05 Apr 18 |
olle |
specimenTube.rnaBox = frm['rnaBox.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.rnaRow = frm['rnaRow.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.rnaColumn = frm['rnaColumn.'+i].value; |
4733 |
05 Apr 18 |
olle |
1265 |
} |
4733 |
05 Apr 18 |
olle |
1266 |
|
4733 |
05 Apr 18 |
olle |
nofSections = frm['nofSections.'+i].value; |
4733 |
05 Apr 18 |
olle |
1268 |
} |
4733 |
05 Apr 18 |
olle |
specimenTube.nofSections = nofSections; |
4733 |
05 Apr 18 |
olle |
specimenTube.comment = frm['comment.'+i].value; |
4733 |
05 Apr 18 |
olle |
specimenTube.specimenType = frm.specimenType.value; |
4733 |
05 Apr 18 |
olle |
specimenTube.specimenInputType = frm.specimenInputType.value; |
4733 |
05 Apr 18 |
olle |
caseInfo.specimen[i] = specimenTube; |
4733 |
05 Apr 18 |
olle |
1274 |
} |
4733 |
05 Apr 18 |
olle |
1275 |
|
4733 |
05 Apr 18 |
olle |
var submitInfo = {}; |
4733 |
05 Apr 18 |
olle |
submitInfo.caseInfo = caseInfo; |
4733 |
05 Apr 18 |
olle |
1278 |
|
4733 |
05 Apr 18 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
4733 |
05 Apr 18 |
olle |
url += '&cmd=CreateSpecimenTubes'; |
4733 |
05 Apr 18 |
olle |
Wizard.showLoadingAnimation('Performing registration...'); |
4733 |
05 Apr 18 |
olle |
Wizard.asyncJsonRequest(url, streg.submissionResults, 'POST', JSON.stringify(submitInfo)); |
4733 |
05 Apr 18 |
olle |
1283 |
} |
4733 |
05 Apr 18 |
olle |
1284 |
|
4733 |
05 Apr 18 |
olle |
streg.submissionResults = function(response) |
4733 |
05 Apr 18 |
olle |
1286 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.showFinalMessage(response.messages); |
4733 |
05 Apr 18 |
olle |
Doc.show('gorestart'); |
4733 |
05 Apr 18 |
olle |
Doc.show('gonext-message'); |
4733 |
05 Apr 18 |
olle |
1290 |
} |
4733 |
05 Apr 18 |
olle |
1291 |
|
4733 |
05 Apr 18 |
olle |
streg.countDownToRestart = function() |
4733 |
05 Apr 18 |
olle |
1293 |
{ |
4733 |
05 Apr 18 |
olle |
var time = restartAt - (new Date()).getTime(); |
4733 |
05 Apr 18 |
olle |
if (time < 0) |
4733 |
05 Apr 18 |
olle |
1296 |
{ |
4733 |
05 Apr 18 |
olle |
Wizard.restartWizard(); |
4733 |
05 Apr 18 |
olle |
1298 |
} |
4733 |
05 Apr 18 |
olle |
else |
4733 |
05 Apr 18 |
olle |
1300 |
{ |
4733 |
05 Apr 18 |
olle |
Doc.element('gonext-message').innerHTML = '<i>Wizard will restart automatically in ' + Math.ceil(time/1000) + ' seconds...</i>'; |
4733 |
05 Apr 18 |
olle |
1302 |
} |
4733 |
05 Apr 18 |
olle |
1303 |
} |
4733 |
05 Apr 18 |
olle |
1304 |
|
4733 |
05 Apr 18 |
olle |
streg.stopAutoRestart = function() |
4733 |
05 Apr 18 |
olle |
1306 |
{ |
4733 |
05 Apr 18 |
olle |
clearTimeout(restartTimer); |
4733 |
05 Apr 18 |
olle |
Doc.hide('gonext-message'); |
4733 |
05 Apr 18 |
olle |
Doc.hide('gostop'); |
4733 |
05 Apr 18 |
olle |
1310 |
} |
4733 |
05 Apr 18 |
olle |
1311 |
|
4733 |
05 Apr 18 |
olle |
streg.getCheckboxStatus = function(checkbox) |
4733 |
05 Apr 18 |
olle |
1313 |
{ |
4733 |
05 Apr 18 |
olle |
return checkbox.checked; |
4733 |
05 Apr 18 |
olle |
1315 |
} |
4733 |
05 Apr 18 |
olle |
1316 |
|
4733 |
05 Apr 18 |
olle |
return streg; |
4733 |
05 Apr 18 |
olle |
1318 |
}(); |
4733 |
05 Apr 18 |
olle |
1319 |
|
4733 |
05 Apr 18 |
olle |
Doc.onLoad(SpecimenTubeReg.initPage); |
4733 |
05 Apr 18 |
olle |
1321 |
|