3176 |
06 Mar 15 |
olle |
var Details = function() |
3176 |
06 Mar 15 |
olle |
2 |
{ |
3176 |
06 Mar 15 |
olle |
var details = {}; |
3176 |
06 Mar 15 |
olle |
var debug = 0; |
3176 |
06 Mar 15 |
olle |
5 |
|
3176 |
06 Mar 15 |
olle |
// Page initialization |
3176 |
06 Mar 15 |
olle |
details.initPage = function() |
3176 |
06 Mar 15 |
olle |
8 |
{ |
3176 |
06 Mar 15 |
olle |
Buttons.addClickHandler('close', App.closeWindow); |
3176 |
06 Mar 15 |
olle |
Buttons.addClickHandler('btnSave', details.saveDetails); |
3176 |
06 Mar 15 |
olle |
11 |
|
3176 |
06 Mar 15 |
olle |
Events.addEventHandler('dnaVolume', 'keypress', Events.numberOnly); |
3176 |
06 Mar 15 |
olle |
Events.addEventHandler('rnaVolume', 'keypress', Events.numberOnly); |
3176 |
06 Mar 15 |
olle |
14 |
|
3176 |
06 Mar 15 |
olle |
var index = Data.int('page-data', 'index'); |
3176 |
06 Mar 15 |
olle |
var frm = document.forms['details']; |
3176 |
06 Mar 15 |
olle |
var pfrm = window.opener.document.forms['meludi']; |
3313 |
07 May 15 |
olle |
18 |
|
3176 |
06 Mar 15 |
olle |
//var specimen = pfrm.extractSourceItems[index].specimen; |
3176 |
06 Mar 15 |
olle |
var selItemsList = getSelectedItemsList(); |
3176 |
06 Mar 15 |
olle |
var item = selItemsList[index]; |
3176 |
06 Mar 15 |
olle |
var specimen = item; |
3176 |
06 Mar 15 |
olle |
23 |
|
3365 |
03 Jun 15 |
olle |
24 |
/* |
3176 |
06 Mar 15 |
olle |
frm.qiacubePosition.value = specimen.qiacubePosition; |
3365 |
03 Jun 15 |
olle |
26 |
*/ |
3176 |
06 Mar 15 |
olle |
frm.dnaVolume.value = specimen.dna.volume; |
3176 |
06 Mar 15 |
olle |
frm.rnaVolume.value = specimen.rna.volume; |
3176 |
06 Mar 15 |
olle |
29 |
|
3176 |
06 Mar 15 |
olle |
frm.specimenComment.value = specimen.comment || ''; |
3176 |
06 Mar 15 |
olle |
frm.dnaComment.value = specimen.dna.comment || ''; |
3176 |
06 Mar 15 |
olle |
frm.rnaComment.value = specimen.rna.comment || ''; |
3176 |
06 Mar 15 |
olle |
33 |
|
3176 |
06 Mar 15 |
olle |
var reagents = window.opener.ExtractionReg.REAGENTS; |
3176 |
06 Mar 15 |
olle |
for (var i = 0; i < reagents.length; i++) |
3176 |
06 Mar 15 |
olle |
36 |
{ |
3176 |
06 Mar 15 |
olle |
var rg = reagents[i]; |
3176 |
06 Mar 15 |
olle |
frm[rg].value = specimen[rg] || ''; |
3176 |
06 Mar 15 |
olle |
Doc.element(rg+'.default').innerHTML = Strings.encodeTags(pfrm[rg].value); |
3176 |
06 Mar 15 |
olle |
40 |
} |
3176 |
06 Mar 15 |
olle |
41 |
|
3176 |
06 Mar 15 |
olle |
details.checkForm(); |
3365 |
03 Jun 15 |
olle |
43 |
/* |
3176 |
06 Mar 15 |
olle |
frm.qiacubePosition.focus(); |
3365 |
03 Jun 15 |
olle |
45 |
*/ |
3365 |
03 Jun 15 |
olle |
frm.specimenComment.focus(); |
3176 |
06 Mar 15 |
olle |
47 |
} |
3176 |
06 Mar 15 |
olle |
48 |
|
3176 |
06 Mar 15 |
olle |
details.checkForm = function() |
3176 |
06 Mar 15 |
olle |
50 |
{ |
3176 |
06 Mar 15 |
olle |
var frm = document.forms['details']; |
3176 |
06 Mar 15 |
olle |
52 |
|
3176 |
06 Mar 15 |
olle |
var index = Data.int('page-data', 'index'); |
3176 |
06 Mar 15 |
olle |
var selItemsList = getSelectedItemsList(); |
3176 |
06 Mar 15 |
olle |
var item = selItemsList[index]; |
3176 |
06 Mar 15 |
olle |
56 |
|
3365 |
03 Jun 15 |
olle |
57 |
/* |
3176 |
06 Mar 15 |
olle |
// Qiacube position |
3176 |
06 Mar 15 |
olle |
var qiacubePositionStr = frm.qiacubePosition.value; |
3352 |
26 May 15 |
olle |
if (ExtractUtils.isSpecimen(item)) |
3176 |
06 Mar 15 |
olle |
61 |
{ |
3176 |
06 Mar 15 |
olle |
// Check prefix indicating QIAcube instrument |
3176 |
06 Mar 15 |
olle |
var qiacubeInstrPrefix = qiacubePositionStr.substring(0,1); |
3176 |
06 Mar 15 |
olle |
if (/^[A-Z]$/.test(qiacubeInstrPrefix) == false) |
3176 |
06 Mar 15 |
olle |
65 |
{ |
3176 |
06 Mar 15 |
olle |
Forms.showNotification('qiacubePosition', 'QIAcube instrument prefix must be uppercase letter A-Z.'); |
3176 |
06 Mar 15 |
olle |
return false; |
3176 |
06 Mar 15 |
olle |
68 |
} |
3176 |
06 Mar 15 |
olle |
// Remove prefix indicating QIAcube instrument |
3176 |
06 Mar 15 |
olle |
qiacubePositionStr = qiacubePositionStr.substring(1); |
3176 |
06 Mar 15 |
olle |
var qiacubePosition = parseInt(qiacubePositionStr, 10); |
3176 |
06 Mar 15 |
olle |
if (qiacubePosition < 1 || qiacubePosition > 12) |
3176 |
06 Mar 15 |
olle |
73 |
{ |
3176 |
06 Mar 15 |
olle |
Forms.showNotification('qiacubePosition', 'QIAcube position must be between 1 and 12.'); |
3176 |
06 Mar 15 |
olle |
return false; |
3176 |
06 Mar 15 |
olle |
76 |
} |
3176 |
06 Mar 15 |
olle |
77 |
} |
3176 |
06 Mar 15 |
olle |
else |
3176 |
06 Mar 15 |
olle |
79 |
{ |
3176 |
06 Mar 15 |
olle |
if (qiacubePositionStr) |
3176 |
06 Mar 15 |
olle |
81 |
{ |
3176 |
06 Mar 15 |
olle |
Forms.showNotification('qiacubePosition', 'Input RNA and DNA do not have a QIAcube position.'); |
3176 |
06 Mar 15 |
olle |
return false; |
3176 |
06 Mar 15 |
olle |
84 |
} |
3176 |
06 Mar 15 |
olle |
85 |
} |
3365 |
03 Jun 15 |
olle |
86 |
*/ |
3176 |
06 Mar 15 |
olle |
87 |
|
3176 |
06 Mar 15 |
olle |
// DNA |
3176 |
06 Mar 15 |
olle |
var dnaVolume = parseFloat(frm.dnaVolume.value); |
3176 |
06 Mar 15 |
olle |
if (!(dnaVolume > 0)) |
3176 |
06 Mar 15 |
olle |
91 |
{ |
3176 |
06 Mar 15 |
olle |
Forms.showNotification('dnaVolume', 'Invalid value for DNA volume.'); |
3176 |
06 Mar 15 |
olle |
return false; |
3176 |
06 Mar 15 |
olle |
94 |
} |
3176 |
06 Mar 15 |
olle |
95 |
|
3176 |
06 Mar 15 |
olle |
// RNA |
3176 |
06 Mar 15 |
olle |
var rnaVolume = parseFloat(frm.rnaVolume.value); |
3176 |
06 Mar 15 |
olle |
if (!(rnaVolume > 0)) |
3176 |
06 Mar 15 |
olle |
99 |
{ |
3176 |
06 Mar 15 |
olle |
Forms.showNotification('rnaVolume', 'Invalid value for RNA volume.'); |
3176 |
06 Mar 15 |
olle |
showError('Invalid value for RNA volume.'); |
3176 |
06 Mar 15 |
olle |
return false; |
3176 |
06 Mar 15 |
olle |
103 |
} |
3176 |
06 Mar 15 |
olle |
104 |
|
3176 |
06 Mar 15 |
olle |
return true; |
3176 |
06 Mar 15 |
olle |
106 |
} |
3176 |
06 Mar 15 |
olle |
107 |
|
3176 |
06 Mar 15 |
olle |
details.saveDetails = function() |
3176 |
06 Mar 15 |
olle |
109 |
{ |
3176 |
06 Mar 15 |
olle |
if (!details.checkForm()) return; |
3176 |
06 Mar 15 |
olle |
111 |
|
3176 |
06 Mar 15 |
olle |
var index = Data.int('page-data', 'index'); |
3176 |
06 Mar 15 |
olle |
var mode = Data.get('page-data', 'mode'); |
3176 |
06 Mar 15 |
olle |
//var specimen = window.opener.document.forms['meludi'].extractSourceItems[index].specimen; |
3176 |
06 Mar 15 |
olle |
//var specimen = pfrm.extractSourceItems[index].specimen; |
3176 |
06 Mar 15 |
olle |
var selItemsList = getSelectedItemsList(); |
3176 |
06 Mar 15 |
olle |
var item = selItemsList[index]; |
3176 |
06 Mar 15 |
olle |
var specimen = item; |
3176 |
06 Mar 15 |
olle |
var frm = document.forms['details']; |
3176 |
06 Mar 15 |
olle |
120 |
|
3365 |
03 Jun 15 |
olle |
121 |
/* |
3176 |
06 Mar 15 |
olle |
specimen.qiacubePosition = frm.qiacubePosition.value; |
3365 |
03 Jun 15 |
olle |
123 |
*/ |
3176 |
06 Mar 15 |
olle |
specimen.comment = frm.specimenComment.value; |
3176 |
06 Mar 15 |
olle |
125 |
|
3176 |
06 Mar 15 |
olle |
specimen.dna.volume = parseFloat(frm.dnaVolume.value); |
3176 |
06 Mar 15 |
olle |
specimen.dna.comment = frm.dnaComment.value; |
3176 |
06 Mar 15 |
olle |
specimen.rna.volume = parseFloat(frm.rnaVolume.value); |
3176 |
06 Mar 15 |
olle |
specimen.rna.comment = frm.rnaComment.value; |
3176 |
06 Mar 15 |
olle |
130 |
|
3176 |
06 Mar 15 |
olle |
if (mode != null && mode == 'ExtractionReg') |
3176 |
06 Mar 15 |
olle |
132 |
{ |
3176 |
06 Mar 15 |
olle |
var reagents = window.opener.ExtractionReg.REAGENTS; |
3176 |
06 Mar 15 |
olle |
for (var i = 0; i < reagents.length; i++) |
3176 |
06 Mar 15 |
olle |
135 |
{ |
3176 |
06 Mar 15 |
olle |
var rg = reagents[i]; |
3176 |
06 Mar 15 |
olle |
specimen[rg] = frm[rg].value || null; |
3176 |
06 Mar 15 |
olle |
138 |
} |
3176 |
06 Mar 15 |
olle |
139 |
} |
3176 |
06 Mar 15 |
olle |
140 |
|
3176 |
06 Mar 15 |
olle |
if (mode != null && mode == 'ExtractionReg') |
3176 |
06 Mar 15 |
olle |
142 |
{ |
3176 |
06 Mar 15 |
olle |
window.opener.ExtractionReg.updateDetailsTable(); |
3176 |
06 Mar 15 |
olle |
144 |
} |
3176 |
06 Mar 15 |
olle |
else |
3176 |
06 Mar 15 |
olle |
146 |
{ |
3176 |
06 Mar 15 |
olle |
window.opener.ExtractionPrep.updateDetailsTable(); |
3176 |
06 Mar 15 |
olle |
148 |
} |
3176 |
06 Mar 15 |
olle |
window.close(); |
3176 |
06 Mar 15 |
olle |
150 |
} |
3176 |
06 Mar 15 |
olle |
151 |
|
3176 |
06 Mar 15 |
olle |
getSelectedItemsList = function() |
3176 |
06 Mar 15 |
olle |
153 |
{ |
3176 |
06 Mar 15 |
olle |
var pfrm = window.opener.document.forms['meludi']; |
3176 |
06 Mar 15 |
olle |
155 |
|
3176 |
06 Mar 15 |
olle |
// Get number of selected extract source items |
3176 |
06 Mar 15 |
olle |
var numItems = 0; |
3176 |
06 Mar 15 |
olle |
var selItemsList = []; |
3176 |
06 Mar 15 |
olle |
for (var i = 0; i < pfrm.extractSourceItems.length; i++) |
3176 |
06 Mar 15 |
olle |
160 |
{ |
3176 |
06 Mar 15 |
olle |
if (pfrm.extractSourceItems[i].selected) |
3176 |
06 Mar 15 |
olle |
162 |
{ |
3212 |
27 Mar 15 |
olle |
if (pfrm.extractSourceItems[i].item != null) |
3176 |
06 Mar 15 |
olle |
164 |
{ |
3212 |
27 Mar 15 |
olle |
selItemsList[numItems] = pfrm.extractSourceItems[i].item; |
3176 |
06 Mar 15 |
olle |
numItems++; |
3176 |
06 Mar 15 |
olle |
167 |
} |
3176 |
06 Mar 15 |
olle |
168 |
} |
3176 |
06 Mar 15 |
olle |
169 |
} |
3176 |
06 Mar 15 |
olle |
return selItemsList; |
3176 |
06 Mar 15 |
olle |
171 |
} |
3176 |
06 Mar 15 |
olle |
172 |
|
3176 |
06 Mar 15 |
olle |
return details; |
3176 |
06 Mar 15 |
olle |
174 |
}(); |
3176 |
06 Mar 15 |
olle |
175 |
|
3176 |
06 Mar 15 |
olle |
Doc.onLoad(Details.initPage); |
3176 |
06 Mar 15 |
olle |
177 |
|