annotate OrthancExplorer/query-retrieve.js @ 3066:5713952f60c0 update-jquery

upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
author am@osimis.io
date Wed, 26 Dec 2018 16:58:21 +0100
parents c9c2faf76bec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
1 function JavascriptDateToDicom(date)
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
2 {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
3 let s = date.toISOString();
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
4 return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
5 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
6
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
7 function GenerateDicomDate(days)
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
8 {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
9 let today = new Date();
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
10 let other = new Date(today);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
11 other.setDate(today.getDate() + days);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
12 return JavascriptDateToDicom(other);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
13 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
14
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
15
3066
5713952f60c0 upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
am@osimis.io
parents: 3023
diff changeset
16 $(document).on("pagebeforeshow", "#query-retrieve", function() {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
17 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
18 url: '../modalities',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
19 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
20 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
21 cache: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
22 success: function(modalities) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
23 let target = $('#qr-server');
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
24 $('option', target).remove();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
25
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
26 for (let i = 0; i < modalities.length; i++) {
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
27 let option = $('<option>').text(modalities[i]);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
28 target.append(option);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
29 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
30
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
31 target.selectmenu('refresh');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
32 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
33 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
34
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
35 let target = $('#qr-date');
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
36 $('option', target).remove();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
37 target.append($('<option>').attr('value', '*').text('Any date'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
38 target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
39 target.append($('<option>').attr('value', GenerateDicomDate(-1)).text('Yesterday'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
40 target.append($('<option>').attr('value', GenerateDicomDate(-7) + '-').text('Last 7 days'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
41 target.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
42 target.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
43 target.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year'));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
44 target.selectmenu('refresh');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
45 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
46
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
47
3066
5713952f60c0 upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
am@osimis.io
parents: 3023
diff changeset
48 $(document).on("click", "#qr-echo", function(e) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
49 let server = $('#qr-server').val();
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
50 let message = 'Error: The C-Echo has failed!';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
51
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
52 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
53 url: '../modalities/' + server + '/echo',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
54 type: 'POST',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
55 cache: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
56 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
57 success: function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
58 message = 'The C-Echo has succeeded!';
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
59 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
60 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
61
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
62 $('<div>').simpledialog2({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
63 mode: 'button',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
64 headerText: 'Echo result',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
65 headerClose: true,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
66 buttonPrompt: message,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
67 animate: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
68 buttons : {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
69 'OK': { click: function () { } }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
70 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
71 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
72
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
73 return false;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
74 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
75
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
76
3066
5713952f60c0 upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
am@osimis.io
parents: 3023
diff changeset
77 $(document).on("click", "#qr-submit", function(e) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
78 let query = {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
79 'Level' : 'Study',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
80 'Query' : {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
81 'AccessionNumber' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
82 'PatientBirthDate' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
83 'PatientID' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
84 'PatientName' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
85 'PatientSex' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
86 'StudyDate' : $('#qr-date').val(),
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
87 'StudyDescription' : '*'
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
88 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
89 };
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
90
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
91 let field = $('#qr-fields input:checked').val();
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
92 query['Query'][field] = $('#qr-value').val().toUpperCase();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
93
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
94 let modalities = '';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
95 $('#qr-modalities input:checked').each(function() {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
96 let s = $(this).attr('name');
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
97 if (modalities == '')
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
98 modalities = s;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
99 else
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
100 modalities += '\\' + s;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
101 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
102
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
103 if (modalities.length > 0) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
104 query['Query']['ModalitiesInStudy'] = modalities;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
105 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
106
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
107
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
108 let server = $('#qr-server').val();
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
109 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
110 url: '../modalities/' + server + '/query',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
111 type: 'POST',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
112 data: JSON.stringify(query),
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
113 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
114 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
115 error: function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
116 alert('Error during query (C-Find)');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
117 },
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
118 success: function(result) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
119 ChangePage('query-retrieve-2', {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
120 'server' : server,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
121 'uuid' : result['ID']
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
122 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
123 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
124 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
125
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
126 return false;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
127 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
128
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
129
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
130
3066
5713952f60c0 upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
am@osimis.io
parents: 3023
diff changeset
131 $(document).on("pagebeforeshow", "#query-retrieve-2", function() {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
132 if ($.mobile.pageData) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
133 let pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
134
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
135 let uri = '../queries/' + pageData.uuid + '/answers';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
136
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
137 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
138 url: uri,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
139 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
140 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
141 success: function(answers) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
142 let target = $('#query-retrieve-2 ul');
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
143 $('li', target).remove();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
144
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
145 for (let i = 0; i < answers.length; i++) {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
146 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
147 url: uri + '/' + answers[i] + '/content?simplify',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
148 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
149 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
150 success: function(study) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
151 let series = '#query-retrieve-3?server=' + pageData.server + '&uuid=' + study['StudyInstanceUID'];
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
152
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
153 let content = ($('<div>')
2336
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
154 .append($('<h3>').text(study['PatientID'] + ' - ' + study['PatientName']))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
155 .append($('<p>').text('Accession number: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
156 .append($('<b>').text(study['AccessionNumber'])))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
157 .append($('<p>').text('Birth date: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
158 .append($('<b>').text(study['PatientBirthDate'])))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
159 .append($('<p>').text('Patient sex: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
160 .append($('<b>').text(study['PatientSex'])))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
161 .append($('<p>').text('Study description: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
162 .append($('<b>').text(study['StudyDescription'])))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
163 .append($('<p>').text('Study date: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
164 .append($('<b>').text(FormatDicomDate(study['StudyDate'])))));
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
165
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
166 let info = $('<a>').attr('href', series).html(content);
2336
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
167
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
168 let answerId = answers[i];
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
169 let retrieve = $('<a>').text('Retrieve all study').click(function() {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
170 ChangePage('query-retrieve-4', {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
171 'query' : pageData.uuid,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
172 'answer' : answerId,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
173 'server' : pageData.server
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
174 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
175 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
176
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
177 target.append($('<li>').append(info).append(retrieve));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
178 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
179 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
180 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
181
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
182 target.listview('refresh');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
183 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
184 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
185 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
186 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
187
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
188
3066
5713952f60c0 upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
am@osimis.io
parents: 3023
diff changeset
189 $(document).on("pagebeforeshow", "#query-retrieve-3", function() {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
190 if ($.mobile.pageData) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
191 let pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
192
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
193 let query = {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
194 'Level' : 'Series',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
195 'Query' : {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
196 'Modality' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
197 'ProtocolName' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
198 'SeriesDescription' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
199 'SeriesInstanceUID' : '*',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
200 'StudyInstanceUID' : pageData.uuid
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
201 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
202 };
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
203
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
204 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
205 url: '../modalities/' + pageData.server + '/query',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
206 type: 'POST',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
207 data: JSON.stringify(query),
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
208 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
209 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
210 error: function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
211 alert('Error during query (C-Find)');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
212 },
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
213 success: function(answer) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
214 let queryUuid = answer['ID'];
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
215 let uri = '../queries/' + answer['ID'] + '/answers';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
216
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
217 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
218 url: uri,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
219 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
220 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
221 success: function(answers) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
222
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
223 let target = $('#query-retrieve-3 ul');
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
224 $('li', target).remove();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
225
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
226 for (let i = 0; i < answers.length; i++) {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
227 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
228 url: uri + '/' + answers[i] + '/content?simplify',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
229 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
230 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
231 success: function(series) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
232 let content = ($('<div>')
2336
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
233 .append($('<h3>').text(series['SeriesDescription']))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
234 .append($('<p>').text('Modality: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
235 .append($('<b>').text(series['Modality'])))
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
236 .append($('<p>').text('ProtocolName: ')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
237 .append($('<b>').text(series['ProtocolName']))));
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
238
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
239 let info = $('<a>').html(content);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
240
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
241 let answerId = answers[i];
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
242 info.click(function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
243 ChangePage('query-retrieve-4', {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
244 'query' : queryUuid,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
245 'study' : pageData.uuid,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
246 'answer' : answerId,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
247 'server' : pageData.server
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
248 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
249 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
250
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
251 target.append($('<li>').attr('data-icon', 'arrow-d').append(info));
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
252 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
253 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
254 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
255
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
256 target.listview('refresh');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
257 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
258 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
259 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
260 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
261 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
262 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
263
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
264
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
265
3066
5713952f60c0 upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
am@osimis.io
parents: 3023
diff changeset
266 $(document).on("pagebeforeshow", "#query-retrieve-4", function() {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
267 if ($.mobile.pageData) {
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
268 let pageData = DeepCopy($.mobile.pageData);
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
269 let uri = '../queries/' + pageData.query + '/answers/' + pageData.answer + '/retrieve';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
270
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
271 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
272 url: '../system',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
273 dataType: 'json',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
274 async: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
275 cache: false,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
276 success: function(system) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
277 $('#retrieve-target').val(system['DicomAet']);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
278
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
279 $('#retrieve-form').submit(function(event) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
280 event.preventDefault();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
281
3023
c9c2faf76bec replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
282 let aet = $('#retrieve-target').val();
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
283 if (aet.length == 0) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
284 aet = system['DicomAet'];
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
285 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
286
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
287 $.ajax({
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
288 url: uri,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
289 type: 'POST',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
290 async: true, // Necessary to block UI
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
291 dataType: 'text',
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
292 data: aet,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
293 beforeSend: function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
294 $.blockUI({ message: $('#info-retrieve') });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
295 },
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
296 complete: function(s) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
297 $.unblockUI();
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
298 },
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
299 success: function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
300 if (pageData.study) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
301 // Go back to the list of series
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
302 ChangePage('query-retrieve-3', {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
303 'server' : pageData.server,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
304 'uuid' : pageData.study
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
305 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
306 } else {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
307 // Go back to the list of studies
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
308 ChangePage('query-retrieve-2', {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
309 'server' : pageData.server,
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
310 'uuid' : pageData.query
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
311 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
312 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
313 },
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
314 error: function() {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
315 alert('Error during retrieve');
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
316 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
317 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
318 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
319 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
320 });
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
321 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1501
diff changeset
322 });