3394 |
12 Jun 15 |
nicklas |
var LinkedSpecimen = function() |
3394 |
12 Jun 15 |
nicklas |
2 |
{ |
3394 |
12 Jun 15 |
nicklas |
var ls = {}; |
3394 |
12 Jun 15 |
nicklas |
var debug = 0; |
3394 |
12 Jun 15 |
nicklas |
5 |
|
3394 |
12 Jun 15 |
nicklas |
6 |
|
3394 |
12 Jun 15 |
nicklas |
ls.initPage = function() |
3394 |
12 Jun 15 |
nicklas |
8 |
{ |
3394 |
12 Jun 15 |
nicklas |
// Navigation |
3394 |
12 Jun 15 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
3394 |
12 Jun 15 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
3394 |
12 Jun 15 |
nicklas |
Buttons.addClickHandler('goupdate', Wizard.goRegister); |
3394 |
12 Jun 15 |
nicklas |
13 |
|
3394 |
12 Jun 15 |
nicklas |
// Final registration |
3394 |
12 Jun 15 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', ls.submit); |
3394 |
12 Jun 15 |
nicklas |
16 |
|
3394 |
12 Jun 15 |
nicklas |
Doc.show('step-1'); |
3394 |
12 Jun 15 |
nicklas |
Doc.show('goupdate'); |
3394 |
12 Jun 15 |
nicklas |
19 |
} |
3394 |
12 Jun 15 |
nicklas |
20 |
|
3394 |
12 Jun 15 |
nicklas |
21 |
|
3394 |
12 Jun 15 |
nicklas |
ls.submit = function() |
3394 |
12 Jun 15 |
nicklas |
23 |
{ |
3394 |
12 Jun 15 |
nicklas |
// Get permission information |
3394 |
12 Jun 15 |
nicklas |
var url = '../LinkedSpecimen.servlet?ID='+App.getSessionId(); |
3394 |
12 Jun 15 |
nicklas |
url += '&cmd=UpdateAllLinkedSpecimenAnnotations'; |
3394 |
12 Jun 15 |
nicklas |
27 |
|
3905 |
29 Apr 16 |
nicklas |
Wizard.showLoadingAnimation('Updating LinkedSpecimen annotation...', 'linked-specimen-progress'); |
3394 |
12 Jun 15 |
nicklas |
Wizard.asyncJsonRequest(url, ls.linkedSpecimenDone, 'POST'); |
3394 |
12 Jun 15 |
nicklas |
30 |
} |
3394 |
12 Jun 15 |
nicklas |
31 |
|
3394 |
12 Jun 15 |
nicklas |
ls.linkedSpecimenDone = function(response) |
3394 |
12 Jun 15 |
nicklas |
33 |
{ |
3394 |
12 Jun 15 |
nicklas |
for (var c = 0; c < response.counters.length; c++) |
3394 |
12 Jun 15 |
nicklas |
35 |
{ |
3394 |
12 Jun 15 |
nicklas |
var counter = response.counters[c]; |
3394 |
12 Jun 15 |
nicklas |
var name = counter.name || 'novalue'; |
3394 |
12 Jun 15 |
nicklas |
Doc.element(name + '-before').innerHTML = counter.before; |
3394 |
12 Jun 15 |
nicklas |
Doc.element(name + '-after').innerHTML = counter.after; |
3394 |
12 Jun 15 |
nicklas |
40 |
} |
3394 |
12 Jun 15 |
nicklas |
41 |
|
3481 |
09 Sep 15 |
nicklas |
Wizard.showFinalMessage(['Number of updated annotations: ' + response.numUpdated]); |
3481 |
09 Sep 15 |
nicklas |
43 |
|
3394 |
12 Jun 15 |
nicklas |
Doc.show('update-results'); |
3394 |
12 Jun 15 |
nicklas |
Doc.show('gorestart'); |
3394 |
12 Jun 15 |
nicklas |
46 |
} |
3394 |
12 Jun 15 |
nicklas |
47 |
|
3394 |
12 Jun 15 |
nicklas |
return ls; |
3394 |
12 Jun 15 |
nicklas |
49 |
}(); |
3394 |
12 Jun 15 |
nicklas |
50 |
|
3394 |
12 Jun 15 |
nicklas |
Doc.onLoad(LinkedSpecimen.initPage); |
3394 |
12 Jun 15 |
nicklas |
52 |
|