2933 |
14 Nov 14 |
olle |
var SpecimenTubeReg = function() |
2933 |
14 Nov 14 |
olle |
2 |
{ |
2933 |
14 Nov 14 |
olle |
var streg = {}; |
2933 |
14 Nov 14 |
olle |
var debug = 0; |
4198 |
31 Oct 16 |
olle |
var myPermissions = {}; |
2933 |
14 Nov 14 |
olle |
6 |
|
2933 |
14 Nov 14 |
olle |
var caseInfo; |
2933 |
14 Nov 14 |
olle |
8 |
|
4147 |
03 Oct 16 |
olle |
var sampleItemPrefix = ''; |
4224 |
09 Nov 16 |
olle |
var sampleItemNumDigits = 5; |
2933 |
14 Nov 14 |
olle |
var nofTubesIsValid = false; |
2933 |
14 Nov 14 |
olle |
var samplingDateIsValid = true; |
3106 |
26 Jan 15 |
olle |
var viableTumourCellsPercentIsValid = true; |
4723 |
29 Mar 18 |
olle |
var usesSitePrefix = false; |
2933 |
14 Nov 14 |
olle |
15 |
|
3276 |
29 Apr 15 |
olle |
// Well validation variable for input specimen, DNA, RNA |
2933 |
14 Nov 14 |
olle |
var wellIsValid = []; |
3276 |
29 Apr 15 |
olle |
// Well validation variables for extracts from specimen |
3276 |
29 Apr 15 |
olle |
var dnaWellIsValid = []; |
3276 |
29 Apr 15 |
olle |
var rnaWellIsValid = []; |
2933 |
14 Nov 14 |
olle |
21 |
|
2933 |
14 Nov 14 |
olle |
var restartTimer; |
2933 |
14 Nov 14 |
olle |
var restartAt; |
2933 |
14 Nov 14 |
olle |
24 |
|
2933 |
14 Nov 14 |
olle |
// Page initialization |
2933 |
14 Nov 14 |
olle |
streg.initPage = function() |
2933 |
14 Nov 14 |
olle |
27 |
{ |
2933 |
14 Nov 14 |
olle |
// Step 1 |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', streg.validateStep1); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('caseName', 'keypress', Wizard.goNextOnTabOrEnter); |
2933 |
14 Nov 14 |
olle |
31 |
|
2933 |
14 Nov 14 |
olle |
// Step 2 |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('step-2', 'wizard-initialize', streg.initializeStep2); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', streg.validateStep2); |
4198 |
31 Oct 16 |
olle |
Events.addEventHandler('pad', 'blur', streg.padOnChange); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('nofTubes', 'keypress', Events.integerOnly); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('nofTubes', 'blur', streg.nofTubesOnChange); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('arrivalDate', 'blur', Wizard.validateDate); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('samplingDate', 'blur', streg.samplingDateOnChange); |
3232 |
08 Apr 15 |
olle |
Events.addEventHandler('projectFocus', 'change', streg.projectFocusOnChange); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('site', 'change', streg.siteOnChange); |
3028 |
11 Dec 14 |
olle |
Events.addEventHandler('specimenType', 'change', streg.specimenTypeOnChange); |
3067 |
08 Jan 15 |
olle |
Events.addEventHandler('viableTumourCellsPercent', 'keypress', Events.integerOnly); |
3067 |
08 Jan 15 |
olle |
Events.addEventHandler('viableTumourCellsPercent', 'blur', streg.viableTumourCellsPercentOnChange); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('otherPathNote', 'keypress', Wizard.goNextOnTab); |
3249 |
14 Apr 15 |
olle |
Buttons.addClickHandler('selectAllMutationAnalysis', streg.mutationAnalysisSelectAll); |
2933 |
14 Nov 14 |
olle |
47 |
|
2933 |
14 Nov 14 |
olle |
// Step 3 |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('step-3', 'wizard-initialize', streg.initializeStep3); |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('step-3', 'wizard-validate', streg.validateStep3); |
2933 |
14 Nov 14 |
olle |
51 |
|
2933 |
14 Nov 14 |
olle |
// Navigation |
2933 |
14 Nov 14 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
2933 |
14 Nov 14 |
olle |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
2933 |
14 Nov 14 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
2933 |
14 Nov 14 |
olle |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
2933 |
14 Nov 14 |
olle |
Buttons.addClickHandler('gostop', streg.stopAutoRestart); |
2933 |
14 Nov 14 |
olle |
58 |
|
2933 |
14 Nov 14 |
olle |
// Final registration |
2933 |
14 Nov 14 |
olle |
Events.addEventHandler('wizard', 'wizard-submit', streg.submit); |
2933 |
14 Nov 14 |
olle |
61 |
|
4198 |
31 Oct 16 |
olle |
// Load permissions |
4198 |
31 Oct 16 |
olle |
streg.initPermissions(); |
4161 |
18 Oct 16 |
olle |
// Load configuration |
4161 |
18 Oct 16 |
olle |
streg.loadConfiguration(); |
4161 |
18 Oct 16 |
olle |
66 |
} |
4161 |
18 Oct 16 |
olle |
67 |
|
4198 |
31 Oct 16 |
olle |
streg.initPermissions = function() |
4198 |
31 Oct 16 |
olle |
69 |
{ |
4198 |
31 Oct 16 |
olle |
// Get permission information |
4198 |
31 Oct 16 |
olle |
var url = '../Install.servlet?ID='+App.getSessionId(); |
4198 |
31 Oct 16 |
olle |
url += '&cmd=GetPermissions'; |
4198 |
31 Oct 16 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4198 |
31 Oct 16 |
olle |
request.open("GET", url, true); |
4198 |
31 Oct 16 |
olle |
Ajax.setReadyStateHandler(request, streg.onPermissionsLoaded, streg.onPermissionsLoaded); |
4198 |
31 Oct 16 |
olle |
request.send(null); |
4198 |
31 Oct 16 |
olle |
77 |
} |
4198 |
31 Oct 16 |
olle |
78 |
|
4198 |
31 Oct 16 |
olle |
// Callback when permission information is ready |
4198 |
31 Oct 16 |
olle |
streg.onPermissionsLoaded = function(request) |
4198 |
31 Oct 16 |
olle |
81 |
{ |
4198 |
31 Oct 16 |
olle |
if (debug) App.debug(Strings.encodeTags(request.responseText)); |
4198 |
31 Oct 16 |
olle |
var response; |
4198 |
31 Oct 16 |
olle |
var error = false; |
4198 |
31 Oct 16 |
olle |
try |
4198 |
31 Oct 16 |
olle |
86 |
{ |
4198 |
31 Oct 16 |
olle |
response = JSON.parse(request.responseText); |
4198 |
31 Oct 16 |
olle |
if (response.status != 'ok') |
4198 |
31 Oct 16 |
olle |
89 |
{ |
4198 |
31 Oct 16 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
4198 |
31 Oct 16 |
olle |
91 |
} |
4198 |
31 Oct 16 |
olle |
92 |
} |
4198 |
31 Oct 16 |
olle |
catch (ex) |
4198 |
31 Oct 16 |
olle |
94 |
{ |
4198 |
31 Oct 16 |
olle |
error = ex; |
4198 |
31 Oct 16 |
olle |
96 |
} |
4198 |
31 Oct 16 |
olle |
97 |
|
4198 |
31 Oct 16 |
olle |
if (error) |
4198 |
31 Oct 16 |
olle |
99 |
{ |
4198 |
31 Oct 16 |
olle |
alert(error); |
4198 |
31 Oct 16 |
olle |
return; |
4198 |
31 Oct 16 |
olle |
102 |
} |
4198 |
31 Oct 16 |
olle |
103 |
|
4198 |
31 Oct 16 |
olle |
myPermissions = response.permissions; |
4198 |
31 Oct 16 |
olle |
//var isAdmin = myPermissions['Administrator'] == 1; |
4198 |
31 Oct 16 |
olle |
//var noProjectIsActive = !App.getActiveProjectId(); |
4198 |
31 Oct 16 |
olle |
107 |
} |
4198 |
31 Oct 16 |
olle |
108 |
|
4161 |
18 Oct 16 |
olle |
streg.loadConfiguration = function() |
4161 |
18 Oct 16 |
olle |
110 |
{ |
4161 |
18 Oct 16 |
olle |
var url = '../Session.servlet?ID='+App.getSessionId(); |
4161 |
18 Oct 16 |
olle |
url += '&cmd=GetConfiguration' |
4161 |
18 Oct 16 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4161 |
18 Oct 16 |
olle |
request.open("GET", url, true); |
4161 |
18 Oct 16 |
olle |
Ajax.setReadyStateHandler(request, streg.onConfiguration, streg.onConfiguration); |
4161 |
18 Oct 16 |
olle |
request.send(null); |
4161 |
18 Oct 16 |
olle |
117 |
} |
4161 |
18 Oct 16 |
olle |
118 |
|
4161 |
18 Oct 16 |
olle |
streg.onConfiguration = function(request) |
4161 |
18 Oct 16 |
olle |
120 |
{ |
4161 |
18 Oct 16 |
olle |
var frm = document.forms['meludi']; |
4161 |
18 Oct 16 |
olle |
122 |
|
4161 |
18 Oct 16 |
olle |
if (debug) |
4161 |
18 Oct 16 |
olle |
124 |
{ |
4161 |
18 Oct 16 |
olle |
App.debug(Strings.encodeTags(request.responseText)); |
4161 |
18 Oct 16 |
olle |
126 |
} |
4161 |
18 Oct 16 |
olle |
127 |
|
4161 |
18 Oct 16 |
olle |
var response; |
4161 |
18 Oct 16 |
olle |
var error = false; |
4161 |
18 Oct 16 |
olle |
try |
4161 |
18 Oct 16 |
olle |
131 |
{ |
4161 |
18 Oct 16 |
olle |
response = JSON.parse(request.responseText); |
4161 |
18 Oct 16 |
olle |
if (response.status != 'ok') |
4161 |
18 Oct 16 |
olle |
134 |
{ |
4161 |
18 Oct 16 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
4161 |
18 Oct 16 |
olle |
136 |
} |
4161 |
18 Oct 16 |
olle |
137 |
} |
4161 |
18 Oct 16 |
olle |
catch (ex) |
4161 |
18 Oct 16 |
olle |
139 |
{ |
4161 |
18 Oct 16 |
olle |
error = ex; |
4161 |
18 Oct 16 |
olle |
141 |
} |
4161 |
18 Oct 16 |
olle |
if (error) App.debug(error); |
4161 |
18 Oct 16 |
olle |
143 |
|
4161 |
18 Oct 16 |
olle |
// Get configuration result |
4161 |
18 Oct 16 |
olle |
var conf = response.configuration; |
4723 |
29 Mar 18 |
olle |
// Check for uses site prefix flag |
4723 |
29 Mar 18 |
olle |
usesSitePrefix = conf.usesSitePrefix; |
4161 |
18 Oct 16 |
olle |
// Check for project focus default |
4161 |
18 Oct 16 |
olle |
var projectFocusDefault = conf.projectFocusDefault; |
4161 |
18 Oct 16 |
olle |
if (projectFocusDefault != null) |
4161 |
18 Oct 16 |
olle |
151 |
{ |
4161 |
18 Oct 16 |
olle |
frm.projectFocus.value = projectFocusDefault; |
4161 |
18 Oct 16 |
olle |
streg.projectFocusOnChange(); |
4161 |
18 Oct 16 |
olle |
154 |
} |
4195 |
31 Oct 16 |
olle |
// Check for specimen type default |
4161 |
18 Oct 16 |
olle |
var specimenTypeDefault = conf.specimenTypeDefault; |
4161 |
18 Oct 16 |
olle |
if (specimenTypeDefault != null) |
4161 |
18 Oct 16 |
olle |
158 |
{ |
4161 |
18 Oct 16 |
olle |
frm.specimenType.value = specimenTypeDefault; |
4161 |
18 Oct 16 |
olle |
160 |
} |
4195 |
31 Oct 16 |
olle |
// Check for specimen input type default |
4195 |
31 Oct 16 |
olle |
var specimenInputTypeDefault = conf.specimenInputTypeDefault; |
4195 |
31 Oct 16 |
olle |
if (specimenInputTypeDefault != null) |
4195 |
31 Oct 16 |
olle |
164 |
{ |
4195 |
31 Oct 16 |
olle |
frm.specimenInputType.value = specimenInputTypeDefault; |
4195 |
31 Oct 16 |
olle |
166 |
} |
4248 |
22 Nov 16 |
olle |
// Check for extracts from first specimen only default |
4248 |
22 Nov 16 |
olle |
var extractsFromFirstSpecimenOnlyDefault = conf.extractsFromFirstSpecimenOnlyDefault; |
4248 |
22 Nov 16 |
olle |
if (extractsFromFirstSpecimenOnlyDefault != null) |
4248 |
22 Nov 16 |
olle |
170 |
{ |
4248 |
22 Nov 16 |
olle |
frm.extractsFromFirstSpecimenOnlyCB.checked = extractsFromFirstSpecimenOnlyDefault; |
4248 |
22 Nov 16 |
olle |
172 |
} |
4161 |
18 Oct 16 |
olle |
173 |
|
4161 |
18 Oct 16 |
olle |
// Continue with initializing info for case |
3148 |
26 Feb 15 |
olle |
var url = '../LabelGeneration.servlet?ID='+App.getSessionId(); |
3148 |
26 Feb 15 |
olle |
url += '&cmd=CountCases'; |
3148 |
26 Feb 15 |
olle |
Wizard.showLoadingAnimation('Loading cases...'); |
3148 |
26 Feb 15 |
olle |
Wizard.asyncJsonRequest(url, streg.caseInfoLoadedStep1); |
3148 |
26 Feb 15 |
olle |
179 |
} |
3148 |
26 Feb 15 |
olle |
180 |
|
3148 |
26 Feb 15 |
olle |
streg.caseInfoLoadedStep1 = function(response) |
3148 |
26 Feb 15 |
olle |
182 |
{ |
3148 |
26 Feb 15 |
olle |
var frm = document.forms['meludi']; |
3148 |
26 Feb 15 |
olle |
184 |
|
4198 |
31 Oct 16 |
olle |
// Disable PAD/CL input field if not Administrator or PatientCurator |
4198 |
31 Oct 16 |
olle |
var isAdmin = myPermissions['Administrator'] == 1; |
4198 |
31 Oct 16 |
olle |
var isPatCur = myPermissions['PatientCurator'] == 1; |
4198 |
31 Oct 16 |
olle |
if (!isAdmin && !isPatCur) |
4198 |
31 Oct 16 |
olle |
189 |
{ |
4198 |
31 Oct 16 |
olle |
frm.pad.disabled = true; |
4198 |
31 Oct 16 |
olle |
191 |
} |
4198 |
31 Oct 16 |
olle |
192 |
|
4147 |
03 Oct 16 |
olle |
sampleItemPrefix = response.sampleItemPrefix; |
4224 |
09 Nov 16 |
olle |
sampleItemNumDigits = response.sampleItemNumDigits; |
3148 |
26 Feb 15 |
olle |
var nofCases = response.count; |
3148 |
26 Feb 15 |
olle |
if (nofCases == null) |
3148 |
26 Feb 15 |
olle |
197 |
{ |
3148 |
26 Feb 15 |
olle |
nofCases = 0; |
3148 |
26 Feb 15 |
olle |
199 |
} |
3148 |
26 Feb 15 |
olle |
var startNum = nofCases + 1; |
4224 |
09 Nov 16 |
olle |
// Pad number with leading zeros to get right number of digits |
4224 |
09 Nov 16 |
olle |
startNum = String('0000000000' + startNum).slice(-sampleItemNumDigits); |
4147 |
03 Oct 16 |
olle |
var startCase = sampleItemPrefix + startNum; |
4723 |
29 Mar 18 |
olle |
if (usesSitePrefix != null && usesSitePrefix) |
4723 |
29 Mar 18 |
olle |
205 |
{ |
4723 |
29 Mar 18 |
olle |
startCase = ''; |
4723 |
29 Mar 18 |
olle |
207 |
} |
3148 |
26 Feb 15 |
olle |
frm.caseName.value = startCase; |
4224 |
09 Nov 16 |
olle |
Doc.element('caseNameText').innerHTML = 'The case name (barcode) associated with this specimen tube ("' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits).'; |
3148 |
26 Feb 15 |
olle |
210 |
|
2933 |
14 Nov 14 |
olle |
Doc.show('step-1'); |
2933 |
14 Nov 14 |
olle |
Doc.show('gonext'); |
2933 |
14 Nov 14 |
olle |
213 |
} |
2933 |
14 Nov 14 |
olle |
214 |
|
2933 |
14 Nov 14 |
olle |
streg.validateStep1 = function(event) |
2933 |
14 Nov 14 |
olle |
216 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
218 |
|
2933 |
14 Nov 14 |
olle |
var caseName = frm.caseName.value; |
2933 |
14 Nov 14 |
olle |
var caseIsValid = false; |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('caseName'); |
2933 |
14 Nov 14 |
olle |
if (caseName == '') |
2933 |
14 Nov 14 |
olle |
223 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Missing'); |
2933 |
14 Nov 14 |
olle |
frm.caseName.focus(); |
2933 |
14 Nov 14 |
olle |
226 |
} |
4224 |
09 Nov 16 |
olle |
else if (!Meludi.isValidCaseName2(caseName, sampleItemPrefix, sampleItemNumDigits)) |
2933 |
14 Nov 14 |
olle |
228 |
{ |
4224 |
09 Nov 16 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Only name = "' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits is allowed.'); |
2933 |
14 Nov 14 |
olle |
frm.caseName.focus(); |
2933 |
14 Nov 14 |
olle |
231 |
} |
2933 |
14 Nov 14 |
olle |
else |
2933 |
14 Nov 14 |
olle |
233 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('caseName', 'valid'); |
2933 |
14 Nov 14 |
olle |
caseIsValid = true; |
2933 |
14 Nov 14 |
olle |
236 |
} |
2933 |
14 Nov 14 |
olle |
237 |
|
2933 |
14 Nov 14 |
olle |
// If not valid, we prevent the wizard from moving to the next step |
2933 |
14 Nov 14 |
olle |
if (!caseIsValid) event.preventDefault(); |
2933 |
14 Nov 14 |
olle |
240 |
} |
2933 |
14 Nov 14 |
olle |
241 |
|
2933 |
14 Nov 14 |
olle |
streg.initializeStep2 = function() |
2933 |
14 Nov 14 |
olle |
243 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
var caseName = frm.caseName.value; |
2933 |
14 Nov 14 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
2933 |
14 Nov 14 |
olle |
url += '&cmd=GetCaseInfo'; |
2933 |
14 Nov 14 |
olle |
url += '&caseName=' + encodeURIComponent(caseName); |
2933 |
14 Nov 14 |
olle |
249 |
|
2933 |
14 Nov 14 |
olle |
Wizard.showLoadingAnimation('Loading information about case...'); |
2933 |
14 Nov 14 |
olle |
Wizard.asyncJsonRequest(url, streg.caseInfoLoaded); |
2933 |
14 Nov 14 |
olle |
252 |
} |
3250 |
15 Apr 15 |
olle |
253 |
|
2933 |
14 Nov 14 |
olle |
streg.caseInfoLoaded = function(response) |
2933 |
14 Nov 14 |
olle |
255 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
caseInfo = response.caseInfo; |
2933 |
14 Nov 14 |
olle |
258 |
|
2933 |
14 Nov 14 |
olle |
Wizard.setCurrentStep(2); |
2933 |
14 Nov 14 |
olle |
Doc.show('gocancel'); |
2933 |
14 Nov 14 |
olle |
Doc.show('gonext'); |
2933 |
14 Nov 14 |
olle |
262 |
|
2933 |
14 Nov 14 |
olle |
frm.arrivalDate.value = Dates.formatDate(new Date(), 'yyyyMMdd'); |
2933 |
14 Nov 14 |
olle |
264 |
|
4723 |
29 Mar 18 |
olle |
// If site determined by site prefix in case name, set site default value and disable site menu |
4723 |
29 Mar 18 |
olle |
//alert("specimentube.js:: streg.caseInfoLoaded: caseInfo.siteDefault = " + caseInfo.siteDefault); |
4723 |
29 Mar 18 |
olle |
if (caseInfo.siteDefault != null) |
4723 |
29 Mar 18 |
olle |
268 |
{ |
4723 |
29 Mar 18 |
olle |
frm.site.value = caseInfo.siteDefault; |
4723 |
29 Mar 18 |
olle |
frm.site.disabled = true; |
4723 |
29 Mar 18 |
olle |
271 |
} |
4723 |
29 Mar 18 |
olle |
272 |
|
2933 |
14 Nov 14 |
olle |
frm.nofTubes.focus(); |
2933 |
14 Nov 14 |
olle |
frm.nofTubes.setSelectionRange(0,1); |
2933 |
14 Nov 14 |
olle |
275 |
} |
2933 |
14 Nov 14 |
olle |
276 |
|
4198 |
31 Oct 16 |
olle |
streg.padOnChange = function() |
4198 |
31 Oct 16 |
olle |
278 |
{ |
4198 |
31 Oct 16 |
olle |
var frm = document.forms['meludi']; |
4198 |
31 Oct 16 |
olle |
var PAD = frm.pad.value; |
4198 |
31 Oct 16 |
olle |
if (PAD == '') |
4198 |
31 Oct 16 |
olle |
282 |
{ |
4198 |
31 Oct 16 |
olle |
Wizard.setInputStatus('pad', 'warning', 'Missing'); |
4198 |
31 Oct 16 |
olle |
return; |
4198 |
31 Oct 16 |
olle |
285 |
} |
4198 |
31 Oct 16 |
olle |
frm.pad.value = PAD.replace(/\+/, '-'); |
4198 |
31 Oct 16 |
olle |
Wizard.setInputStatus('pad', 'valid'); |
4198 |
31 Oct 16 |
olle |
288 |
} |
4198 |
31 Oct 16 |
olle |
289 |
|
2933 |
14 Nov 14 |
olle |
streg.nofTubesOnChange = function() |
2933 |
14 Nov 14 |
olle |
291 |
{ |
2933 |
14 Nov 14 |
olle |
nofTubesIsValid = false; |
2933 |
14 Nov 14 |
olle |
293 |
|
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
var nofTubes = frm.nofTubes.value; |
2933 |
14 Nov 14 |
olle |
296 |
|
2933 |
14 Nov 14 |
olle |
if (nofTubes == '') |
2933 |
14 Nov 14 |
olle |
298 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('nofTubes', 'invalid', 'Missing'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
301 |
} |
2933 |
14 Nov 14 |
olle |
if (parseInt(nofTubes) < 1) |
2933 |
14 Nov 14 |
olle |
303 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('nofTubes', 'invalid', 'Must be at least 1'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
306 |
} |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('nofTubes', 'valid'); |
2933 |
14 Nov 14 |
olle |
nofTubesIsValid = true; |
2933 |
14 Nov 14 |
olle |
309 |
} |
2933 |
14 Nov 14 |
olle |
310 |
|
2933 |
14 Nov 14 |
olle |
streg.samplingDateOnChange = function() |
2933 |
14 Nov 14 |
olle |
312 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
314 |
|
2933 |
14 Nov 14 |
olle |
samplingDateIsValid = false; |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('samplingDate'); |
2933 |
14 Nov 14 |
olle |
317 |
|
2933 |
14 Nov 14 |
olle |
var samplingDate = frm.samplingDate.value; |
2933 |
14 Nov 14 |
olle |
319 |
|
2933 |
14 Nov 14 |
olle |
if (samplingDate != '') |
2933 |
14 Nov 14 |
olle |
321 |
{ |
2933 |
14 Nov 14 |
olle |
// Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. |
2933 |
14 Nov 14 |
olle |
samplingDate = Meludi.autoFillDate(samplingDate); |
2933 |
14 Nov 14 |
olle |
frm.samplingDate.value = samplingDate; |
2933 |
14 Nov 14 |
olle |
325 |
|
2933 |
14 Nov 14 |
olle |
var d = Dates.parseString(samplingDate, 'yyyyMMdd'); |
2933 |
14 Nov 14 |
olle |
if (d == null) |
2933 |
14 Nov 14 |
olle |
328 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('samplingDate', 'invalid', 'Not a valid date'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
331 |
} |
2933 |
14 Nov 14 |
olle |
332 |
|
2933 |
14 Nov 14 |
olle |
var today = new Date(); |
2933 |
14 Nov 14 |
olle |
if (d.getTime() > today.getTime()) |
2933 |
14 Nov 14 |
olle |
335 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('samplingDate', 'invalid', 'Future date is not valid'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
338 |
} |
3159 |
04 Mar 15 |
olle |
339 |
|
3159 |
04 Mar 15 |
olle |
var arrivalDate = frm.arrivalDate.value; |
3159 |
04 Mar 15 |
olle |
if (arrivalDate != '' && arrivalDate < samplingDate) |
3159 |
04 Mar 15 |
olle |
342 |
{ |
3159 |
04 Mar 15 |
olle |
Wizard.setInputStatus('samplingDate', 'invalid', 'Arrival date is before sampling date'); |
3159 |
04 Mar 15 |
olle |
return; |
3159 |
04 Mar 15 |
olle |
345 |
} |
3159 |
04 Mar 15 |
olle |
346 |
|
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('samplingDate', 'valid'); |
2933 |
14 Nov 14 |
olle |
348 |
} |
2933 |
14 Nov 14 |
olle |
samplingDateIsValid = true; |
2933 |
14 Nov 14 |
olle |
350 |
} |
2933 |
14 Nov 14 |
olle |
351 |
|
3232 |
08 Apr 15 |
olle |
streg.projectFocusOnChange = function() |
3232 |
08 Apr 15 |
olle |
353 |
{ |
3232 |
08 Apr 15 |
olle |
var frm = document.forms['meludi']; |
3232 |
08 Apr 15 |
olle |
var projectFocus = frm.projectFocus.value; |
3232 |
08 Apr 15 |
olle |
356 |
|
3232 |
08 Apr 15 |
olle |
streg.mutationAnalysisReset(); |
3232 |
08 Apr 15 |
olle |
358 |
|
3232 |
08 Apr 15 |
olle |
if (projectFocus == 'melanoma') |
3232 |
08 Apr 15 |
olle |
360 |
{ |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisNras.checked = true; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisBraf.checked = true; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisKit.checked = true; |
3232 |
08 Apr 15 |
olle |
return; |
3232 |
08 Apr 15 |
olle |
365 |
} |
3232 |
08 Apr 15 |
olle |
if (projectFocus == 'lungcancer') |
3232 |
08 Apr 15 |
olle |
367 |
{ |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisKras.checked = true; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisEgfr.checked = true; |
3232 |
08 Apr 15 |
olle |
return; |
3232 |
08 Apr 15 |
olle |
371 |
} |
3232 |
08 Apr 15 |
olle |
if (projectFocus == 'coloncancer') |
3232 |
08 Apr 15 |
olle |
373 |
{ |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisKras.checked = true; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisNras.checked = true; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisBraf.checked = true; |
3232 |
08 Apr 15 |
olle |
return; |
3232 |
08 Apr 15 |
olle |
378 |
} |
3232 |
08 Apr 15 |
olle |
if (projectFocus == 'GIST') |
3232 |
08 Apr 15 |
olle |
380 |
{ |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisPdgfra.checked = true; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisKit.checked = true; |
3232 |
08 Apr 15 |
olle |
return; |
3232 |
08 Apr 15 |
olle |
384 |
} |
3232 |
08 Apr 15 |
olle |
385 |
} |
3232 |
08 Apr 15 |
olle |
386 |
|
3232 |
08 Apr 15 |
olle |
streg.mutationAnalysisReset = function() |
3232 |
08 Apr 15 |
olle |
388 |
{ |
3232 |
08 Apr 15 |
olle |
var frm = document.forms['meludi']; |
3232 |
08 Apr 15 |
olle |
390 |
|
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisKras.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisNras.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisBraf.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisEgfr.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisAlkEml4.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisPdgfra.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisKit.checked = false; |
4730 |
04 Apr 18 |
olle |
frm.mutationAnalysisTst170.checked = false; |
3232 |
08 Apr 15 |
olle |
frm.mutationAnalysisOther.checked = false; |
3232 |
08 Apr 15 |
olle |
400 |
} |
3232 |
08 Apr 15 |
olle |
401 |
|
3249 |
14 Apr 15 |
olle |
streg.mutationAnalysisSelectAll = function() |
3249 |
14 Apr 15 |
olle |
403 |
{ |
3249 |
14 Apr 15 |
olle |
var frm = document.forms['meludi']; |
3249 |
14 Apr 15 |
olle |
405 |
|
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisKras.checked = true; |
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisNras.checked = true; |
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisBraf.checked = true; |
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisEgfr.checked = true; |
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisAlkEml4.checked = true; |
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisPdgfra.checked = true; |
3249 |
14 Apr 15 |
olle |
frm.mutationAnalysisKit.checked = true; |
4730 |
04 Apr 18 |
olle |
//frm.mutationAnalysisTst170.checked = true; |
3249 |
14 Apr 15 |
olle |
//frm.mutationAnalysisOther.checked = true; |
3249 |
14 Apr 15 |
olle |
415 |
} |
3249 |
14 Apr 15 |
olle |
416 |
|
3067 |
08 Jan 15 |
olle |
streg.viableTumourCellsPercentOnChange = function() |
3067 |
08 Jan 15 |
olle |
418 |
{ |
3067 |
08 Jan 15 |
olle |
viableTumourCellsPercentIsValid = false; |
3067 |
08 Jan 15 |
olle |
420 |
|
3067 |
08 Jan 15 |
olle |
var frm = document.forms['meludi']; |
3067 |
08 Jan 15 |
olle |
var viableTumourCellsPercent = frm.viableTumourCellsPercent.value; |
3067 |
08 Jan 15 |
olle |
423 |
|
3106 |
26 Jan 15 |
olle |
if (viableTumourCellsPercent != null) |
3067 |
08 Jan 15 |
olle |
425 |
{ |
3106 |
26 Jan 15 |
olle |
if (parseInt(viableTumourCellsPercent) < 0) |
3106 |
26 Jan 15 |
olle |
427 |
{ |
3106 |
26 Jan 15 |
olle |
Wizard.setInputStatus('viableTumourCellsPercent', 'invalid', 'Must be at least 0'); |
3106 |
26 Jan 15 |
olle |
return; |
3106 |
26 Jan 15 |
olle |
430 |
} |
3106 |
26 Jan 15 |
olle |
if (parseInt(viableTumourCellsPercent) > 100) |
3106 |
26 Jan 15 |
olle |
432 |
{ |
3106 |
26 Jan 15 |
olle |
Wizard.setInputStatus('viableTumourCellsPercent', 'invalid', 'Must be at most 100'); |
3106 |
26 Jan 15 |
olle |
return; |
3106 |
26 Jan 15 |
olle |
435 |
} |
3067 |
08 Jan 15 |
olle |
436 |
} |
3067 |
08 Jan 15 |
olle |
Wizard.setInputStatus('viableTumourCellsPercent', 'valid'); |
3067 |
08 Jan 15 |
olle |
viableTumourCellsPercentIsValid = true; |
3067 |
08 Jan 15 |
olle |
439 |
} |
3067 |
08 Jan 15 |
olle |
440 |
|
2933 |
14 Nov 14 |
olle |
streg.validateStep2 = function(event) |
2933 |
14 Nov 14 |
olle |
442 |
{ |
2933 |
14 Nov 14 |
olle |
var valid = true; |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
445 |
|
2933 |
14 Nov 14 |
olle |
valid &= nofTubesIsValid; |
2933 |
14 Nov 14 |
olle |
valid &= Wizard.isValid('arrivalDate'); |
2933 |
14 Nov 14 |
olle |
valid &= samplingDateIsValid; |
3067 |
08 Jan 15 |
olle |
valid &= viableTumourCellsPercentIsValid; |
2933 |
14 Nov 14 |
olle |
450 |
|
2933 |
14 Nov 14 |
olle |
if (!valid) event.preventDefault(); |
2933 |
14 Nov 14 |
olle |
452 |
} |
2933 |
14 Nov 14 |
olle |
453 |
|
2933 |
14 Nov 14 |
olle |
streg.initializeStep3 = function() |
2933 |
14 Nov 14 |
olle |
455 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
3028 |
11 Dec 14 |
olle |
var tubeContentType = frm.tubeContentType.value; |
2933 |
14 Nov 14 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
3028 |
11 Dec 14 |
olle |
nofTubes = streg.fixNofTubes(tubeContentType, nofTubes); |
3028 |
11 Dec 14 |
olle |
frm.nofTubes.value = nofTubes; |
4246 |
21 Nov 16 |
olle |
var extractsFromFirstSpecimenOnly = frm.extractsFromFirstSpecimenOnlyCB.checked; |
3028 |
11 Dec 14 |
olle |
var storageBoxSuffix = streg.fetchStorageBoxSuffix(tubeContentType); |
2933 |
14 Nov 14 |
olle |
if (nofTubes > 2) Doc.addClass('step-2', 'auto-hide'); |
2933 |
14 Nov 14 |
olle |
464 |
|
2933 |
14 Nov 14 |
olle |
var html = ''; |
3252 |
16 Apr 15 |
olle |
466 |
|
3252 |
16 Apr 15 |
olle |
// Add buttons for adding standard comments for all specimens/RNA/DNA |
3252 |
16 Apr 15 |
olle |
html += '<tr class="section-header">'; |
3252 |
16 Apr 15 |
olle |
html += '<td colspan="4">Standard comments</td>'; |
3252 |
16 Apr 15 |
olle |
html += '</tr>'; |
3252 |
16 Apr 15 |
olle |
471 |
|
3252 |
16 Apr 15 |
olle |
html += '<tr class="align-top">'; |
3252 |
16 Apr 15 |
olle |
html += '<td class="subprompt"></td>'; |
3252 |
16 Apr 15 |
olle |
html += '<td><div class="button basicbutton interactable" id="addCarvedOutComment" style="font-weight: normal;">Add "Utkarvad" (Carved out)</div></td>'; |
3252 |
16 Apr 15 |
olle |
html += '<td class="status" id="addCarvedOutComment.status"></td>'; |
3252 |
16 Apr 15 |
olle |
html += '<td class="help"><span id="addCarvedOutComment.message" class="message"></span>Click button to add standard comment for all items.</td>'; |
3252 |
16 Apr 15 |
olle |
html += '</tr>'; |
3252 |
16 Apr 15 |
olle |
478 |
|
3252 |
16 Apr 15 |
olle |
html += '<tr class="align-top">'; |
3252 |
16 Apr 15 |
olle |
html += '<td class="subprompt"></td>'; |
3252 |
16 Apr 15 |
olle |
html += '<td><div class="button basicbutton interactable" id="addMnbComment" style="font-weight: normal;">Add "MNB" (Medium needle biopsy)</div></td>'; |
3252 |
16 Apr 15 |
olle |
html += '<td class="status" id="addMnbComment.status"></td>'; |
3252 |
16 Apr 15 |
olle |
html += '<td class="help"><span id="addMnbComment.message" class="message"></span>Click button to add standard comment for all items.</td>'; |
3252 |
16 Apr 15 |
olle |
html += '</tr>'; |
3252 |
16 Apr 15 |
olle |
485 |
|
2933 |
14 Nov 14 |
olle |
for (var i=0; i < nofTubes; i++) |
2933 |
14 Nov 14 |
olle |
487 |
{ |
3028 |
11 Dec 14 |
olle |
var tubeContentTypeName = streg.fetchTubeContentTypeName(tubeContentType, i); |
3028 |
11 Dec 14 |
olle |
var tubeContentTypeNameInternal = streg.fetchTubeContentTypeNameInternal(tubeContentType, tubeContentTypeName); |
3028 |
11 Dec 14 |
olle |
var tubeName = streg.fetchTubeName(tubeContentType, caseInfo, i); |
2933 |
14 Nov 14 |
olle |
var tubeNo = i+caseInfo.specimenFirstIndex; |
3028 |
11 Dec 14 |
olle |
var tubeIdentifier = streg.fetchTubeIdentifier(tubeContentType, tubeName, tubeNo); |
2933 |
14 Nov 14 |
olle |
html += '<tr class="section-header">'; |
3028 |
11 Dec 14 |
olle |
html += '<td colspan="4">'+tubeContentTypeName+' Tube '+tubeName+'</td>'; |
2933 |
14 Nov 14 |
olle |
html += '</tr>'; |
2933 |
14 Nov 14 |
olle |
496 |
|
3276 |
29 Apr 15 |
olle |
497 |
/* |
3028 |
11 Dec 14 |
olle |
var boxMsg = 'Box-number where the '+tubeContentTypeNameInternal+' tube is located in.'; |
3276 |
29 Apr 15 |
olle |
499 |
*/ |
3276 |
29 Apr 15 |
olle |
var boxMsg = 'Box-number and position where the '+tubeContentTypeNameInternal+' tube is located.'; |
3276 |
29 Apr 15 |
olle |
var dnaBoxMsg = 'Box-number and position where the DNA extract will be located.'; |
3276 |
29 Apr 15 |
olle |
var rnaBoxMsg = 'Box-number and position where the RNA extract will be located.'; |
2933 |
14 Nov 14 |
olle |
var disabledAttribute = ''; |
3253 |
17 Apr 15 |
olle |
if (i == 0 && tubeContentType == 'Specimen') |
2933 |
14 Nov 14 |
olle |
505 |
{ |
3276 |
29 Apr 15 |
olle |
boxMsg = 'No storage space allocated for first '+tubeContentTypeNameInternal+'; all amount expected to be used.'; |
2933 |
14 Nov 14 |
olle |
disabledAttribute = ' disabled'; |
2933 |
14 Nov 14 |
olle |
508 |
} |
2933 |
14 Nov 14 |
olle |
html += '<tr>'; |
3276 |
29 Apr 15 |
olle |
html += '<td class="subprompt">'+tubeContentTypeName+' '+tubeName+' '+'Box</td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="input">'; |
3276 |
29 Apr 15 |
olle |
512 |
/* |
2933 |
14 Nov 14 |
olle |
html += '<input type="text" name="box.'+i+'" id="box.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'></td>'; |
3276 |
29 Apr 15 |
olle |
514 |
*/ |
3276 |
29 Apr 15 |
olle |
html += '<input type="text" name="box.'+i+'" id="box.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'>'; |
3276 |
29 Apr 15 |
olle |
html += ' Row<input type="text" name="row.'+i+'" id="row.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
3276 |
29 Apr 15 |
olle |
html += ' Column<input type="text" name="column.'+i+'" id="column.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
3276 |
29 Apr 15 |
olle |
html += '</td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="status" id="box.'+i+'.status"></td>'; |
3276 |
29 Apr 15 |
olle |
html += '<td class="help"><span id="box.'+i+'.message" class="message"></span>'+boxMsg+'<span id="position.'+i+'.message" class="message"></span></td>'; |
2933 |
14 Nov 14 |
olle |
html += '</tr>'; |
3276 |
29 Apr 15 |
olle |
522 |
/* |
2933 |
14 Nov 14 |
olle |
html += '<tr>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="subprompt">Row</td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="input">'; |
2933 |
14 Nov 14 |
olle |
html += '<input type="text" name="row.'+i+'" id="row.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
2933 |
14 Nov 14 |
olle |
html += ' Column<input type="text" name="column.'+i+'" id="column.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
2933 |
14 Nov 14 |
olle |
html += '</td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="status" id="position.'+i+'.status"></td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="help"><span id="position.'+i+'.message" class="message"></span></td>'; |
2933 |
14 Nov 14 |
olle |
html += '</tr>'; |
3276 |
29 Apr 15 |
olle |
532 |
*/ |
2933 |
14 Nov 14 |
olle |
533 |
|
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'Specimen') |
3028 |
11 Dec 14 |
olle |
535 |
{ |
3276 |
29 Apr 15 |
olle |
disabledAttribute = ''; |
4246 |
21 Nov 16 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
4246 |
21 Nov 16 |
olle |
538 |
{ |
4246 |
21 Nov 16 |
olle |
html += '<tr>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="subprompt">DNA extract'+' '+tubeName+'.d '+'Box</td>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="input">'; |
4246 |
21 Nov 16 |
olle |
html += '<input type="text" name="dnaBox.'+i+'" id="dnaBox.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'>'; |
4246 |
21 Nov 16 |
olle |
html += ' Row<input type="text" name="dnaRow.'+i+'" id="dnaRow.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4246 |
21 Nov 16 |
olle |
html += ' Column<input type="text" name="dnaColumn.'+i+'" id="dnaColumn.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4246 |
21 Nov 16 |
olle |
html += '</td>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="status" id="dnaBox.'+i+'.status"></td>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="help"><span id="dnaBox.'+i+'.message" class="message"></span>'+dnaBoxMsg+'<span id="dnaPosition.'+i+'.message" class="message"></span></td>'; |
4246 |
21 Nov 16 |
olle |
html += '</tr>'; |
3276 |
29 Apr 15 |
olle |
549 |
|
4246 |
21 Nov 16 |
olle |
html += '<tr>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="subprompt">RNA extract'+' '+tubeName+'.r '+'Box</td>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="input">'; |
4246 |
21 Nov 16 |
olle |
html += '<input type="text" name="rnaBox.'+i+'" id="rnaBox.'+i+'" style="width: 12em;" maxlength="12"'+disabledAttribute+'>'; |
4246 |
21 Nov 16 |
olle |
html += ' Row<input type="text" name="rnaRow.'+i+'" id="rnaRow.'+i+'" style="text-transform:uppercase; width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4246 |
21 Nov 16 |
olle |
html += ' Column<input type="text" name="rnaColumn.'+i+'" id="rnaColumn.'+i+'" style="width: 3em;" maxlength="2"'+disabledAttribute+'>'; |
4246 |
21 Nov 16 |
olle |
html += '</td>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="status" id="rnaBox.'+i+'.status"></td>'; |
4246 |
21 Nov 16 |
olle |
html += '<td class="help"><span id="rnaBox.'+i+'.message" class="message"></span>'+rnaBoxMsg+'<span id="rnaPosition.'+i+'.message" class="message"></span></td>'; |
4246 |
21 Nov 16 |
olle |
html += '</tr>'; |
4246 |
21 Nov 16 |
olle |
560 |
} |
3276 |
29 Apr 15 |
olle |
561 |
|
3276 |
29 Apr 15 |
olle |
html += '<tr>'; |
3028 |
11 Dec 14 |
olle |
html += '<td class="subprompt">Number of sections</td>'; |
3028 |
11 Dec 14 |
olle |
html += '<td class="input">'; |
3028 |
11 Dec 14 |
olle |
html += '<input type="text" name="nofSections.'+i+'" id="nofSections.'+i+'" style="width: 3em;" maxlength="2" value="1">'; |
3028 |
11 Dec 14 |
olle |
html += '</td>'; |
3028 |
11 Dec 14 |
olle |
html += '<td class="status" id="nofSections.'+i+'.status"></td>'; |
3028 |
11 Dec 14 |
olle |
html += '<td class="help"><span id="nofSections.'+i+'.message" class="message"></span>Number of sections (slices) in FFPE block.</td>'; |
3028 |
11 Dec 14 |
olle |
html += '</tr>'; |
3028 |
11 Dec 14 |
olle |
570 |
} |
3028 |
11 Dec 14 |
olle |
571 |
|
2933 |
14 Nov 14 |
olle |
html += '<tr class="align-top">'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="subprompt">Operator delivery comment</td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="input"><textarea rows="3" name="comment.'+i+'" id="comment.'+i+'"></textarea></td>'; |
2933 |
14 Nov 14 |
olle |
html += '<td class="status" id="comment.'+i+'.status"></td>'; |
3028 |
11 Dec 14 |
olle |
html += '<td class="help"><span id="comment.'+i+'.message" class="message"></span>In this field, enter information specific for '+tubeContentTypeNameInternal+' tube ' +tubeIdentifier+'.</td>'; |
2933 |
14 Nov 14 |
olle |
html += '</tr>'; |
2933 |
14 Nov 14 |
olle |
578 |
} |
2933 |
14 Nov 14 |
olle |
Doc.element('specimen-tubes').innerHTML = html; |
2933 |
14 Nov 14 |
olle |
580 |
|
3252 |
16 Apr 15 |
olle |
// Add click handlers for buttons for adding standard comments for all specimens/RNA/DNA |
3252 |
16 Apr 15 |
olle |
var addCarvedOutCommentGeneralButton = Doc.element('addCarvedOutComment'); |
3252 |
16 Apr 15 |
olle |
Buttons.addClickHandler(addCarvedOutCommentGeneralButton, streg.addCommentGeneral, {'nofTubes': nofTubes, 'text-field': 'comment.', 'text': 'Utkarvad.'}); |
3252 |
16 Apr 15 |
olle |
var addMnbCommentGeneralButton = Doc.element('addMnbComment'); |
3252 |
16 Apr 15 |
olle |
Buttons.addClickHandler(addMnbCommentGeneralButton, streg.addCommentGeneral, {'nofTubes': nofTubes, 'text-field': 'comment.', 'text': 'MNB.'}); |
3250 |
15 Apr 15 |
olle |
586 |
|
2933 |
14 Nov 14 |
olle |
Wizard.setCurrentStep(3); |
2933 |
14 Nov 14 |
olle |
Doc.show('goregister'); |
2933 |
14 Nov 14 |
olle |
Doc.show('gocancel'); |
2933 |
14 Nov 14 |
olle |
frm['comment.0'].focus(); |
2933 |
14 Nov 14 |
olle |
591 |
|
2933 |
14 Nov 14 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
2933 |
14 Nov 14 |
olle |
url += '&cmd=FindStoragePositions'; |
2933 |
14 Nov 14 |
olle |
url += '&nofTubes='+frm.nofTubes.value; |
3028 |
11 Dec 14 |
olle |
url += '&storageBoxSuffix='+storageBoxSuffix; |
4246 |
21 Nov 16 |
olle |
url += '&extractsFromFirstSpecimenOnly='+extractsFromFirstSpecimenOnly; |
2933 |
14 Nov 14 |
olle |
597 |
|
2933 |
14 Nov 14 |
olle |
Wizard.showLoadingAnimation('Looking for empty box positions...'); |
2933 |
14 Nov 14 |
olle |
Wizard.asyncJsonRequest(url, streg.storagePositionsLoaded); |
2933 |
14 Nov 14 |
olle |
600 |
} |
3250 |
15 Apr 15 |
olle |
601 |
|
3252 |
16 Apr 15 |
olle |
streg.addCommentGeneral = function(event) |
3252 |
16 Apr 15 |
olle |
603 |
{ |
3252 |
16 Apr 15 |
olle |
var nofTubes = Data.get(event.currentTarget, 'nofTubes', event.currentTarget.id); |
3252 |
16 Apr 15 |
olle |
var textFieldBase = Data.get(event.currentTarget, 'text-field', event.currentTarget.id); |
3252 |
16 Apr 15 |
olle |
var text = Data.get(event.currentTarget, 'text', event.currentTarget.id); |
3252 |
16 Apr 15 |
olle |
for (var i=0; i < nofTubes; i++) |
3252 |
16 Apr 15 |
olle |
608 |
{ |
3252 |
16 Apr 15 |
olle |
var textField = Doc.element(textFieldBase+i); |
3252 |
16 Apr 15 |
olle |
if (textField) |
3252 |
16 Apr 15 |
olle |
611 |
{ |
3252 |
16 Apr 15 |
olle |
if (text && text != '') |
3252 |
16 Apr 15 |
olle |
613 |
{ |
3252 |
16 Apr 15 |
olle |
if (textField.value != '') |
3252 |
16 Apr 15 |
olle |
615 |
{ |
3252 |
16 Apr 15 |
olle |
textField.value += ' '; |
3252 |
16 Apr 15 |
olle |
617 |
} |
3252 |
16 Apr 15 |
olle |
textField.value += text; |
3252 |
16 Apr 15 |
olle |
619 |
} |
3252 |
16 Apr 15 |
olle |
620 |
} |
3252 |
16 Apr 15 |
olle |
621 |
} |
3670 |
17 Dec 15 |
olle |
streg.setNumberOfSectionsFromComment(event); |
3252 |
16 Apr 15 |
olle |
623 |
} |
3252 |
16 Apr 15 |
olle |
624 |
|
3250 |
15 Apr 15 |
olle |
streg.addComment = function(event) |
3250 |
15 Apr 15 |
olle |
626 |
{ |
3250 |
15 Apr 15 |
olle |
var textField = Doc.element(Data.get(event.currentTarget, 'text-field', event.currentTarget.id)); |
3250 |
15 Apr 15 |
olle |
var text = Data.get(event.currentTarget, 'text', event.currentTarget.id); |
3250 |
15 Apr 15 |
olle |
if (textField) |
3250 |
15 Apr 15 |
olle |
630 |
{ |
3250 |
15 Apr 15 |
olle |
if (text && text != '') |
3250 |
15 Apr 15 |
olle |
632 |
{ |
3250 |
15 Apr 15 |
olle |
if (textField.value != '') |
3250 |
15 Apr 15 |
olle |
634 |
{ |
3250 |
15 Apr 15 |
olle |
textField.value += ' '; |
3250 |
15 Apr 15 |
olle |
636 |
} |
3250 |
15 Apr 15 |
olle |
textField.value += text; |
3250 |
15 Apr 15 |
olle |
638 |
} |
3250 |
15 Apr 15 |
olle |
639 |
} |
3670 |
17 Dec 15 |
olle |
streg.setNumberOfSectionsFromComment(event); |
3250 |
15 Apr 15 |
olle |
641 |
} |
3670 |
17 Dec 15 |
olle |
642 |
|
3670 |
17 Dec 15 |
olle |
streg.setNumberOfSectionsFromComment = function(event) |
3670 |
17 Dec 15 |
olle |
644 |
{ |
3670 |
17 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3670 |
17 Dec 15 |
olle |
var nofTubes = Data.get(event.currentTarget, 'nofTubes', event.currentTarget.id); |
3670 |
17 Dec 15 |
olle |
var textFieldBase = Data.get(event.currentTarget, 'text-field', event.currentTarget.id); |
3670 |
17 Dec 15 |
olle |
for (var i=0; i < nofTubes; i++) |
3670 |
17 Dec 15 |
olle |
649 |
{ |
3670 |
17 Dec 15 |
olle |
var numSections = 1; |
3670 |
17 Dec 15 |
olle |
var textField = Doc.element(textFieldBase+i); |
3670 |
17 Dec 15 |
olle |
if (textField) |
3670 |
17 Dec 15 |
olle |
653 |
{ |
3670 |
17 Dec 15 |
olle |
var text = textField.value; |
3670 |
17 Dec 15 |
olle |
if (text && text != '') |
3670 |
17 Dec 15 |
olle |
656 |
{ |
3670 |
17 Dec 15 |
olle |
// If comment "Utkarvad." and not "MNB." => number of sections set to 0 |
3670 |
17 Dec 15 |
olle |
if (text.indexOf('Utkarvad.') >= 0 && text.indexOf('MNB.') < 0) |
3670 |
17 Dec 15 |
olle |
659 |
{ |
3670 |
17 Dec 15 |
olle |
numSections = 0; |
3670 |
17 Dec 15 |
olle |
661 |
} |
3670 |
17 Dec 15 |
olle |
662 |
} |
3670 |
17 Dec 15 |
olle |
663 |
} |
3670 |
17 Dec 15 |
olle |
frm['nofSections.'+i].value = numSections; |
3670 |
17 Dec 15 |
olle |
665 |
} |
3670 |
17 Dec 15 |
olle |
666 |
} |
2933 |
14 Nov 14 |
olle |
667 |
|
2933 |
14 Nov 14 |
olle |
streg.storagePositionsLoaded = function(response) |
2933 |
14 Nov 14 |
olle |
669 |
{ |
2933 |
14 Nov 14 |
olle |
var freeWells = response.wells; |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
3028 |
11 Dec 14 |
olle |
var tubeContentType = frm.tubeContentType.value; |
2933 |
14 Nov 14 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
4246 |
21 Nov 16 |
olle |
var extractsFromFirstSpecimenOnly = frm.extractsFromFirstSpecimenOnlyCB.checked; |
2933 |
14 Nov 14 |
olle |
675 |
|
2933 |
14 Nov 14 |
olle |
// No storage space is allocated for first specimen, |
2933 |
14 Nov 14 |
olle |
// since all amount is expected to be used for analysis. |
2933 |
14 Nov 14 |
olle |
// Specimen tube with i == 0 is therefore skipped. |
3276 |
29 Apr 15 |
olle |
if (tubeContentType == 'Specimen') |
2933 |
14 Nov 14 |
olle |
680 |
{ |
3276 |
29 Apr 15 |
olle |
for (var i = 0; i < nofTubes; i++) |
3276 |
29 Apr 15 |
olle |
682 |
{ |
3276 |
29 Apr 15 |
olle |
wellIndex = 3*i; |
3276 |
29 Apr 15 |
olle |
var specWell = null; |
3276 |
29 Apr 15 |
olle |
if (i > 0) |
3276 |
29 Apr 15 |
olle |
686 |
{ |
3276 |
29 Apr 15 |
olle |
specWell = freeWells[wellIndex]; |
3276 |
29 Apr 15 |
olle |
if (!specWell || specWell == '') |
3276 |
29 Apr 15 |
olle |
689 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('box.'+i, 'invalid', 'Missing box'); |
3276 |
29 Apr 15 |
olle |
return; |
3276 |
29 Apr 15 |
olle |
692 |
} |
3276 |
29 Apr 15 |
olle |
693 |
} |
4246 |
21 Nov 16 |
olle |
var dnaWell = null; |
4246 |
21 Nov 16 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
3276 |
29 Apr 15 |
olle |
696 |
{ |
4246 |
21 Nov 16 |
olle |
dnaWell = freeWells[wellIndex+1]; |
4246 |
21 Nov 16 |
olle |
if (!dnaWell || dnaWell == '') |
4246 |
21 Nov 16 |
olle |
699 |
{ |
4246 |
21 Nov 16 |
olle |
Wizard.setInputStatus('dnaBox.'+i, 'invalid', 'Missing box'); |
4246 |
21 Nov 16 |
olle |
return; |
4246 |
21 Nov 16 |
olle |
702 |
} |
3276 |
29 Apr 15 |
olle |
703 |
} |
4246 |
21 Nov 16 |
olle |
var rnaWell = null; |
4246 |
21 Nov 16 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
3276 |
29 Apr 15 |
olle |
706 |
{ |
4246 |
21 Nov 16 |
olle |
rnaWell = freeWells[wellIndex+2]; |
4246 |
21 Nov 16 |
olle |
if (!rnaWell || rnaWell == '') |
4246 |
21 Nov 16 |
olle |
709 |
{ |
4246 |
21 Nov 16 |
olle |
Wizard.setInputStatus('rnaBox.'+i, 'invalid', 'Missing box'); |
4246 |
21 Nov 16 |
olle |
return; |
4246 |
21 Nov 16 |
olle |
712 |
} |
3276 |
29 Apr 15 |
olle |
713 |
} |
3276 |
29 Apr 15 |
olle |
714 |
|
3276 |
29 Apr 15 |
olle |
// Update form fields for storage plates |
3276 |
29 Apr 15 |
olle |
if (specWell) |
3276 |
29 Apr 15 |
olle |
717 |
{ |
3276 |
29 Apr 15 |
olle |
frm['box.'+i].value = specWell.bioPlate.name; |
3276 |
29 Apr 15 |
olle |
frm['row.'+i].value = Meludi.wellToAlpha(specWell.row); |
3276 |
29 Apr 15 |
olle |
frm['column.'+i].value = specWell.column+1; |
3276 |
29 Apr 15 |
olle |
721 |
} |
3276 |
29 Apr 15 |
olle |
722 |
|
3276 |
29 Apr 15 |
olle |
if (dnaWell) |
3276 |
29 Apr 15 |
olle |
724 |
{ |
3276 |
29 Apr 15 |
olle |
frm['dnaBox.'+i].value = dnaWell.bioPlate.name; |
3276 |
29 Apr 15 |
olle |
frm['dnaRow.'+i].value = Meludi.wellToAlpha(dnaWell.row); |
3276 |
29 Apr 15 |
olle |
frm['dnaColumn.'+i].value = dnaWell.column+1; |
3276 |
29 Apr 15 |
olle |
728 |
} |
3276 |
29 Apr 15 |
olle |
729 |
|
3276 |
29 Apr 15 |
olle |
if (rnaWell) |
3276 |
29 Apr 15 |
olle |
731 |
{ |
3276 |
29 Apr 15 |
olle |
frm['rnaBox.'+i].value = rnaWell.bioPlate.name; |
3276 |
29 Apr 15 |
olle |
frm['rnaRow.'+i].value = Meludi.wellToAlpha(rnaWell.row); |
3276 |
29 Apr 15 |
olle |
frm['rnaColumn.'+i].value = rnaWell.column+1; |
3276 |
29 Apr 15 |
olle |
735 |
} |
3276 |
29 Apr 15 |
olle |
736 |
|
3276 |
29 Apr 15 |
olle |
// Move focus to next field |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('box.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'row.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('row.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'column.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'dnaBox.'+i }); |
3276 |
29 Apr 15 |
olle |
741 |
|
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaBox.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'dnaRow.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaRow.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'dnaColumn.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaColumn.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'rnaBox.'+i }); |
3276 |
29 Apr 15 |
olle |
745 |
|
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaBox.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'rnaRow.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaRow.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'rnaColumn.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaColumn.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'nofSections.'+i }); |
3276 |
29 Apr 15 |
olle |
749 |
|
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'comment.'+i }); |
3276 |
29 Apr 15 |
olle |
751 |
|
3276 |
29 Apr 15 |
olle |
// Form validation |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Events.integerOnly); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('box.'+i, 'change', streg.wellOnChange, { 'boxtype': 'Specimen', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('row.'+i, 'change', streg.wellOnChange, { 'boxtype': 'Specimen', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('column.'+i, 'change', streg.wellOnChange, { 'boxtype': 'Specimen', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('box.'+i, 'keyup', streg.boxOnKeyUp, { 'boxtype': 'Specimen'}); |
3276 |
29 Apr 15 |
olle |
758 |
|
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaColumn.'+i, 'keypress', Events.integerOnly); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaBox.'+i, 'change', streg.wellOnChange, { 'boxtype': 'DNA', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaRow.'+i, 'change', streg.wellOnChange, { 'boxtype': 'DNA', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaColumn.'+i, 'change', streg.wellOnChange, { 'boxtype': 'DNA', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('dnaBox.'+i, 'keyup', streg.boxOnKeyUp, { 'boxtype': 'DNA'}); |
3276 |
29 Apr 15 |
olle |
764 |
|
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaColumn.'+i, 'keypress', Events.integerOnly); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaBox.'+i, 'change', streg.wellOnChange, { 'boxtype': 'RNA', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaRow.'+i, 'change', streg.wellOnChange, { 'boxtype': 'RNA', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaColumn.'+i, 'change', streg.wellOnChange, { 'boxtype': 'RNA', 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('rnaBox.'+i, 'keyup', streg.boxOnKeyUp, { 'boxtype': 'RNA'}); |
3276 |
29 Apr 15 |
olle |
770 |
|
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Events.integerOnly); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('nofSections.'+i, 'change', streg.nofSectionsOnChange, { 'index': i }); |
3276 |
29 Apr 15 |
olle |
773 |
|
3276 |
29 Apr 15 |
olle |
wellIsValid[i] = true; |
3276 |
29 Apr 15 |
olle |
dnaWellIsValid[i] = true; |
3276 |
29 Apr 15 |
olle |
rnaWellIsValid[i] = true; |
3276 |
29 Apr 15 |
olle |
777 |
/* |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('position.'+i, 'valid'); |
3276 |
29 Apr 15 |
olle |
779 |
*/ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('box.'+i, 'valid'); |
4246 |
21 Nov 16 |
olle |
if (i == 0 || !extractsFromFirstSpecimenOnly) |
4246 |
21 Nov 16 |
olle |
782 |
{ |
4246 |
21 Nov 16 |
olle |
Wizard.setInputStatus('dnaBox.'+i, 'valid'); |
4246 |
21 Nov 16 |
olle |
Wizard.setInputStatus('rnaBox.'+i, 'valid'); |
4246 |
21 Nov 16 |
olle |
785 |
} |
3276 |
29 Apr 15 |
olle |
if (tubeContentType == 'Specimen') |
3276 |
29 Apr 15 |
olle |
787 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('nofSections.'+i, 'valid'); |
3276 |
29 Apr 15 |
olle |
789 |
} |
3276 |
29 Apr 15 |
olle |
790 |
} |
3028 |
11 Dec 14 |
olle |
791 |
} |
3276 |
29 Apr 15 |
olle |
else if (tubeContentType == 'DNA' || tubeContentType == 'RNA' || tubeContentType == 'DNA_RNA') |
3028 |
11 Dec 14 |
olle |
793 |
{ |
3276 |
29 Apr 15 |
olle |
for (var i = 0; i < nofTubes; i++) |
3028 |
11 Dec 14 |
olle |
795 |
{ |
3276 |
29 Apr 15 |
olle |
var wellIndex = i; |
3276 |
29 Apr 15 |
olle |
var well = freeWells[wellIndex]; |
3276 |
29 Apr 15 |
olle |
if (!well || well == '') |
3276 |
29 Apr 15 |
olle |
799 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('box.'+i, 'invalid', 'Missing box'); |
3276 |
29 Apr 15 |
olle |
return; |
3276 |
29 Apr 15 |
olle |
802 |
} |
3276 |
29 Apr 15 |
olle |
frm['box.'+i].value = well.bioPlate.name; |
3276 |
29 Apr 15 |
olle |
frm['row.'+i].value = Meludi.wellToAlpha(well.row); |
3276 |
29 Apr 15 |
olle |
frm['column.'+i].value = well.column+1; |
2933 |
14 Nov 14 |
olle |
806 |
|
3276 |
29 Apr 15 |
olle |
// Move focus to next field |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('box.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'row.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('row.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'column.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'nofSections.'+i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Wizard.focusOnEnter, { 'next-focus': 'comment.'+i }); |
2933 |
14 Nov 14 |
olle |
812 |
|
3276 |
29 Apr 15 |
olle |
// Form validation |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('column.'+i, 'keypress', Events.integerOnly); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('box.'+i, 'change', streg.wellOnChange, { 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('row.'+i, 'change', streg.wellOnChange, { 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('column.'+i, 'change', streg.wellOnChange, { 'index': i }); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('box.'+i, 'keyup', streg.boxOnKeyUp); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('nofSections.'+i, 'keypress', Events.integerOnly); |
3276 |
29 Apr 15 |
olle |
Events.addEventHandler('nofSections.'+i, 'change', streg.nofSectionsOnChange, { 'index': i }); |
2933 |
14 Nov 14 |
olle |
821 |
|
3276 |
29 Apr 15 |
olle |
wellIsValid[i] = true; |
3276 |
29 Apr 15 |
olle |
823 |
/* |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('position.'+i, 'valid'); |
3276 |
29 Apr 15 |
olle |
825 |
*/ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('box.'+i, 'valid'); |
3276 |
29 Apr 15 |
olle |
if (tubeContentType == 'Specimen') |
3276 |
29 Apr 15 |
olle |
828 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus('nofSections.'+i, 'valid'); |
3276 |
29 Apr 15 |
olle |
830 |
} |
3028 |
11 Dec 14 |
olle |
831 |
} |
2933 |
14 Nov 14 |
olle |
832 |
} |
2933 |
14 Nov 14 |
olle |
833 |
} |
3028 |
11 Dec 14 |
olle |
834 |
|
3028 |
11 Dec 14 |
olle |
streg.fixNofTubes = function(tubeContentType, nofTubes) |
3028 |
11 Dec 14 |
olle |
836 |
{ |
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'DNA') |
3028 |
11 Dec 14 |
olle |
838 |
{ |
3028 |
11 Dec 14 |
olle |
nofTubes = 1; |
3028 |
11 Dec 14 |
olle |
840 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'RNA') |
3028 |
11 Dec 14 |
olle |
842 |
{ |
3028 |
11 Dec 14 |
olle |
nofTubes = 1; |
3028 |
11 Dec 14 |
olle |
844 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'DNA_RNA') |
3028 |
11 Dec 14 |
olle |
846 |
{ |
3028 |
11 Dec 14 |
olle |
nofTubes = 2; |
3028 |
11 Dec 14 |
olle |
848 |
} |
3028 |
11 Dec 14 |
olle |
return nofTubes; |
3028 |
11 Dec 14 |
olle |
850 |
} |
2933 |
14 Nov 14 |
olle |
851 |
|
3028 |
11 Dec 14 |
olle |
streg.fetchStorageBoxSuffix = function(tubeContentType) |
3028 |
11 Dec 14 |
olle |
853 |
{ |
3028 |
11 Dec 14 |
olle |
var storageBoxSuffix = null; |
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'Specimen') |
3028 |
11 Dec 14 |
olle |
856 |
{ |
3028 |
11 Dec 14 |
olle |
storageBoxSuffix = '_sp'; |
3028 |
11 Dec 14 |
olle |
858 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'DNA') |
3028 |
11 Dec 14 |
olle |
860 |
{ |
3253 |
17 Apr 15 |
olle |
storageBoxSuffix = '_dna'; |
3028 |
11 Dec 14 |
olle |
862 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'RNA') |
3028 |
11 Dec 14 |
olle |
864 |
{ |
3028 |
11 Dec 14 |
olle |
storageBoxSuffix = '_rna'; |
3028 |
11 Dec 14 |
olle |
866 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'DNA_RNA') |
3028 |
11 Dec 14 |
olle |
868 |
{ |
3253 |
17 Apr 15 |
olle |
storageBoxSuffix = '_dna_rna'; |
3028 |
11 Dec 14 |
olle |
870 |
} |
3028 |
11 Dec 14 |
olle |
return storageBoxSuffix; |
3028 |
11 Dec 14 |
olle |
872 |
} |
3028 |
11 Dec 14 |
olle |
873 |
|
3028 |
11 Dec 14 |
olle |
streg.fetchTubeContentTypeName = function(tubeContentType, tubeIndex) |
3028 |
11 Dec 14 |
olle |
875 |
{ |
3028 |
11 Dec 14 |
olle |
var tubeContentTypeName = tubeContentType; |
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'DNA_RNA') |
3028 |
11 Dec 14 |
olle |
878 |
{ |
3028 |
11 Dec 14 |
olle |
if (tubeIndex == 0) |
3028 |
11 Dec 14 |
olle |
880 |
{ |
3028 |
11 Dec 14 |
olle |
tubeContentTypeName = 'DNA'; |
3028 |
11 Dec 14 |
olle |
882 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeIndex == 1) |
3028 |
11 Dec 14 |
olle |
884 |
{ |
3028 |
11 Dec 14 |
olle |
tubeContentTypeName = 'RNA'; |
3028 |
11 Dec 14 |
olle |
886 |
} |
3028 |
11 Dec 14 |
olle |
887 |
} |
3028 |
11 Dec 14 |
olle |
return tubeContentTypeName; |
3028 |
11 Dec 14 |
olle |
889 |
} |
3028 |
11 Dec 14 |
olle |
890 |
|
3028 |
11 Dec 14 |
olle |
streg.fetchTubeContentTypeNameInternal = function(tubeContentType, tubeContentTypeName) |
3028 |
11 Dec 14 |
olle |
892 |
{ |
3028 |
11 Dec 14 |
olle |
var tubeContentTypeNameInternal = tubeContentTypeName; |
3028 |
11 Dec 14 |
olle |
// Convert all names except abbreviations to all lower case |
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'Specimen') |
3028 |
11 Dec 14 |
olle |
896 |
{ |
3028 |
11 Dec 14 |
olle |
tubeContentTypeNameInternal = tubeContentTypeName.toLowerCase(); |
3028 |
11 Dec 14 |
olle |
898 |
} |
3028 |
11 Dec 14 |
olle |
return tubeContentTypeNameInternal; |
3028 |
11 Dec 14 |
olle |
900 |
} |
3028 |
11 Dec 14 |
olle |
901 |
|
3028 |
11 Dec 14 |
olle |
streg.fetchTubeName = function(tubeContentType, caseInfo, tubeIndex) |
3028 |
11 Dec 14 |
olle |
903 |
{ |
3028 |
11 Dec 14 |
olle |
var tubeName = Strings.encodeTags(caseInfo.originalName); |
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'Specimen') |
3028 |
11 Dec 14 |
olle |
906 |
{ |
3028 |
11 Dec 14 |
olle |
var tubeNo = tubeIndex + caseInfo.specimenFirstIndex; |
3028 |
11 Dec 14 |
olle |
tubeName = tubeName+'.'+tubeNo; |
3028 |
11 Dec 14 |
olle |
909 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'DNA') |
3028 |
11 Dec 14 |
olle |
911 |
{ |
3028 |
11 Dec 14 |
olle |
tubeName = tubeName+'.d'; |
3028 |
11 Dec 14 |
olle |
913 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'RNA') |
3028 |
11 Dec 14 |
olle |
915 |
{ |
3028 |
11 Dec 14 |
olle |
tubeName = tubeName+'.r'; |
3028 |
11 Dec 14 |
olle |
917 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeContentType == 'DNA_RNA') |
3028 |
11 Dec 14 |
olle |
919 |
{ |
3028 |
11 Dec 14 |
olle |
if (tubeIndex == 0) |
3028 |
11 Dec 14 |
olle |
921 |
{ |
3028 |
11 Dec 14 |
olle |
tubeName = tubeName+'.d'; |
3028 |
11 Dec 14 |
olle |
923 |
} |
3028 |
11 Dec 14 |
olle |
else if (tubeIndex == 1) |
3028 |
11 Dec 14 |
olle |
925 |
{ |
3028 |
11 Dec 14 |
olle |
tubeName = tubeName+'.r'; |
3028 |
11 Dec 14 |
olle |
927 |
} |
3028 |
11 Dec 14 |
olle |
928 |
} |
3028 |
11 Dec 14 |
olle |
return tubeName; |
3028 |
11 Dec 14 |
olle |
930 |
} |
3028 |
11 Dec 14 |
olle |
931 |
|
3028 |
11 Dec 14 |
olle |
streg.fetchTubeIdentifier = function(tubeContentType, tubeName, tubeNo) |
3028 |
11 Dec 14 |
olle |
933 |
{ |
3028 |
11 Dec 14 |
olle |
var tubeIdentifier = tubeName; |
3028 |
11 Dec 14 |
olle |
if (tubeContentType == 'Specimen') |
3028 |
11 Dec 14 |
olle |
936 |
{ |
3028 |
11 Dec 14 |
olle |
tubeIdentifier = tubeNo; |
3028 |
11 Dec 14 |
olle |
938 |
} |
3028 |
11 Dec 14 |
olle |
return tubeIdentifier; |
3028 |
11 Dec 14 |
olle |
940 |
} |
3028 |
11 Dec 14 |
olle |
941 |
|
2933 |
14 Nov 14 |
olle |
streg.boxOnKeyUp = function(event) |
2933 |
14 Nov 14 |
olle |
943 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
3028 |
11 Dec 14 |
olle |
var tubeContentType = frm.tubeContentType.value; |
2933 |
14 Nov 14 |
olle |
946 |
|
3276 |
29 Apr 15 |
olle |
var boxType = Data.get(event.currentTarget, 'boxtype'); |
2933 |
14 Nov 14 |
olle |
var index = Data.int(event.currentTarget, 'index'); |
2933 |
14 Nov 14 |
olle |
949 |
|
3276 |
29 Apr 15 |
olle |
// Get box prefix, default is for input tubes |
3276 |
29 Apr 15 |
olle |
var boxPrefix = 'box.'; |
3276 |
29 Apr 15 |
olle |
if (boxType && boxType == 'DNA') |
3276 |
29 Apr 15 |
olle |
953 |
{ |
3276 |
29 Apr 15 |
olle |
boxPrefix = 'dnaBox.'; |
3276 |
29 Apr 15 |
olle |
955 |
} |
3276 |
29 Apr 15 |
olle |
if (boxType && boxType == 'RNA') |
3276 |
29 Apr 15 |
olle |
957 |
{ |
3276 |
29 Apr 15 |
olle |
boxPrefix = 'rnaBox.'; |
3276 |
29 Apr 15 |
olle |
959 |
} |
3276 |
29 Apr 15 |
olle |
960 |
|
3028 |
11 Dec 14 |
olle |
// Check box name |
3028 |
11 Dec 14 |
olle |
var boxIsValid = true; |
3276 |
29 Apr 15 |
olle |
var box = frm[boxPrefix+index].value; |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
3028 |
11 Dec 14 |
olle |
// Check for prefix "ML_" |
3028 |
11 Dec 14 |
olle |
if (box.indexOf('ML_') != 0) |
2933 |
14 Nov 14 |
olle |
967 |
{ |
3028 |
11 Dec 14 |
olle |
boxIsValid = false; |
2933 |
14 Nov 14 |
olle |
969 |
} |
3028 |
11 Dec 14 |
olle |
var suffix = '_sp'; |
3276 |
29 Apr 15 |
olle |
if (tubeContentType == 'DNA' || (boxType && boxType == 'DNA')) |
3028 |
11 Dec 14 |
olle |
972 |
{ |
3253 |
17 Apr 15 |
olle |
suffix = '_dna'; |
3253 |
17 Apr 15 |
olle |
974 |
} |
3276 |
29 Apr 15 |
olle |
else if (tubeContentType == 'RNA' || (boxType && boxType == 'RNA')) |
3253 |
17 Apr 15 |
olle |
976 |
{ |
3028 |
11 Dec 14 |
olle |
suffix = '_rna'; |
3028 |
11 Dec 14 |
olle |
978 |
} |
3028 |
11 Dec 14 |
olle |
// Check for suffix |
3028 |
11 Dec 14 |
olle |
if (box.indexOf(suffix) != (box.length - suffix.length)) |
3028 |
11 Dec 14 |
olle |
981 |
{ |
3028 |
11 Dec 14 |
olle |
boxIsValid = false; |
3028 |
11 Dec 14 |
olle |
983 |
} |
3028 |
11 Dec 14 |
olle |
984 |
|
3028 |
11 Dec 14 |
olle |
if (!boxIsValid) |
3028 |
11 Dec 14 |
olle |
986 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Box name must start with "ML_" and end with "'+suffix+'"'); |
3028 |
11 Dec 14 |
olle |
return; |
3028 |
11 Dec 14 |
olle |
989 |
} |
2933 |
14 Nov 14 |
olle |
990 |
} |
2933 |
14 Nov 14 |
olle |
991 |
|
2933 |
14 Nov 14 |
olle |
streg.wellOnChange = function(event) |
2933 |
14 Nov 14 |
olle |
993 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
var target = event.currentTarget; |
2933 |
14 Nov 14 |
olle |
996 |
|
3276 |
29 Apr 15 |
olle |
var boxType = Data.get(target, 'boxtype'); |
2933 |
14 Nov 14 |
olle |
var index = Data.int(target, 'index'); |
3276 |
29 Apr 15 |
olle |
999 |
|
3276 |
29 Apr 15 |
olle |
// Get well position prefixes, default is for input tubes |
3276 |
29 Apr 15 |
olle |
var boxPrefix = 'box.'; |
3276 |
29 Apr 15 |
olle |
var rowPrefix = 'row.'; |
3276 |
29 Apr 15 |
olle |
var columnPrefix = 'column.'; |
3276 |
29 Apr 15 |
olle |
if (boxType && boxType == 'DNA') |
3276 |
29 Apr 15 |
olle |
1005 |
{ |
3276 |
29 Apr 15 |
olle |
boxPrefix = 'dnaBox.'; |
3276 |
29 Apr 15 |
olle |
rowPrefix = 'dnaRow.'; |
3276 |
29 Apr 15 |
olle |
columnPrefix = 'dnaColumn.'; |
3276 |
29 Apr 15 |
olle |
1009 |
} |
3276 |
29 Apr 15 |
olle |
if (boxType && boxType == 'RNA') |
3276 |
29 Apr 15 |
olle |
1011 |
{ |
3276 |
29 Apr 15 |
olle |
boxPrefix = 'rnaBox.'; |
3276 |
29 Apr 15 |
olle |
rowPrefix = 'rnaRow.'; |
3276 |
29 Apr 15 |
olle |
columnPrefix = 'rnaColumn.'; |
3276 |
29 Apr 15 |
olle |
1015 |
} |
3276 |
29 Apr 15 |
olle |
var box = frm[boxPrefix+index].value; |
3276 |
29 Apr 15 |
olle |
var row = frm[rowPrefix+index].value; |
3276 |
29 Apr 15 |
olle |
var column = frm[columnPrefix+index].value; |
2933 |
14 Nov 14 |
olle |
1019 |
|
3276 |
29 Apr 15 |
olle |
//wellIsValid[index] = true; |
3276 |
29 Apr 15 |
olle |
if (!boxType || boxType == 'Specimen') |
3276 |
29 Apr 15 |
olle |
1022 |
{ |
3276 |
29 Apr 15 |
olle |
wellIsValid[index] = false; |
3276 |
29 Apr 15 |
olle |
1024 |
} |
3276 |
29 Apr 15 |
olle |
else if (boxType && boxType == 'DNA') |
3276 |
29 Apr 15 |
olle |
1026 |
{ |
3276 |
29 Apr 15 |
olle |
dnaWellIsValid[index] = false; |
3276 |
29 Apr 15 |
olle |
1028 |
} |
3276 |
29 Apr 15 |
olle |
else if (boxType && boxType == 'RNA') |
3276 |
29 Apr 15 |
olle |
1030 |
{ |
3276 |
29 Apr 15 |
olle |
rnaWellIsValid[index] = false; |
3276 |
29 Apr 15 |
olle |
1032 |
} |
3276 |
29 Apr 15 |
olle |
else |
3276 |
29 Apr 15 |
olle |
1034 |
{ |
3276 |
29 Apr 15 |
olle |
wellIsValid[index] = false; |
3276 |
29 Apr 15 |
olle |
1036 |
} |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
3276 |
29 Apr 15 |
olle |
1038 |
/* |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('position.'+index); |
3276 |
29 Apr 15 |
olle |
1040 |
*/ |
2933 |
14 Nov 14 |
olle |
1041 |
|
2933 |
14 Nov 14 |
olle |
if (box == '') |
2933 |
14 Nov 14 |
olle |
1043 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing box'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
1046 |
} |
3276 |
29 Apr 15 |
olle |
1047 |
|
3276 |
29 Apr 15 |
olle |
// Position errors are reported on box message line |
2933 |
14 Nov 14 |
olle |
if (row == '') |
2933 |
14 Nov 14 |
olle |
1050 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing row'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
1053 |
} |
2933 |
14 Nov 14 |
olle |
1054 |
|
2933 |
14 Nov 14 |
olle |
if (column == '') |
2933 |
14 Nov 14 |
olle |
1056 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing column'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
1059 |
} |
2933 |
14 Nov 14 |
olle |
1060 |
|
2933 |
14 Nov 14 |
olle |
// Check for duplicates |
2933 |
14 Nov 14 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
2933 |
14 Nov 14 |
olle |
for (var i=0; i < nofTubes; i++) |
2933 |
14 Nov 14 |
olle |
1064 |
{ |
2933 |
14 Nov 14 |
olle |
if (i != index) |
2933 |
14 Nov 14 |
olle |
1066 |
{ |
3276 |
29 Apr 15 |
olle |
if (box == frm.elements[boxPrefix+i].value && row == frm[rowPrefix+i].value && column == frm[columnPrefix+i].value) |
2933 |
14 Nov 14 |
olle |
1068 |
{ |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'The position is already used once in this wizard'); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
1071 |
} |
2933 |
14 Nov 14 |
olle |
1072 |
} |
2933 |
14 Nov 14 |
olle |
1073 |
} |
2933 |
14 Nov 14 |
olle |
1074 |
|
3276 |
29 Apr 15 |
olle |
//Wizard.setInputStatus('position.'+index, 'checking', 'Checking...'); |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'checking', 'Checking...'); |
2933 |
14 Nov 14 |
olle |
1077 |
|
2933 |
14 Nov 14 |
olle |
// Seems to be ok -- check if used by another sample |
2933 |
14 Nov 14 |
olle |
var request = Ajax.getXmlHttpRequest(); |
2933 |
14 Nov 14 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
2933 |
14 Nov 14 |
olle |
url += '&cmd=ValidateWell'; |
2933 |
14 Nov 14 |
olle |
url += '&box=' + encodeURIComponent(box); |
2933 |
14 Nov 14 |
olle |
url += '&row=' + encodeURIComponent(row); |
2933 |
14 Nov 14 |
olle |
url += '&column=' + encodeURIComponent(column); |
2933 |
14 Nov 14 |
olle |
1085 |
|
3276 |
29 Apr 15 |
olle |
Wizard.asyncJsonRequest(url, function(response) { streg.onBoxValidated(response, boxType, index) } ); |
2933 |
14 Nov 14 |
olle |
1087 |
} |
2933 |
14 Nov 14 |
olle |
1088 |
|
3276 |
29 Apr 15 |
olle |
streg.onBoxValidated = function(response, boxType, index) |
2933 |
14 Nov 14 |
olle |
1090 |
{ |
3276 |
29 Apr 15 |
olle |
// Get well position prefixes, default is for input tubes |
3276 |
29 Apr 15 |
olle |
var boxPrefix = 'box.'; |
3276 |
29 Apr 15 |
olle |
if (boxType && boxType == 'DNA') |
3276 |
29 Apr 15 |
olle |
1094 |
{ |
3276 |
29 Apr 15 |
olle |
boxPrefix = 'dnaBox.'; |
3276 |
29 Apr 15 |
olle |
1096 |
} |
3276 |
29 Apr 15 |
olle |
if (boxType && boxType == 'RNA') |
3276 |
29 Apr 15 |
olle |
1098 |
{ |
3276 |
29 Apr 15 |
olle |
boxPrefix = 'rnaBox.'; |
3276 |
29 Apr 15 |
olle |
1100 |
} |
3276 |
29 Apr 15 |
olle |
1101 |
|
3276 |
29 Apr 15 |
olle |
//Wizard.setInputStatus('position.'+index); |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
2933 |
14 Nov 14 |
olle |
if (response.message) |
2933 |
14 Nov 14 |
olle |
1105 |
{ |
3276 |
29 Apr 15 |
olle |
//Wizard.setInputStatus(response.box ? 'box.'+index : 'position.'+index, 'invalid', Strings.encodeTags(response.message)); |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', Strings.encodeTags(response.message)); |
2933 |
14 Nov 14 |
olle |
return; |
2933 |
14 Nov 14 |
olle |
1109 |
} |
2933 |
14 Nov 14 |
olle |
1110 |
|
3276 |
29 Apr 15 |
olle |
//wellIsValid[index] = true; |
3276 |
29 Apr 15 |
olle |
if (!boxType || boxType == 'Specimen') |
3276 |
29 Apr 15 |
olle |
1113 |
{ |
3276 |
29 Apr 15 |
olle |
wellIsValid[index] = true; |
3276 |
29 Apr 15 |
olle |
1115 |
} |
3276 |
29 Apr 15 |
olle |
else if (boxType && boxType == 'DNA') |
3276 |
29 Apr 15 |
olle |
1117 |
{ |
3276 |
29 Apr 15 |
olle |
dnaWellIsValid[index] = true; |
3276 |
29 Apr 15 |
olle |
1119 |
} |
3276 |
29 Apr 15 |
olle |
else if (boxType && boxType == 'RNA') |
3276 |
29 Apr 15 |
olle |
1121 |
{ |
3276 |
29 Apr 15 |
olle |
rnaWellIsValid[index] = true; |
3276 |
29 Apr 15 |
olle |
1123 |
} |
3276 |
29 Apr 15 |
olle |
else |
3276 |
29 Apr 15 |
olle |
1125 |
{ |
3276 |
29 Apr 15 |
olle |
wellIsValid[index] = true; |
3276 |
29 Apr 15 |
olle |
1127 |
} |
3276 |
29 Apr 15 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'valid'); |
3276 |
29 Apr 15 |
olle |
1129 |
/* |
2933 |
14 Nov 14 |
olle |
Wizard.setInputStatus('position.'+index, 'valid'); |
3276 |
29 Apr 15 |
olle |
1131 |
*/ |
2933 |
14 Nov 14 |
olle |
1132 |
} |
2933 |
14 Nov 14 |
olle |
1133 |
|
2933 |
14 Nov 14 |
olle |
1134 |
|
3028 |
11 Dec 14 |
olle |
streg.nofSectionsOnChange = function(event) |
3028 |
11 Dec 14 |
olle |
1136 |
{ |
3028 |
11 Dec 14 |
olle |
var frm = document.forms['meludi']; |
3028 |
11 Dec 14 |
olle |
var target = event.currentTarget; |
3028 |
11 Dec 14 |
olle |
1139 |
|
3028 |
11 Dec 14 |
olle |
var index = Data.int(target, 'index'); |
3028 |
11 Dec 14 |
olle |
var nofSections = frm['nofSections.'+index].value; |
3028 |
11 Dec 14 |
olle |
1142 |
|
3028 |
11 Dec 14 |
olle |
Wizard.setInputStatus('nofSections.'+index); |
3028 |
11 Dec 14 |
olle |
1144 |
|
3028 |
11 Dec 14 |
olle |
if (nofSections == '') |
3028 |
11 Dec 14 |
olle |
1146 |
{ |
3028 |
11 Dec 14 |
olle |
Wizard.setInputStatus('nofSections'+index, 'invalid', 'Missing'); |
3028 |
11 Dec 14 |
olle |
return; |
3028 |
11 Dec 14 |
olle |
1149 |
} |
3028 |
11 Dec 14 |
olle |
if (parseInt(nofSections) < 1) |
3028 |
11 Dec 14 |
olle |
1151 |
{ |
3028 |
11 Dec 14 |
olle |
Wizard.setInputStatus('nofSections'+index, 'invalid', 'Must be at least 1'); |
3028 |
11 Dec 14 |
olle |
return; |
3028 |
11 Dec 14 |
olle |
1154 |
} |
3028 |
11 Dec 14 |
olle |
Wizard.setInputStatus('nofSections'+index, 'valid'); |
3028 |
11 Dec 14 |
olle |
1156 |
} |
3028 |
11 Dec 14 |
olle |
1157 |
|
2933 |
14 Nov 14 |
olle |
streg.validateStep3 = function(event) |
2933 |
14 Nov 14 |
olle |
1159 |
{ |
2933 |
14 Nov 14 |
olle |
var valid = false; |
2933 |
14 Nov 14 |
olle |
1161 |
|
3276 |
29 Apr 15 |
olle |
var frm = document.forms['meludi']; |
3276 |
29 Apr 15 |
olle |
var tubeContentType = frm.tubeContentType.value; |
3276 |
29 Apr 15 |
olle |
if (tubeContentType == 'Specimen') |
2933 |
14 Nov 14 |
olle |
1165 |
{ |
3276 |
29 Apr 15 |
olle |
for (var i = 0; i < wellIsValid.length; i++) |
2933 |
14 Nov 14 |
olle |
1167 |
{ |
3276 |
29 Apr 15 |
olle |
// No storage space is allocated for first specimen, |
3276 |
29 Apr 15 |
olle |
// since all amount is expected to be used for analysis. |
3276 |
29 Apr 15 |
olle |
// Specimen tube with i == 0 is therefore skipped. |
3276 |
29 Apr 15 |
olle |
if (i > 0) |
3276 |
29 Apr 15 |
olle |
1172 |
{ |
3276 |
29 Apr 15 |
olle |
if (!wellIsValid[i]) |
3276 |
29 Apr 15 |
olle |
1174 |
{ |
3276 |
29 Apr 15 |
olle |
event.preventDefault(); |
3276 |
29 Apr 15 |
olle |
return; |
3276 |
29 Apr 15 |
olle |
1177 |
} |
3276 |
29 Apr 15 |
olle |
1178 |
} |
3276 |
29 Apr 15 |
olle |
if (!dnaWellIsValid[i]) |
3276 |
29 Apr 15 |
olle |
1180 |
{ |
3276 |
29 Apr 15 |
olle |
event.preventDefault(); |
3276 |
29 Apr 15 |
olle |
return; |
3276 |
29 Apr 15 |
olle |
1183 |
} |
3276 |
29 Apr 15 |
olle |
if (!rnaWellIsValid[i]) |
3276 |
29 Apr 15 |
olle |
1185 |
{ |
3276 |
29 Apr 15 |
olle |
event.preventDefault(); |
3276 |
29 Apr 15 |
olle |
return; |
3276 |
29 Apr 15 |
olle |
1188 |
} |
2933 |
14 Nov 14 |
olle |
1189 |
} |
2933 |
14 Nov 14 |
olle |
1190 |
} |
3276 |
29 Apr 15 |
olle |
else |
3276 |
29 Apr 15 |
olle |
1192 |
{ |
3276 |
29 Apr 15 |
olle |
// Input DNA, RNA, or DNA + RNA |
3276 |
29 Apr 15 |
olle |
for (var i = 0; i < wellIsValid.length; i++) |
3276 |
29 Apr 15 |
olle |
1195 |
{ |
3276 |
29 Apr 15 |
olle |
if (!wellIsValid[i]) |
3276 |
29 Apr 15 |
olle |
1197 |
{ |
3276 |
29 Apr 15 |
olle |
event.preventDefault(); |
3276 |
29 Apr 15 |
olle |
return; |
3276 |
29 Apr 15 |
olle |
1200 |
} |
3276 |
29 Apr 15 |
olle |
1201 |
} |
3276 |
29 Apr 15 |
olle |
1202 |
} |
2933 |
14 Nov 14 |
olle |
1203 |
} |
2933 |
14 Nov 14 |
olle |
1204 |
|
2933 |
14 Nov 14 |
olle |
1205 |
|
2933 |
14 Nov 14 |
olle |
streg.submit = function() |
2933 |
14 Nov 14 |
olle |
1207 |
{ |
2933 |
14 Nov 14 |
olle |
var frm = document.forms['meludi']; |
2933 |
14 Nov 14 |
olle |
1209 |
|
4198 |
31 Oct 16 |
olle |
caseInfo.pad = frm.pad.value; |
2933 |
14 Nov 14 |
olle |
caseInfo.arrivalDate = Strings.trim(frm.arrivalDate.value); |
2933 |
14 Nov 14 |
olle |
caseInfo.samplingDate = Strings.trim(frm.samplingDate.value); |
3123 |
09 Feb 15 |
olle |
caseInfo.mutationAnalysisKras = frm.mutationAnalysisKras.checked; |
3123 |
09 Feb 15 |
olle |
caseInfo.mutationAnalysisNras = frm.mutationAnalysisNras.checked; |
2933 |
14 Nov 14 |
olle |
caseInfo.mutationAnalysisBraf = frm.mutationAnalysisBraf.checked; |
2933 |
14 Nov 14 |
olle |
caseInfo.mutationAnalysisEgfr = frm.mutationAnalysisEgfr.checked; |
3123 |
09 Feb 15 |
olle |
caseInfo.mutationAnalysisAlkEml4 = frm.mutationAnalysisAlkEml4.checked; |
3123 |
09 Feb 15 |
olle |
caseInfo.mutationAnalysisPdgfra = frm.mutationAnalysisPdgfra.checked; |
3123 |
09 Feb 15 |
olle |
caseInfo.mutationAnalysisKit = frm.mutationAnalysisKit.checked; |
4730 |
04 Apr 18 |
olle |
caseInfo.mutationAnalysisTst170 = frm.mutationAnalysisTst170.checked; |
3123 |
09 Feb 15 |
olle |
caseInfo.mutationAnalysisOther = frm.mutationAnalysisOther.checked; |
2933 |
14 Nov 14 |
olle |
caseInfo.site = frm.site.value; |
3028 |
11 Dec 14 |
olle |
caseInfo.tubeContentType = frm.tubeContentType.value; |
3028 |
11 Dec 14 |
olle |
caseInfo.specimenType = frm.specimenType.value; |
4195 |
31 Oct 16 |
olle |
caseInfo.specimenInputType = frm.specimenInputType.value; |
2933 |
14 Nov 14 |
olle |
caseInfo.projectFocus = frm.projectFocus.value; |
4732 |
04 Apr 18 |
olle |
caseInfo.metastasisSite = frm.metastasisSite.value; |
3067 |
08 Jan 15 |
olle |
caseInfo.viableTumourCellsPercent = frm.viableTumourCellsPercent.value; |
2933 |
14 Nov 14 |
olle |
caseInfo.otherPathNote = frm.otherPathNote.value; |
4246 |
21 Nov 16 |
olle |
caseInfo.extractsFromFirstSpecimenOnly = frm.extractsFromFirstSpecimenOnlyCB.checked; |
2933 |
14 Nov 14 |
olle |
1231 |
|
2933 |
14 Nov 14 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
2933 |
14 Nov 14 |
olle |
caseInfo.specimen = []; |
2933 |
14 Nov 14 |
olle |
for (var i = 0; i < nofTubes; i++) |
2933 |
14 Nov 14 |
olle |
1235 |
{ |
2933 |
14 Nov 14 |
olle |
var specimenTube ={}; |
3028 |
11 Dec 14 |
olle |
specimenTube.name = streg.fetchTubeName(caseInfo.tubeContentType, caseInfo, i); |
2933 |
14 Nov 14 |
olle |
specimenTube.box = frm['box.'+i].value; |
2933 |
14 Nov 14 |
olle |
specimenTube.row = frm['row.'+i].value; |
2933 |
14 Nov 14 |
olle |
specimenTube.column = frm['column.'+i].value; |
3028 |
11 Dec 14 |
olle |
var nofSections = null; |
3028 |
11 Dec 14 |
olle |
if (caseInfo.tubeContentType == 'Specimen') |
3028 |
11 Dec 14 |
olle |
1243 |
{ |
4246 |
21 Nov 16 |
olle |
if (i == 0 || !caseInfo.extractsFromFirstSpecimenOnly) |
4246 |
21 Nov 16 |
olle |
1245 |
{ |
4246 |
21 Nov 16 |
olle |
// Storage position for DNA extract from specimen |
4246 |
21 Nov 16 |
olle |
specimenTube.dnaBox = frm['dnaBox.'+i].value; |
4246 |
21 Nov 16 |
olle |
specimenTube.dnaRow = frm['dnaRow.'+i].value; |
4246 |
21 Nov 16 |
olle |
specimenTube.dnaColumn = frm['dnaColumn.'+i].value; |
3276 |
29 Apr 15 |
olle |
1250 |
|
4246 |
21 Nov 16 |
olle |
// Storage position for RNA extract from specimen |
4246 |
21 Nov 16 |
olle |
specimenTube.rnaBox = frm['rnaBox.'+i].value; |
4246 |
21 Nov 16 |
olle |
specimenTube.rnaRow = frm['rnaRow.'+i].value; |
4246 |
21 Nov 16 |
olle |
specimenTube.rnaColumn = frm['rnaColumn.'+i].value; |
4246 |
21 Nov 16 |
olle |
1255 |
} |
3276 |
29 Apr 15 |
olle |
1256 |
|
3028 |
11 Dec 14 |
olle |
nofSections = frm['nofSections.'+i].value; |
3028 |
11 Dec 14 |
olle |
1258 |
} |
3028 |
11 Dec 14 |
olle |
specimenTube.nofSections = nofSections; |
2933 |
14 Nov 14 |
olle |
specimenTube.comment = frm['comment.'+i].value; |
3028 |
11 Dec 14 |
olle |
specimenTube.specimenType = frm.specimenType.value; |
4195 |
31 Oct 16 |
olle |
specimenTube.specimenInputType = frm.specimenInputType.value; |
2933 |
14 Nov 14 |
olle |
caseInfo.specimen[i] = specimenTube; |
2933 |
14 Nov 14 |
olle |
1264 |
} |
2933 |
14 Nov 14 |
olle |
1265 |
|
2933 |
14 Nov 14 |
olle |
var submitInfo = {}; |
2933 |
14 Nov 14 |
olle |
submitInfo.caseInfo = caseInfo; |
2933 |
14 Nov 14 |
olle |
1268 |
|
2933 |
14 Nov 14 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
2933 |
14 Nov 14 |
olle |
url += '&cmd=CreateSpecimenTubes'; |
2933 |
14 Nov 14 |
olle |
Wizard.showLoadingAnimation('Performing registration...'); |
2933 |
14 Nov 14 |
olle |
Wizard.asyncJsonRequest(url, streg.submissionResults, 'POST', JSON.stringify(submitInfo)); |
2933 |
14 Nov 14 |
olle |
1273 |
} |
2933 |
14 Nov 14 |
olle |
1274 |
|
2933 |
14 Nov 14 |
olle |
streg.submissionResults = function(response) |
2933 |
14 Nov 14 |
olle |
1276 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.showFinalMessage(response.messages); |
2933 |
14 Nov 14 |
olle |
Doc.show('gorestart'); |
2933 |
14 Nov 14 |
olle |
Doc.show('gonext-message'); |
2933 |
14 Nov 14 |
olle |
1280 |
} |
2933 |
14 Nov 14 |
olle |
1281 |
|
2933 |
14 Nov 14 |
olle |
streg.countDownToRestart = function() |
2933 |
14 Nov 14 |
olle |
1283 |
{ |
2933 |
14 Nov 14 |
olle |
var time = restartAt - (new Date()).getTime(); |
2933 |
14 Nov 14 |
olle |
if (time < 0) |
2933 |
14 Nov 14 |
olle |
1286 |
{ |
2933 |
14 Nov 14 |
olle |
Wizard.restartWizard(); |
2933 |
14 Nov 14 |
olle |
1288 |
} |
2933 |
14 Nov 14 |
olle |
else |
2933 |
14 Nov 14 |
olle |
1290 |
{ |
2933 |
14 Nov 14 |
olle |
Doc.element('gonext-message').innerHTML = '<i>Wizard will restart automatically in ' + Math.ceil(time/1000) + ' seconds...</i>'; |
2933 |
14 Nov 14 |
olle |
1292 |
} |
2933 |
14 Nov 14 |
olle |
1293 |
} |
2933 |
14 Nov 14 |
olle |
1294 |
|
2933 |
14 Nov 14 |
olle |
streg.stopAutoRestart = function() |
2933 |
14 Nov 14 |
olle |
1296 |
{ |
2933 |
14 Nov 14 |
olle |
clearTimeout(restartTimer); |
2933 |
14 Nov 14 |
olle |
Doc.hide('gonext-message'); |
2933 |
14 Nov 14 |
olle |
Doc.hide('gostop'); |
2933 |
14 Nov 14 |
olle |
1300 |
} |
2933 |
14 Nov 14 |
olle |
1301 |
|
2933 |
14 Nov 14 |
olle |
streg.getCheckboxStatus = function(checkbox) |
2933 |
14 Nov 14 |
olle |
1303 |
{ |
2933 |
14 Nov 14 |
olle |
return checkbox.checked; |
2933 |
14 Nov 14 |
olle |
1305 |
} |
2933 |
14 Nov 14 |
olle |
1306 |
|
2933 |
14 Nov 14 |
olle |
return streg; |
2933 |
14 Nov 14 |
olle |
1308 |
}(); |
2933 |
14 Nov 14 |
olle |
1309 |
|
2933 |
14 Nov 14 |
olle |
Doc.onLoad(SpecimenTubeReg.initPage); |
2933 |
14 Nov 14 |
olle |
1311 |
|