Mercurial > hg > orthanc
annotate OrthancExplorer/explorer.js @ 3099:9c71abbff70f db-changes
removing build dependency on plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 07 Jan 2019 16:13:16 +0100 |
parents | b89a4288d605 |
children | 5713952f60c0 81b58b549845 |
rev | line source |
---|---|
0 | 1 // http://stackoverflow.com/questions/1663741/is-there-a-good-jquery-drag-and-drop-file-upload-plugin |
2 | |
3 | |
4 // Forbid the access to IE | |
5 if ($.browser.msie) | |
6 { | |
7 alert("Please use Mozilla Firefox or Google Chrome. Microsoft Internet Explorer is not supported."); | |
8 } | |
9 | |
10 // http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html | |
11 //$.mobile.ajaxEnabled = false; | |
12 //$.mobile.page.prototype.options.addBackBtn = true; | |
13 //$.mobile.defaultPageTransition = 'slide'; | |
14 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
15 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
16 var LIMIT_RESOURCES = 100; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
17 |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
18 var currentPage = ''; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
19 var currentUuid = ''; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
20 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
21 |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
22 function DeepCopy(obj) |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
23 { |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
24 return jQuery.extend(true, {}, obj); |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
25 } |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
26 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
27 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
28 function ChangePage(page, options) |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
29 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
30 let first = true; |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
31 if (options) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
32 for (let key in options) { |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
33 let value = options[key]; |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
34 if (first) { |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
35 page += '?'; |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
36 first = false; |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
37 } else { |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
38 page += '&'; |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
39 } |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
40 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
41 page += key + '=' + value; |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
42 } |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
43 } |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
44 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
45 window.location.replace('explorer.html#' + page); |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
46 /*$.mobile.changePage('#' + page, { |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
47 changeHash: true |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
48 });*/ |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
49 } |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
50 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
51 |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
52 function Refresh() |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
53 { |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
54 if (currentPage == 'patient') |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
55 RefreshPatient(); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
56 else if (currentPage == 'study') |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
57 RefreshStudy(); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
58 else if (currentPage == 'series') |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
59 RefreshSeries(); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
60 else if (currentPage == 'instance') |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
61 RefreshInstance(); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
62 } |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
63 |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
64 |
0 | 65 $(document).ready(function() { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
66 let $tree = $('#dicom-tree'); |
0 | 67 $tree.tree({ |
68 autoEscape: false | |
69 }); | |
70 | |
71 $('#dicom-tree').bind( | |
72 'tree.click', | |
73 function(event) { | |
74 if (event.node.is_open) | |
75 $tree.tree('closeNode', event.node, true); | |
76 else | |
77 $tree.tree('openNode', event.node, true); | |
78 } | |
79 ); | |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
80 |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
81 currentPage = $.mobile.pageData.active; |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
82 currentUuid = $.mobile.pageData.uuid; |
1591 | 83 if (!(typeof currentPage === 'undefined') && |
84 !(typeof currentUuid === 'undefined') && | |
85 currentPage.length > 0 && | |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
86 currentUuid.length > 0) |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
87 { |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
88 Refresh(); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
89 } |
0 | 90 }); |
91 | |
92 | |
93 function SplitLongUid(s) | |
94 { | |
95 return '<span>' + s.substr(0, s.length / 2) + '</span> <span>' + s.substr(s.length / 2, s.length - s.length / 2) + '</span>'; | |
96 } | |
97 | |
98 | |
99 function ParseDicomDate(s) | |
100 { | |
101 y = parseInt(s.substr(0, 4), 10); | |
102 m = parseInt(s.substr(4, 2), 10) - 1; | |
103 d = parseInt(s.substr(6, 2), 10); | |
104 | |
105 if (y == null || m == null || d == null || | |
106 !isFinite(y) || !isFinite(m) || !isFinite(d)) | |
107 { | |
108 return null; | |
109 } | |
110 | |
111 if (y < 1900 || y > 2100 || | |
112 m < 0 || m >= 12 || | |
113 d <= 0 || d >= 32) | |
114 { | |
115 return null; | |
116 } | |
117 | |
118 return new Date(y, m, d); | |
119 } | |
120 | |
121 | |
122 function FormatDicomDate(s) | |
123 { | |
124 if (s == undefined) | |
125 return "No date"; | |
126 | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
127 let d = ParseDicomDate(s); |
0 | 128 if (d == null) |
129 return '?'; | |
130 else | |
131 return d.toString('dddd, MMMM d, yyyy'); | |
132 } | |
133 | |
134 | |
80 | 135 function Sort(arr, fieldExtractor, isInteger, reverse) |
0 | 136 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
137 let defaultValue; |
33 | 138 if (isInteger) |
139 defaultValue = 0; | |
140 else | |
141 defaultValue = ''; | |
142 | |
0 | 143 arr.sort(function(a, b) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
144 let ta = fieldExtractor(a); |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
145 let tb = fieldExtractor(b); |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
146 let order; |
0 | 147 |
33 | 148 if (ta == undefined) |
149 ta = defaultValue; | |
150 | |
151 if (tb == undefined) | |
152 tb = defaultValue; | |
153 | |
0 | 154 if (isInteger) |
155 { | |
156 ta = parseInt(ta, 10); | |
157 tb = parseInt(tb, 10); | |
158 order = ta - tb; | |
159 } | |
160 else | |
161 { | |
162 if (ta < tb) | |
163 order = -1; | |
164 else if (ta > tb) | |
165 order = 1; | |
166 else | |
167 order = 0; | |
168 } | |
169 | |
170 if (reverse) | |
171 return -order; | |
172 else | |
173 return order; | |
174 }); | |
175 } | |
176 | |
177 | |
80 | 178 function SortOnDicomTag(arr, tag, isInteger, reverse) |
179 { | |
180 return Sort(arr, function(a) { | |
181 return a.MainDicomTags[tag]; | |
182 }, isInteger, reverse); | |
183 } | |
184 | |
185 | |
0 | 186 |
1345 | 187 function GetResource(uri, callback) |
0 | 188 { |
189 $.ajax({ | |
1345 | 190 url: '..' + uri, |
0 | 191 dataType: 'json', |
192 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
193 cache: false, |
0 | 194 success: function(s) { |
195 callback(s); | |
196 } | |
197 }); | |
198 } | |
199 | |
200 | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
201 function CompleteFormatting(node, link, isReverse, count) |
0 | 202 { |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
203 if (count != null) |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
204 { |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
205 node = node.add($('<span>') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
206 .addClass('ui-li-count') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
207 .text(count)); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
208 } |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
209 |
0 | 210 if (link != null) |
211 { | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
212 node = $('<a>').attr('href', link).append(node); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
213 |
0 | 214 if (isReverse) |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
215 node.attr('data-direction', 'reverse') |
0 | 216 } |
217 | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
218 node = $('<li>').append(node); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
219 |
0 | 220 if (isReverse) |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
221 node.attr('data-icon', 'back'); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
222 |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
223 return node; |
0 | 224 } |
225 | |
226 | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
227 function FormatMainDicomTags(target, tags, tagsToIgnore) |
38 | 228 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
229 for (let i in tags) |
38 | 230 { |
231 if (tagsToIgnore.indexOf(i) == -1) | |
232 { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
233 let v = tags[i]; |
38 | 234 |
40 | 235 if (i == "PatientBirthDate" || |
236 i == "StudyDate" || | |
237 i == "SeriesDate") | |
38 | 238 { |
239 v = FormatDicomDate(v); | |
240 } | |
40 | 241 else if (i == "DicomStudyInstanceUID" || |
242 i == "DicomSeriesInstanceUID") | |
38 | 243 { |
244 v = SplitLongUid(v); | |
245 } | |
246 | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
247 target.append($('<p>') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
248 .text(i + ': ') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
249 .append($('<strong>').text(v))); |
38 | 250 } |
251 } | |
252 } | |
253 | |
0 | 254 |
255 function FormatPatient(patient, link, isReverse) | |
256 { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
257 let node = $('<div>').append($('<h3>').text(patient.MainDicomTags.PatientName)); |
0 | 258 |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
259 FormatMainDicomTags(node, patient.MainDicomTags, [ |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
260 "PatientName" |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
261 // "OtherPatientIDs" |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
262 ]); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
263 |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
264 return CompleteFormatting(node, link, isReverse, patient.Studies.length); |
0 | 265 } |
266 | |
267 | |
268 | |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
269 function FormatStudy(study, link, isReverse, includePatient) |
0 | 270 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
271 let label; |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
272 |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
273 if (includePatient) { |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
274 label = study.Label; |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
275 } else { |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
276 label = study.MainDicomTags.StudyDescription; |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
277 } |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
278 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
279 let node = $('<div>').append($('<h3>').text(label)); |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
280 |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
281 if (includePatient) { |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
282 FormatMainDicomTags(node, study.PatientMainDicomTags, [ |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
283 'PatientName' |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
284 ]); |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
285 } |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
286 |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
287 FormatMainDicomTags(node, study.MainDicomTags, [ |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
288 'StudyDescription', |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
289 'StudyTime' |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
290 ]); |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
291 |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
292 return CompleteFormatting(node, link, isReverse, study.Series.length); |
0 | 293 } |
294 | |
295 | |
296 | |
297 function FormatSeries(series, link, isReverse) | |
298 { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
299 let c; |
82 | 300 if (series.ExpectedNumberOfInstances == null || |
301 series.Instances.length == series.ExpectedNumberOfInstances) | |
80 | 302 { |
82 | 303 c = series.Instances.length; |
80 | 304 } |
305 else | |
306 { | |
307 c = series.Instances.length + '/' + series.ExpectedNumberOfInstances; | |
308 } | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
309 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
310 let node = $('<div>') |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
311 .append($('<h3>').text(series.MainDicomTags.SeriesDescription)) |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
312 .append($('<p>').append($('<em>') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
313 .text('Status: ') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
314 .append($('<strong>').text(series.Status)))); |
80 | 315 |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
316 FormatMainDicomTags(node, series.MainDicomTags, [ |
40 | 317 "SeriesDescription", |
318 "SeriesTime", | |
41
c1097a676eca
better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
319 "Manufacturer", |
c1097a676eca
better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
320 "ImagesInAcquisition", |
1732
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
321 "SeriesDate", |
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
322 "ImageOrientationPatient" |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
323 ]); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
324 |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
325 return CompleteFormatting(node, link, isReverse, c); |
0 | 326 } |
327 | |
328 | |
329 function FormatInstance(instance, link, isReverse) | |
330 { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
331 let node = $('<div>').append($('<h3>').text('Instance: ' + instance.IndexInSeries)); |
0 | 332 |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
333 FormatMainDicomTags(node, instance.MainDicomTags, [ |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
334 "AcquisitionNumber", |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
335 "InstanceNumber", |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
336 "InstanceCreationDate", |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
337 "InstanceCreationTime", |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
338 "ImagePositionPatient" |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
339 ]); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
340 |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
341 return CompleteFormatting(node, link, isReverse); |
0 | 342 } |
343 | |
344 | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
345 $('[data-role="page"]').live('pagebeforeshow', function() { |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
346 $.ajax({ |
153 | 347 url: '../system', |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
348 dataType: 'json', |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
349 async: false, |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
350 cache: false, |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
351 success: function(s) { |
165 | 352 if (s.Name != "") { |
2336
a95beca72e99
fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2292
diff
changeset
|
353 $('.orthanc-name').html($('<a>') |
a95beca72e99
fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2292
diff
changeset
|
354 .addClass('ui-link') |
a95beca72e99
fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2292
diff
changeset
|
355 .attr('href', 'explorer.html') |
a95beca72e99
fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2292
diff
changeset
|
356 .text(s.Name) |
a95beca72e99
fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2292
diff
changeset
|
357 .append(' » ')); |
165 | 358 } |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
359 } |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
360 }); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
361 }); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
362 |
0 | 363 |
364 | |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
365 $('#lookup').live('pagebeforeshow', function() { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
366 // NB: "GenerateDicomDate()" is defined in "query-retrieve.js" |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
367 let target = $('#lookup-study-date'); |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
368 $('option', target).remove(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
369 target.append($('<option>').attr('value', '*').text('Any date')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
370 target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
371 target.append($('<option>').attr('value', GenerateDicomDate(-1)).text('Yesterday')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
372 target.append($('<option>').attr('value', GenerateDicomDate(-7) + '-').text('Last 7 days')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
373 target.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
374 target.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
375 target.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year')); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
376 target.selectmenu('refresh'); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
377 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
378 $('#lookup-result').hide(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
379 }); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
380 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
381 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
382 $('#lookup-submit').live('click', function() { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
383 $('#lookup-result').hide(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
384 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
385 let lookup = { |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
386 'Level' : 'Study', |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
387 'Expand' : true, |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
388 'Limit' : LIMIT_RESOURCES + 1, |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
389 'Query' : { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
390 'StudyDate' : $('#lookup-study-date').val() |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
391 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
392 }; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
393 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
394 $('#lookup-form input').each(function(index, input) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
395 if (input.value.length != 0) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
396 if (input.id == 'lookup-patient-id') { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
397 lookup['Query']['PatientID'] = input.value; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
398 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
399 else if (input.id == 'lookup-patient-name') { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
400 lookup['Query']['PatientName'] = input.value; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
401 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
402 else if (input.id == 'lookup-accession-number') { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
403 lookup['Query']['AccessionNumber'] = input.value; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
404 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
405 else if (input.id == 'lookup-study-description') { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
406 lookup['Query']['StudyDescription'] = input.value; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
407 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
408 else { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
409 console.error('Unknown lookup field: ' + input.id); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
410 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
411 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
412 }); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
413 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
414 $.ajax({ |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
415 url: '../tools/find', |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
416 type: 'POST', |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
417 data: JSON.stringify(lookup), |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
418 dataType: 'json', |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
419 async: false, |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
420 error: function() { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
421 alert('Error during lookup'); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
422 }, |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
423 success: function(studies) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
424 FormatListOfStudies('#lookup-result ul', '#lookup-alert', '#lookup-count', studies); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
425 $('#lookup-result').show(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
426 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
427 }); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
428 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
429 return false; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
430 }); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
431 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
432 |
0 | 433 $('#find-patients').live('pagebeforeshow', function() { |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
434 GetResource('/patients?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(patients) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
435 let target = $('#all-patients'); |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
436 $('li', target).remove(); |
0 | 437 |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
438 SortOnDicomTag(patients, 'PatientName', false, false); |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
439 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
440 let count, showAlert; |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
441 if (patients.length <= LIMIT_RESOURCES) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
442 count = patients.length; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
443 showAlert = false; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
444 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
445 else { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
446 count = LIMIT_RESOURCES; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
447 showAlert = true; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
448 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
449 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
450 for (let i = 0; i < count; i++) { |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
451 let p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID); |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
452 target.append(p); |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
453 } |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
454 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
455 target.listview('refresh'); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
456 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
457 if (showAlert) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
458 $('#count-patients').text(LIMIT_RESOURCES); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
459 $('#alert-patients').show(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
460 } else { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
461 $('#alert-patients').hide(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
462 } |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
463 }); |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
464 }); |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
465 |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
466 |
0 | 467 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
468 function FormatListOfStudies(targetId, alertId, countId, studies) |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
469 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
470 let target = $(targetId); |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
471 $('li', target).remove(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
472 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
473 for (let i = 0; i < studies.length; i++) { |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
474 let patient = studies[i].PatientMainDicomTags.PatientName; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
475 let study = studies[i].MainDicomTags.StudyDescription; |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
476 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
477 let s; |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
478 if (typeof patient === 'string') { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
479 s = patient; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
480 } |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
481 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
482 if (typeof study === 'string') { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
483 if (s.length > 0) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
484 s += ' - '; |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
485 } |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
486 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
487 s += study; |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
488 } |
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
489 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
490 studies[i]['Label'] = s; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
491 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
492 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
493 Sort(studies, function(a) { return a.Label }, false, false); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
494 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
495 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
496 let count, showAlert; |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
497 if (studies.length <= LIMIT_RESOURCES) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
498 count = studies.length; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
499 showAlert = false; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
500 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
501 else { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
502 count = LIMIT_RESOURCES; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
503 showAlert = true; |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
504 } |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
505 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
506 for (let i = 0; i < count; i++) { |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
507 let p = FormatStudy(studies[i], '#study?uuid=' + studies[i].ID, false, true); |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
508 target.append(p); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
509 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
510 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
511 target.listview('refresh'); |
2594
7fbe3f024ac9
new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
512 |
2873
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
513 if (showAlert) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
514 $(countId).text(LIMIT_RESOURCES); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
515 $(alertId).show(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
516 } else { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
517 $(alertId).hide(); |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
518 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
519 } |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
520 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
521 |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
522 $('#find-studies').live('pagebeforeshow', function() { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
523 GetResource('/studies?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(studies) { |
703d1e848907
Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2647
diff
changeset
|
524 FormatListOfStudies('#all-studies', '#alert-studies', '#count-studies', studies); |
1345 | 525 }); |
0 | 526 }); |
527 | |
528 | |
529 | |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
530 function SetupAnonymizedOrModifiedFrom(buttonSelector, resource, resourceType, field) |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
531 { |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
532 if (field in resource) |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
533 { |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
534 $(buttonSelector).closest('li').show(); |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
535 $(buttonSelector).click(function(e) { |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
536 window.location.assign('explorer.html#' + resourceType + '?uuid=' + resource[field]); |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
537 }); |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
538 } |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
539 else |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
540 { |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
541 $(buttonSelector).closest('li').hide(); |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
542 } |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
543 } |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
544 |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
545 |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
546 |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
547 function RefreshPatient() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
548 { |
0 | 549 if ($.mobile.pageData) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
550 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:
1732
diff
changeset
|
551 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
552 GetResource('/patients/' + pageData.uuid, function(patient) { |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
553 GetResource('/patients/' + pageData.uuid + '/studies', function(studies) { |
1345 | 554 SortOnDicomTag(studies, 'StudyDate', false, true); |
0 | 555 |
1345 | 556 $('#patient-info li').remove(); |
557 $('#patient-info') | |
558 .append('<li data-role="list-divider">Patient</li>') | |
559 .append(FormatPatient(patient)) | |
560 .listview('refresh'); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
561 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
562 let target = $('#list-studies'); |
1345 | 563 $('li', target).remove(); |
564 | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
565 for (let i = 0; i < studies.length; i++) { |
1345 | 566 if (i == 0 || studies[i].MainDicomTags.StudyDate != studies[i - 1].MainDicomTags.StudyDate) |
567 { | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
568 target.append($('<li>') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
569 .attr('data-role', 'list-divider') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
570 .text(FormatDicomDate(studies[i].MainDicomTags.StudyDate))); |
0 | 571 } |
572 | |
1345 | 573 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID)); |
574 } | |
0 | 575 |
1345 | 576 SetupAnonymizedOrModifiedFrom('#patient-anonymized-from', patient, 'patient', 'AnonymizedFrom'); |
577 SetupAnonymizedOrModifiedFrom('#patient-modified-from', patient, 'patient', 'ModifiedFrom'); | |
578 | |
579 target.listview('refresh'); | |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
580 |
1345 | 581 // Check whether this patient is protected |
582 $.ajax({ | |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
583 url: '../patients/' + pageData.uuid + '/protected', |
1345 | 584 type: 'GET', |
585 dataType: 'text', | |
586 async: false, | |
587 cache: false, | |
588 success: function (s) { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
589 let v = (s == '1') ? 'on' : 'off'; |
1345 | 590 $('#protection').val(v).slider('refresh'); |
591 } | |
592 }); | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
593 |
1345 | 594 currentPage = 'patient'; |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
595 currentUuid = pageData.uuid; |
0 | 596 }); |
597 }); | |
598 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
599 } |
0 | 600 |
601 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
602 function RefreshStudy() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
603 { |
0 | 604 if ($.mobile.pageData) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
605 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:
1732
diff
changeset
|
606 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
607 GetResource('/studies/' + pageData.uuid, function(study) { |
1345 | 608 GetResource('/patients/' + study.ParentPatient, function(patient) { |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
609 GetResource('/studies/' + pageData.uuid + '/series', function(series) { |
1345 | 610 SortOnDicomTag(series, 'SeriesDate', false, true); |
0 | 611 |
1345 | 612 $('#study .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
613 $('#study-info li').remove(); | |
614 $('#study-info') | |
615 .append('<li data-role="list-divider">Patient</li>') | |
616 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
617 .append('<li data-role="list-divider">Study</li>') | |
618 .append(FormatStudy(study)) | |
619 .listview('refresh'); | |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
620 |
1345 | 621 SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', 'AnonymizedFrom'); |
622 SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', 'ModifiedFrom'); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
623 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
624 let target = $('#list-series'); |
1345 | 625 $('li', target).remove(); |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
626 for (let i = 0; i < series.length; i++) { |
1345 | 627 if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate) |
628 { | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
629 target.append($('<li>') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
630 .attr('data-role', 'list-divider') |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
631 .text(FormatDicomDate(series[i].MainDicomTags.SeriesDate))); |
0 | 632 } |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
633 |
1345 | 634 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID)); |
635 } | |
636 target.listview('refresh'); | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
637 |
1345 | 638 currentPage = 'study'; |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
639 currentUuid = pageData.uuid; |
0 | 640 }); |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
641 }); |
0 | 642 }); |
643 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
644 } |
0 | 645 |
646 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
647 function RefreshSeries() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
648 { |
0 | 649 if ($.mobile.pageData) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
650 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:
1732
diff
changeset
|
651 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
652 GetResource('/series/' + pageData.uuid, function(series) { |
1345 | 653 GetResource('/studies/' + series.ParentStudy, function(study) { |
654 GetResource('/patients/' + study.ParentPatient, function(patient) { | |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
655 GetResource('/series/' + pageData.uuid + '/instances', function(instances) { |
1345 | 656 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); |
0 | 657 |
1345 | 658 $('#series .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
659 $('#series .study-link').attr('href', '#study?uuid=' + study.ID); | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
660 |
1345 | 661 $('#series-info li').remove(); |
662 $('#series-info') | |
663 .append('<li data-role="list-divider">Patient</li>') | |
664 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
665 .append('<li data-role="list-divider">Study</li>') | |
666 .append(FormatStudy(study, '#study?uuid=' + study.ID, true)) | |
667 .append('<li data-role="list-divider">Series</li>') | |
668 .append(FormatSeries(series)) | |
669 .listview('refresh'); | |
0 | 670 |
1345 | 671 SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', 'AnonymizedFrom'); |
672 SetupAnonymizedOrModifiedFrom('#series-modified-from', series, 'series', 'ModifiedFrom'); | |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
673 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
674 let target = $('#list-instances'); |
1345 | 675 $('li', target).remove(); |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
676 for (let i = 0; i < instances.length; i++) { |
1345 | 677 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID)); |
678 } | |
679 target.listview('refresh'); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
680 |
1345 | 681 currentPage = 'series'; |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
682 currentUuid = pageData.uuid; |
0 | 683 }); |
684 }); | |
685 }); | |
686 }); | |
687 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
688 } |
0 | 689 |
690 | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
691 function EscapeHtml(value) |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
692 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
693 let ENTITY_MAP = { |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
694 '&': '&', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
695 '<': '<', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
696 '>': '>', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
697 '"': '"', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
698 "'": ''', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
699 '/': '/', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
700 '`': '`', |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
701 '=': '=' |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
702 }; |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
703 |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
704 return String(value).replace(/[&<>"'`=\/]/g, function (s) { |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
705 return ENTITY_MAP[s]; |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
706 }); |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
707 } |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
708 |
0 | 709 |
710 function ConvertForTree(dicom) | |
711 { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
712 let result = []; |
0 | 713 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
714 for (let i in dicom) { |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
715 if (dicom[i] != null) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
716 let label = (i + '<span class="tag-name"> (<i>' + |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
717 EscapeHtml(dicom[i]["Name"]) + |
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
718 '</i>)</span>: '); |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
719 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
720 if (dicom[i]["Type"] == 'String') |
0 | 721 { |
722 result.push({ | |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
723 label: label + '<strong>' + EscapeHtml(dicom[i]["Value"]) + '</strong>', |
0 | 724 children: [] |
725 }); | |
726 } | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
727 else if (dicom[i]["Type"] == 'TooLong') |
0 | 728 { |
729 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
730 label: label + '<i>Too long</i>', |
0 | 731 children: [] |
732 }); | |
733 } | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
734 else if (dicom[i]["Type"] == 'Null') |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
735 { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
736 result.push({ |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
737 label: label + '<i>Null</i>', |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
738 children: [] |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
739 }); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
740 } |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
741 else if (dicom[i]["Type"] == 'Sequence') |
0 | 742 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
743 let c = []; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
744 for (let j = 0; j < dicom[i]["Value"].length; j++) { |
0 | 745 c.push({ |
746 label: 'Item ' + j, | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
747 children: ConvertForTree(dicom[i]["Value"][j]) |
0 | 748 }); |
749 } | |
750 | |
751 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
752 label: label + '[]', |
0 | 753 children: c |
754 }); | |
755 } | |
756 } | |
757 } | |
758 | |
759 return result; | |
760 } | |
761 | |
762 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
763 function RefreshInstance() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
764 { |
0 | 765 if ($.mobile.pageData) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
766 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:
1732
diff
changeset
|
767 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
768 GetResource('/instances/' + pageData.uuid, function(instance) { |
1345 | 769 GetResource('/series/' + instance.ParentSeries, function(series) { |
770 GetResource('/studies/' + series.ParentStudy, function(study) { | |
771 GetResource('/patients/' + study.ParentPatient, function(patient) { | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
772 |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
773 $('#instance .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
774 $('#instance .study-link').attr('href', '#study?uuid=' + study.ID); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
775 $('#instance .series-link').attr('href', '#series?uuid=' + series.ID); |
0 | 776 |
777 $('#instance-info li').remove(); | |
778 $('#instance-info') | |
779 .append('<li data-role="list-divider">Patient</li>') | |
780 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
781 .append('<li data-role="list-divider">Study</li>') | |
782 .append(FormatStudy(study, '#study?uuid=' + study.ID, true)) | |
783 .append('<li data-role="list-divider">Series</li>') | |
784 .append(FormatSeries(series, '#series?uuid=' + series.ID, true)) | |
785 .append('<li data-role="list-divider">Instance</li>') | |
786 .append(FormatInstance(instance)) | |
787 .listview('refresh'); | |
788 | |
1345 | 789 GetResource('/instances/' + instance.ID + '/tags', function(s) { |
790 $('#dicom-tree').tree('loadData', ConvertForTree(s)); | |
0 | 791 }); |
792 | |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
793 SetupAnonymizedOrModifiedFrom('#instance-anonymized-from', instance, 'instance', 'AnonymizedFrom'); |
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
794 SetupAnonymizedOrModifiedFrom('#instance-modified-from', instance, 'instance', 'ModifiedFrom'); |
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
795 |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
796 currentPage = 'instance'; |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
797 currentUuid = pageData.uuid; |
0 | 798 }); |
799 }); | |
800 }); | |
801 }); | |
802 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
803 } |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
804 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
805 $(document).live('pagebeforehide', function() { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
806 currentPage = ''; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
807 currentUuid = ''; |
0 | 808 }); |
809 | |
810 | |
811 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
812 $('#patient').live('pagebeforeshow', RefreshPatient); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
813 $('#study').live('pagebeforeshow', RefreshStudy); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
814 $('#series').live('pagebeforeshow', RefreshSeries); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
815 $('#instance').live('pagebeforeshow', RefreshInstance); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
816 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
817 $(function() { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
818 $(window).hashchange(function(e, data) { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
819 // This fixes the navigation with the back button and with the anonymization |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
820 if ('uuid' in $.mobile.pageData && |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
821 currentPage == $.mobile.pageData.active && |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
822 currentUuid != $.mobile.pageData.uuid) { |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
823 Refresh(); |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
824 } |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
825 }); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
826 }); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
827 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
828 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
829 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
830 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
831 |
0 | 832 function DeleteResource(path) |
833 { | |
834 $.ajax({ | |
835 url: path, | |
836 type: 'DELETE', | |
837 dataType: 'json', | |
838 async: false, | |
839 success: function(s) { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
840 let ancestor = s.RemainingAncestor; |
0 | 841 if (ancestor == null) |
2929
e0c620f964e5
Go back to lookup if deleting a resource without an ancestor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2874
diff
changeset
|
842 $.mobile.changePage('#lookup'); |
0 | 843 else |
201
bee20e978835
refactoring of delete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
165
diff
changeset
|
844 $.mobile.changePage('#' + ancestor.Type.toLowerCase() + '?uuid=' + ancestor.ID); |
0 | 845 } |
846 }); | |
847 } | |
848 | |
849 | |
850 | |
851 function OpenDeleteResourceDialog(path, title) | |
852 { | |
853 $(document).simpledialog2({ | |
854 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/ | |
855 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/options.html | |
856 mode: 'button', | |
857 animate: false, | |
858 headerText: title, | |
859 headerClose: true, | |
860 width: '500px', | |
861 buttons : { | |
862 'OK': { | |
863 click: function () { | |
864 DeleteResource(path); | |
865 }, | |
866 icon: "delete", | |
867 theme: "c" | |
868 }, | |
869 'Cancel': { | |
870 click: function () { | |
871 } | |
872 } | |
873 } | |
874 }); | |
875 } | |
876 | |
877 | |
878 | |
879 $('#instance-delete').live('click', function() { | |
83 | 880 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid, |
0 | 881 'Delete this instance?'); |
882 }); | |
883 | |
884 $('#study-delete').live('click', function() { | |
83 | 885 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid, |
0 | 886 'Delete this study?'); |
887 }); | |
888 | |
889 $('#series-delete').live('click', function() { | |
83 | 890 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid, |
0 | 891 'Delete this series?'); |
892 }); | |
893 | |
894 $('#patient-delete').live('click', function() { | |
83 | 895 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid, |
0 | 896 'Delete this patient?'); |
897 }); | |
898 | |
899 | |
900 $('#instance-download-dicom').live('click', function(e) { | |
901 // http://stackoverflow.com/a/1296101 | |
902 e.preventDefault(); //stop the browser from following | |
83 | 903 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file'; |
0 | 904 }); |
905 | |
906 $('#instance-download-json').live('click', function(e) { | |
907 // http://stackoverflow.com/a/1296101 | |
908 e.preventDefault(); //stop the browser from following | |
83 | 909 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags'; |
0 | 910 }); |
911 | |
912 | |
250
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
913 |
0 | 914 $('#instance-preview').live('click', function(e) { |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
915 if ($.mobile.pageData) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
916 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:
1732
diff
changeset
|
917 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
918 let pdf = '../instances/' + pageData.uuid + '/pdf'; |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
919 $.ajax({ |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
920 url: pdf, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
921 cache: false, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
922 success: function(s) { |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
923 window.location.assign(pdf); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
924 }, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
925 error: function() { |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
926 GetResource('/instances/' + pageData.uuid + '/frames', function(frames) { |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
927 if (frames.length == 1) |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
928 { |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
929 // Viewing a single-frame image |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
930 jQuery.slimbox('../instances/' + pageData.uuid + '/preview', '', { |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
931 overlayFadeDuration : 1, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
932 resizeDuration : 1, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
933 imageFadeDuration : 1 |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
934 }); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
935 } |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
936 else |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
937 { |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
938 // Viewing a multi-frame image |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
939 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
940 let images = []; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
941 for (let i = 0; i < frames.length; i++) { |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
942 images.push([ '../instances/' + pageData.uuid + '/frames/' + i + '/preview' ]); |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
943 } |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
944 |
1556
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
945 jQuery.slimbox(images, 0, { |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
946 overlayFadeDuration : 1, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
947 resizeDuration : 1, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
948 imageFadeDuration : 1, |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
949 loop : true |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
950 }); |
b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1345
diff
changeset
|
951 } |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
952 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
953 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
954 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
955 } |
0 | 956 }); |
957 | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
958 |
1345 | 959 |
0 | 960 $('#series-preview').live('click', function(e) { |
961 if ($.mobile.pageData) { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
962 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:
1732
diff
changeset
|
963 |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
964 GetResource('/series/' + pageData.uuid, function(series) { |
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
965 GetResource('/series/' + pageData.uuid + '/instances', function(instances) { |
1345 | 966 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); |
0 | 967 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
968 let images = []; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
969 for (let i = 0; i < instances.length; i++) { |
1345 | 970 images.push([ '../instances/' + instances[i].ID + '/preview', |
2292
ccd44d546b47
Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2119
diff
changeset
|
971 (i + 1).toString() + '/' + instances.length.toString() ]) |
1345 | 972 } |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
973 |
1345 | 974 jQuery.slimbox(images, 0, { |
975 overlayFadeDuration : 1, | |
976 resizeDuration : 1, | |
977 imageFadeDuration : 1, | |
978 loop : true | |
979 }); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
980 }); |
0 | 981 }); |
982 } | |
983 }); | |
984 | |
985 | |
986 | |
987 | |
988 | |
989 function ChooseDicomModality(callback) | |
990 { | |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
991 let clickedModality = ''; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
992 let clickedPeer = ''; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
993 let items = $('<ul>') |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
994 .attr('data-divider-theme', 'd') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
995 .attr('data-role', 'listview'); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
996 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
997 // Retrieve the list of the known DICOM modalities |
0 | 998 $.ajax({ |
83 | 999 url: '../modalities', |
0 | 1000 type: 'GET', |
1001 dataType: 'json', | |
1002 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1003 cache: false, |
0 | 1004 success: function(modalities) { |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1005 if (modalities.length > 0) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1006 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1007 items.append('<li data-role="list-divider">DICOM modalities</li>'); |
484
b8ace6fc1d1f
preparation for handling Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
482
diff
changeset
|
1008 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1009 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:
2929
diff
changeset
|
1010 let name = modalities[i]; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1011 let item = $('<li>') |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1012 .html('<a href="#" rel="close">' + name + '</a>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1013 .attr('name', name) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1014 .click(function() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1015 clickedModality = $(this).attr('name'); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1016 }); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1017 items.append(item); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1018 } |
0 | 1019 } |
1020 | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1021 // Retrieve the list of the known Orthanc peers |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1022 $.ajax({ |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1023 url: '../peers', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1024 type: 'GET', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1025 dataType: 'json', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1026 async: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1027 cache: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1028 success: function(peers) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1029 if (peers.length > 0) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1030 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1031 items.append('<li data-role="list-divider">Orthanc peers</li>'); |
484
b8ace6fc1d1f
preparation for handling Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
482
diff
changeset
|
1032 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1033 for (let i = 0; i < peers.length; i++) { |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1034 let name = peers[i]; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1035 let item = $('<li>') |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1036 .html('<a href="#" rel="close">' + name + '</a>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1037 .attr('name', name) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1038 .click(function() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1039 clickedPeer = $(this).attr('name'); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1040 }); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1041 items.append(item); |
0 | 1042 } |
1043 } | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1044 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1045 // Launch the dialog |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1046 $('#dialog').simpledialog2({ |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1047 mode: 'blank', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1048 animate: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1049 headerText: 'Choose target', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1050 headerClose: true, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1051 forceInput: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1052 width: '100%', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1053 blankContent: items, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1054 callbackClose: function() { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1055 let timer; |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1056 function WaitForDialogToClose() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1057 if (!$('#dialog').is(':visible')) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1058 clearInterval(timer); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1059 callback(clickedModality, clickedPeer); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1060 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1061 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1062 timer = setInterval(WaitForDialogToClose, 100); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1063 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1064 }); |
0 | 1065 } |
1066 }); | |
1067 } | |
1068 }); | |
1069 } | |
1070 | |
1071 | |
405
97a00b30abcc
sending of studies and patients with orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
354
diff
changeset
|
1072 $('#instance-store,#series-store,#study-store,#patient-store').live('click', function(e) { |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1073 ChooseDicomModality(function(modality, peer) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1074 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:
1732
diff
changeset
|
1075 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1076 let url; |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1077 let loading; |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1078 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1079 if (modality != '') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1080 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1081 url = '../modalities/' + modality + '/store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1082 loading = '#dicom-store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1083 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1084 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1085 if (peer != '') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1086 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1087 url = '../peers/' + peer + '/store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1088 loading = '#peer-store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1089 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1090 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1091 if (url != '') { |
0 | 1092 $.ajax({ |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1093 url: url, |
0 | 1094 type: 'POST', |
1095 dataType: 'text', | |
2119
e0517f25919e
Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1732
diff
changeset
|
1096 data: pageData.uuid, |
0 | 1097 async: true, // Necessary to block UI |
1098 beforeSend: function() { | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1099 $.blockUI({ message: $(loading) }); |
0 | 1100 }, |
1101 complete: function(s) { | |
1102 $.unblockUI(); | |
1103 }, | |
1104 success: function(s) { | |
1105 }, | |
1106 error: function() { | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1107 alert('Error during store'); |
0 | 1108 } |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
1109 }); |
0 | 1110 } |
1111 }); | |
1112 }); | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1113 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1114 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1115 $('#show-tag-name').live('change', function(e) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1116 let checked = e.currentTarget.checked; |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1117 if (checked) |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1118 $('.tag-name').show(); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1119 else |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1120 $('.tag-name').hide(); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
1121 }); |
250
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1122 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1123 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1124 $('#patient-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1125 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1126 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1127 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1128 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1129 $('#study-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1130 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1131 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1132 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1133 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1134 $('#series-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1135 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1136 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1137 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
1138 |
1188
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1139 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1140 $('#patient-media').live('click', function(e) { |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1141 e.preventDefault(); //stop the browser from following |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1142 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/media'; |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1143 }); |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1144 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1145 $('#study-media').live('click', function(e) { |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1146 e.preventDefault(); //stop the browser from following |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1147 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/media'; |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1148 }); |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1149 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1150 $('#series-media').live('click', function(e) { |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1151 e.preventDefault(); //stop the browser from following |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1152 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media'; |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1153 }); |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1154 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1155 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
1156 |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1157 $('#protection').live('change', function(e) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1158 let isProtected = e.target.value == "on"; |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1159 $.ajax({ |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1160 url: '../patients/' + $.mobile.pageData.uuid + '/protected', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1161 type: 'PUT', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1162 dataType: 'text', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1163 data: isProtected ? '1' : '0', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1164 async: false |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1165 }); |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
1166 }); |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1167 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1168 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1169 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1170 function OpenAnonymizeResourceDialog(path, title) |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1171 { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1172 $(document).simpledialog2({ |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1173 mode: 'button', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1174 animate: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1175 headerText: title, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1176 headerClose: true, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1177 width: '500px', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1178 buttons : { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1179 'OK': { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1180 click: function () { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1181 $.ajax({ |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1182 url: path + '/anonymize', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1183 type: 'POST', |
354 | 1184 data: '{ "Keep" : [ "SeriesDescription", "StudyDescription" ] }', |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1185 dataType: 'json', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1186 async: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1187 cache: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1188 success: function(s) { |
351 | 1189 // The following line does not work... |
1190 //$.mobile.changePage('explorer.html#patient?uuid=' + s.PatientID); | |
1191 | |
1192 window.location.assign('explorer.html#patient?uuid=' + s.PatientID); | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
1193 //window.location.reload(); |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1194 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1195 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1196 }, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1197 icon: "delete", |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1198 theme: "c" |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1199 }, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1200 'Cancel': { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1201 click: function () { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1202 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1203 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1204 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1205 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1206 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1207 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1208 $('#instance-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1209 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1210 'Anonymize this instance?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1211 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1212 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1213 $('#study-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1214 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1215 'Anonymize this study?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1216 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1217 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1218 $('#series-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1219 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1220 'Anonymize this series?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
1221 }); |
351 | 1222 |
1223 $('#patient-anonymize').live('click', function() { | |
1224 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid, | |
1225 'Anonymize this patient?'); | |
1226 }); | |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1227 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1228 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1229 $('#plugins').live('pagebeforeshow', function() { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1230 $.ajax({ |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1231 url: '../plugins', |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1232 dataType: 'json', |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1233 async: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1234 cache: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1235 success: function(plugins) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1236 let target = $('#all-plugins'); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1237 $('li', target).remove(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1238 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1239 plugins.map(function(id) { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1240 return $.ajax({ |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1241 url: '../plugins/' + id, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1242 dataType: 'json', |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1243 async: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1244 cache: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1245 success: function(plugin) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1246 let li = $('<li>'); |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1247 let item = li; |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1248 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1249 if ('RootUri' in plugin) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1250 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1251 item = $('<a>'); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1252 li.append(item); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1253 item.click(function() { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1254 window.open(plugin.RootUri); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1255 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1256 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1257 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1258 item.append($('<h1>').text(plugin.ID)); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1259 item.append($('<p>').text(plugin.Description)); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1260 item.append($('<span>').addClass('ui-li-count').text(plugin.Version)); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1261 target.append(li); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1262 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1263 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1264 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1265 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1266 target.listview('refresh'); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1267 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1268 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1269 }); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1270 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1271 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1272 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1273 function ParseJobTime(s) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1274 { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1275 let t = (s.substr(0, 4) + '-' + |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1276 s.substr(4, 2) + '-' + |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1277 s.substr(6, 5) + ':' + |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1278 s.substr(11, 2) + ':' + |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1279 s.substr(13)); |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1280 let utc = new Date(t); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1281 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1282 // Convert from UTC to local time |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1283 return new Date(utc.getTime() - utc.getTimezoneOffset() * 60000); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1284 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1285 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1286 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1287 function AddJobField(target, description, field) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1288 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1289 if (!(typeof field === 'undefined')) { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1290 target.append($('<p>') |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1291 .text(description) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1292 .append($('<strong>').text(field))); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1293 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1294 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1295 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1296 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1297 function AddJobDateField(target, description, field) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1298 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1299 if (!(typeof field === 'undefined')) { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1300 target.append($('<p>') |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1301 .text(description) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1302 .append($('<strong>').text(ParseJobTime(field)))); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1303 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1304 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1305 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1306 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1307 $('#jobs').live('pagebeforeshow', function() { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1308 $.ajax({ |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1309 url: '../jobs?expand', |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1310 dataType: 'json', |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1311 async: false, |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1312 cache: false, |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1313 success: function(jobs) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1314 let target = $('#all-jobs'); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1315 $('li', target).remove(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1316 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1317 let running = $('<li>') |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1318 .attr('data-role', 'list-divider') |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1319 .text('Currently running'); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1320 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1321 let pending = $('<li>') |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1322 .attr('data-role', 'list-divider') |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1323 .text('Pending jobs'); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1324 |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1325 let inactive = $('<li>') |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1326 .attr('data-role', 'list-divider') |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1327 .text('Inactive jobs'); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1328 |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1329 target.append(running); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1330 target.append(pending); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1331 target.append(inactive); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1332 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1333 jobs.map(function(job) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1334 let li = $('<li>'); |
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1335 let item = $('<a>'); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1336 li.append(item); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1337 item.attr('href', '#job?uuid=' + job.ID); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1338 item.append($('<h1>').text(job.Type)); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1339 item.append($('<span>').addClass('ui-li-count').text(job.State)); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1340 AddJobField(item, 'ID: ', job.ID); |
2647
73d7d95dd75e
removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2597
diff
changeset
|
1341 AddJobField(item, 'Local AET: ', job.Content.LocalAet); |
73d7d95dd75e
removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2597
diff
changeset
|
1342 AddJobField(item, 'Remote AET: ', job.Content.RemoteAet); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1343 AddJobDateField(item, 'Creation time: ', job.CreationTime); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1344 AddJobDateField(item, 'Completion time: ', job.CompletionTime); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1345 AddJobDateField(item, 'ETA: ', job.EstimatedTimeOfArrival); |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1346 |
2589
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1347 if (job.State == 'Running' || |
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1348 job.State == 'Pending' || |
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1349 job.State == 'Paused') { |
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1350 AddJobField(item, 'Priority: ', job.Priority); |
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1351 AddJobField(item, 'Progress: ', job.Progress); |
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1352 } |
a3fdfb6979ed
getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2583
diff
changeset
|
1353 |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1354 if (job.State == 'Running') { |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1355 li.insertAfter(running); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1356 } else if (job.State == 'Pending' || |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1357 job.State == 'Paused') { |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1358 li.insertAfter(pending); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1359 } else { |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1360 li.insertAfter(inactive); |
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1361 } |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1362 }); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1363 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1364 target.listview('refresh'); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1365 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1366 }); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1367 }); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1368 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1369 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1370 $('#job').live('pagebeforeshow', function() { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1371 if ($.mobile.pageData) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1372 let pageData = DeepCopy($.mobile.pageData); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1373 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1374 $.ajax({ |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1375 url: '../jobs/' + pageData.uuid, |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1376 dataType: 'json', |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1377 async: false, |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1378 cache: false, |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1379 success: function(job) { |
3023
c9c2faf76bec
replaced 'var' by 'let' in Orthanc Explorer's JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2929
diff
changeset
|
1380 let target = $('#job-info'); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1381 $('li', target).remove(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1382 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1383 target.append($('<li>') |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1384 .attr('data-role', 'list-divider') |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1385 .text('General information about the job')); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1386 |
3065
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1387 { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1388 let block = $('<li>'); |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1389 for (let i in job) { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1390 if (i == 'CreationTime' || |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1391 i == 'CompletionTime' || |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1392 i == 'EstimatedTimeOfArrival') { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1393 AddJobDateField(block, i + ': ', job[i]); |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1394 } else if (i != 'InternalContent' && |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1395 i != 'Content' && |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1396 i != 'Timestamp') { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1397 AddJobField(block, i + ': ', job[i]); |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1398 } |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1399 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1400 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1401 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1402 target.append(block); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1403 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1404 target.append($('<li>') |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1405 .attr('data-role', 'list-divider') |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1406 .text('Detailed information')); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1407 |
3065
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1408 { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1409 let block = $('<li>'); |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1410 |
3065
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1411 for (let item in job.Content) { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1412 let value = job.Content[item]; |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1413 if (typeof value !== 'string') { |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1414 value = JSON.stringify(value); |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1415 } |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1416 |
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1417 AddJobField(block, item + ': ', value); |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1418 } |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1419 } |
3065
b89a4288d605
Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents:
3023
diff
changeset
|
1420 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1421 target.append(block); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1422 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1423 target.listview('refresh'); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1424 |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1425 $('#job-cancel').closest('.ui-btn').hide(); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1426 $('#job-retry').closest('.ui-btn').hide(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1427 $('#job-resubmit').closest('.ui-btn').hide(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1428 $('#job-pause').closest('.ui-btn').hide(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1429 $('#job-resume').closest('.ui-btn').hide(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1430 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1431 if (job.State == 'Running' || |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1432 job.State == 'Pending' || |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1433 job.State == 'Retry') { |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1434 $('#job-cancel').closest('.ui-btn').show(); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1435 $('#job-pause').closest('.ui-btn').show(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1436 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1437 else if (job.State == 'Success') { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1438 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1439 else if (job.State == 'Failure') { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1440 $('#job-resubmit').closest('.ui-btn').show(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1441 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1442 else if (job.State == 'Paused') { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1443 $('#job-resume').closest('.ui-btn').show(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1444 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1445 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1446 }); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1447 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2336
diff
changeset
|
1448 }); |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1449 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1450 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1451 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1452 function TriggerJobAction(action) |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1453 { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1454 $.ajax({ |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1455 url: '../jobs/' + $.mobile.pageData.uuid + '/' + action, |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1456 type: 'POST', |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1457 async: false, |
2583
1b6a6d80b6f2
OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2582
diff
changeset
|
1458 cache: false, |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1459 complete: function(s) { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1460 window.location.reload(); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1461 } |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1462 }); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1463 } |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1464 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1465 $('#job-cancel').live('click', function() { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1466 TriggerJobAction('cancel'); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1467 }); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1468 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1469 $('#job-resubmit').live('click', function() { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1470 TriggerJobAction('resubmit'); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1471 }); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1472 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1473 $('#job-pause').live('click', function() { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1474 TriggerJobAction('pause'); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1475 }); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1476 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1477 $('#job-resume').live('click', function() { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1478 TriggerJobAction('resume'); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
1479 }); |