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