3412 |
22 Jun 15 |
olle |
var ExtraMaterialReg = function() |
3412 |
22 Jun 15 |
olle |
2 |
{ |
3412 |
22 Jun 15 |
olle |
var emreg = {}; |
3412 |
22 Jun 15 |
olle |
var debug = 0; |
3412 |
22 Jun 15 |
olle |
5 |
|
3412 |
22 Jun 15 |
olle |
var emInfo; |
4207 |
07 Nov 16 |
olle |
7 |
|
4207 |
07 Nov 16 |
olle |
var sampleItemPrefix = ''; |
3412 |
22 Jun 15 |
olle |
var nofExtraMaterialIsValid = false; |
3435 |
02 Jul 15 |
olle |
var extraMaterialIsValid = false; |
3412 |
22 Jun 15 |
olle |
var jsonOldNameArr = []; |
3412 |
22 Jun 15 |
olle |
12 |
|
3412 |
22 Jun 15 |
olle |
var restartTimer; |
3412 |
22 Jun 15 |
olle |
var restartAt; |
3412 |
22 Jun 15 |
olle |
15 |
|
3412 |
22 Jun 15 |
olle |
// Page initialization |
3412 |
22 Jun 15 |
olle |
emreg.initPage = function() |
3412 |
22 Jun 15 |
olle |
18 |
{ |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
20 |
|
3412 |
22 Jun 15 |
olle |
// Step 1 |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', emreg.validateStep1); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('nofExtraMaterial', 'keypress', Events.integerOnly); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('nofExtraMaterial', 'blur', emreg.nofExtraMaterialOnChange); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('nofExtraMaterial', 'keypress', Wizard.goNextOnTabOrEnter); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('arrivalDateDefault', 'blur', emreg.arrivalDateOnChange, { 'index': -1 }); |
3412 |
22 Jun 15 |
olle |
27 |
|
3412 |
22 Jun 15 |
olle |
// Set default value for default arrival date |
3412 |
22 Jun 15 |
olle |
frm.arrivalDateDefault.value = Dates.formatDate(new Date(), 'yyyyMMdd'); |
3412 |
22 Jun 15 |
olle |
30 |
|
3412 |
22 Jun 15 |
olle |
// Step 2 |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('step-2', 'wizard-initialize', emreg.initializeStep2); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', emreg.validateStep2); |
3412 |
22 Jun 15 |
olle |
34 |
|
3412 |
22 Jun 15 |
olle |
// Navigation |
3412 |
22 Jun 15 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
3412 |
22 Jun 15 |
olle |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
3412 |
22 Jun 15 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
3412 |
22 Jun 15 |
olle |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
3412 |
22 Jun 15 |
olle |
Buttons.addClickHandler('gostop', emreg.stopAutoRestart); |
3412 |
22 Jun 15 |
olle |
41 |
|
3412 |
22 Jun 15 |
olle |
// Final registration |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('wizard', 'wizard-submit', emreg.submit); |
3412 |
22 Jun 15 |
olle |
44 |
|
4207 |
07 Nov 16 |
olle |
// Call LabelGenerationServlet to get sample item prefix |
4207 |
07 Nov 16 |
olle |
var url = '../LabelGeneration.servlet?ID='+App.getSessionId(); |
4207 |
07 Nov 16 |
olle |
url += '&cmd=CountCases'; |
4207 |
07 Nov 16 |
olle |
48 |
|
4207 |
07 Nov 16 |
olle |
Wizard.showLoadingAnimation('Loading information about project...'); |
4207 |
07 Nov 16 |
olle |
Wizard.asyncJsonRequest(url, emreg.projectInfoLoaded); |
4207 |
07 Nov 16 |
olle |
51 |
} |
4207 |
07 Nov 16 |
olle |
52 |
|
4207 |
07 Nov 16 |
olle |
emreg.projectInfoLoaded = function(response) |
4207 |
07 Nov 16 |
olle |
54 |
{ |
4207 |
07 Nov 16 |
olle |
var frm = document.forms['meludi']; |
4207 |
07 Nov 16 |
olle |
56 |
|
4207 |
07 Nov 16 |
olle |
sampleItemPrefix = response.sampleItemPrefix; |
4207 |
07 Nov 16 |
olle |
58 |
|
4207 |
07 Nov 16 |
olle |
Doc.element('instructSamplePrefix').innerHTML = '4. The name must not start with "' + sampleItemPrefix + '", since that is reserved for MeLuDI items.<br>'; |
4207 |
07 Nov 16 |
olle |
60 |
|
3412 |
22 Jun 15 |
olle |
Doc.show('step-1'); |
3412 |
22 Jun 15 |
olle |
Doc.show('gonext'); |
3412 |
22 Jun 15 |
olle |
63 |
} |
3412 |
22 Jun 15 |
olle |
64 |
|
3412 |
22 Jun 15 |
olle |
emreg.validateStep1 = function(event) |
3412 |
22 Jun 15 |
olle |
66 |
{ |
3412 |
22 Jun 15 |
olle |
emreg.nofExtraMaterialOnChange(); |
3412 |
22 Jun 15 |
olle |
// If not valid, we prevent the wizard from moving to the next step |
3412 |
22 Jun 15 |
olle |
if (!nofExtraMaterialIsValid) event.preventDefault(); |
3412 |
22 Jun 15 |
olle |
70 |
} |
3412 |
22 Jun 15 |
olle |
71 |
|
3412 |
22 Jun 15 |
olle |
emreg.initializeStep2 = function() |
3412 |
22 Jun 15 |
olle |
73 |
{ |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
var nofExtraMaterial = frm.nofExtraMaterial.value; |
3412 |
22 Jun 15 |
olle |
76 |
|
3412 |
22 Jun 15 |
olle |
var html = '<table id="extra-material" class="step-form">'; |
3412 |
22 Jun 15 |
olle |
// First header row |
3412 |
22 Jun 15 |
olle |
html += '<thead>'; |
3412 |
22 Jun 15 |
olle |
html += '<tr>'; |
3412 |
22 Jun 15 |
olle |
html += '<th class="dottedleft" style="width: 18em;">Name</th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th colspan="3" style="width: 9em;">Type</th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th style="width: 18em;">Item name</th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th style="width: 8em;">Arrival date</th>'; |
3637 |
01 Dec 15 |
olle |
html += '<th colspan="2" style="width: 11em;">Control reference std.</th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th style="width: 300px;">Operator delivery comment</th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th></th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th>Input message</th>'; |
3412 |
22 Jun 15 |
olle |
html += '</tr>'; |
3412 |
22 Jun 15 |
olle |
// Second header row |
3412 |
22 Jun 15 |
olle |
html += '<tr>'; |
3412 |
22 Jun 15 |
olle |
html += '<th></th>'; |
3412 |
22 Jun 15 |
olle |
html += '<td style="width: 3em;">DNA</td><td style="width: 3em;">RNA</td><td style="width: 3em;">Spec.</td>'; |
3412 |
22 Jun 15 |
olle |
html += '<th class="dottedleft"></th>'; |
3412 |
22 Jun 15 |
olle |
html += '<th style="width: 8em;"></th>'; |
3637 |
01 Dec 15 |
olle |
html += '<td style="width: 3em;"></td>'; |
3637 |
01 Dec 15 |
olle |
html += '<td style="width: 8em;">Lot no.</td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td style="width: 300px;"></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td class="dottedleft"></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td class="dottedleft"></td>'; |
3412 |
22 Jun 15 |
olle |
html += '</tr>'; |
3412 |
22 Jun 15 |
olle |
html += '</thead>'; |
3412 |
22 Jun 15 |
olle |
html += '<tbody>'; |
3412 |
22 Jun 15 |
olle |
104 |
|
3412 |
22 Jun 15 |
olle |
for (var i=0; i < nofExtraMaterial; i++) |
3412 |
22 Jun 15 |
olle |
106 |
{ |
3412 |
22 Jun 15 |
olle |
// Get id for next tab field, going down each column, starting with the one at left |
3412 |
22 Jun 15 |
olle |
var nameNextId = 'name.'+(i+1); |
3412 |
22 Jun 15 |
olle |
// Check if reached last row |
3412 |
22 Jun 15 |
olle |
if (i == nofExtraMaterial-1) |
3412 |
22 Jun 15 |
olle |
111 |
{ |
3412 |
22 Jun 15 |
olle |
nameNextId = 'comment.0'; |
3412 |
22 Jun 15 |
olle |
113 |
} |
3412 |
22 Jun 15 |
olle |
var arrivalDateNextId = 'arrivaldate.'+(i+1); |
3412 |
22 Jun 15 |
olle |
// Check if reached last row |
3412 |
22 Jun 15 |
olle |
if (i == nofExtraMaterial-1) |
3412 |
22 Jun 15 |
olle |
117 |
{ |
3412 |
22 Jun 15 |
olle |
arrivalDateNextId = 'comment.0'; |
3412 |
22 Jun 15 |
olle |
119 |
} |
3412 |
22 Jun 15 |
olle |
// Check if reached last row |
3412 |
22 Jun 15 |
olle |
var commentNextId = 'comment.'+(i+1); |
3412 |
22 Jun 15 |
olle |
if (i == nofExtraMaterial-1) |
3412 |
22 Jun 15 |
olle |
123 |
{ |
3412 |
22 Jun 15 |
olle |
commentNextId = 'goregister'; |
3412 |
22 Jun 15 |
olle |
125 |
} |
3412 |
22 Jun 15 |
olle |
html += '<tr>'; |
3637 |
01 Dec 15 |
olle |
html += '<td><input type="text" id="name.'+i+'" style="width: 16em;" data-next-focus="'+nameNextId+'"></input></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td style="width: 3em;"><input type="radio" name="type.'+i+'" id="isDna.'+i+'" value="DNA" checked></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td style="width: 3em;"><input type="radio" name="type.'+i+'" id="isRna.'+i+'" value="RNA" ></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td style="width: 3em;"><input type="radio" name="type.'+i+'" id="isSpecimen.'+i+'" value="Specimen" ></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td id="itemname.'+i+'" style="width: 18em;"></td>'; |
3412 |
22 Jun 15 |
olle |
// Arrival date |
3412 |
22 Jun 15 |
olle |
html += '<td class="input" style="width: 8em;">'; |
3412 |
22 Jun 15 |
olle |
html += '<input type="text" id="arrivaldate.'+i+'"' |
3412 |
22 Jun 15 |
olle |
html += ' class="auto-init" data-auto-init="focus-on-enter" data-next-focus="'+arrivalDateNextId+'"' |
3412 |
22 Jun 15 |
olle |
html += ' data-disallow-future-date="1"' |
3412 |
22 Jun 15 |
olle |
html += ' style="width: 6em;" maxlength="10">' |
3412 |
22 Jun 15 |
olle |
html += '</td>'; |
3637 |
01 Dec 15 |
olle |
// Control check box |
3637 |
01 Dec 15 |
olle |
html += '<td style="width: 3em;"><input type="checkbox" name="isControl.'+i+'" id="isControl.'+i+'"></td>'; |
3637 |
01 Dec 15 |
olle |
// Control lot no. |
3637 |
01 Dec 15 |
olle |
html += '<td><input type="text" id="controlLotNo.'+i+'" style="width: 8em;" data-next-focus=""></input></td>'; |
3412 |
22 Jun 15 |
olle |
// Operator delivery comment |
3412 |
22 Jun 15 |
olle |
html += '<td class="input" style="width: 300px;"><textarea rows="1" name="comment.'+i+'" id="comment.'+i+'" style="width: 300px; height: 20px;" data-next-focus="'+commentNextId+'"></textarea></td>'; |
3412 |
22 Jun 15 |
olle |
// Status and message columns |
3412 |
22 Jun 15 |
olle |
html += '<td class="status" id="extramaterial.'+i+'.status"></td>'; |
3412 |
22 Jun 15 |
olle |
html += '<td class="help"><span id="extramaterial.'+i+'.message" class="message"></span></td>'; |
3412 |
22 Jun 15 |
olle |
html += '</tr>'; |
3412 |
22 Jun 15 |
olle |
149 |
} |
3412 |
22 Jun 15 |
olle |
Doc.element('extra-material').innerHTML = html; |
3412 |
22 Jun 15 |
olle |
151 |
|
3412 |
22 Jun 15 |
olle |
for (var i=0; i < nofExtraMaterial; i++) |
3412 |
22 Jun 15 |
olle |
153 |
{ |
3412 |
22 Jun 15 |
olle |
// Add event handlers |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('name.'+i, 'change', emreg.nameOnChange, { 'index': i }); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('isDna.'+i, 'change', emreg.typeOnChange, { 'type': 'DNA', 'index': i }); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('isRna.'+i, 'change', emreg.typeOnChange, { 'type': 'RNA', 'index': i }); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('isSpecimen.'+i, 'change', emreg.typeOnChange, { 'type': 'Specimen', 'index': i }); |
3412 |
22 Jun 15 |
olle |
Events.addEventHandler('arrivaldate.'+i, 'blur', emreg.arrivalDateOnChange, { 'index': i }); |
3637 |
01 Dec 15 |
olle |
Events.addEventHandler('isControl.'+i, 'change', emreg.controlOnChange, { 'index': i }); |
3412 |
22 Jun 15 |
olle |
161 |
|
3412 |
22 Jun 15 |
olle |
// Set default values for dates |
3412 |
22 Jun 15 |
olle |
var defaultArrivalDate = frm.arrivalDateDefault.value; |
3412 |
22 Jun 15 |
olle |
frm['arrivaldate.'+i].value = defaultArrivalDate; |
3435 |
02 Jul 15 |
olle |
165 |
|
3435 |
02 Jul 15 |
olle |
// Set default values for input status |
3435 |
02 Jul 15 |
olle |
Wizard.setInputStatus('extramaterial.'+i, 'invalid', 'Missing name'); |
3637 |
01 Dec 15 |
olle |
168 |
|
3637 |
01 Dec 15 |
olle |
// Disable control lot number field initially |
3637 |
01 Dec 15 |
olle |
Doc.addClass('controlLotNo.'+i, 'disabled'); |
3412 |
22 Jun 15 |
olle |
171 |
} |
3412 |
22 Jun 15 |
olle |
172 |
|
3412 |
22 Jun 15 |
olle |
Wizard.setCurrentStep(2); |
3412 |
22 Jun 15 |
olle |
Doc.show('goregister'); |
3412 |
22 Jun 15 |
olle |
Doc.show('gocancel'); |
3412 |
22 Jun 15 |
olle |
frm['name.0'].focus(); |
3412 |
22 Jun 15 |
olle |
177 |
} |
3412 |
22 Jun 15 |
olle |
178 |
|
3412 |
22 Jun 15 |
olle |
emreg.nofExtraMaterialOnChange = function() |
3412 |
22 Jun 15 |
olle |
180 |
{ |
3412 |
22 Jun 15 |
olle |
nofExtraMaterialIsValid = false; |
3412 |
22 Jun 15 |
olle |
182 |
|
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
var nofExtraMaterial = frm.nofExtraMaterial.value; |
3412 |
22 Jun 15 |
olle |
185 |
|
3412 |
22 Jun 15 |
olle |
if (nofExtraMaterial == '') |
3412 |
22 Jun 15 |
olle |
187 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('nofExtraMaterial', 'invalid', 'Missing'); |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
190 |
} |
3412 |
22 Jun 15 |
olle |
if (parseInt(nofExtraMaterial) < 1) |
3412 |
22 Jun 15 |
olle |
192 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('nofExtraMaterial', 'invalid', 'Must be at least 1'); |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
195 |
} |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('nofExtraMaterial', 'valid'); |
3412 |
22 Jun 15 |
olle |
nofExtraMaterialIsValid = true; |
3412 |
22 Jun 15 |
olle |
198 |
} |
3412 |
22 Jun 15 |
olle |
199 |
|
3412 |
22 Jun 15 |
olle |
emreg.nameOnChange = function(event) |
3412 |
22 Jun 15 |
olle |
201 |
{ |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
var target = event.currentTarget; |
3412 |
22 Jun 15 |
olle |
204 |
|
3412 |
22 Jun 15 |
olle |
var index = Data.int(target, 'index'); |
3412 |
22 Jun 15 |
olle |
206 |
|
3639 |
02 Dec 15 |
olle |
// Extra material names may contain letters, figures, underscores "_", and hyphens "-". |
3639 |
02 Dec 15 |
olle |
// The name must contain at least one letter. |
3639 |
02 Dec 15 |
olle |
// The name must not start with underscore "_" or hyphen "-". |
3639 |
02 Dec 15 |
olle |
// The name must not start with "ML", since that is reserved for MeLuDI items. |
3639 |
02 Dec 15 |
olle |
211 |
|
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = true; |
3435 |
02 Jul 15 |
olle |
213 |
|
3412 |
22 Jun 15 |
olle |
var namePrefix = 'name.'; |
3412 |
22 Jun 15 |
olle |
var name = frm[namePrefix+index].value; |
3412 |
22 Jun 15 |
olle |
216 |
|
3639 |
02 Dec 15 |
olle |
// Check that name is not empty string |
3412 |
22 Jun 15 |
olle |
if (name == '') |
3412 |
22 Jun 15 |
olle |
219 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'Missing name'); |
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = false; |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
223 |
} |
4207 |
07 Nov 16 |
olle |
// Check that name does not start with sample item prefix |
4207 |
07 Nov 16 |
olle |
if (name.indexOf(sampleItemPrefix) == 0) |
3412 |
22 Jun 15 |
olle |
226 |
{ |
4207 |
07 Nov 16 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'Name of extra material must not start with "' + sampleItemPrefix + '"'); |
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = false; |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
230 |
} |
3639 |
02 Dec 15 |
olle |
// Check that name does not start with underscore "_" |
3639 |
02 Dec 15 |
olle |
if (name.indexOf('_') == 0) |
3639 |
02 Dec 15 |
olle |
233 |
{ |
3639 |
02 Dec 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'Name of extra material must not start with "_"'); |
3639 |
02 Dec 15 |
olle |
extraMaterialIsValid = false; |
3639 |
02 Dec 15 |
olle |
return; |
3639 |
02 Dec 15 |
olle |
237 |
} |
3639 |
02 Dec 15 |
olle |
// Check that name does not start with hyphen "-" |
3639 |
02 Dec 15 |
olle |
if (name.indexOf('-') == 0) |
3639 |
02 Dec 15 |
olle |
240 |
{ |
3639 |
02 Dec 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'Name of extra material must not start with "-"'); |
3639 |
02 Dec 15 |
olle |
extraMaterialIsValid = false; |
3639 |
02 Dec 15 |
olle |
return; |
3639 |
02 Dec 15 |
olle |
244 |
} |
3639 |
02 Dec 15 |
olle |
// Check that name only contains letters, figures, underscores, and hyphens |
3639 |
02 Dec 15 |
olle |
var pattern = /^[A-Za-z0-9_-]*$/ |
3639 |
02 Dec 15 |
olle |
if (!pattern.test(name)) |
3639 |
02 Dec 15 |
olle |
248 |
{ |
3639 |
02 Dec 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'Name must contain only letters, figures, underscores, and hyphens'); |
3639 |
02 Dec 15 |
olle |
extraMaterialIsValid = false; |
3639 |
02 Dec 15 |
olle |
return; |
3639 |
02 Dec 15 |
olle |
252 |
} |
3639 |
02 Dec 15 |
olle |
// Check that name contains at least one letter |
3639 |
02 Dec 15 |
olle |
pattern = /^[0-9_-]*[A-Za-z]+[A-Za-z0-9_-]*$/ |
3639 |
02 Dec 15 |
olle |
if (!pattern.test(name)) |
3639 |
02 Dec 15 |
olle |
256 |
{ |
3639 |
02 Dec 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'Name must contain at least one letter'); |
3639 |
02 Dec 15 |
olle |
extraMaterialIsValid = false; |
3639 |
02 Dec 15 |
olle |
return; |
3639 |
02 Dec 15 |
olle |
260 |
} |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'valid'); |
3412 |
22 Jun 15 |
olle |
262 |
|
3412 |
22 Jun 15 |
olle |
var type = frm['type.'+index].value; |
3412 |
22 Jun 15 |
olle |
264 |
|
3412 |
22 Jun 15 |
olle |
// Check if an old name exists |
3412 |
22 Jun 15 |
olle |
var oldName = jsonOldNameArr[index]; |
3412 |
22 Jun 15 |
olle |
267 |
|
3412 |
22 Jun 15 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
3412 |
22 Jun 15 |
olle |
url += '&cmd=GetExtraMaterialInfo'; |
3412 |
22 Jun 15 |
olle |
url += '&index=' + encodeURIComponent(index); |
3412 |
22 Jun 15 |
olle |
url += '&name=' + encodeURIComponent(name); |
3412 |
22 Jun 15 |
olle |
url += '&type=' + encodeURIComponent(type); |
3412 |
22 Jun 15 |
olle |
url += '&oldName=' + encodeURIComponent(oldName); |
3412 |
22 Jun 15 |
olle |
274 |
|
3412 |
22 Jun 15 |
olle |
Wizard.showLoadingAnimation('Loading information about extra material...'); |
3412 |
22 Jun 15 |
olle |
Wizard.asyncJsonRequest(url, emreg.extraMaterialInfoLoaded); |
3412 |
22 Jun 15 |
olle |
277 |
} |
3412 |
22 Jun 15 |
olle |
278 |
|
3412 |
22 Jun 15 |
olle |
emreg.extraMaterialInfoLoaded = function(response) |
3412 |
22 Jun 15 |
olle |
280 |
{ |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3435 |
02 Jul 15 |
olle |
var nofExtraMaterial = frm.nofExtraMaterial.value; |
3412 |
22 Jun 15 |
olle |
emInfo = response.emInfo; |
3412 |
22 Jun 15 |
olle |
284 |
|
3412 |
22 Jun 15 |
olle |
var index = emInfo.index; |
3412 |
22 Jun 15 |
olle |
var name = emInfo.name; |
3412 |
22 Jun 15 |
olle |
var type = emInfo.type; |
3435 |
02 Jul 15 |
olle |
var namePrefix = 'name.'; |
3435 |
02 Jul 15 |
olle |
var typePrefix = 'type.'; |
3435 |
02 Jul 15 |
olle |
var itemnamePrefix = 'itemname.'; |
3412 |
22 Jun 15 |
olle |
var nofSpecimen = emInfo.nofSpecimen; |
3412 |
22 Jun 15 |
olle |
var nofDna = emInfo.nofDna; |
3412 |
22 Jun 15 |
olle |
var nofRna = emInfo.nofRna; |
3412 |
22 Jun 15 |
olle |
var highestSpecimenNumber = emInfo.highestSpecimenNumber; |
3435 |
02 Jul 15 |
olle |
var oldNameHighestSpecimenNumber = emInfo.oldNameHighestSpecimenNumber; |
3435 |
02 Jul 15 |
olle |
var jsonResult = []; |
3412 |
22 Jun 15 |
olle |
var itemnamePrefix = 'itemname.'; |
3435 |
02 Jul 15 |
olle |
var jsonExtractSuffix = {}; |
3435 |
02 Jul 15 |
olle |
jsonExtractSuffix['DNA'] = '.d'; |
3435 |
02 Jul 15 |
olle |
jsonExtractSuffix['RNA'] = '.r'; |
3412 |
22 Jun 15 |
olle |
301 |
|
3412 |
22 Jun 15 |
olle |
if (type == 'DNA' && nofDna > 0) |
3412 |
22 Jun 15 |
olle |
303 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'DNA extract with that name already exists'); |
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = false; |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
307 |
} |
3412 |
22 Jun 15 |
olle |
308 |
|
3412 |
22 Jun 15 |
olle |
if (type == 'RNA' && nofRna > 0) |
3412 |
22 Jun 15 |
olle |
310 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus('extramaterial.'+index, 'invalid', 'RNA extract with that name already exists'); |
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = false; |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
314 |
} |
3412 |
22 Jun 15 |
olle |
315 |
|
3412 |
22 Jun 15 |
olle |
var itemname = name; |
3435 |
02 Jul 15 |
olle |
317 |
// |
3435 |
02 Jul 15 |
olle |
jsonResult = emreg.checkExtractItemNames(); |
3435 |
02 Jul 15 |
olle |
for (var i=0; i < nofExtraMaterial; i++) |
3412 |
22 Jun 15 |
olle |
320 |
{ |
3435 |
02 Jul 15 |
olle |
var tmpType = frm[typePrefix+i].value; |
3435 |
02 Jul 15 |
olle |
var tmpName = frm[namePrefix+i].value; |
3435 |
02 Jul 15 |
olle |
if (tmpType == 'DNA' || tmpType == 'RNA') |
3435 |
02 Jul 15 |
olle |
324 |
{ |
3435 |
02 Jul 15 |
olle |
if (tmpName == '') |
3435 |
02 Jul 15 |
olle |
326 |
{ |
3435 |
02 Jul 15 |
olle |
Doc.element(itemnamePrefix+i).innerHTML = ''; |
3435 |
02 Jul 15 |
olle |
Wizard.setInputStatus('extramaterial.'+i, 'invalid', 'Missing name'); |
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = false; |
3435 |
02 Jul 15 |
olle |
330 |
} |
3435 |
02 Jul 15 |
olle |
else |
3435 |
02 Jul 15 |
olle |
332 |
{ |
3435 |
02 Jul 15 |
olle |
if (jsonResult[i]) |
3435 |
02 Jul 15 |
olle |
334 |
{ |
3435 |
02 Jul 15 |
olle |
itemname = tmpName + jsonExtractSuffix[tmpType]; |
3435 |
02 Jul 15 |
olle |
// Update itemname |
3435 |
02 Jul 15 |
olle |
Doc.element(itemnamePrefix+i).innerHTML = itemname; |
3435 |
02 Jul 15 |
olle |
Wizard.setInputStatus('extramaterial.'+i, 'valid', ''); |
3435 |
02 Jul 15 |
olle |
339 |
} |
3435 |
02 Jul 15 |
olle |
else |
3435 |
02 Jul 15 |
olle |
341 |
{ |
3435 |
02 Jul 15 |
olle |
Wizard.setInputStatus('extramaterial.'+i, 'invalid', tmpType + ' extract name duplicate'); |
3435 |
02 Jul 15 |
olle |
extraMaterialIsValid = false; |
3435 |
02 Jul 15 |
olle |
344 |
} |
3435 |
02 Jul 15 |
olle |
345 |
} |
3435 |
02 Jul 15 |
olle |
346 |
} |
3412 |
22 Jun 15 |
olle |
347 |
} |
3435 |
02 Jul 15 |
olle |
if (type == 'Specimen') |
3412 |
22 Jun 15 |
olle |
349 |
{ |
3412 |
22 Jun 15 |
olle |
// Update all specimens with same base name to get unique number suffices |
3412 |
22 Jun 15 |
olle |
emreg.updateSpecimenItemNames(name, highestSpecimenNumber); |
3412 |
22 Jun 15 |
olle |
352 |
} |
3412 |
22 Jun 15 |
olle |
353 |
|
3412 |
22 Jun 15 |
olle |
// Check if an old name exists |
3412 |
22 Jun 15 |
olle |
var oldName = jsonOldNameArr[index]; |
3412 |
22 Jun 15 |
olle |
if (oldName) |
3412 |
22 Jun 15 |
olle |
357 |
{ |
3412 |
22 Jun 15 |
olle |
// Update all specimens with same old base name to get unique number suffices |
3412 |
22 Jun 15 |
olle |
emreg.updateSpecimenItemNames(oldName, oldNameHighestSpecimenNumber); |
3412 |
22 Jun 15 |
olle |
360 |
} |
3412 |
22 Jun 15 |
olle |
// Update JSONArr of names |
3412 |
22 Jun 15 |
olle |
jsonOldNameArr[index] = name; |
3412 |
22 Jun 15 |
olle |
363 |
} |
3412 |
22 Jun 15 |
olle |
364 |
|
3435 |
02 Jul 15 |
olle |
365 |
/** |
3435 |
02 Jul 15 |
olle |
* Check for duplicate names of extracs in list. |
3435 |
02 Jul 15 |
olle |
* The first occurrence is considered OK, while |
3435 |
02 Jul 15 |
olle |
* following are considered duplicates. JSONArray |
3435 |
02 Jul 15 |
olle |
* jsonResults has value `false` for duplicates, |
3435 |
02 Jul 15 |
olle |
* else `true`. |
3435 |
02 Jul 15 |
olle |
371 |
*/ |
3435 |
02 Jul 15 |
olle |
emreg.checkExtractItemNames = function() |
3435 |
02 Jul 15 |
olle |
373 |
{ |
3435 |
02 Jul 15 |
olle |
// Check if more than one extract item with same name |
3435 |
02 Jul 15 |
olle |
// and type exists in the table |
3435 |
02 Jul 15 |
olle |
376 |
|
3435 |
02 Jul 15 |
olle |
var frm = document.forms['meludi']; |
3435 |
02 Jul 15 |
olle |
var namePrefix = 'name.'; |
3435 |
02 Jul 15 |
olle |
var typePrefix = 'type.'; |
3435 |
02 Jul 15 |
olle |
var itemnamePrefix = 'itemname.'; |
3435 |
02 Jul 15 |
olle |
var nofExtractsWithName = 0; |
3435 |
02 Jul 15 |
olle |
var jsonResult = []; |
3435 |
02 Jul 15 |
olle |
jsonResult[0] = true; |
3435 |
02 Jul 15 |
olle |
var nofExtraMaterial = frm.nofExtraMaterial.value; |
3435 |
02 Jul 15 |
olle |
for (var i=0; i < nofExtraMaterial; i++) |
3435 |
02 Jul 15 |
olle |
386 |
{ |
3435 |
02 Jul 15 |
olle |
jsonResult[i] = true; |
3435 |
02 Jul 15 |
olle |
388 |
} |
3435 |
02 Jul 15 |
olle |
for (var i=0; i < nofExtraMaterial; i++) |
3435 |
02 Jul 15 |
olle |
390 |
{ |
3435 |
02 Jul 15 |
olle |
var currentType = frm[typePrefix+i].value; |
3435 |
02 Jul 15 |
olle |
var currentName = frm[namePrefix+i].value; |
3435 |
02 Jul 15 |
olle |
for (var j=(i+1); j < nofExtraMaterial; j++) |
3435 |
02 Jul 15 |
olle |
394 |
{ |
3435 |
02 Jul 15 |
olle |
var type = frm[typePrefix+j].value; |
3435 |
02 Jul 15 |
olle |
if (type == currentType) |
3435 |
02 Jul 15 |
olle |
397 |
{ |
3435 |
02 Jul 15 |
olle |
var name = frm[namePrefix+j].value; |
3435 |
02 Jul 15 |
olle |
if (name == currentName) |
3435 |
02 Jul 15 |
olle |
400 |
{ |
3435 |
02 Jul 15 |
olle |
jsonResult[j] = false; |
3435 |
02 Jul 15 |
olle |
402 |
} |
3435 |
02 Jul 15 |
olle |
403 |
} |
3435 |
02 Jul 15 |
olle |
404 |
} |
3435 |
02 Jul 15 |
olle |
405 |
} |
3435 |
02 Jul 15 |
olle |
return jsonResult; |
3435 |
02 Jul 15 |
olle |
407 |
} |
3435 |
02 Jul 15 |
olle |
408 |
|
3412 |
22 Jun 15 |
olle |
emreg.updateSpecimenItemNames = function(currentName, highestSpecimenNumber) |
3412 |
22 Jun 15 |
olle |
410 |
{ |
3412 |
22 Jun 15 |
olle |
// Update all item names for specimens with given name |
3412 |
22 Jun 15 |
olle |
// by adding numbers above those already used for specimens |
3412 |
22 Jun 15 |
olle |
// in the database |
3412 |
22 Jun 15 |
olle |
414 |
|
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
var nofExtraMaterial = frm.nofExtraMaterial.value; |
3412 |
22 Jun 15 |
olle |
var highestTempSpecimenNumber = highestSpecimenNumber; |
3412 |
22 Jun 15 |
olle |
for (var i=0; i < nofExtraMaterial; i++) |
3412 |
22 Jun 15 |
olle |
419 |
{ |
3412 |
22 Jun 15 |
olle |
var namePrefix = 'name.'; |
3412 |
22 Jun 15 |
olle |
var typePrefix = 'type.'; |
3412 |
22 Jun 15 |
olle |
var itemnamePrefix = 'itemname.'; |
3412 |
22 Jun 15 |
olle |
var type = frm[typePrefix+i].value; |
3412 |
22 Jun 15 |
olle |
if (type == 'Specimen') |
3412 |
22 Jun 15 |
olle |
425 |
{ |
3412 |
22 Jun 15 |
olle |
var name = frm[namePrefix+i].value; |
3412 |
22 Jun 15 |
olle |
if (name == currentName) |
3412 |
22 Jun 15 |
olle |
428 |
{ |
3412 |
22 Jun 15 |
olle |
// Increment highest temporary specimen number |
3412 |
22 Jun 15 |
olle |
highestTempSpecimenNumber++; |
3412 |
22 Jun 15 |
olle |
var itemname = name + '.' + highestTempSpecimenNumber; |
3412 |
22 Jun 15 |
olle |
432 |
|
3412 |
22 Jun 15 |
olle |
// Update itemname |
3412 |
22 Jun 15 |
olle |
Doc.element(itemnamePrefix+i).innerHTML = itemname; |
3412 |
22 Jun 15 |
olle |
435 |
} |
3412 |
22 Jun 15 |
olle |
436 |
} |
3412 |
22 Jun 15 |
olle |
437 |
} |
3412 |
22 Jun 15 |
olle |
438 |
} |
3412 |
22 Jun 15 |
olle |
439 |
|
3412 |
22 Jun 15 |
olle |
emreg.typeOnChange = function(event) |
3412 |
22 Jun 15 |
olle |
441 |
{ |
3637 |
01 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3637 |
01 Dec 15 |
olle |
var target = event.currentTarget; |
3637 |
01 Dec 15 |
olle |
444 |
|
3637 |
01 Dec 15 |
olle |
var index = Data.int(target, 'index'); |
3637 |
01 Dec 15 |
olle |
446 |
|
3637 |
01 Dec 15 |
olle |
var type = frm['type.'+index].value; |
3637 |
01 Dec 15 |
olle |
448 |
|
3637 |
01 Dec 15 |
olle |
if (type == 'DNA') |
3637 |
01 Dec 15 |
olle |
450 |
{ |
3637 |
01 Dec 15 |
olle |
// Enable control check box |
3637 |
01 Dec 15 |
olle |
Doc.removeClass('isControl.'+index, 'disabled'); |
3637 |
01 Dec 15 |
olle |
453 |
} |
3637 |
01 Dec 15 |
olle |
else |
3637 |
01 Dec 15 |
olle |
455 |
{ |
3637 |
01 Dec 15 |
olle |
// Uncheck and disable control check box |
3637 |
01 Dec 15 |
olle |
frm['isControl.'+index].checked = false; |
3637 |
01 Dec 15 |
olle |
Doc.addClass('isControl.'+index, 'disabled'); |
3637 |
01 Dec 15 |
olle |
// Clear and disable control lot number field |
3637 |
01 Dec 15 |
olle |
frm['controlLotNo.'+index].value = ''; |
3637 |
01 Dec 15 |
olle |
Doc.addClass('controlLotNo.'+index, 'disabled'); |
3637 |
01 Dec 15 |
olle |
462 |
} |
3412 |
22 Jun 15 |
olle |
emreg.nameOnChange(event); |
3412 |
22 Jun 15 |
olle |
464 |
} |
3412 |
22 Jun 15 |
olle |
465 |
|
3412 |
22 Jun 15 |
olle |
emreg.arrivalDateOnChange = function(event) |
3412 |
22 Jun 15 |
olle |
467 |
{ |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
var target = event.currentTarget; |
3412 |
22 Jun 15 |
olle |
470 |
|
3412 |
22 Jun 15 |
olle |
var index = Data.int(target, 'index'); |
3412 |
22 Jun 15 |
olle |
472 |
|
3412 |
22 Jun 15 |
olle |
var arrivalDateKey = 'arrivalDateDefault'; |
3412 |
22 Jun 15 |
olle |
var messageFieldKey = 'arrivalDateDefault'; |
3412 |
22 Jun 15 |
olle |
if (index >= 0) |
3412 |
22 Jun 15 |
olle |
476 |
{ |
3412 |
22 Jun 15 |
olle |
var arrivalDatePrefix = 'arrivaldate.'; |
3412 |
22 Jun 15 |
olle |
var messageFieldPrefix = 'extramaterial.'; |
3412 |
22 Jun 15 |
olle |
arrivalDateKey = arrivalDatePrefix+index; |
3412 |
22 Jun 15 |
olle |
messageFieldKey = messageFieldPrefix+index; |
3412 |
22 Jun 15 |
olle |
481 |
} |
3412 |
22 Jun 15 |
olle |
var arrivalDate = frm[arrivalDateKey].value; |
3412 |
22 Jun 15 |
olle |
483 |
|
3412 |
22 Jun 15 |
olle |
if (arrivalDate != '') |
3412 |
22 Jun 15 |
olle |
485 |
{ |
3412 |
22 Jun 15 |
olle |
// Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. |
3412 |
22 Jun 15 |
olle |
arrivalDate = Meludi.autoFillDate(arrivalDate); |
3412 |
22 Jun 15 |
olle |
frm[arrivalDateKey].value = arrivalDate; |
3412 |
22 Jun 15 |
olle |
489 |
|
3412 |
22 Jun 15 |
olle |
var d = Dates.parseString(arrivalDate, 'yyyyMMdd'); |
3412 |
22 Jun 15 |
olle |
if (d == null) |
3412 |
22 Jun 15 |
olle |
492 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus(messageFieldKey, 'invalid', 'Not a valid date'); |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
495 |
} |
3412 |
22 Jun 15 |
olle |
496 |
|
3412 |
22 Jun 15 |
olle |
var today = new Date(); |
3412 |
22 Jun 15 |
olle |
if (d.getTime() > today.getTime()) |
3412 |
22 Jun 15 |
olle |
499 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus(messageFieldKey, 'invalid', 'Future date is not valid'); |
3412 |
22 Jun 15 |
olle |
return; |
3412 |
22 Jun 15 |
olle |
502 |
} |
3412 |
22 Jun 15 |
olle |
503 |
|
3412 |
22 Jun 15 |
olle |
Wizard.setInputStatus(messageFieldKey, 'valid'); |
3412 |
22 Jun 15 |
olle |
emreg.nameOnChange(event); |
3412 |
22 Jun 15 |
olle |
506 |
} |
3412 |
22 Jun 15 |
olle |
507 |
} |
3412 |
22 Jun 15 |
olle |
508 |
|
3637 |
01 Dec 15 |
olle |
emreg.controlOnChange = function(event) |
3637 |
01 Dec 15 |
olle |
510 |
{ |
3637 |
01 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3637 |
01 Dec 15 |
olle |
var target = event.currentTarget; |
3637 |
01 Dec 15 |
olle |
513 |
|
3637 |
01 Dec 15 |
olle |
var index = Data.int(target, 'index'); |
3637 |
01 Dec 15 |
olle |
// Enable/Disable control lot number field |
3637 |
01 Dec 15 |
olle |
if (frm['isControl.'+index].checked) |
3637 |
01 Dec 15 |
olle |
517 |
{ |
3637 |
01 Dec 15 |
olle |
// Enable control lot number field |
3637 |
01 Dec 15 |
olle |
Doc.removeClass('controlLotNo.'+index, 'disabled'); |
3637 |
01 Dec 15 |
olle |
520 |
} |
3637 |
01 Dec 15 |
olle |
else |
3637 |
01 Dec 15 |
olle |
522 |
{ |
3637 |
01 Dec 15 |
olle |
// Disable control lot number field |
3637 |
01 Dec 15 |
olle |
Doc.addClass('controlLotNo.'+index, 'disabled'); |
3637 |
01 Dec 15 |
olle |
// Clear control lot number field |
3637 |
01 Dec 15 |
olle |
frm['controlLotNo.'+index].value = ''; |
3637 |
01 Dec 15 |
olle |
527 |
} |
3637 |
01 Dec 15 |
olle |
528 |
} |
3637 |
01 Dec 15 |
olle |
529 |
|
3412 |
22 Jun 15 |
olle |
emreg.validateStep2 = function(event) |
3412 |
22 Jun 15 |
olle |
531 |
{ |
3412 |
22 Jun 15 |
olle |
var valid = true; |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
534 |
|
3412 |
22 Jun 15 |
olle |
valid &= nofExtraMaterialIsValid; |
3435 |
02 Jul 15 |
olle |
valid &= extraMaterialIsValid; |
3412 |
22 Jun 15 |
olle |
537 |
|
3412 |
22 Jun 15 |
olle |
if (!valid) event.preventDefault(); |
3412 |
22 Jun 15 |
olle |
539 |
} |
3412 |
22 Jun 15 |
olle |
540 |
|
3412 |
22 Jun 15 |
olle |
emreg.submit = function() |
3412 |
22 Jun 15 |
olle |
542 |
{ |
3412 |
22 Jun 15 |
olle |
var frm = document.forms['meludi']; |
3412 |
22 Jun 15 |
olle |
544 |
|
3412 |
22 Jun 15 |
olle |
var nofExtraMaterial = parseInt(frm.nofExtraMaterial.value); |
3412 |
22 Jun 15 |
olle |
emInfo.specimen = []; |
3412 |
22 Jun 15 |
olle |
for (var i = 0; i < nofExtraMaterial; i++) |
3412 |
22 Jun 15 |
olle |
548 |
{ |
3412 |
22 Jun 15 |
olle |
var specimenTube = {}; |
3412 |
22 Jun 15 |
olle |
specimenTube.name = Doc.element('itemname.'+i).innerHTML; |
3412 |
22 Jun 15 |
olle |
specimenTube.type = frm['type.'+i].value; |
3412 |
22 Jun 15 |
olle |
specimenTube.arrivaldate = frm['arrivaldate.'+i].value; |
3637 |
01 Dec 15 |
olle |
specimenTube.controllotno = frm['controlLotNo.'+i].value; |
3412 |
22 Jun 15 |
olle |
specimenTube.comment = frm['comment.'+i].value; |
3412 |
22 Jun 15 |
olle |
emInfo.specimen[i] = specimenTube; |
3412 |
22 Jun 15 |
olle |
556 |
} |
3412 |
22 Jun 15 |
olle |
557 |
|
3412 |
22 Jun 15 |
olle |
var submitInfo = {}; |
3412 |
22 Jun 15 |
olle |
submitInfo.emInfo = emInfo; |
3412 |
22 Jun 15 |
olle |
560 |
|
3412 |
22 Jun 15 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
3412 |
22 Jun 15 |
olle |
url += '&cmd=CreateExtraMaterial'; |
3412 |
22 Jun 15 |
olle |
Wizard.showLoadingAnimation('Performing registration...'); |
3412 |
22 Jun 15 |
olle |
Wizard.asyncJsonRequest(url, emreg.submissionResults, 'POST', JSON.stringify(submitInfo)); |
3412 |
22 Jun 15 |
olle |
565 |
} |
3435 |
02 Jul 15 |
olle |
566 |
|
3412 |
22 Jun 15 |
olle |
emreg.submissionResults = function(response) |
3412 |
22 Jun 15 |
olle |
568 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.showFinalMessage(response.messages); |
3412 |
22 Jun 15 |
olle |
Doc.show('gorestart'); |
3412 |
22 Jun 15 |
olle |
Doc.show('gonext-message'); |
3412 |
22 Jun 15 |
olle |
572 |
} |
3412 |
22 Jun 15 |
olle |
573 |
|
3412 |
22 Jun 15 |
olle |
emreg.countDownToRestart = function() |
3412 |
22 Jun 15 |
olle |
575 |
{ |
3412 |
22 Jun 15 |
olle |
var time = restartAt - (new Date()).getTime(); |
3412 |
22 Jun 15 |
olle |
if (time < 0) |
3412 |
22 Jun 15 |
olle |
578 |
{ |
3412 |
22 Jun 15 |
olle |
Wizard.restartWizard(); |
3412 |
22 Jun 15 |
olle |
580 |
} |
3412 |
22 Jun 15 |
olle |
else |
3412 |
22 Jun 15 |
olle |
582 |
{ |
3412 |
22 Jun 15 |
olle |
Doc.element('gonext-message').innerHTML = '<i>Wizard will restart automatically in ' + Math.ceil(time/1000) + ' seconds...</i>'; |
3412 |
22 Jun 15 |
olle |
584 |
} |
3412 |
22 Jun 15 |
olle |
585 |
} |
3412 |
22 Jun 15 |
olle |
586 |
|
3412 |
22 Jun 15 |
olle |
emreg.stopAutoRestart = function() |
3412 |
22 Jun 15 |
olle |
588 |
{ |
3412 |
22 Jun 15 |
olle |
clearTimeout(restartTimer); |
3412 |
22 Jun 15 |
olle |
Doc.hide('gonext-message'); |
3412 |
22 Jun 15 |
olle |
Doc.hide('gostop'); |
3412 |
22 Jun 15 |
olle |
592 |
} |
3412 |
22 Jun 15 |
olle |
593 |
|
3412 |
22 Jun 15 |
olle |
return emreg; |
3412 |
22 Jun 15 |
olle |
595 |
}(); |
3412 |
22 Jun 15 |
olle |
596 |
|
3412 |
22 Jun 15 |
olle |
Doc.onLoad(ExtraMaterialReg.initPage); |
3412 |
22 Jun 15 |
olle |
598 |
|