3449 |
28 Jul 15 |
olle |
var SelectFile = function() |
3449 |
28 Jul 15 |
olle |
2 |
{ |
3449 |
28 Jul 15 |
olle |
var selectfile = {}; |
3449 |
28 Jul 15 |
olle |
var debug = 0; |
3449 |
28 Jul 15 |
olle |
5 |
|
3449 |
28 Jul 15 |
olle |
// Page initialization |
3449 |
28 Jul 15 |
olle |
selectfile.initPage = function() |
3449 |
28 Jul 15 |
olle |
8 |
{ |
3449 |
28 Jul 15 |
olle |
Buttons.addClickHandler('close', App.closeWindow); |
3449 |
28 Jul 15 |
olle |
10 |
|
3459 |
30 Jul 15 |
olle |
Events.addEventHandler('dnaFile', 'change', selectfile.readFile); |
3449 |
28 Jul 15 |
olle |
12 |
} |
3449 |
28 Jul 15 |
olle |
13 |
|
3449 |
28 Jul 15 |
olle |
selectfile.readFile = function() |
3449 |
28 Jul 15 |
olle |
15 |
{ |
3459 |
30 Jul 15 |
olle |
var frm = document.forms['meludi']; |
3459 |
30 Jul 15 |
olle |
var file = frm.dnaFile.files[0]; |
3449 |
28 Jul 15 |
olle |
18 |
|
3459 |
30 Jul 15 |
olle |
Wizard.showLoadingAnimation('Loading DNA from file \'' + Strings.encodeTags(file.name) + '\'...'); |
3449 |
28 Jul 15 |
olle |
20 |
|
3449 |
28 Jul 15 |
olle |
var reader = new FileReader(); |
3459 |
30 Jul 15 |
olle |
reader.onload = selectfile.dnaFileLoaded; |
3449 |
28 Jul 15 |
olle |
reader.readAsText(file); |
3449 |
28 Jul 15 |
olle |
24 |
} |
3449 |
28 Jul 15 |
olle |
25 |
|
3459 |
30 Jul 15 |
olle |
selectfile.dnaFileLoaded = function(event) |
3449 |
28 Jul 15 |
olle |
27 |
{ |
3449 |
28 Jul 15 |
olle |
try |
3449 |
28 Jul 15 |
olle |
29 |
{ |
3459 |
30 Jul 15 |
olle |
window.opener.SelectDna.parseDnaFile(event.target.result); |
3449 |
28 Jul 15 |
olle |
Wizard.hideWizardStatus(); |
3449 |
28 Jul 15 |
olle |
window.close(); |
3449 |
28 Jul 15 |
olle |
33 |
} |
3449 |
28 Jul 15 |
olle |
catch (ex) |
3449 |
28 Jul 15 |
olle |
35 |
{ |
3449 |
28 Jul 15 |
olle |
Wizard.setWizardStatus('messagecontainer error', ex); |
3449 |
28 Jul 15 |
olle |
37 |
} |
3449 |
28 Jul 15 |
olle |
38 |
} |
3449 |
28 Jul 15 |
olle |
39 |
|
3449 |
28 Jul 15 |
olle |
return selectfile; |
3449 |
28 Jul 15 |
olle |
41 |
}(); |
3449 |
28 Jul 15 |
olle |
42 |
|
3449 |
28 Jul 15 |
olle |
Doc.onLoad(SelectFile.initPage); |
3449 |
28 Jul 15 |
olle |
44 |
|