4631 |
21 Nov 17 |
nicklas |
var MapData = function() |
4631 |
21 Nov 17 |
nicklas |
2 |
{ |
4631 |
21 Nov 17 |
nicklas |
var map = {}; |
4631 |
21 Nov 17 |
nicklas |
var debug = 0; |
4631 |
21 Nov 17 |
nicklas |
5 |
|
4631 |
21 Nov 17 |
nicklas |
map.initPage = function() |
4631 |
21 Nov 17 |
nicklas |
7 |
{ |
4631 |
21 Nov 17 |
nicklas |
// Step 1 |
4631 |
21 Nov 17 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', map.validateStep1); |
4631 |
21 Nov 17 |
nicklas |
Wizard.initFileSelectionField('file'); |
4631 |
21 Nov 17 |
nicklas |
11 |
|
4631 |
21 Nov 17 |
nicklas |
// Navigation |
4631 |
21 Nov 17 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
4631 |
21 Nov 17 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
4631 |
21 Nov 17 |
nicklas |
Buttons.addClickHandler('goexport', Wizard.goRegister); |
4631 |
21 Nov 17 |
nicklas |
Buttons.addClickHandler('godownload', map.download); |
4631 |
21 Nov 17 |
nicklas |
17 |
|
4631 |
21 Nov 17 |
nicklas |
// Final registration |
4631 |
21 Nov 17 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', map.submit); |
4631 |
21 Nov 17 |
nicklas |
20 |
|
4632 |
22 Nov 17 |
nicklas |
Relax.checkIsAdmin('"MapDataToReleases" wizard', |
4632 |
22 Nov 17 |
nicklas |
function() |
4632 |
22 Nov 17 |
nicklas |
23 |
{ |
4632 |
22 Nov 17 |
nicklas |
Doc.show('step-1'); |
4632 |
22 Nov 17 |
nicklas |
Doc.show('goexport'); |
4632 |
22 Nov 17 |
nicklas |
26 |
}); |
4631 |
21 Nov 17 |
nicklas |
27 |
} |
4631 |
21 Nov 17 |
nicklas |
28 |
|
4631 |
21 Nov 17 |
nicklas |
map.validateStep1 = function(event) |
4631 |
21 Nov 17 |
nicklas |
30 |
{ |
4631 |
21 Nov 17 |
nicklas |
var valid = true; |
4631 |
21 Nov 17 |
nicklas |
valid &= Wizard.isValid('file'); |
4631 |
21 Nov 17 |
nicklas |
if (!valid) event.preventDefault(); |
4631 |
21 Nov 17 |
nicklas |
34 |
} |
4631 |
21 Nov 17 |
nicklas |
35 |
|
4631 |
21 Nov 17 |
nicklas |
map.submit = function() |
4631 |
21 Nov 17 |
nicklas |
37 |
{ |
4631 |
21 Nov 17 |
nicklas |
var frm = document.forms['reggie']; |
4631 |
21 Nov 17 |
nicklas |
39 |
|
4631 |
21 Nov 17 |
nicklas |
var formData = new FormData(); |
4631 |
21 Nov 17 |
nicklas |
var file = frm.file.files[0]; |
4631 |
21 Nov 17 |
nicklas |
formData.append('file', file, file.name); |
4631 |
21 Nov 17 |
nicklas |
43 |
|
4631 |
21 Nov 17 |
nicklas |
var url = '../Export.servlet?ID='+App.getSessionId(); |
4631 |
21 Nov 17 |
nicklas |
url += '&cmd=MapDataToReleases'; |
4631 |
21 Nov 17 |
nicklas |
46 |
|
4631 |
21 Nov 17 |
nicklas |
Wizard.showLoadingAnimation('Working...', 'map-data-progress'); |
4631 |
21 Nov 17 |
nicklas |
Wizard.asyncJsonRequest(url, map.submissionResults, 'POST', formData); |
4631 |
21 Nov 17 |
nicklas |
49 |
} |
4631 |
21 Nov 17 |
nicklas |
50 |
|
4631 |
21 Nov 17 |
nicklas |
map.submissionResults = function(response) |
4631 |
21 Nov 17 |
nicklas |
52 |
{ |
4631 |
21 Nov 17 |
nicklas |
Wizard.showFinalMessage(response.messages); |
4631 |
21 Nov 17 |
nicklas |
Doc.show('godownload'); |
5512 |
19 Jun 19 |
nicklas |
Doc.show('gorestart'); |
4631 |
21 Nov 17 |
nicklas |
56 |
} |
4631 |
21 Nov 17 |
nicklas |
57 |
|
4631 |
21 Nov 17 |
nicklas |
map.download = function() |
4631 |
21 Nov 17 |
nicklas |
59 |
{ |
4631 |
21 Nov 17 |
nicklas |
var url = '../Export.servlet?ID='+App.getSessionId(); |
4631 |
21 Nov 17 |
nicklas |
url += '&cmd=DownloadMappedData'; |
4631 |
21 Nov 17 |
nicklas |
location.href = url; |
4631 |
21 Nov 17 |
nicklas |
63 |
} |
4631 |
21 Nov 17 |
nicklas |
64 |
|
4631 |
21 Nov 17 |
nicklas |
return map; |
4631 |
21 Nov 17 |
nicklas |
66 |
}(); |
4631 |
21 Nov 17 |
nicklas |
67 |
|
4631 |
21 Nov 17 |
nicklas |
Doc.onLoad(MapData.initPage); |
4631 |
21 Nov 17 |
nicklas |
69 |
|