2783 |
10 Oct 14 |
nicklas |
var Histology = function() |
2783 |
10 Oct 14 |
nicklas |
2 |
{ |
2783 |
10 Oct 14 |
nicklas |
var histology = {}; |
2853 |
23 Oct 14 |
nicklas |
var debug = 0; |
2783 |
10 Oct 14 |
nicklas |
5 |
|
2783 |
10 Oct 14 |
nicklas |
// Page initialization |
2783 |
10 Oct 14 |
nicklas |
histology.initPage = function() |
2783 |
10 Oct 14 |
nicklas |
8 |
{ |
2783 |
10 Oct 14 |
nicklas |
// Step 1 |
2783 |
10 Oct 14 |
nicklas |
Events.addEventHandler('numLabels', 'keypress', Events.integerOnly); |
2783 |
10 Oct 14 |
nicklas |
11 |
|
2783 |
10 Oct 14 |
nicklas |
// Navigation |
5309 |
15 Feb 19 |
nicklas |
Buttons.addClickHandler('godownloadcsv', histology.downloadLabels); |
5309 |
15 Feb 19 |
nicklas |
Buttons.addClickHandler('godownloadxlsx', histology.downloadLabels); |
2783 |
10 Oct 14 |
nicklas |
15 |
|
2783 |
10 Oct 14 |
nicklas |
var url = '../Histology.servlet?ID='+App.getSessionId(); |
2783 |
10 Oct 14 |
nicklas |
url += '&cmd=GetHistologyWorkLists&all=1'; |
2783 |
10 Oct 14 |
nicklas |
Wizard.showLoadingAnimation('Loading histology work lists...'); |
2783 |
10 Oct 14 |
nicklas |
Wizard.asyncJsonRequest(url, histology.histologyListsLoaded); |
2783 |
10 Oct 14 |
nicklas |
20 |
} |
2783 |
10 Oct 14 |
nicklas |
21 |
|
2783 |
10 Oct 14 |
nicklas |
histology.histologyListsLoaded = function(response) |
2783 |
10 Oct 14 |
nicklas |
23 |
{ |
2783 |
10 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
2783 |
10 Oct 14 |
nicklas |
var workLists = response.workLists; |
2783 |
10 Oct 14 |
nicklas |
26 |
|
2783 |
10 Oct 14 |
nicklas |
if (workLists.length > 0) |
2783 |
10 Oct 14 |
nicklas |
28 |
{ |
2783 |
10 Oct 14 |
nicklas |
for (var i=0; i < workLists.length; i++) |
2783 |
10 Oct 14 |
nicklas |
30 |
{ |
2783 |
10 Oct 14 |
nicklas |
var list = workLists[i]; |
2783 |
10 Oct 14 |
nicklas |
var name = list.name + ' (' + list.size + ')'; |
2783 |
10 Oct 14 |
nicklas |
var option = new Option(name, list.id); |
2783 |
10 Oct 14 |
nicklas |
frm.workList[frm.workList.length] = option; |
2783 |
10 Oct 14 |
nicklas |
35 |
} |
2783 |
10 Oct 14 |
nicklas |
36 |
|
2783 |
10 Oct 14 |
nicklas |
Wizard.setInputStatus('workList', 'valid'); |
2783 |
10 Oct 14 |
nicklas |
38 |
} |
2783 |
10 Oct 14 |
nicklas |
else |
2783 |
10 Oct 14 |
nicklas |
40 |
{ |
2783 |
10 Oct 14 |
nicklas |
Wizard.setFatalError('No Histology work lists available for processing.'); |
2783 |
10 Oct 14 |
nicklas |
return; |
2783 |
10 Oct 14 |
nicklas |
43 |
} |
2783 |
10 Oct 14 |
nicklas |
44 |
|
2783 |
10 Oct 14 |
nicklas |
Doc.show('step-1'); |
5309 |
15 Feb 19 |
nicklas |
Doc.show('godownloadcsv'); |
5309 |
15 Feb 19 |
nicklas |
Doc.show('godownloadxlsx'); |
2783 |
10 Oct 14 |
nicklas |
48 |
} |
2783 |
10 Oct 14 |
nicklas |
49 |
|
2783 |
10 Oct 14 |
nicklas |
histology.downloadLabels = function(event) |
2783 |
10 Oct 14 |
nicklas |
51 |
{ |
2783 |
10 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
5309 |
15 Feb 19 |
nicklas |
var format = Data.get(event.currentTarget, 'format'); |
2783 |
10 Oct 14 |
nicklas |
54 |
|
2783 |
10 Oct 14 |
nicklas |
var url = '../Histology.servlet?ID='+App.getSessionId(); |
2783 |
10 Oct 14 |
nicklas |
url += '&cmd=DownloadHEGlassLabels'; |
2783 |
10 Oct 14 |
nicklas |
url += '&workListId='+frm.workList.value; |
2783 |
10 Oct 14 |
nicklas |
url += '&numSlides=' + parseInt(frm.numLabels.value, 10); |
5309 |
15 Feb 19 |
nicklas |
url += '&format='+encodeURIComponent(format); |
2783 |
10 Oct 14 |
nicklas |
60 |
|
2783 |
10 Oct 14 |
nicklas |
location.href = url; |
2783 |
10 Oct 14 |
nicklas |
62 |
} |
2783 |
10 Oct 14 |
nicklas |
63 |
|
2783 |
10 Oct 14 |
nicklas |
return histology; |
2783 |
10 Oct 14 |
nicklas |
65 |
}(); |
2783 |
10 Oct 14 |
nicklas |
66 |
|
2783 |
10 Oct 14 |
nicklas |
Doc.onLoad(Histology.initPage); |
2783 |
10 Oct 14 |
nicklas |
68 |
|