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