annotate OrthancExplorer/explorer.js @ 659:443cced10836

code cleaning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Nov 2013 14:41:46 +0100
parents a8be42bcf2bb
children 2e11c3353356
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 // http://stackoverflow.com/questions/1663741/is-there-a-good-jquery-drag-and-drop-file-upload-plugin
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 // Forbid the access to IE
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 if ($.browser.msie)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 alert("Please use Mozilla Firefox or Google Chrome. Microsoft Internet Explorer is not supported.");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 // http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 //$.mobile.ajaxEnabled = false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 //$.mobile.page.prototype.options.addBackBtn = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 //$.mobile.defaultPageTransition = 'slide';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
15
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
16 var currentPage = '';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
17 var currentUuid = '';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
18
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
19
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 // http://stackoverflow.com/a/4673436
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 String.prototype.format = function() {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 var args = arguments;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 return this.replace(/{(\d+)}/g, function(match, number) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 /*return typeof args[number] != 'undefined'
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 ? args[number]
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 : match;*/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 return args[number];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 $(document).ready(function() {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 var $tree = $('#dicom-tree');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 $tree.tree({
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 autoEscape: false
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 $('#dicom-tree').bind(
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 'tree.click',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 function(event) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 if (event.node.is_open)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 $tree.tree('closeNode', event.node, true);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 $tree.tree('openNode', event.node, true);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 );
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 function SplitLongUid(s)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 return '<span>' + s.substr(0, s.length / 2) + '</span> <span>' + s.substr(s.length / 2, s.length - s.length / 2) + '</span>';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 function ParseDicomDate(s)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 y = parseInt(s.substr(0, 4), 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 m = parseInt(s.substr(4, 2), 10) - 1;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 d = parseInt(s.substr(6, 2), 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 if (y == null || m == null || d == null ||
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 !isFinite(y) || !isFinite(m) || !isFinite(d))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 return null;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 if (y < 1900 || y > 2100 ||
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 m < 0 || m >= 12 ||
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 d <= 0 || d >= 32)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 return null;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 return new Date(y, m, d);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 function FormatDicomDate(s)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 if (s == undefined)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 return "No date";
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 var d = ParseDicomDate(s);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 if (d == null)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 return '?';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 return d.toString('dddd, MMMM d, yyyy');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
93 function Sort(arr, fieldExtractor, isInteger, reverse)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
33
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
95 var defaultValue;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
96 if (isInteger)
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
97 defaultValue = 0;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
98 else
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
99 defaultValue = '';
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
100
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 arr.sort(function(a, b) {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
102 var ta = fieldExtractor(a);
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
103 var tb = fieldExtractor(b);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 var order;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
33
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
106 if (ta == undefined)
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
107 ta = defaultValue;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
108
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
109 if (tb == undefined)
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
110 tb = defaultValue;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
111
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 if (isInteger)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 ta = parseInt(ta, 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 tb = parseInt(tb, 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 order = ta - tb;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 if (ta < tb)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 order = -1;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 else if (ta > tb)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 order = 1;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 order = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 if (reverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 return -order;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 return order;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
136 function SortOnDicomTag(arr, tag, isInteger, reverse)
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
137 {
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
138 return Sort(arr, function(a) {
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
139 return a.MainDicomTags[tag];
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
140 }, isInteger, reverse);
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
141 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
142
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
143
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 function GetSingleResource(type, uuid, callback)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 var resource = null;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 $.ajax({
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
149 url: '../' + type + '/' + uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
152 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 callback(s);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 function GetMultipleResources(type, uuids, callback)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 if (uuids == null)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 $.ajax({
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
165 url: '../' + type,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
168 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 uuids = s;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 var resources = [];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 var ajaxRequests = uuids.map(function(uuid) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 return $.ajax({
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
178 url: '../' + type + '/' + uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 async: true,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
181 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 resources.push(s);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 // Wait for all the AJAX requests to end
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 $.when.apply($, ajaxRequests).then(function() {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 callback(resources);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 function CompleteFormatting(s, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 if (link != null)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 s = 'href="' + link + '">' + s + '</a>';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 if (isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 s = 'data-direction="reverse" '+ s;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 s = '<a ' + s;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 if (isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 return '<li data-icon="back">' + s + '</li>';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 return '<li>' + s + '</li>';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
215 function FormatMainDicomTags(tags, tagsToIgnore)
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
216 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
217 var s = '';
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
218
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
219 for (var i in tags)
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
220 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
221 if (tagsToIgnore.indexOf(i) == -1)
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
222 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
223 var v = tags[i];
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
224
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
225 if (i == "PatientBirthDate" ||
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
226 i == "StudyDate" ||
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
227 i == "SeriesDate")
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
228 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
229 v = FormatDicomDate(v);
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
230 }
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
231 else if (i == "DicomStudyInstanceUID" ||
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
232 i == "DicomSeriesInstanceUID")
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
233 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
234 v = SplitLongUid(v);
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
235 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
236
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
237
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
238 s += ('<p>{0}: <strong>{1}</strong></p>').format(i, v);
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
239 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
240 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
241
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
242 return s;
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
243 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
244
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 function FormatPatient(patient, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 {
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
248 var s = ('<h3>{0}</h3>{1}' +
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
249 '<span class="ui-li-count">{2}</span>'
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 ).format
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
251 (patient.MainDicomTags.PatientName,
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
252 FormatMainDicomTags(patient.MainDicomTags, [
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
253 "PatientName",
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
254 "OtherPatientIDs"
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
255 ]),
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 patient.Studies.length
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 );
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 return CompleteFormatting(s, link, isReverse);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 function FormatStudy(study, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 {
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
266 var s = ('<h3>{0}</h3>{1}' +
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 '<span class="ui-li-count">{2}</span>'
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 ).format
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 (study.MainDicomTags.StudyDescription,
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
270 FormatMainDicomTags(study.MainDicomTags, [
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
271 "StudyDescription",
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
272 "StudyTime"
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
273 ]),
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 study.Series.length
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 );
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 return CompleteFormatting(s, link, isReverse);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 function FormatSeries(series, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
284 var c;
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 80
diff changeset
285 if (series.ExpectedNumberOfInstances == null ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 80
diff changeset
286 series.Instances.length == series.ExpectedNumberOfInstances)
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
287 {
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 80
diff changeset
288 c = series.Instances.length;
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
289 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
290 else
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
291 {
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
292 c = series.Instances.length + '/' + series.ExpectedNumberOfInstances;
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
293 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
294
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
295 var s = ('<h3>{0}</h3>' +
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
296 '<p><em>Status: <strong>{1}</strong></em></p>{2}' +
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
297 '<span class="ui-li-count">{3}</span>').format
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 (series.MainDicomTags.SeriesDescription,
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
299 series.Status,
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
300 FormatMainDicomTags(series.MainDicomTags, [
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
301 "SeriesDescription",
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
302 "SeriesTime",
41
c1097a676eca better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
303 "Manufacturer",
c1097a676eca better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
304 "ImagesInAcquisition",
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
305 "SeriesDate"
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
306 ]),
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
307 c
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 );
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 return CompleteFormatting(s, link, isReverse);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 function FormatInstance(instance, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 {
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
316 var s = ('<h3>Instance {0}</h3>{1}').format
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
317 (instance.IndexInSeries,
40
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
318 FormatMainDicomTags(instance.MainDicomTags, [
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
319 "AcquisitionNumber",
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
320 "InstanceNumber",
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
321 "InstanceCreationDate",
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
322 "InstanceCreationTime"
a08b085190e1 simplifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 38
diff changeset
323 ])
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 );
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 return CompleteFormatting(s, link, isReverse);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
330 $('[data-role="page"]').live('pagebeforeshow', function() {
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
331 $.ajax({
153
5b6b5c9f280f fix path
jodogne
parents: 152
diff changeset
332 url: '../system',
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
333 dataType: 'json',
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
334 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
335 cache: false,
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
336 success: function(s) {
165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
337 if (s.Name != "") {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
338 $('.orthanc-name').html('<a class="ui-link" href="explorer.html">' + s.Name + '</a> &raquo; ');
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
339 }
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
340 }
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
341 });
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
342 });
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
343
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 $('#find-patients').live('pagebeforeshow', function() {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 GetMultipleResources('patients', null, function(patients) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 var target = $('#all-patients');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 $('li', target).remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 SortOnDicomTag(patients, 'PatientName', false, false);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 for (var i = 0; i < patients.length; i++) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 var p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 target.append(p);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 target.listview('refresh');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
364 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
365 {
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
366 if (field in resource)
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
367 {
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
368 $(buttonSelector).closest('li').show();
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
369 $(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
370 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
371 });
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
372 }
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
373 else
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
374 {
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
375 $(buttonSelector).closest('li').hide();
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
376 }
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
377 }
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
378
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
379
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
380
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
381 function RefreshPatient()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
382 {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 if ($.mobile.pageData) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 GetSingleResource('patients', $.mobile.pageData.uuid, function(patient) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 GetMultipleResources('studies', patient.Studies, function(studies) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 SortOnDicomTag(studies, 'StudyDate', false, true);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 $('#patient-info li').remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 $('#patient-info')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 .append('<li data-role="list-divider">Patient</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 .append(FormatPatient(patient))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 .listview('refresh');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 var target = $('#list-studies');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 $('li', target).remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 for (var i = 0; i < studies.length; i++) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 if (i == 0 || studies[i].MainDicomTags.StudyDate != studies[i - 1].MainDicomTags.StudyDate)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 target.append('<li data-role="list-divider">{0}</li>'.format
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 (FormatDicomDate(studies[i].MainDicomTags.StudyDate)));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
407 SetupAnonymizedOrModifiedFrom('#patient-anonymized-from', patient, 'patient', 'AnonymizedFrom');
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
408 SetupAnonymizedOrModifiedFrom('#patient-modified-from', patient, 'patient', 'ModifiedFrom');
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
409
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 target.listview('refresh');
274
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
411
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
412 // Check whether this patient is protected
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
413 $.ajax({
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
414 url: '../patients/' + $.mobile.pageData.uuid + '/protected',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
415 type: 'GET',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
416 dataType: 'text',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
417 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
418 cache: false,
274
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
419 success: function (s) {
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
420 var v = (s == '1') ? 'on' : 'off';
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
421 $('#protection').val(v).slider('refresh');
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
422 }
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
423 });
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
424
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
425 currentPage = 'patient';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
426 currentUuid = $.mobile.pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
430 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
433 function RefreshStudy()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
434 {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 if ($.mobile.pageData) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 GetSingleResource('studies', $.mobile.pageData.uuid, function(study) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 GetSingleResource('patients', study.ParentPatient, function(patient) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 GetMultipleResources('series', study.Series, function(series) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 SortOnDicomTag(series, 'SeriesDate', false, true);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
441 $('#study .patient-link').attr('href', '#patient?uuid=' + patient.ID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 $('#study-info li').remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 $('#study-info')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 .append('<li data-role="list-divider">Patient</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 .append('<li data-role="list-divider">Study</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 .append(FormatStudy(study))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 .listview('refresh');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
450 SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', 'AnonymizedFrom');
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
451 SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', 'ModifiedFrom');
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
452
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 var target = $('#list-series');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 $('li', target).remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 for (var i = 0; i < series.length; i++) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 target.append('<li data-role="list-divider">{0}</li>'.format
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 (FormatDicomDate(series[i].MainDicomTags.SeriesDate)));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 target.listview('refresh');
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
464
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
465 currentPage = 'study';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
466 currentUuid = $.mobile.pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
471 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
474 function RefreshSeries()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
475 {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 if ($.mobile.pageData) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 GetSingleResource('series', $.mobile.pageData.uuid, function(series) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 GetSingleResource('studies', series.ParentStudy, function(study) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 GetSingleResource('patients', study.ParentPatient, function(patient) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 GetMultipleResources('instances', series.Instances, function(instances) {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
481 Sort(instances, function(x) { return x.IndexInSeries; }, true, false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
483 $('#series .patient-link').attr('href', '#patient?uuid=' + patient.ID);
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
484 $('#series .study-link').attr('href', '#study?uuid=' + study.ID);
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
485
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 $('#series-info li').remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 $('#series-info')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 .append('<li data-role="list-divider">Patient</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 .append('<li data-role="list-divider">Study</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 .append(FormatStudy(study, '#study?uuid=' + study.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 .append('<li data-role="list-divider">Series</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 .append(FormatSeries(series))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 .listview('refresh');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
496 SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', 'AnonymizedFrom');
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
497 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
498
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 var target = $('#list-instances');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 $('li', target).remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 for (var i = 0; i < instances.length; i++) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 target.listview('refresh');
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
505
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
506 currentPage = 'series';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
507 currentUuid = $.mobile.pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
513 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 function ConvertForTree(dicom)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 var result = [];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 for (var i in dicom) {
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
522 if (dicom[i] != null) {
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
523 var label = i + '<span class="tag-name"> (<i>' + dicom[i]["Name"] + '</i>)</span>: ';
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
524
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
525 if (dicom[i]["Type"] == 'String')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 result.push({
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
528 label: label + '<strong>' + dicom[i]["Value"] + '</strong>',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 children: []
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 }
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
532 else if (dicom[i]["Type"] == 'TooLong')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 result.push({
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
535 label: label + '<i>Too long</i>',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 children: []
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 }
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
539 else if (dicom[i]["Type"] == 'Null')
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
540 {
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
541 result.push({
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
542 label: label + '<i>Null</i>',
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
543 children: []
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
544 });
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
545 }
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
546 else if (dicom[i]["Type"] == 'Sequence')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 var c = [];
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
549 for (var j = 0; j < dicom[i]["Value"].length; j++) {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 c.push({
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 label: 'Item ' + j,
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
552 children: ConvertForTree(dicom[i]["Value"][j])
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 result.push({
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
557 label: label + '[]',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 children: c
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 return result;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
568 function RefreshInstance()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
569 {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 if ($.mobile.pageData) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 GetSingleResource('instances', $.mobile.pageData.uuid, function(instance) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 GetSingleResource('series', instance.ParentSeries, function(series) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 GetSingleResource('studies', series.ParentStudy, function(study) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 GetSingleResource('patients', study.ParentPatient, function(patient) {
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
575
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
576 $('#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
577 $('#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
578 $('#instance .series-link').attr('href', '#series?uuid=' + series.ID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 $('#instance-info li').remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 $('#instance-info')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 .append('<li data-role="list-divider">Patient</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 .append('<li data-role="list-divider">Study</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 .append(FormatStudy(study, '#study?uuid=' + study.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 .append('<li data-role="list-divider">Series</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 .append(FormatSeries(series, '#series?uuid=' + series.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 .append('<li data-role="list-divider">Instance</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 .append(FormatInstance(instance))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 .listview('refresh');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 $.ajax({
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
593 url: '../instances/' + instance.ID + '/tags',
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
594 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 $('#dicom-tree').tree('loadData', ConvertForTree(s));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
601 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
602 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
603
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
604 currentPage = 'instance';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
605 currentUuid = $.mobile.pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
611 }
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
612
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
613 $(document).live('pagebeforehide', function() {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
614 currentPage = '';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
615 currentUuid = '';
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
620 $('#patient').live('pagebeforeshow', RefreshPatient);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
621 $('#study').live('pagebeforeshow', RefreshStudy);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
622 $('#series').live('pagebeforeshow', RefreshSeries);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
623 $('#instance').live('pagebeforeshow', RefreshInstance);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
624
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
625 $(function() {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
626 $(window).hashchange(function(e, data) {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
627 // 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
628 if ('uuid' in $.mobile.pageData &&
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
629 currentPage == $.mobile.pageData.active &&
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
630 currentUuid != $.mobile.pageData.uuid) {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
631 if (currentPage == 'patient')
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
632 RefreshPatient();
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
633 else if (currentPage == 'study')
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
634 RefreshStudy();
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
635 else if (currentPage == 'series')
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
636 RefreshSeries();
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
637 else if (currentPage == 'instance')
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
638 RefreshInstance();
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
639 }
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
640 });
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
641 });
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
642
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
643
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
644
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
645
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
646
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 function DeleteResource(path)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 $.ajax({
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 url: path,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 type: 'DELETE',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 async: false,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 var ancestor = s.RemainingAncestor;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 if (ancestor == null)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 $.mobile.changePage('#find-patients');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 else
201
bee20e978835 refactoring of delete
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 165
diff changeset
659 $.mobile.changePage('#' + ancestor.Type.toLowerCase() + '?uuid=' + ancestor.ID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 function OpenDeleteResourceDialog(path, title)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 $(document).simpledialog2({
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/options.html
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 mode: 'button',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 animate: false,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 headerText: title,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 headerClose: true,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 width: '500px',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 buttons : {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 'OK': {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 click: function () {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 DeleteResource(path);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 icon: "delete",
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 theme: "c"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 'Cancel': {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 click: function () {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 $('#instance-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
695 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 'Delete this instance?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 $('#study-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
700 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 'Delete this study?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 $('#series-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
705 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 'Delete this series?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 $('#patient-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
710 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 'Delete this patient?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 $('#instance-download-dicom').live('click', function(e) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 // http://stackoverflow.com/a/1296101
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 e.preventDefault(); //stop the browser from following
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
718 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file';
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 $('#instance-download-json').live('click', function(e) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 // http://stackoverflow.com/a/1296101
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723 e.preventDefault(); //stop the browser from following
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
724 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags';
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727
250
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
728
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 $('#instance-preview').live('click', function(e) {
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
730 if ($.mobile.pageData) {
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
731 GetSingleResource('instances', $.mobile.pageData.uuid + '/frames', function(frames) {
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
732 if (frames.length == 1)
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
733 {
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
734 // Viewing a single-frame image
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
735 jQuery.slimbox('../instances/' + $.mobile.pageData.uuid + '/preview', '', {
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
736 overlayFadeDuration : 1,
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
737 resizeDuration : 1,
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
738 imageFadeDuration : 1
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
739 });
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
740 }
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
741 else
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
742 {
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
743 // Viewing a multi-frame image
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
744
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
745 var images = [];
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
746 for (var i = 0; i < frames.length; i++) {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
747 images.push([ '../instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]);
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
748 }
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
749
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
750 jQuery.slimbox(images, 0, {
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
751 overlayFadeDuration : 1,
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
752 resizeDuration : 1,
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
753 imageFadeDuration : 1,
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
754 loop : true
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
755 });
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
756 }
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
757 });
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
758
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
759 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 $('#series-preview').live('click', function(e) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 if ($.mobile.pageData) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 GetSingleResource('series', $.mobile.pageData.uuid, function(series) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 GetMultipleResources('instances', series.Instances, function(instances) {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
766 Sort(instances, function(x) { return x.IndexInSeries; }, true, false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 var images = [];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 for (var i = 0; i < instances.length; i++) {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
770 images.push([ '../instances/' + instances[i].ID + '/preview',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 '{0}/{1}'.format(i + 1, instances.length) ])
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 jQuery.slimbox(images, 0, {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 overlayFadeDuration : 1,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 resizeDuration : 1,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 imageFadeDuration : 1,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 loop : true
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 })
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790 function ChooseDicomModality(callback)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 {
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
792 var clickedModality = '';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
793 var clickedPeer = '';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
794 var items = $('<ul>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
795 .attr('data-divider-theme', 'd')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
796 .attr('data-role', 'listview');
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
797
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
798 // Retrieve the list of the known DICOM modalities
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 $.ajax({
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
800 url: '../modalities',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 type: 'GET',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
804 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 success: function(modalities) {
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
806 if (modalities.length > 0)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
807 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
808 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
809
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
810 for (var i = 0; i < modalities.length; i++) {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
811 var name = modalities[i];
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
812 var item = $('<li>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
813 .html('<a href="#" rel="close">' + name + '</a>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
814 .attr('name', name)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
815 .click(function() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
816 clickedModality = $(this).attr('name');
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
817 });
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
818 items.append(item);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
819 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
822 // Retrieve the list of the known Orthanc peers
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
823 $.ajax({
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
824 url: '../peers',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
825 type: 'GET',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
826 dataType: 'json',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
827 async: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
828 cache: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
829 success: function(peers) {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
830 if (peers.length > 0)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
831 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
832 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
833
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
834 for (var i = 0; i < peers.length; i++) {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
835 var name = peers[i];
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
836 var item = $('<li>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
837 .html('<a href="#" rel="close">' + name + '</a>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
838 .attr('name', name)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
839 .click(function() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
840 clickedPeer = $(this).attr('name');
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
841 });
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
842 items.append(item);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844 }
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
845
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
846 // Launch the dialog
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
847 $('#dialog').simpledialog2({
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
848 mode: 'blank',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
849 animate: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
850 headerText: 'Choose target',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
851 headerClose: true,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
852 forceInput: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
853 width: '100%',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
854 blankContent: items,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
855 callbackClose: function() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
856 var timer;
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
857 function WaitForDialogToClose() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
858 if (!$('#dialog').is(':visible')) {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
859 clearInterval(timer);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
860 callback(clickedModality, clickedPeer);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
861 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
862 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
863 timer = setInterval(WaitForDialogToClose, 100);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
864 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
865 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
867 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872
405
97a00b30abcc sending of studies and patients with orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 354
diff changeset
873 $('#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
874 ChooseDicomModality(function(modality, peer) {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
875 var url;
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
876 var loading;
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
877
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
878 if (modality != '')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
879 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
880 url = '../modalities/' + modality + '/store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
881 loading = '#dicom-store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
882 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
883
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
884 if (peer != '')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
885 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
886 url = '../peers/' + peer + '/store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
887 loading = '#peer-store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
888 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
889
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
890 if (url != '') {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 $.ajax({
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
892 url: url,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 type: 'POST',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 dataType: 'text',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 data: $.mobile.pageData.uuid,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 async: true, // Necessary to block UI
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 beforeSend: function() {
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
898 $.blockUI({ message: $(loading) });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 complete: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 $.unblockUI();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 error: function() {
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
906 alert('Error during store');
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 }
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
908 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 });
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
912
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
913
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
914 $('#show-tag-name').live('change', function(e) {
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
915 var checked = e.currentTarget.checked;
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
916 if (checked)
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
917 $('.tag-name').show();
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
918 else
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
919 $('.tag-name').hide();
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
920 });
250
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
921
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
922
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
923 $('#patient-archive').live('click', function(e) {
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
924 e.preventDefault(); //stop the browser from following
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
925 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive';
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
926 });
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
927
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
928 $('#study-archive').live('click', function(e) {
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
929 e.preventDefault(); //stop the browser from following
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
930 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive';
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
931 });
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
932
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
933 $('#series-archive').live('click', function(e) {
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
934 e.preventDefault(); //stop the browser from following
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
935 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive';
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
936 });
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
937
274
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
938 $('#protection').live('change', function(e) {
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
939 var isProtected = e.target.value == "on";
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
940 $.ajax({
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
941 url: '../patients/' + $.mobile.pageData.uuid + '/protected',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
942 type: 'PUT',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
943 dataType: 'text',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
944 data: isProtected ? '1' : '0',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
945 async: false
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
946 });
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
947 });
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
948
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
949
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
950
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
951 function OpenAnonymizeResourceDialog(path, title)
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
952 {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
953 $(document).simpledialog2({
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
954 mode: 'button',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
955 animate: false,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
956 headerText: title,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
957 headerClose: true,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
958 width: '500px',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
959 buttons : {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
960 'OK': {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
961 click: function () {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
962 $.ajax({
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
963 url: path + '/anonymize',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
964 type: 'POST',
354
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 351
diff changeset
965 data: '{ "Keep" : [ "SeriesDescription", "StudyDescription" ] }',
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
966 dataType: 'json',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
967 async: false,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
968 cache: false,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
969 success: function(s) {
351
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
970 // The following line does not work...
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
971 //$.mobile.changePage('explorer.html#patient?uuid=' + s.PatientID);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
972
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
973 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
974 //window.location.reload();
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
975 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
976 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
977 },
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
978 icon: "delete",
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
979 theme: "c"
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
980 },
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
981 'Cancel': {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
982 click: function () {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
983 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
984 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
985 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
986 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
987 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
988
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
989 $('#instance-anonymize').live('click', function() {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
990 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
991 'Anonymize this instance?');
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
992 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
993
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
994 $('#study-anonymize').live('click', function() {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
995 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
996 'Anonymize this study?');
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
997 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
998
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
999 $('#series-anonymize').live('click', function() {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1000 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1001 'Anonymize this series?');
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1002 });
351
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1003
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1004 $('#patient-anonymize').live('click', function() {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1005 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1006 'Anonymize this patient?');
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1007 });